/* Oberfläche: Rahmen, Seitenleiste, Komponenten, Dialoge, Schublade, Suchpalette. Wird nach style.css geladen und überschreibt dessen Werte.
   Nur Gestaltung, keine Markenbestandteile. Farben: neutrale Flächen, grüner Akzent. Hell und Dunkel über dieselben Token. */

/* ---------- Token ---------- */
:root {
  --bg: #f5f6f8; --panel: #ffffff; --ink: #1a2227; --muted: #5f6b73; --faint: #8a949b; --line: #e2e6ea; --line-soft: #edf0f2;
  --hover: #f0f2f4; --nav-on: #e8ecef; --brand-soft: #e4f2ed; --side: var(--bg); --side-ink: var(--muted);
  --r-btn: 10px; --r-card: 12px; --r-field: 8px; --shadow-pop: 0 10px 30px rgba(15, 25, 30, .18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1016; --panel: #131920; --ink: #e3e9ee; --muted: #a4acb4; --faint: #80878f; --line: #252c35; --line-soft: #1c222a;
    --hover: #1e252d; --nav-on: #131920; --brand-soft: #173a31; --side: #0b1016; --side-ink: #a4acb4; --shadow-pop: 0 12px 34px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="dark"] {
  --bg: #0b1016; --panel: #131920; --ink: #e3e9ee; --muted: #a4acb4; --faint: #80878f; --line: #252c35; --line-soft: #1c222a;
  --hover: #1e252d; --nav-on: #131920; --brand-soft: #173a31; --side: #0b1016; --side-ink: #a4acb4; --shadow-pop: 0 12px 34px rgba(0, 0, 0, .55);
}

/* ---------- Grundschrift ---------- */
body { font: 13px/1.5 Inter, system-ui, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input, select, textarea { border-radius: var(--r-field); background: var(--bg); padding: 7px 10px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
label { font-size: 12px; font-weight: 500; }
code { font-size: .92em; }

/* ---------- Rahmen und Seitenleiste ---------- */
.shell { grid-template-columns: 240px minmax(0, 1fr); }
.side { padding: 0; gap: 0; background: var(--side); color: var(--side-ink); border-right: 1px solid var(--line); height: 100vh; height: 100dvh; overflow-y: auto; overflow-x: hidden; }
.side .logo { display: flex; align-items: center; gap: 8px; padding: 14px 16px 10px; font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.side .logo .brand, .mbar .brand { color: var(--brand); width: 18px; height: 18px; }
.sb-search { display: flex; align-items: center; gap: 8px; margin: 4px 8px 10px; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--panel); color: var(--muted); font-size: 12px; cursor: pointer; text-align: left; }
.sb-search:hover { border-color: var(--faint); }
.sb-search span { flex: 1; }
.sb-search kbd, .pal-foot kbd { font-size: 11px; font-weight: 500; font-family: inherit; color: var(--faint); white-space: nowrap; }
.nav-grp { display: flex; flex-direction: column; gap: 1px; padding: 0 8px; }
.nav-gl { padding: 16px 16px 4px; font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.side .nav-i { display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 6px 8px; border-radius: var(--r-btn); color: var(--side-ink); font-size: 13px; font-weight: 400; text-decoration: none; background: none; border: 0; width: 100%; text-align: left; cursor: pointer; justify-content: flex-start; }
.side .nav-i:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
.side .nav-i.on { background: var(--nav-on); color: var(--ink); font-weight: 500; }
.side .ic { flex: none; width: 16px; height: 16px; opacity: .85; }
.nav-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-b { flex: none; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--line); color: var(--ink); font-size: 11px; font-weight: 500; line-height: 18px; text-align: center; }
.nav-b.hot { background: var(--bad-soft); color: var(--bad); }
.nav-fold .chev { margin-left: auto; transition: transform .15s; opacity: .6; }
.nav-fold.open .chev { transform: rotate(180deg); }
.nav-sub { display: none; margin: 1px 0 2px 16px; padding-left: 10px; border-left: 1px solid var(--line); flex-direction: column; gap: 1px; }
.nav-fold.open .nav-sub { display: flex; }
.side .nav-i.sub { padding-left: 10px; }
.side .nav-r { display: flex; align-items: center; gap: 8px; margin: 0 8px; padding: 5px 8px; border-radius: var(--r-btn); color: var(--side-ink); font-size: 12px; text-decoration: none; }
.side .nav-r:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
.side .nav-r.on { background: var(--nav-on); color: var(--ink); }
.nav-dot { flex: none; width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.nav-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-nr { flex: none; font: 11px ui-monospace, Consolas, monospace; color: var(--faint); }
.sb-user { margin-top: auto; position: sticky; bottom: 0; display: flex; align-items: center; gap: 4px; padding: 10px 8px; border-top: 1px solid var(--line); background: var(--side); }
.sb-me { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: var(--r-btn); color: var(--ink); text-decoration: none; }
.sb-me:hover { background: var(--hover); text-decoration: none; }
.sb-me .av { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--panel); font-size: 11px; font-weight: 600; }
.sb-me .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sb-me .who b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .who small { padding: 0; font-size: 11px; text-transform: none; letter-spacing: 0; opacity: 1; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-ic { flex: none; width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: var(--r-btn); background: none; color: var(--muted); cursor: pointer; }
.sb-ic:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.sb-ic.on { color: var(--ink); }
.mbar, .sb-backdrop { display: none; }

main { padding: 24px 32px 48px; max-width: 1480px; }
.eyebrow { font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); margin-bottom: 2px; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
h2 { font-size: 13px; font-weight: 600; }
.sub { font-size: 13px; color: var(--muted); }
.bar { align-items: flex-start; margin-bottom: 18px; }
.bar > div:last-child { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 30px; padding: 4px 12px; border-radius: var(--r-btn); font-size: 12.5px; font-weight: 500; line-height: 1.3; border: 1px solid transparent; transition: background .12s, border-color .12s; }
a.btn:hover { text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.btn.ghost:hover { background: var(--hover); filter: none; border-color: var(--faint); }
.btn:disabled { opacity: .55; cursor: default; }

/* ---------- Reiter (Unterstreichung) ---------- */
.tabs { gap: 0; margin-bottom: 14px; border-bottom: 1px solid var(--line); align-items: stretch; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 12px; margin-bottom: -1px; font-size: 13px; font-weight: 500; background: none; color: var(--muted); }
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: none; color: var(--ink); border-color: var(--ink); }
.tabs > span button { border-radius: 6px; padding: 4px 10px; margin: 4px 0; border: 0; }
.tabs > span button.on { background: var(--hover); }

/* ---------- Karten ---------- */
.card { border-radius: var(--r-card); }
.card > h2:first-child { margin: -14px -16px 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); align-items: center; font-size: 13px; }
.card > h2:first-child a { font-size: 12px; font-weight: 400; color: var(--muted); }
.card > h2:first-child a:hover { color: var(--ink); }
.card.login > h2:first-child, .card.stat > h2:first-child { margin: 0 0 10px; padding: 0; border: 0; }
.stat b { font-size: 24px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin: 2px 0; }
.stat span { font-size: 12px; }
.grid { gap: 12px; }
.row { padding: 10px 0; border-top-color: var(--line-soft); }
a.card:hover { border-color: var(--faint); text-decoration: none; }

/* ---------- Tabellen ---------- */
table { border-radius: var(--r-card); }
main table th { font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); padding: 10px 12px; border-bottom-color: var(--line); }
main table td { padding: 12px; border-bottom-color: var(--line-soft); }
tr.click:hover td { background: var(--hover); }
.bel-paper th { text-transform: none; letter-spacing: normal; }
.progress { background: var(--line); }

/* ---------- Marken ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500; line-height: 1.4; }
.pill.ok { background: var(--brand-soft); color: var(--brand); }
.pill.info { background: color-mix(in srgb, #3b82f6 16%, transparent); color: #3b82f6; }
.pill.mute { background: var(--hover); color: var(--muted); }
.badge { background: var(--bad); }

/* ---------- Leerzustand ---------- */
.empty { padding: 32px 16px; font-size: 13px; }
.empty::before { content: ''; display: block; width: 36px; height: 36px; margin: 0 auto 10px; border: 1px solid var(--line); border-radius: 50%; background: linear-gradient(var(--faint), var(--faint)) center / 12px 1.5px no-repeat, var(--bg); }

/* ---------- Dialoge ---------- */
.modal-bg { background: rgba(4, 8, 12, .55); backdrop-filter: blur(2px); }
.modal { border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: -20px -20px 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-x { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.modal-x:hover { background: var(--hover); color: var(--ink); }
.modal .actions { align-items: center; }
.modal [data-quick].btn { min-height: 0; padding: 1px 8px; font-size: 11.5px; border-radius: 999px; }
.modal-bg.drawer { display: flex; justify-content: flex-end; align-items: stretch; padding: 0; }
.modal.drawer { width: min(520px, 100%); height: 100%; max-height: none; border-radius: 0; border-width: 0 0 0 1px; padding: 0 20px 0; display: flex; flex-direction: column; }
.modal.drawer .modal-head { margin: 0 -20px 16px; position: sticky; top: 0; z-index: 1; background: var(--panel); flex: none; }
.modal.drawer .two { flex: 0 0 auto; align-content: start; }
.modal.drawer .actions { position: sticky; bottom: 0; margin: auto -20px 0; padding: 12px 20px; background: var(--panel); border-top: 1px solid var(--line); flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .modal-bg { animation: ob-fade .12s ease-out; }
  .modal-bg:not(.drawer) .modal { animation: ob-pop .14s ease-out; }
  .modal-bg.drawer .modal { animation: ob-slide .18s ease-out; }
  @keyframes ob-fade { from { opacity: 0; } }
  @keyframes ob-pop { from { opacity: 0; transform: translateY(6px) scale(.99); } }
  @keyframes ob-slide { from { transform: translateX(32px); opacity: .6; } }
}

/* ---------- Menüs (Popover) ---------- */
.pu-menulist, .bel-menu > div, .rte-menu { border-radius: var(--r-field); box-shadow: var(--shadow-pop); }
.pu-menulist > button:hover:not([disabled]), .pu-menulist > a:hover, .bel-menu button:hover { background: var(--hover); }

/* ---------- Suchpalette ---------- */
.pal-bg { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: 14vh 16px 16px; background: rgba(4, 8, 12, .5); backdrop-filter: blur(3px); }
.pal { width: min(560px, 100%); display: flex; flex-direction: column; max-height: 70vh; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); overflow: hidden; }
.pal-in { width: 100%; margin: 0; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-size: 15px; }
.pal-in:focus-visible { box-shadow: none; outline: 0; }
.pal-list { overflow-y: auto; padding: 6px; }
.pal-g { padding: 10px 10px 4px; font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.pal-i { display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: var(--r-field); cursor: pointer; }
.pal-i.on { background: var(--hover); }
.pal-l { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.pal-s { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }
.pal-msg { padding: 18px 12px; text-align: center; color: var(--muted); }
.pal-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--faint); }

/* ---------- Handy: Seitenleiste als Überlagerung ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .mbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: 0; z-index: 30; height: 48px; padding: 0 8px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .mbar-t { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; }
  .side { position: fixed; top: 0; bottom: 0; left: 0; width: min(280px, 85vw); height: 100vh; height: 100dvh; flex-direction: column; flex-wrap: nowrap; z-index: 41; transform: translateX(-102%); transition: transform .18s ease-out; box-shadow: var(--shadow-pop); }
  .nav-open .side { transform: none; }
  .nav-open .sb-backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(4, 8, 12, .5); }
  main { padding: 16px 16px 40px; }
  .bar { flex-wrap: wrap; }
  .modal.drawer { width: 100%; }
  .modal .two, .modal.drawer .two { grid-template-columns: 1fr; }
  .pal-bg { padding-top: 8vh; }
  .pal-foot { display: none; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tabs button { white-space: nowrap; }
  main > table, .card > table { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
@media print { .mbar, .sb-backdrop, .pal-bg { display: none !important; } }
