/* ==========================================================================
   VOLTA – Web FTP Console
   Layoutgerüst nach dem Muster einer Geschäftskunden-Portalseite:
   feste Kopfzeile, linke Navigation, dichtes Datenraster, ruhige Flächen.
   Farbwelt: tiefes Marineblau mit einer breit gefächerten Neon-Palette,
   die Bedeutung trägt statt zu dekorieren.
   ========================================================================== */

:root {
  /* Flächen */
  --bg:          #070b16;
  --surface:     #0d1322;
  --surface-2:   #121a2e;
  --surface-3:   #18223a;
  --line:        #1e2a45;

  /* Schrift */
  --text:        #e9eef9;
  --text-dim:    #a9b4cc;
  --muted:       #76839f;

  /* Neon-Palette, semantisch belegt */
  --signal:      #ff2d55;  /* Hauptaktion, Löschen, Markenakzent */
  --signal-dim:  #c01c3c;
  --cyan:        #2ad4f0;  /* Navigation, Links, Freigaben */
  --violet-1:    #a86bff;  /* Bibliothek, Sicherungen */
  --lime:        #9ef01a;  /* Erfolg, Upload, Ordner */
  --amber:       #ffb224;  /* Warnung, Ablauf, Rechte */
  --rose:        #ff6ea9;  /* Bilder */
  --sky:         #5b8cff;  /* Dokumente */

  /* Maße */
  --topbar-h:    56px;
  --sidebar-w:   268px;
  --radius:      3px;
  --radius-lg:   6px;

  /* Typografie */
  --font-head:   "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  --font-body:   "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono:   "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --shadow-pop:  0 18px 48px rgba(2, 5, 14, .66);
  --ease:        cubic-bezier(.2, .7, .3, 1);
}

* { box-sizing: border-box; }

/* Das hidden-Attribut muss immer gewinnen, auch gegen display-Regeln einzelner Klassen. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Feiner Raster-Unterdruck – einmalig, nicht wiederholt als Dekor */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(42, 212, 240, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 212, 240, .035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 120% 80% at 50% 0%, #000 0%, transparent 72%);
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

code, kbd, .mono { font-family: var(--font-mono); font-size: .92em; }

.muted { color: var(--text-dim); }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ========================================================== Marke */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 26px;
  height: 26px;
  flex: none;
  position: relative;
  background: var(--signal);
  clip-path: polygon(0 0, 100% 0, 100% 72%, 72% 100%, 0 100%);
  box-shadow: 0 0 18px rgba(255, 45, 85, .55);
}
.brand-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  width: 4px;
  height: 14px;
  background: var(--bg);
  transform: translateX(-50%) skewX(-18deg);
}

.brand-text {
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1;
  display: flex;
  flex-direction: column;
}
.brand-text em {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .22em;
  color: var(--muted);
  margin-top: 3px;
}
.brand-lg .brand-mark { width: 38px; height: 38px; }
.brand-lg .brand-text { font-size: 27px; }
.brand-lg .brand-text em { font-size: 12px; }

/* ========================================================== Buttons */

.btn {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .015em;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  transition: background .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease);
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #202c48; border-color: #2d3d61; }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-lg { padding: 11px 22px; font-size: 16px; }
.btn-block { width: 100%; display: block; }

.btn-primary {
  background: var(--signal);
  border-color: var(--signal);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #ff4668;
  border-color: #ff4668;
  box-shadow: 0 0 20px rgba(255, 45, 85, .35);
}

.btn-ghost { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }

.btn-danger { border-color: rgba(255, 45, 85, .4); color: #ff8098; }
.btn-danger:hover:not(:disabled) { background: rgba(255, 45, 85, .14); border-color: var(--signal); color: #fff; }

.btn-accent-cyan { border-color: rgba(42, 212, 240, .4); color: var(--cyan); }
.btn-accent-cyan:hover:not(:disabled) { background: rgba(42, 212, 240, .13); border-color: var(--cyan); }

.btn-accent-violet { border-color: rgba(168, 107, 255, .42); color: var(--violet-1); }
.btn-accent-violet:hover:not(:disabled) { background: rgba(168, 107, 255, .14); border-color: var(--violet-1); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-dim);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.icon-btn-sm { width: 26px; height: 26px; }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.icon-btn-sm svg { width: 13px; height: 13px; }

/* ========================================================== Formulare */

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 5px;
}
.field > span i { font-style: normal; font-weight: 500; color: var(--muted); }

input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="url"],
select,
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 9px 11px;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(42, 212, 240, .14);
}
input::placeholder { color: var(--muted); }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.field-hint { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.field-hint[data-score="4"], .field-hint[data-score="5"] { color: var(--lime); }
.field-hint[data-score="0"], .field-hint[data-score="1"] { color: var(--amber); }

.input-reveal { position: relative; display: block; }
.input-reveal input { padding-right: 82px; }
.reveal-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--font-head);
  cursor: pointer;
  padding: 4px 7px;
}
.reveal-btn:hover { color: var(--cyan); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.col-span-2 { grid-column: 1 / -1; }

.switch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.switch input { appearance: none; width: 32px; height: 17px; border-radius: 9px; background: var(--surface-3); border: 1px solid var(--line); position: relative; cursor: pointer; flex: none; transition: background .16s var(--ease); }
.switch input::after { content: ""; position: absolute; left: 2px; top: 1.5px; width: 12px; height: 12px; border-radius: 50%; background: var(--muted); transition: transform .16s var(--ease), background .16s var(--ease); }
.switch input:checked { background: rgba(42, 212, 240, .22); border-color: var(--cyan); }
.switch input:checked::after { transform: translateX(14px); background: var(--cyan); }
.switch span { font-size: 12.5px; color: var(--text-dim); font-family: var(--font-head); font-weight: 500; }

.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ========================================================== Meldungen */

.alert {
  border-left: 3px solid var(--line);
  background: var(--surface-2);
  padding: 11px 14px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 13.5px;
  margin: 16px 0;
}
.alert p { margin: 0 0 5px; }
.alert p:last-child { margin: 0; }
.alert-error { border-left-color: var(--signal); color: #ffc2ce; background: rgba(255, 45, 85, .09); }
.alert-warn  { border-left-color: var(--amber); color: #ffddab; background: rgba(255, 178, 36, .09); }
.alert-ok    { border-left-color: var(--lime); color: #ddffb0; background: rgba(158, 240, 26, .08); }

/* ========================================================== Kopfzeile */

.topbar {
  position: fixed;
  top: env(safe-area-inset-top, 0px);
  left: 0;
  right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: rgba(10, 15, 28, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 60;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, var(--signal) 0%, var(--violet-1) 26%, var(--cyan) 58%, var(--lime) 82%, transparent 100%);
  opacity: .55;
}

.nav-toggle { display: none; }
.topbar-spacer { flex: 1; }

.topbar-connection {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
  min-width: 0;
}
.topbar-connection select {
  width: 320px;
  max-width: 42vw;
  padding: 6px 30px 6px 10px;
  font-size: 13px;
  background-color: var(--surface);
}
.conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
  flex: none;
  transition: background .2s var(--ease), box-shadow .2s var(--ease);
}
.conn-dot[data-state="on"] { background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.conn-dot[data-state="busy"] { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.conn-dot[data-state="error"] { background: var(--signal); box-shadow: 0 0 10px var(--signal); }

.topbar-user { display: flex; align-items: baseline; gap: 10px; }
.user-name { font-family: var(--font-head); font-weight: 600; }
.user-role { font-size: 11.5px; color: var(--muted); font-family: var(--font-head); }

/* ========================================================== Gerüst */

.shell {
  display: flex;
  min-height: 100vh;
  padding-top: var(--topbar-h);
  position: relative;
  z-index: 1;
}

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.nav-list { list-style: none; margin: 0; padding: 14px 10px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  background: transparent;
  border: 0;
  border-left: 2px solid transparent;
  color: var(--text-dim);
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  padding: 9px 12px;
  cursor: pointer;
  text-align: left;
  transition: color .14s var(--ease), background .14s var(--ease);
}
.nav-item:hover { color: var(--text); background: var(--surface-2); }
.nav-item.is-active { color: var(--text); background: var(--surface-2); border-left-color: var(--signal); }
.nav-item.is-active .nav-ico { background: var(--signal); box-shadow: 0 0 10px rgba(255, 45, 85, .5); }

.nav-ico {
  width: 7px; height: 7px;
  background: var(--muted);
  flex: none;
  transform: rotate(45deg);
  transition: background .14s var(--ease);
}
.nav-item[data-view="shares"].is-active .nav-ico { background: var(--cyan); box-shadow: 0 0 10px rgba(42, 212, 240, .55); }
.nav-item[data-view="library"].is-active .nav-ico { background: var(--violet-1); box-shadow: 0 0 10px rgba(168, 107, 255, .55); }
.nav-item[data-view="log"].is-active .nav-ico { background: var(--amber); box-shadow: 0 0 10px rgba(255, 178, 36, .5); }
.nav-item[data-view="users"].is-active .nav-ico { background: var(--lime); box-shadow: 0 0 10px rgba(158, 240, 26, .5); }
.nav-item[data-view="shares"].is-active { border-left-color: var(--cyan); }
.nav-item[data-view="library"].is-active { border-left-color: var(--violet-1); }
.nav-item[data-view="log"].is-active { border-left-color: var(--amber); }
.nav-item[data-view="users"].is-active { border-left-color: var(--lime); }

.sidebar-section { padding: 6px 10px 14px; border-top: 1px solid var(--line); margin-top: 6px; flex: 1; min-height: 0; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 8px; }
.sidebar-head h2 { font-size: 12px; letter-spacing: .14em; color: var(--muted); font-weight: 600; }

.conn-list { list-style: none; margin: 0; padding: 0; }
.conn-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
}
.conn-item:hover { background: var(--surface-2); }
.conn-item.is-active { background: var(--surface-2); border-color: rgba(42, 212, 240, .32); }
.conn-item .ci-body { min-width: 0; flex: 1; }
.conn-item .ci-label { display: block; font-family: var(--font-head); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-item .ci-host { display: block; font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-item .ci-proto { font-size: 10px; font-family: var(--font-head); letter-spacing: .1em; color: var(--cyan); border: 1px solid rgba(42, 212, 240, .3); padding: 1px 5px; border-radius: 2px; flex: none; }
.conn-item .ci-proto[data-p="ftps"] { color: var(--lime); border-color: rgba(158, 240, 26, .35); }
.conn-item .ci-edit { opacity: 0; }
.conn-item:hover .ci-edit { opacity: 1; }

.sidebar-foot { border-top: 1px solid var(--line); padding: 12px 22px 18px; }
.quota-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding: 3px 0; }
.quota-line strong { color: var(--text-dim); font-family: var(--font-mono); font-weight: 500; }

/* ========================================================== Inhalt */

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { display: none; flex-direction: column; flex: 1; min-height: 0; padding: 0 0 0 0; }
.view.is-active { display: flex; }

.view-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.view-title { font-size: 24px; letter-spacing: .005em; }
.view-head-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.view-head-actions input[type="search"] { width: 240px; padding: 7px 11px; font-size: 13px; }
.view-intro { margin: 16px 22px 0; max-width: 72ch; color: var(--text-dim); }

.filter-box input { width: 220px; padding: 7px 11px; font-size: 13px; }

/* Brotkrumen */
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 13px; min-width: 0; }
.crumb {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px 7px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: inherit;
}
.crumb:hover { background: var(--surface-2); color: var(--cyan); }
.crumb.is-current { color: var(--text); font-weight: 500; }
.crumb-sep { color: var(--line); user-select: none; }
.crumb-root { color: var(--signal); }

/* Werkzeugleiste */
.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-wrap: wrap;
}
.tool-group { display: flex; gap: 6px; flex-wrap: wrap; }
.tool-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.tool-spacer { flex: 1; }
.tool-group[data-requires="selection"] { opacity: .4; pointer-events: none; transition: opacity .16s var(--ease); }
.tool-group[data-requires="selection"].is-ready { opacity: 1; pointer-events: auto; }

/* Tabelle */
.table-wrap { flex: 1; min-height: 0; overflow: auto; position: relative; }

.file-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.file-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-family: var(--font-head);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  padding: 9px 12px;
  white-space: nowrap;
}
.file-table thead th.sortable { cursor: pointer; }
.file-table thead th.sortable:hover { color: var(--text); }
.file-table thead th[data-dir="asc"]::after { content: " ↑"; color: var(--cyan); }
.file-table thead th[data-dir="desc"]::after { content: " ↓"; color: var(--cyan); }

.file-table tbody tr {
  border-bottom: 1px solid rgba(30, 42, 69, .55);
  transition: background .1s var(--ease);
}
.file-table tbody tr:hover { background: rgba(24, 34, 58, .6); }
.file-table tbody tr.is-selected { background: rgba(42, 212, 240, .09); }
.file-table tbody tr.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--cyan); }
.file-table td { padding: 7px 12px; vertical-align: middle; }

.col-check { width: 38px; }
.col-size { width: 110px; text-align: right; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); }
.col-kind { width: 110px; color: var(--muted); font-size: 12.5px; }
.col-date { width: 148px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); }
.col-perms { width: 86px; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.col-actions { width: 96px; }

.name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kind-bar { width: 3px; height: 17px; flex: none; border-radius: 1px; background: var(--muted); }
.kind-bar[data-kind="dir"]     { background: var(--lime);    box-shadow: 0 0 7px rgba(158, 240, 26, .5); }
.kind-bar[data-kind="code"]    { background: var(--cyan); }
.kind-bar[data-kind="markup"]  { background: var(--violet-1); }
.kind-bar[data-kind="image"]   { background: var(--rose); }
.kind-bar[data-kind="video"]   { background: var(--sky); }
.kind-bar[data-kind="audio"]   { background: var(--sky); }
.kind-bar[data-kind="archive"] { background: var(--amber); }
.kind-bar[data-kind="doc"]     { background: var(--sky); }

.name-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48vw;
}
.name-link:hover { color: var(--cyan); }
tr.is-dir .name-link { font-weight: 600; }
.sym-flag { font-size: 10.5px; color: var(--amber); font-family: var(--font-head); letter-spacing: .08em; }

.row-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: 0; transition: opacity .12s var(--ease); }
tr:hover .row-actions, tr.is-selected .row-actions { opacity: 1; }

.empty-state { padding: 64px 24px; text-align: center; }
.empty-title { font-family: var(--font-head); font-size: 19px; margin: 0 0 6px; }
.empty-text { color: var(--muted); margin: 0; }

.drop-overlay {
  position: absolute;
  inset: 10px;
  border: 2px dashed var(--lime);
  background: rgba(158, 240, 26, .07);
  display: none;
  place-items: center;
  border-radius: var(--radius-lg);
  pointer-events: none;
  z-index: 20;
}
.drop-overlay span { font-family: var(--font-head); font-size: 19px; color: var(--lime); }
#dropZone.is-dragging .drop-overlay { display: grid; }

/* Statusleiste */
.statusbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--muted);
  font-family: var(--font-mono);
}
.status-sep { width: 1px; height: 13px; background: var(--line); }
.status-spacer { flex: 1; }

/* ========================================================== Karten */

.card-list { padding: 18px 22px 40px; display: grid; gap: 12px; }

.card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 16px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.card-share { border-left-color: var(--cyan); }
.card-share.is-expired { border-left-color: var(--muted); opacity: .62; }
.card-backup { border-left-color: var(--violet-1); }

.card-main { flex: 1; min-width: 240px; }
.card-title { font-family: var(--font-head); font-size: 17px; font-weight: 600; margin: 0 0 3px; }
.card-sub { color: var(--muted); font-size: 12.5px; font-family: var(--font-mono); word-break: break-all; margin: 0; }
.card-meta { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; }
.card-meta div { display: flex; flex-direction: column; }
.card-meta dt, .card-meta .mt-label { font-size: 11px; color: var(--muted); font-family: var(--font-head); letter-spacing: .08em; }
.card-meta dd, .card-meta .mt-value { margin: 0; font-size: 13px; color: var(--text-dim); }
.card-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }

.link-field { display: flex; gap: 6px; margin-top: 10px; }
.link-field input { font-family: var(--font-mono); font-size: 12px; background: var(--bg); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-head);
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.pill-live { color: var(--lime); border-color: rgba(158, 240, 26, .35); background: rgba(158, 240, 26, .08); }
.pill-expired { color: var(--muted); }
.pill-lock { color: var(--amber); border-color: rgba(255, 178, 36, .35); }
.pill-dir { color: var(--cyan); border-color: rgba(42, 212, 240, .3); }

/* ========================================================== Tafeln */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
}
.panel-title { font-size: 18px; margin-bottom: 12px; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; padding: 18px 22px 40px; align-items: start; }

.spec-list { margin: 0; }
.spec-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid rgba(30, 42, 69, .5); }
.spec-list > div:last-child { border-bottom: 0; }
.spec-list dt { color: var(--muted); font-size: 13px; }
.spec-list dd { margin: 0; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); text-align: right; }

.plain-list { margin: 10px 0 0; padding-left: 18px; color: var(--text-dim); }
.plain-list li { margin-bottom: 6px; }

/* ========================================================== Dialoge */

.modal-root { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4, 7, 15, .74); backdrop-filter: blur(3px); }
.modal {
  position: relative;
  width: min(620px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--signal);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  animation: modal-in .16s var(--ease);
}
.modal[data-accent="cyan"] { border-top-color: var(--cyan); }
.modal[data-accent="violet"] { border-top-color: var(--violet-1); }
.modal[data-accent="amber"] { border-top-color: var(--amber); }
.modal[data-accent="lime"] { border-top-color: var(--lime); }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } }

.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 19px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-body > p:first-child { margin-top: 0; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); }

.duration-row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; }
.path-preview { font-family: var(--font-mono); font-size: 12.5px; color: var(--cyan); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 11px; word-break: break-all; }
.item-list { list-style: none; margin: 0 0 14px; padding: 0; max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.item-list li { padding: 6px 11px; font-family: var(--font-mono); font-size: 12.5px; border-bottom: 1px solid rgba(30, 42, 69, .5); color: var(--text-dim); }
.item-list li:last-child { border-bottom: 0; }

.chmod-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 12px 0; }
.chmod-col { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.chmod-col h4 { font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.chmod-col label { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 2px 0; cursor: pointer; }
.chmod-col input { width: auto; }
.chmod-value { font-family: var(--font-mono); font-size: 22px; color: var(--amber); text-align: center; letter-spacing: .14em; }

/* ========================================================== Editor */

.editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
}
.editor-overlay[hidden] { display: none; }

.editor-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-wrap: wrap;
}
.editor-file { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.editor-file strong { font-family: var(--font-head); font-size: 17px; }
.editor-path { font-family: var(--font-mono); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.dirty-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.editor-tools { margin-left: auto; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.editor-find { padding: 9px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.find-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.find-row input[type="text"] { width: 220px; padding: 6px 10px; font-size: 13px; font-family: var(--font-mono); }
.find-count { font-family: var(--font-mono); font-size: 12px; color: var(--cyan); min-width: 86px; }

.editor-body { flex: 1; display: flex; min-height: 0; background: #060a13; }

.gutter {
  width: 62px;
  flex: none;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 21px;
  color: var(--muted);
  text-align: right;
  padding: 12px 10px 12px 0;
  user-select: none;
}
.gutter div { height: 21px; }
.gutter div.is-current { color: var(--cyan); background: rgba(42, 212, 240, .08); }
.gutter div.is-match { color: var(--amber); }
.gutter div.is-marked { color: var(--signal); font-weight: 500; }

.editor-scroll { position: relative; flex: 1; min-width: 0; overflow: hidden; }

#editorArea,
.highlight-layer {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 21px;
  padding: 12px 16px;
  white-space: pre;
  tab-size: 4;
  border: 0;
  margin: 0;
  letter-spacing: 0;
}

#editorArea {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  color: var(--text);
  resize: none;
  overflow: auto;
  z-index: 2;
  caret-color: var(--cyan);
  border-radius: 0;
}
#editorArea:focus { outline: none; box-shadow: none; }
#editorArea.wrap-on { white-space: pre-wrap; word-break: break-word; }

.highlight-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: transparent;
  z-index: 1;
  pointer-events: none;
}
.highlight-layer mark { background: rgba(255, 178, 36, .3); color: transparent; border-radius: 2px; }
.highlight-layer mark.is-active { background: rgba(42, 212, 240, .42); }
.highlight-layer .line-flash { display: block; background: rgba(255, 45, 85, .16); box-shadow: inset 2px 0 0 var(--signal); }

.editor-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

/* ========================================================== Hinweise */

.toast-stack { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; max-width: min(400px, 90vw); }
.toast {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 11px 15px;
  box-shadow: var(--shadow-pop);
  font-size: 13.5px;
  animation: toast-in .18s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
.toast-ok { border-left-color: var(--lime); }
.toast-error { border-left-color: var(--signal); }
.toast-warn { border-left-color: var(--amber); }
.toast strong { display: block; font-family: var(--font-head); margin-bottom: 2px; }

.busy-bar { position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px)); left: 0; right: 0; height: 2px; z-index: 150; background: rgba(42, 212, 240, .12); overflow: hidden; }
.busy-bar span { display: block; height: 100%; width: 34%; background: linear-gradient(90deg, transparent, var(--cyan), var(--violet-1), transparent); animation: busy 1.1s linear infinite; }
@keyframes busy { from { transform: translateX(-120%); } to { transform: translateX(420%); } }

/* ========================================================== Setup & Login */

.page-setup, .page-login { min-height: 100vh; }

.setup-shell, .login-shell { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; min-height: 100vh; }

.setup-aside, .login-stage {
  background: linear-gradient(165deg, #0c1326 0%, #070b16 60%, #0a0f1f 100%);
  border-right: 1px solid var(--line);
  padding: 44px 40px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.setup-aside::after, .login-stage::after {
  content: "";
  position: absolute;
  right: -1px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--signal), var(--violet-1) 35%, var(--cyan) 68%, var(--lime));
  opacity: .7;
}

.setup-claim { font-size: 34px; line-height: 1.12; margin: 36px 0 14px; }
.setup-sub { color: var(--text-dim); max-width: 42ch; }
.setup-steps { list-style: none; counter-reset: s; margin: 32px 0 0; padding: 0; }
.setup-steps li { counter-increment: s; display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--text-dim); font-family: var(--font-head); font-size: 15px; }
.setup-steps li::before { content: counter(s); width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line); color: var(--cyan); font-size: 12px; border-radius: 2px; flex: none; }
.setup-foot { margin-top: auto; color: var(--muted); font-size: 12px; font-family: var(--font-mono); }

.setup-main { padding: 44px; overflow-y: auto; }
.setup-main .panel { max-width: 720px; }

.check-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.check-table td { padding: 7px 0; border-bottom: 1px solid rgba(30, 42, 69, .6); }
.check-value { text-align: right; font-family: var(--font-mono); font-size: 12.5px; }
.check-table tr.is-ok .check-value { color: var(--lime); }
.check-table tr.is-bad .check-value { color: var(--signal); }
.check-table tr.is-bad td:first-child { color: #ffb8c5; }

.radio-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 20px; }
.radio-card { display: flex; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; cursor: pointer; }
.radio-card:hover { border-color: #2d3d61; }
.radio-card input { width: auto; margin-top: 3px; accent-color: var(--signal); }
.radio-card input:checked ~ .radio-body strong { color: var(--signal); }
.radio-card:has(input:checked) { border-color: rgba(255, 45, 85, .45); background: rgba(255, 45, 85, .05); }
.radio-body strong { display: block; font-family: var(--font-head); font-size: 15px; }
.radio-body em { font-style: normal; font-size: 12.5px; color: var(--muted); }

.done-mark { width: 44px; height: 44px; margin-bottom: 14px; border: 2px solid var(--lime); border-radius: 50%; position: relative; }
.done-mark::after { content: ""; position: absolute; left: 13px; top: 7px; width: 11px; height: 20px; border: solid var(--lime); border-width: 0 2px 2px 0; transform: rotate(42deg); }

.login-stage .stage-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(168, 107, 255, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 212, 240, .08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 20% 15%, #000, transparent 68%);
}
.stage-copy { position: relative; display: flex; flex-direction: column; height: 100%; }
.stage-line { font-family: var(--font-head); font-size: 25px; line-height: 1.26; margin: 40px 0 0; max-width: 20ch; }
.stage-facts { margin: auto 0 0; }
.stage-facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); }
.stage-facts dt { color: var(--muted); font-size: 12.5px; font-family: var(--font-head); }
.stage-facts dd { margin: 0; font-size: 12.5px; font-family: var(--font-mono); color: var(--text-dim); }

.login-main { display: grid; place-items: center; padding: 40px; }
.login-form { width: min(400px, 100%); }
.login-form h1 { font-size: 30px; margin-bottom: 4px; }
.login-form .muted { margin: 0 0 24px; }
.login-form .btn { margin-top: 8px; }
.login-foot { margin-top: 26px; text-align: center; color: var(--muted); font-size: 12px; font-family: var(--font-mono); }

/* ========================================================== Öffentliche Freigabe */

.page-share { padding: 0; }
.share-head {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
}
.share-head::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, var(--cyan), var(--violet-1) 50%, transparent);
}
.share-wrap { max-width: 940px; margin: 0 auto; padding: 28px 24px 60px; position: relative; z-index: 1; }
.share-title { font-size: 28px; margin-bottom: 4px; }
.share-expiry { display: flex; gap: 20px; flex-wrap: wrap; margin: 18px 0 26px; }
.share-expiry > div { border-left: 2px solid var(--line); padding-left: 12px; }
.share-expiry dt { font-size: 11.5px; color: var(--muted); font-family: var(--font-head); letter-spacing: .08em; }
.share-expiry dd { margin: 2px 0 0; font-family: var(--font-mono); font-size: 13px; }
.share-expiry > div:first-child { border-left-color: var(--cyan); }

.share-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.share-table th { text-align: left; font-family: var(--font-head); font-size: 12.5px; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); }
.share-table td { padding: 9px 12px; border-bottom: 1px solid rgba(30, 42, 69, .5); }
.share-table tr:hover td { background: rgba(24, 34, 58, .5); }

.notice-page { max-width: 520px; margin: 14vh auto; text-align: center; padding: 0 24px; }
.notice-page h1 { font-size: 30px; margin-bottom: 10px; }

/* ========================================================== Responsiv */

@media (max-width: 1080px) {
  .topbar-connection select { width: 220px; }
  .col-perms, .col-kind { display: none; }
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; }
  .sidebar {
    position: fixed;
    top: calc(var(--topbar-h) + env(safe-area-inset-top, 0px));
    left: 0;
    bottom: 0;
    z-index: 55;
    transform: translateX(-100%);
    transition: transform .2s var(--ease);
    height: auto;
  }
  .sidebar.is-open { transform: none; }
  .setup-shell, .login-shell { grid-template-columns: 1fr; }
  .setup-aside, .login-stage { display: none; }
  .setup-main, .login-main { padding: 24px; }
  .grid-2, .radio-row { grid-template-columns: 1fr; }
  .col-date { display: none; }
  .view-head-actions input[type="search"], .filter-box input { width: 150px; }
  .editor-path { display: none; }
  .topbar-user .user-role { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* ==========================================================================
   Administration, Konfiguration, Fehlerprotokolle
   ========================================================================== */

.pill-fail { color: #ff8098; border-color: rgba(255, 45, 85, .45); background: rgba(255, 45, 85, .09); }
.pill-solid { color: #fff; background: var(--signal); border-color: var(--signal); }

.sub-title { font-size: 15px; color: var(--text-dim); margin: 24px 0 10px; }
.sub-title:first-child { margin-top: 0; }
.row-actions.is-visible { opacity: 1; }

/* Navigation der Administration: eigene Akzentfarbe je Bereich */
.page-admin .sidebar-foot { margin-top: auto; }
.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--signal);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.page-admin .nav-item[data-view="health"].is-active      { border-left-color: var(--cyan); }
.page-admin .nav-item[data-view="health"].is-active .nav-ico      { background: var(--cyan); box-shadow: 0 0 10px rgba(42, 212, 240, .55); }
.page-admin .nav-item[data-view="protocols"].is-active   { border-left-color: var(--amber); }
.page-admin .nav-item[data-view="protocols"].is-active .nav-ico   { background: var(--amber); box-shadow: 0 0 10px rgba(255, 178, 36, .5); }
.page-admin .nav-item[data-view="activity"].is-active    { border-left-color: var(--violet-1); }
.page-admin .nav-item[data-view="activity"].is-active .nav-ico    { background: var(--violet-1); box-shadow: 0 0 10px rgba(168, 107, 255, .55); }
.page-admin .nav-item[data-view="config"].is-active      { border-left-color: var(--sky); }
.page-admin .nav-item[data-view="config"].is-active .nav-ico      { background: var(--sky); box-shadow: 0 0 10px rgba(91, 140, 255, .55); }
.page-admin .nav-item[data-view="maintenance"].is-active { border-left-color: var(--rose); }
.page-admin .nav-item[data-view="maintenance"].is-active .nav-ico { background: var(--rose); box-shadow: 0 0 10px rgba(255, 110, 169, .5); }

/* Gesamturteil */
.verdict {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 18px 22px 0;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  flex-wrap: wrap;
}
.verdict[data-state="ok"]   { border-left-color: var(--lime); }
.verdict[data-state="warn"] { border-left-color: var(--amber); }
.verdict[data-state="fail"] { border-left-color: var(--signal); }
.verdict h2 { font-size: 22px; }
.verdict p { margin: 3px 0 0; color: var(--text-dim); font-size: 13px; }
.verdict-counts { display: flex; gap: 28px; margin: 0 0 0 auto; }
.verdict-counts > div { display: flex; flex-direction: column-reverse; align-items: flex-end; }
.verdict-counts dt { font-size: 11.5px; color: var(--muted); font-family: var(--font-head); }
.verdict-counts dd { margin: 0; font-family: var(--font-mono); font-size: 22px; line-height: 1.1; }
.verdict-counts [data-kind="ok"] dd   { color: var(--lime); }
.verdict-counts [data-kind="warn"] dd { color: var(--amber); }
.verdict-counts [data-kind="fail"] dd { color: var(--signal); }

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
  padding: 18px 22px 40px;
  align-items: start;
}
.panel-flat { margin: 0 22px 40px; }
.panel-flat .table-wrap { overflow: visible; }

.attention { list-style: none; margin: 0; padding: 0; }
.attention li { padding: 10px 0; border-bottom: 1px solid rgba(30, 42, 69, .55); }
.attention li:last-child { border-bottom: 0; }
.att-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.att-head strong { font-family: var(--font-head); font-size: 15px; }
.attention p { margin: 5px 0 0; color: var(--text-dim); font-size: 13px; }

.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { border-bottom: 1px solid rgba(30, 42, 69, .55); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list button, .mini-list .ml-static {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 4px;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
}
.mini-list button { cursor: pointer; }
.mini-list button:hover .ml-title { color: var(--cyan); }
.ml-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-meta { color: var(--muted); font-size: 12px; font-family: var(--font-mono); white-space: nowrap; }

/* System Health */
.health-table td { vertical-align: top; }
.health-table tr.group-row td {
  background: var(--surface-2);
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.health-table tr[data-status="fail"] td:first-child { box-shadow: inset 3px 0 0 var(--signal); }
.health-table tr[data-status="warn"] td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.hint-cell { color: var(--text-dim); font-size: 12.5px; max-width: 46ch; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* Wartung */
.maint-row { display: flex; align-items: flex-end; gap: 14px; margin-top: 14px; }
.maint-row .field { margin: 0; flex: 1; }

/* Akkordeon (Generator auf der Konfigurationsseite) */
.accordion { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); max-width: 720px; }
.accordion > summary {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 18px 24px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.accordion > summary::-webkit-details-marker { display: none; }
.accordion > summary::before {
  content: "";
  width: 7px; height: 7px;
  border-right: 2px solid var(--cyan);
  border-bottom: 2px solid var(--cyan);
  transform: translateY(-2px) rotate(-45deg);
  transition: transform .16s var(--ease);
  flex: none;
}
.accordion[open] > summary::before { transform: translateY(-3px) rotate(45deg); }
.accordion[open] > summary { border-bottom: 1px solid var(--line); }
.accordion-title { font-family: var(--font-head); font-size: 18px; font-weight: 600; }
.accordion-sub { color: var(--muted); font-size: 13px; }
.accordion > summary:hover .accordion-title { color: var(--cyan); }
.accordion-body { padding: 22px 24px 24px; }
.setup-main .accordion { max-width: 720px; }

/* Markdown-Leser für Fehlerprotokolle */
.reader {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  flex: 1;
  min-height: 0;
  height: calc(100vh - var(--topbar-h) - 74px);
}
.reader-list { border-right: 1px solid var(--line); overflow-y: auto; background: var(--surface); }
.reader-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 12px 18px;
  background: none;
  border: 0;
  border-bottom: 1px solid rgba(30, 42, 69, .6);
  border-left: 3px solid transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.reader-item:hover { background: var(--surface-2); }
.reader-item.is-active { background: var(--surface-2); border-left-color: var(--amber); }
.ri-top { display: flex; align-items: center; gap: 8px; }
.ri-count { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.ri-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; line-height: 1.25; }
.ri-meta { font-size: 12px; color: var(--muted); }

.reader-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.reader-empty { margin: auto; text-align: center; padding: 24px; max-width: 420px; }
.reader-empty .empty-text { margin-top: 6px; }
.reader-doc { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.reader-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 18px 26px 14px; flex-wrap: wrap; }
.reader-titles { min-width: 0; flex: 1; }
.reader-titles h2 { font-size: 22px; line-height: 1.2; }
.reader-titles .card-sub { margin-top: 5px; font-family: var(--font-body); font-size: 12.5px; }
.reader-tabs { display: flex; gap: 2px; padding: 0 26px; border-bottom: 1px solid var(--line); }
.reader-tabs button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 14px;
  cursor: pointer;
}
.reader-tabs button:hover { color: var(--text); }
.reader-tabs button.is-active { color: var(--text); border-bottom-color: var(--amber); }
.reader-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 26px 40px; }

.md-body { max-width: 74ch; line-height: 1.65; color: var(--text-dim); }
.md-body h1 { font-size: 26px; color: var(--text); margin: 0 0 14px; }
.md-body h2 { font-size: 19px; color: var(--text); margin: 28px 0 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.md-body h3 { font-size: 16px; color: var(--text); margin: 20px 0 6px; }
.md-body p { margin: 0 0 12px; }
.md-body ul, .md-body ol { margin: 0 0 14px; padding-left: 22px; }
.md-body li { margin: 3px 0; }
.md-body li > strong:first-child { color: var(--text); }
.md-body strong { color: var(--text); }
.md-body a { color: var(--cyan); }
.md-body hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
.md-body blockquote { margin: 14px 0; padding: 6px 14px; border-left: 3px solid var(--amber); background: rgba(255, 178, 36, .07); color: var(--text-dim); }
.md-body blockquote p { margin: 0; }
.md-body code { font-family: var(--font-mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px; padding: 1px 5px; color: var(--text); }
.md-code, .md-raw {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 14px;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-dim);
}
.md-code code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; }
.md-raw { white-space: pre-wrap; word-break: break-word; }
.md-table { overflow-x: auto; margin: 0 0 14px; }
.md-table table { border-collapse: collapse; font-size: 13px; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: 6px 10px; }
.md-table th { background: var(--surface-2); color: var(--text); }

@media (max-width: 960px) {
  .reader { grid-template-columns: 1fr; height: auto; }
  .reader-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .reader-body { min-height: 360px; }
  .verdict-counts { margin-left: 0; }
  .admin-grid { grid-template-columns: 1fr; }
}
