/* Files — ruhige Graustufen-Oberfläche.
   Neutrale Grautöne, Systemschrift, weiche Kanten, wenig Kontrast.
   Ein einziger, zurückhaltender Akzent für Fokus und Auswahl.
   Folgt der Systemeinstellung: dunkel als Standard, hell wenn gewünscht. */

:root {
  color-scheme: dark light;

  --bg:        #191a1c;   /* Seite */
  --surface:   #1f2123;   /* Karten, Leisten */
  --surface-2: #26282b;   /* Hover */
  --surface-3: #2e3134;   /* aktiv, ausgewählt */
  --line:      #2b2e31;   /* Haarlinie */
  --line-2:    #3a3e42;   /* betont */

  --text:      #e6e8ea;
  --text-2:    #a6abb0;   /* zweitrangig */
  --text-3:    #767c82;   /* Hinweise, Platzhalter */

  --accent:    #8ea8c3;   /* entsättigtes Blaugrau */
  --accent-2:  #a9bed4;
  --accent-bg: #253039;
  --danger:    #d99494;
  --danger-bg: #332626;
  --warn:      #ceac7e;
  --ok:        #96bda3;

  --shadow: 0 1px 2px rgba(0, 0, 0, .28), 0 8px 24px rgba(0, 0, 0, .22);

  --radius:   6px;
  --radius-l: 9px;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo,
          Consolas, "DejaVu Sans Mono", monospace;

  --head: 52px;
  --side: 244px;
  --aside: 348px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:        #f3f4f5;
    --surface:   #ffffff;
    --surface-2: #f1f2f4;
    --surface-3: #e7e9ec;
    --line:      #e3e5e8;
    --line-2:    #ccd0d5;

    --text:      #1d1f22;
    --text-2:    #5b6167;
    --text-3:    #868c93;

    --accent:    #4a6f95;
    --accent-2:  #3c5d7e;
    --accent-bg: #e9eff5;
    --danger:    #a94c4c;
    --danger-bg: #fbeded;
    --warn:      #8a6414;
    --ok:        #3d7551;

    --shadow: 0 1px 2px rgba(16, 20, 24, .06), 0 8px 24px rgba(16, 20, 24, .08);
  }
}

/* Kennfarben der Bereiche — entsättigt, nur als kleiner Punkt sichtbar. */
.accent-stone  { --dot: #8b9298; }
.accent-slate  { --dot: #7d95af; }
.accent-sage   { --dot: #87a291; }
.accent-sand   { --dot: #b09b72; }
.accent-clay   { --dot: #b28880; }
.accent-plum   { --dot: #9a89a6; }

*, *::before, *::after { box-sizing: border-box; }

/* Muss vor den Layoutregeln stehen und sie schlagen: mehrere Ebenen werden
   über das hidden-Attribut geschaltet, setzen aber selbst display: flex/grid. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent-bg); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

svg { flex: 0 0 auto; }

/* ---------------------------------------------------------------- Bausteine */

.dim     { color: var(--text-2); }
.dimmer  { color: var(--text-3); }
.bright  { color: var(--text); }
.acc     { color: var(--accent); }
.danger  { color: var(--danger); }
.warn    { color: var(--warn); }
.grow    { flex: 1 1 auto; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden  { display: none !important; }
.num     { font-variant-numeric: tabular-nums; }
.mono    { font-family: var(--mono); font-size: 12px; }

.label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ------------------------------------------------------------------ Knöpfe */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { background: var(--surface-3); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
a.btn { text-decoration: none; }

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-2); }
.btn-primary:active:not(:disabled) { background: var(--accent-2); }

@media (prefers-color-scheme: dark) {
  .btn-primary { color: #16181a; font-weight: 600; }
}

.btn-danger { color: var(--danger); border-color: var(--line-2); }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger); }

/* Flächenloser Knopf. Wird auch ohne .btn benutzt und ist deshalb allein
   vollständig — sonst schlägt die Standardoptik des Browsers durch. */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 9px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn-ghost:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost.danger { color: var(--danger); }
.btn-ghost.danger:hover:not(:disabled) { background: var(--danger-bg); }

.btn-icon { padding: 0; width: 30px; min-height: 30px; }

/* ------------------------------------------------------------------ Formulare */

.field { display: block; margin-bottom: 15px; }
.field > .label { display: block; margin-bottom: 6px; }
.field > .hint { display: block; margin-top: 5px; font-size: 12px; color: var(--text-3); }

input[type=text], input[type=password], input[type=url], input[type=email],
input[type=search], input[type=datetime-local], select, textarea {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  outline: none;
  font-size: 13.5px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

/* Das eingebaute Löschkreuz von type="search" passt nicht ins Raster und
   doppelt sich mit Escape. */
input[type=search]::-webkit-search-cancel-button,
input[type=search]::-webkit-search-decoration { appearance: none; display: none; }
textarea { resize: vertical; min-height: 96px; line-height: 1.6; padding: 9px 10px; }

select {
  appearance: none;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  color: var(--text);
}

/* ------------------------------------------------------------------- Ladeebene */

.boot {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 90;
}
.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line-2);
  border-top-color: var(--text-3);
  border-radius: 50%;
}
@media (prefers-reduced-motion: no-preference) {
  .spinner { animation: spin .7s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
}

.noscript {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  background: var(--bg);
  color: var(--text-2);
  z-index: 200;
}

/* ---------------------------------------------------------------- Meldungen */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 130;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 380px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text);
  pointer-events: auto;
}
.toast svg { margin-top: 1px; }
.toast.is-ok svg { color: var(--ok); }
.toast.is-warn svg { color: var(--warn); }
.toast.is-err { border-color: var(--danger); }
.toast.is-err svg { color: var(--danger); }
.toast .close { margin: -4px -4px 0 4px; }

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in .16s ease-out; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
}

/* --------------------------------------------------------------- App-Gerüst */

.app { height: 100%; display: flex; flex-direction: column; }

.appbar {
  flex: 0 0 var(--head);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  cursor: pointer;
}
.brand svg { color: var(--text-2); }

.appbar nav { display: flex; gap: 2px; }
.navlink {
  padding: 6px 11px;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.navlink:hover { background: var(--surface-2); color: var(--text); }
.navlink.is-active { background: var(--surface-3); color: var(--text); }
.navlink:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.appbar .spacer { flex: 1 1 auto; }
.appbar .meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.appbar .who { display: flex; align-items: center; gap: 7px; padding-right: 4px; }

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
}

.view { flex: 1 1 auto; overflow: auto; }
.view-flush { overflow: hidden; }
.view-pad { padding: 26px 24px 48px; max-width: 1180px; margin: 0 auto; }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-title { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.015em; }
.page-sub { font-size: 13px; color: var(--text-3); }

/* ------------------------------------------------------------ Anmeldemaske */

.gate { height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate-box { width: 100%; max-width: 340px; }
.gate-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}
.gate-brand svg { color: var(--text-2); }
.gate-sub { color: var(--text-3); font-size: 13px; margin-bottom: 22px; }
.gate form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 20px;
  box-shadow: var(--shadow);
}
.gate .btn { width: 100%; margin-top: 4px; }
.gate-msg { margin-top: 12px; font-size: 13px; min-height: 19px; }
.gate-msg.danger { color: var(--danger); }
.gate-msg.warn { color: var(--warn); }

/* -------------------------------------------------------------- Bereiche */

.sector-list {
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: var(--surface);
  overflow: hidden;
}
.sector-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 88px 84px 116px 40px;
  align-items: center;
  gap: 16px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.sector-row:last-child { border-bottom: 0; }
.sector-row:hover { background: var(--surface-2); }
.sector-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--text-3)); }
.sector-open {
  background: none; border: 0; padding: 0; text-align: left;
  font: inherit; color: inherit; cursor: pointer; min-width: 0;
}
.sector-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.sector-name { font-weight: 500; }
.sector-desc { color: var(--text-3); font-size: 12.5px; margin-top: 1px; }
.sector-row .num { color: var(--text-2); font-size: 13px; text-align: right; white-space: nowrap; }
.sector-row .when { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.empty {
  padding: 52px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-l);
}
.empty strong { display: block; color: var(--text-2); font-size: 14.5px; font-weight: 600; margin-bottom: 5px; }
.empty svg { color: var(--line-2); margin-bottom: 12px; }

/* ---------------------------------------------------------------- Browser */

.browser { height: 100%; display: grid; grid-template-columns: var(--side) minmax(0, 1fr); }
.browser.has-detail { grid-template-columns: var(--side) minmax(0, 1fr) var(--aside); }

.pane { overflow: auto; height: 100%; }
.pane-tree { border-right: 1px solid var(--line); background: var(--surface); }
.pane-detail { border-left: 1px solid var(--line); background: var(--surface); }

.tree-head {
  position: sticky; top: 0; z-index: 2;
  padding: 12px 12px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.tree-title { font-weight: 600; font-size: 14px; margin-top: 6px; }
.tree-list { padding: 8px; }
.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  background: none;
  border: 0;
  border-radius: var(--radius);
  color: var(--text-2);
  cursor: pointer;
  text-align: left;
  font-size: 13.5px;
}
.tree-item:hover { background: var(--surface-2); color: var(--text); }
.tree-item.is-active { background: var(--surface-3); color: var(--text); font-weight: 500; }
.tree-item.is-drop { box-shadow: inset 0 0 0 1px var(--accent); }
.tree-item svg { color: var(--text-3); }
.tree-item.is-active svg { color: var(--accent); }
.tree-item .count { margin-left: auto; color: var(--text-3); font-size: 12px; }
.tree-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.crumbbar {
  position: sticky; top: 0; z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; min-width: 0; }
.crumb {
  background: none; border: 0; padding: 3px 6px; border-radius: 4px;
  color: var(--text-2); font: inherit; font-size: 13.5px; cursor: pointer;
}
.crumb:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.crumb.is-last { color: var(--text); font-weight: 500; cursor: default; }
.crumb-sep { color: var(--text-3); display: flex; }
.crumbbar .tools { margin-left: auto; display: flex; gap: 6px; flex: 0 0 auto; }

.list-head, .list-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 86px 124px 124px;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
}
.list-head {
  position: sticky; top: 51px; z-index: 2;
  height: 32px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-3);
}
.list-head span { white-space: nowrap; overflow: hidden; }
.list-head button {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: inherit; font: inherit; text-align: left;
  display: inline-flex; align-items: center; gap: 4px;
}
.list-head button:hover { color: var(--text-2); }
.list-head .num { text-align: right; justify-content: flex-end; }

.list-row {
  height: 38px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.list-row:hover { background: var(--surface-2); }
.list-row.is-selected { background: var(--surface-3); }
.list-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.list-row.is-drop { box-shadow: inset 0 0 0 1px var(--accent); }
.list-row svg { color: var(--text-3); }
.list-row.is-folder svg { color: var(--accent); }
.list-row .name { font-size: 13.5px; }
.list-row.is-selected .name { font-weight: 500; }
.list-row .num  { color: var(--text-3); font-size: 12.5px; text-align: right; white-space: nowrap; }
.list-row .when { color: var(--text-3); font-size: 12.5px; white-space: nowrap; }

.tagcount {
  display: inline-block;
  margin-left: 7px;
  padding: 0 6px;
  border-radius: 20px;
  background: var(--surface-3);
  color: var(--text-3);
  font-size: 11px;
  vertical-align: 1px;
}

.dropzone-active { box-shadow: inset 0 0 0 2px var(--accent); }

/* ------------------------------------------------------------ Detail-Panel */

.detail-head {
  position: sticky; top: 0; z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.detail-kind {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-3); margin-bottom: 3px;
}
.detail-title { font-weight: 600; font-size: 14.5px; word-break: break-word; line-height: 1.4; }
.detail-section { padding: 14px; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.detail-section > .section-label { display: block; margin-bottom: 9px; }

.preview {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  overflow: hidden;
}
.preview img, .preview video { max-width: 100%; max-height: 300px; display: block; }
.preview audio { width: 100%; padding: 12px; }
.preview iframe { width: 100%; height: 340px; border: 0; background: #fff; }
.preview pre {
  margin: 0; padding: 12px; width: 100%; max-height: 300px; overflow: auto;
  font: 12px/1.6 var(--mono); color: var(--text-2);
  white-space: pre-wrap; word-break: break-word;
}
.preview-none {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-3); font-size: 12.5px; padding: 26px;
}
.preview-none svg { color: var(--line-2); }

.kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 7px 12px; font-size: 12.5px; margin: 0; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text-2); word-break: break-word; }
.kv dd.mono { word-break: break-all; }

.taglist { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--surface-3);
  border: 0;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.tag:hover { background: var(--danger-bg); color: var(--danger); }
.tag:hover svg { color: var(--danger); }
.tag svg { color: var(--text-3); }
.tag.is-static { cursor: default; }
.tag.is-static:hover { background: var(--surface-3); color: var(--text-2); }

/* ---------------------------------------------------------------- Markdown */

.md { font-size: 13.5px; line-height: 1.65; color: var(--text-2); word-break: break-word; }
.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { color: var(--text); font-weight: 600; margin: 16px 0 7px; line-height: 1.35; }
.md h1 { font-size: 15px; }
.md h2 { font-size: 14px; }
.md h3 { font-size: 13.5px; }
.md p { margin: 0 0 10px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; }
.md li { margin-bottom: 3px; }
.md code {
  background: var(--surface-3); border-radius: 3px; padding: 1px 5px;
  font-family: var(--mono); font-size: 12px; color: var(--text);
}
.md pre {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px; overflow-x: auto; margin: 0 0 10px;
}
.md pre code { background: none; padding: 0; }
.md blockquote {
  margin: 0 0 10px; padding: 2px 0 2px 12px;
  border-left: 2px solid var(--line-2); color: var(--text-3);
}
.md a { color: var(--accent); text-underline-offset: 2px; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.md-empty { color: var(--text-3); }

/* --------------------------------------------------------------- Protokoll */

.filterbar {
  position: sticky; top: 0; z-index: 2;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.filterbar input, .filterbar select { width: auto; min-width: 170px; }

.logline {
  display: grid;
  grid-template-columns: 152px 116px 148px minmax(0, 1fr) 112px;
  gap: 14px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  align-items: baseline;
}
.logline:hover { background: var(--surface-2); }
.logline .when { color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.logline .who  { color: var(--text-2); }
.logline .what { color: var(--text); font-weight: 500; }
.logline .info { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logline .from { color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.logline.is-alert .what { color: var(--danger); }
.logline.is-warn  .what { color: var(--warn); }

/* ------------------------------------------------------- Konto und Verwaltung */

.console-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 18px;
}
.card h3 { margin: 0 0 14px; font-size: 14px; font-weight: 600; }
/* Nur der Einleitungstext der Karte rückt an die Überschrift heran. Ohne den
   Kindselektor gewinnt der negative Rand auch gegen .field > .hint und schöbe
   Hinweistexte in das Eingabefeld darüber. */
.card > .hint { color: var(--text-3); font-size: 12.5px; margin: -8px 0 16px; }

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 78px 132px auto;
  gap: 14px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.user-row:last-child { border-bottom: 0; }
.user-row .flags { display: flex; gap: 6px; }
.badge {
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.badge.is-admin { background: var(--accent-bg); color: var(--accent); }
.badge.is-off   { background: var(--danger-bg); color: var(--danger); }
.badge.is-2fa   { background: var(--surface-3); color: var(--ok); }

.secret-box {
  padding: 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: .1em;
  color: var(--text);
  word-break: break-all;
  text-align: center;
}

/* ------------------------------------------------------------------ Dialog */

.modal-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 14, 16, .55);
  z-index: 100;
}
@media (prefers-color-scheme: light) {
  .modal-root { background: rgba(28, 32, 38, .32); }
}
.modal {
  width: 100%;
  max-width: 440px;
  max-height: 86vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
}
.modal-head { padding: 16px 18px 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 16px 18px; }
.modal-body > p { margin: 0 0 12px; color: var(--text-2); font-size: 13.5px; }
.modal-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-msg { font-size: 13px; color: var(--danger); min-height: 18px; margin-top: 8px; }

@media (prefers-reduced-motion: no-preference) {
  .modal { animation: modal-in .14s ease-out; }
  @keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
}

/* ------------------------------------------------------------ Sperrbildschirm */

.lockscreen {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lock-box { width: 100%; max-width: 320px; text-align: center; }
.lock-box .lock-icon { color: var(--text-3); margin-bottom: 14px; }
.lock-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.lock-note { color: var(--text-3); font-size: 13px; margin-bottom: 20px; }
.lock-box .field { text-align: left; }
.lock-box .btn { width: 100%; margin-top: 4px; }

/* ------------------------------------------------------------------- Suche */

.palette {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(12, 14, 16, .5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 24px 24px;
}
@media (prefers-color-scheme: light) {
  .palette { background: rgba(28, 32, 38, .3); }
}
.palette-box {
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.palette-search { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.palette-search svg { color: var(--text-3); }
.palette-input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 14px 0 !important;
  font-size: 15px !important;
  min-height: auto !important;
}
.palette-input:focus { border: 0 !important; box-shadow: none !important; }
.palette-scope { flex: 0 0 auto; }
.palette-results { max-height: 52vh; overflow: auto; padding: 6px; }
.palette-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: 0;
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 13.5px;
}
.palette-row:hover, .palette-row.is-active { background: var(--surface-2); }
.palette-row svg { color: var(--text-3); }
.palette-row .where { color: var(--text-3); font-size: 12px; margin-left: auto; flex: 0 0 auto; }
.palette-note { padding: 18px 14px; color: var(--text-3); font-size: 13px; text-align: center; }

/* ------------------------------------------------------- Schmale Bildschirme */

@media (max-width: 1180px) {
  .browser, .browser.has-detail { grid-template-columns: 210px minmax(0, 1fr); }
  .pane-detail {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(360px, 92vw);
    z-index: 70;
    box-shadow: var(--shadow);
  }
  .sector-row { grid-template-columns: 10px minmax(0, 1fr) 84px 116px 40px; }
  .sector-row .num + .num { display: none; }
}

@media (max-width: 760px) {
  .browser, .browser.has-detail { grid-template-columns: minmax(0, 1fr); }
  .pane-tree { display: none; }
  .list-head, .list-row { grid-template-columns: 20px minmax(0, 1fr) 84px; }
  .list-head .when, .list-row .when { display: none; }
  .logline { grid-template-columns: minmax(0, 1fr); gap: 3px; padding: 10px 16px; }
  .logline .from { text-align: left; }
  .view-pad { padding: 18px 14px 36px; }
  .appbar { gap: 10px; padding: 0 12px; }
  .appbar .who span { display: none; }
  .toasts { left: 16px; align-items: stretch; }
}
