/* style.css — v1.0.0 */

:root {
  --primary:  #000049;
  --secondary:#8EB3D0;
  --tertiary: #F9B04B;
  --tertiary-rgb: 249,176,75;

  --accent: var(--primary);
  --bg: #ffffff;
  --bg-elev: #f6f8fb;
  --text: #0a0a0a;
  --muted: #606b78;
  --border: #d7dee8;
  --focus: #2b90ff;

  --danger: #cf2e2e;

  --controls-font-size: 0.9rem;
  --table-body-font-size: 0.85rem;
  --modal-border-color: var(--primary);
  --header-h: 0px;
  --tab-width: 11ch;

  --assignee-col-width: 20ch;
  --status-col-width: 150px;
  --id-col-width: 72px;
  --date-col-width: 10.5ch;
  --kuerzel-col-width: 6ch;
  --raum-col-width: 64px;
  --mail-col-width: 100px;
  --action-col-width: 44px;

  --row-height: 2.8em;
  --user-row-height: 3.8em;

  --done-bg: rgba(40,162,40,0.18);
  --done-bg-solid: #cfe9cf;

  --roomstaff-bg: rgba(64,120,204,0.16);
  --roomstaff-bg-solid: #d7e3f8;

  --shadow-1: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-3: 0 14px 40px rgba(0,0,0,0.20);

  --hover-row: rgba(0,0,0,0.02);
  --hover-row-dark: rgba(255,255,255,0.04);
}

:root.dark {
  --bg: #0f141c;
  --bg-elev: #151b24;
  --text: #ecf2f9;
  --muted: #a2adba;
  --border: #2a3545;

  --accent: var(--secondary);
  --modal-border-color: var(--secondary);

  --done-bg: rgba(40,162,40,0.12);
  --done-bg-solid: var(--done-bg);

  --roomstaff-bg: rgba(64,120,204,0.18);
  --roomstaff-bg-solid: #16263a;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans"; background: var(--bg); color: var(--text); }

.app-header {
  position: sticky; top: 0; z-index: 1000;
  padding: 56px 12px 8px 12px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,0.03);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
@supports (backdrop-filter: blur(8px)) {
  .app-header {
    background: color-mix(in oklab, var(--bg-elev) 85%, transparent);
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    border-bottom-color: color-mix(in oklab, var(--border) 65%, transparent);
  }
}

.app-title { margin: 0; font-size: 20px; }
.accent { color: var(--accent); }

#themeToggle { 
  position: fixed; 
  top: 8px; 
  left: 12px; 
  z-index: 1100;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  box-shadow: none;
}

#themeToggle:hover {
  box-shadow: none;
}

#themeToggle .theme-icon {
  width: 20px;
  height: 20px;
}

/* Show sun icon in light mode, moon icon in dark mode */
:root:not(.dark) #themeToggle .theme-sun {
  display: block;
  color: var(--primary);
}

:root:not(.dark) #themeToggle .theme-moon {
  display: none;
}

:root.dark #themeToggle .theme-sun {
  display: none;
}

:root.dark #themeToggle .theme-moon {
  display: block;
  color: var(--secondary);
}

.right-actions {
  position: absolute; top: 8px; right: 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end;
}

.nav-group.tabs {
  display: flex; gap: 2px; align-items: flex-end; border-bottom: 2px solid var(--border); padding-bottom: 0; flex-wrap: wrap;
}
.btn-tab {
  border-radius: 10px 10px 0 0;
  border: 1px solid var(--accent); border-bottom: none;
  background: transparent; color: var(--accent);
  padding: 8px 12px; min-width: var(--tab-width); text-align: center;
  transition: background-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}
.btn-tab:hover { box-shadow: none; }
.btn-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: var(--shadow-1); }

.btn {
  padding: 8px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  will-change: box-shadow;
}
.btn:hover { box-shadow: var(--shadow-1); }
.btn:active { box-shadow: none; }
.btn-strong { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: var(--shadow-1); }
.btn-strong:hover { box-shadow: var(--shadow-2); }
.btn-outline { background: transparent; }

:root.dark .btn-strong { color: #000 !important; }
:root.dark .btn-tab.active { color: #000 !important; }
:root.dark body[data-page="admin"] .drawer-item.active,
:root.dark body[data-page="admin"] .drawer-item:hover { color: #000 !important; }

.btn-login { background: var(--tertiary); color: var(--primary) !important; border-color: var(--tertiary); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: 6px 10px; font-size: 0.9rem; }

.icon-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; margin: 0;
  border: none; background: transparent; color: var(--accent);
  border-radius: 6px; cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}
.icon-btn:hover { background: rgba(0,0,0,0.08); box-shadow: var(--shadow-1); }
:root.dark .icon-btn:hover { background: rgba(255,255,255,0.08); }
.icon-btn svg { width: 18px; height: 18px; display: block; }
.icon-btn.save { color: var(--accent); }

.input-icon { position: relative; }
.input-icon > input { padding-right: 40px; }
.btn-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  padding: 4px;
  cursor: pointer;
  color: #aaaaaa !important;
  transition: color 160ms ease;
}
.btn-icon:hover { color: #aaaaaa !important; }
.btn-icon svg { width: 20px; height: 20px; display: block; }
.btn-icon .icon-eye { display: none; }
.btn-icon.is-on .icon-eye { display: block; }
.btn-icon.is-on .icon-eye-off { display: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 12px; }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow-1);
  transition: box-shadow 200ms ease, border-color 180ms ease;
}
.card:hover { box-shadow: var(--shadow-1); }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-head .search-input { width: min(320px, 100%); }

.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; margin-bottom: 8px; }
.top-actions .search-input { width: min(320px, 100%); }

.row { margin-bottom: 10px; }
.row-inline { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.row-flex { display: flex; flex-direction: column; gap: 6px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="color"],
textarea,
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: #000;
  max-width: 100%;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04) inset;
}
:root.dark input[type],
:root.dark textarea,
:root.dark select {
  background: #0f141c;
  color: #fff;
  border-color: #2a3545;
  box-shadow: 0 1px 2px rgba(0,0,0,0.35) inset;
}
textarea { resize: none; }
.hint { font-size: 12px; color: var(--muted); }
.msg { min-height: 1.2em; color: var(--muted); margin-top: 6px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }

.app-version { margin-top: 8px; text-align: right; font-size: 0.8rem; color: #aaaaaa; }

.tile-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.tile, .tile-input {
  display: flex; align-items: center; justify-content: center; height: 48px;
  border: 1px solid var(--border); border-radius: 12px;
  background: #fff; color: #000; cursor: pointer; padding: 6px;
  box-shadow: var(--shadow-1);
  transition: transform 160ms ease, box-shadow 200ms ease, outline-color 160ms ease, background-color 180ms ease, border-color 160ms ease;
  will-change: transform, box-shadow;
}
:root.dark .tile, :root.dark .tile-input {
  background: #0f141c; color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

.tile:hover, .tile-input:hover,
.tile:focus, .tile-input:focus,
.tile:focus-visible, .tile-input:focus-visible,
.tile:focus-within, .tile-input:focus-within {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.tile.selected, .tile-input.selected {
  outline: 2px solid var(--tertiary);
  background: rgba(var(--tertiary-rgb), 0.2);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

.tile-input { cursor: default; }
.tile-input input { width: 100%; border: none; background: transparent; color: inherit; text-align: center; }
.tile-input input:focus { outline: none; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.filters {
  margin-bottom: 10px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px;
  display: grid; gap: 10px; overflow-x: hidden;
  box-shadow: var(--shadow-1);
}

.filters-top { display: grid; grid-auto-flow: column; grid-template-rows: auto auto; grid-auto-columns: 1fr; gap: 6px 12px; align-items: stretch; justify-items: stretch; }
.filters-top > label { grid-row: 1; margin-bottom: 0; }
.filters-top > :not(label) { grid-row: 2; width: 100%; }
.filters-bottom { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, max-content)); gap: 8px 12px; align-items: end; justify-content: start; }

.input-inline { width: auto; }
.input-inline.date { width: auto; min-width: 10ch; }
.input.small { width: 80px; max-width: 9ch; }

.filters input[type="date"] {
  appearance: none;
  height: 36px; line-height: 1.5;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: #000;
  width: 100%;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
:root.dark .filters input[type="date"] {
  background: #0f141c;
  color: #fff;
  border-color: #2a3545;
}
.filters input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: 0.75; margin-right: 2px; filter: saturate(0) brightness(0.2);
}
:root.dark .filters input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) opacity(0.85);
}

.table-wrap { width: 100%; overflow-x: auto; }
.no-h-scroll { overflow-x: hidden; }
body[data-page="admin"] .no-h-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; table-layout: fixed; }
thead th {
  position: sticky; top: 0; z-index: 3; background: var(--bg-elev); color: var(--accent);
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

th, td {
  border-bottom: 1px solid var(--border);
  padding: 6px 8px;
  vertical-align: middle;
  height: var(--row-height);
}

th.th-sortable { position: relative; cursor: pointer; }
th.th-sortable::after { content: ''; display: inline-block; margin-left: 6px; font-size: 0.8em; line-height: 1; color: currentColor; }
th.th-sortable.sorted-asc::after { content: '▲'; }
th.th-sortable.sorted-desc::after { content: '▼'; }

.tickets { min-width: 1300px; }
.tickets thead th { font-size: 1rem !important; }
.tickets tbody { font-size: var(--table-body-font-size) !important; }
.tickets tbody input, .tickets tbody textarea, .tickets tbody button { font-size: inherit !important; }
.tickets tbody select, .tickets tbody .status-select, .tickets tbody .assignee-select {
  font: 400 var(--controls-font-size)/1.3 system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", sans-serif !important;
  height: 32px !important;
  line-height: 1.5 !important;
  appearance: none;
}
.tickets tbody select option { font-size: var(--controls-font-size) !important; }

.tickets th:first-child {
  position: sticky; left: 0; z-index: 5;
  background: var(--bg-elev);
  box-shadow: 2px 0 0 rgba(0,0,0,0.06);
}
.tickets td:first-child {
  position: sticky; left: 0; z-index: 2;
  background: var(--bg-elev);
  box-shadow: 2px 0 0 rgba(0,0,0,0.06);
}
:root.dark .tickets th:first-child, :root.dark .tickets td:first-child { box-shadow: 2px 0 0 rgba(255,255,255,0.06); }

.tickets tbody td { cursor: pointer !important; }
.tickets tbody td.assignee-td,
.tickets tbody td.status-td,
.tickets tbody td.solution-td,
.tickets tbody td.action-td { cursor: default !important; }

.tickets th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tickets tbody td { white-space: normal; }

.tickets th,
.tickets td {
  padding-top: 3px;
  padding-bottom: 3px;
  line-height: 1.5;
}

.cell-wrap {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  line-height: 1.5;
  max-height: calc(1.32em * 2);
  white-space: normal;
  word-break: break-word;
}

.th-assignee { width: var(--assignee-col-width); }
.col-status  { width: var(--status-col-width); }
.th-id       { width: var(--id-col-width); }
.th-date     { width: var(--date-col-width); }
.th-date2    { width: var(--date-col-width); }
.th-kuerzel  { width: var(--kuerzel-col-width); }
.th-category { min-width: 220px; }
.tickets td:nth-child(6) { min-width: 220px; }
.th-raum     { width: var(--raum-col-width); }
.th-action   { width: var(--action-col-width); text-align: center; }
.action-td   { text-align: center; }
.tickets th:nth-child(8), .tickets td:nth-child(8) { min-width: 320px; }
.tickets th:nth-child(9), .tickets td:nth-child(9) { min-width: 260px; }
.tickets th:nth-child(10), .tickets td:nth-child(10) { min-width: 260px; }

/* WICHTIG: Kein Hover-Highlight mehr in der Tickets-Tabelle
   (die früheren :hover-Hintergrundregeln wurden entfernt) */

.status-td.open     { background: rgba(207,46,46,0.15); }
.status-td.progress { background: rgba(243,193,47,0.25); }

.tickets td select {
  width: 100%;
  appearance: none;
  background-color: transparent !important;
  background-image: none !important;
  border: none !important;
  box-shadow: none !important;
  color: inherit !important;
  padding-left: 6px; padding-right: 6px;
}

tr.done-row td { background: var(--done-bg); }
tr.done-row td:first-child { background: var(--done-bg-solid) !important; }
tr.done-row select, tr.done-row input, tr.done-row textarea {
  background-color: transparent !important;
  border-color: transparent !important;
}

tr.roomstaff-row td { background: var(--roomstaff-bg) !important; }
tr.roomstaff-row td:first-child { background: var(--roomstaff-bg-solid) !important; }

.solution-textarea {
  width: 100%; height: calc(var(--row-height) - 0.4em);
  line-height: 1.5; resize: none; overflow: auto;
}

dialog { border: none !important; padding: 0; background: transparent; outline: none !important; }
dialog::backdrop { background: rgba(0,0,0,0.45); }
dialog .modal {
  min-width: 320px; max-width: 720px; padding: 10px; display: flex; flex-direction: column; gap: 8px;
  max-height: 90vh; overflow: auto; background: var(--bg-elev); color: var(--text);
  border: 2px solid var(--modal-border-color) !important; border-radius: 12px; overflow: hidden; box-shadow: 0 18px 50px rgba(0,0,0,0.25);
}

.detail-grid { display: grid; grid-template-columns: 1fr 1fr 140px 140px; gap: 8px; }
.detail-grid .narrow { min-width: 120px; }
.detail-val { margin-top: 4px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }

.container-ipad { max-width: 1024px; height: calc(100vh - 60px); display: grid; align-items: center; }
.compact input, .compact textarea, .compact select { padding: 6px 8px; }
.container-fhd { max-width: 1920px; }

.admin-settings .settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px 16px;
}
@media (min-width: 700px) {
  .admin-settings .settings-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1100px) {
  .admin-settings .settings-grid { grid-template-columns: fit-content(286px) 220px 200px 160px minmax(0, 1fr); }
}
.settings-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.accent-row {
  display: grid;
  grid-template-columns: 46px max-content;
  gap: 8px;
  align-items: center;
}
.accent-row input[type="color"] {
  width: 46px; height: 36px; padding: 0; border-radius: 8px; border: 1px solid var(--border);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.accent-row .hex { width: 10ch; }

.rules { margin-top: 4px; }
.rules-title { margin: 0 0 6px 0; }

#sec-server .rules-inline {
  display: flex; align-items: center; column-gap: 12px; row-gap: 0; flex-wrap: wrap;
}
#sec-server .rules-inline .field { display: block; }
#sec-server .rules-inline .field > label { margin: 0; white-space: nowrap; align-self: center; }
#sec-server .rules-inline .field > input,
#sec-server .rules-inline .field > .field-row { align-self: center; }
#sec-server .field-row { display: inline-flex; align-items: center; gap: 8px; }
#sec-server .rules-inline .field input,
#sec-server .rules-inline .field-row input {
  height: 36px;
  line-height: 1.5;
}
#sec-server .rules-inline .field-row .btn {
  height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
}

#rulePattern { width: 14ch; }
#ruleKuerzel { width: 8ch; }

#sec-server .rules-existing { margin-top: 10px; }
#sec-server .rules-list { display: block; }
#sec-server .rules-table-wrap { width: 100%; overflow-x: auto; }
#sec-server .rules-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 0;
  table-layout: auto;
  background: var(--bg);
}
#sec-server .rules-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-elev);
  color: var(--accent);
  text-align: center;
  white-space: nowrap;
}
#sec-server .rules-table th,
#sec-server .rules-table td {
  border-bottom: 1px solid var(--border);
  padding: 6px 8px;
  vertical-align: middle;
}

#sec-server .rules-table td.col-pattern input[type="text"] { width: 14ch; }
#sec-server .rules-table td.col-kuerzel input[type="text"] { width: 8ch; }

#sec-server .col-pattern { width: 14ch; }
#sec-server .col-kuerzel { width: 8ch; }
#sec-server .col-actions { width: max-content; white-space: nowrap; }
#sec-server .rules-table .actions { display: inline-flex; gap: 6px; }

.users-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(160px, 1fr));
  gap: 8px 12px;
  align-items: end;
}
.users-grid .form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-start; align-items: center; }
@media (max-width: 1200px) { .users-grid { grid-template-columns: repeat(4, minmax(160px, 1fr)); } }
@media (max-width: 900px)  { .users-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); } }
@media (max-width: 700px)  { .users-grid { grid-template-columns: repeat(2, minmax(160px, 1fr)); } }
@media (max-width: 480px)  { .users-grid { grid-template-columns: 1fr; } }

#catManageList { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.cat-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: grab;
  box-shadow: var(--shadow-1);
  transition: box-shadow 180ms ease, border-color 160ms ease, background-color 180ms ease;
}
.cat-item:hover { box-shadow: var(--shadow-1); }
.cat-item:active { cursor: grabbing; }
.cat-item.dragging { opacity: 0.6; }
.cat-item.drag-over { outline: 2px dashed var(--accent); outline-offset: 2px; }
.cat-head { display: none; }
.cat-num { font-size: 0.85rem; color: var(--muted); }

.cat-inline { display: grid; grid-template-columns: max-content auto; gap: 8px; align-items: center; }
#catName { max-width: 32ch; width: 100%; }

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 1px;
}
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--tertiary) !important;
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(var(--tertiary-rgb), 0.25);
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--tertiary) !important;
}
input::selection, textarea::selection { background: var(--tertiary); color: #000; }
input::-moz-selection, textarea::-moz-selection { background: var(--tertiary); color: #000; }

:root:not(.dark) input[type="checkbox"] { accent-color: var(--primary); }
:root.dark input[type="checkbox"] { accent-color: var(--secondary); }

label[for="notifyEnabled"] {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon-btn.btn-del { color: var(--danger); }
.icon-btn.btn-del:hover { background: rgba(207,46,46,0.15); }

@media (max-width: 820px) {
  :root { --assignee-col-width: 130px; --status-col-width: 110px; --date-col-width: 10.5ch; }
  .th-date2 { width: var(--date-col-width); }
  .tickets th:nth-child(8), .tickets td:nth-child(8) { min-width: 260px; }
  .tickets th:nth-child(9), .tickets td:nth-child(9) { min-width: 220px; }
  .tickets th:nth-child(10), .tickets td:nth-child(10) { min-width: 220px; }
}
@media (max-width: 600px) {
  th, td { padding: 4px 6px; }
  .tickets { min-width: 1250px; }
}

#usersTable th:first-child, #usersTable td:first-child { width: 5ch; min-width: 5ch; }
#usersTable th:nth-child(7), #usersTable td:nth-child(7) { width: 14ch; min-width: 12ch; white-space: nowrap; line-height: 1.5; font-variant-numeric: tabular-nums; }
#usersTable th:nth-child(2),
#usersTable th:nth-child(3),
#usersTable th:nth-child(4),
#usersTable th:nth-child(5),
#usersTable th:nth-child(6),
#usersTable td:nth-child(2),
#usersTable td:nth-child(3),
#usersTable td:nth-child(4),
#usersTable td:nth-child(5),
#usersTable td:nth-child(6) { width: auto; }
#usersTable .th-action, #usersTable td.actions-td, #usersTable td:last-child { width: auto; min-width: 0; white-space: nowrap; text-align: right; }
#usersTable tbody tr { height: var(--user-row-height); }
#usersTable th, #usersTable td { height: var(--user-row-height); padding-top: 0; padding-bottom: 0; vertical-align: middle; }
#usersTable td input[type="text"], #usersTable td select { height: calc(var(--user-row-height) - 10px); margin: 0; }

label[for="beschreibung"] + .row-inline { grid-template-columns: 1fr; }
#beschreibung { width: 100%; }
#descSuggestions { margin-top: 6px; }

body[data-page="admin"] .hamburger {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background-color 160ms ease, box-shadow 160ms ease;
}
body[data-page="admin"] .hamburger:hover { box-shadow: var(--shadow-1); }
body[data-page="admin"] .hamburger:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

body[data-page="admin"] .drawer {
  position: fixed; top: 0; left: 0; height: 100vh; width: 280px;
  background: var(--bg-elev); border-right: 1px solid var(--border);
  transform: translateX(-100%); transition: transform 180ms ease-in-out, box-shadow 180ms ease;
  z-index: 1200; padding: 12px 8px;
  box-shadow: var(--shadow-2);
}
body[data-page="admin"] .drawer.open { transform: translateX(0); }
body[data-page="admin"] .drawer-backdrop {
  position: fixed; inset: 0; z-index: 1190; background: rgba(0,0,0,0.45);
}
body[data-page="admin"] .drawer-nav { display: flex; flex-direction: column; gap: 6px; }
body[data-page="admin"] .drawer-item {
  width: 100%; text-align: left;
  padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--accent);
  background: transparent; color: var(--accent);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}
body[data-page="admin"] .drawer-item.active,
body[data-page="admin"] .drawer-item:hover {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

#sec-server .settings-left {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1fr);
  gap: 12px 16px;
  align-items: start;
}
@media (max-width: 720px) {
  #sec-server .settings-left { grid-template-columns: 1fr; }
}
#sec-server label[for="notifyEmail"] { white-space: nowrap; }
#sec-server .settings-left .full-col,
#sec-server .settings-actions-left { grid-column: 1 / -1; }
#sec-server .settings-actions-left .actions {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

#sec-server .rules-existing { margin-top: 10px; }
#sec-server .rules-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 12px 16px;
}

#sec-server #rulePattern { width: 14ch; }
#sec-server #ruleKuerzel { width: 8ch; }
#sec-server .rules-list input[data-field="pattern"] { width: 14ch !important; }
#sec-server .rules-list input[data-field="kuerzel"] { width: 8ch !important; }

@media (min-width: 1100px) {
  #sec-server .admin-settings .settings-grid { grid-template-columns: 1fr !important; }
  #sec-server .settings-left {
    grid-column: 1 / -1 !important;
    grid-template-columns: minmax(280px, 1fr) minmax(360px, 1fr) !important;
  }
  #sec-server .settings-left > .settings-col,
  #sec-server .settings-left > .full-col,
  #sec-server .settings-actions-left {
    grid-column: auto !important;
    grid-row: auto !important;
  }
  #sec-server .settings-left > .full-col { grid-column: 1 / -1 !important; }
  #sec-server .settings-actions-left { grid-column: 1 / -1 !important; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease, box-shadow 200ms ease;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  z-index: 2000;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  max-width: min(90vw, 720px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  box-shadow: var(--shadow-2);
}
.toast.ok { border-color: #2e7d32; }
.toast.err { border-color: var(--danger); }
.toast.info { border-color: var(--accent); }
