/* ============================================================
   Moddy · Apps — Portal-Design „Mitternacht & Enzian"
   Kühle, technische Blau-Grau-Palette, hell/dunkel über Tokens.
   Schrift: Schibsted Grotesk (variabel, lokal gehostet).
   ============================================================ */

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("../fonts/schibsted-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Design-Tokens ---------- */
:root {
  color-scheme: light dark; /* native Controls (Checkboxen, Selects, Scrollbars) folgen dem Theme */
  --bg: #f2f4f8;
  --bg-grad: linear-gradient(180deg, rgba(42, 85, 201, 0.05), rgba(42, 85, 201, 0) 320px);
  --surface: #ffffff;
  --surface-2: #eceff5;
  --border: #d9dfe9;
  --border-input: #7e8b9d;  /* Eingabefeld-Kontur: 3.46:1 vs. Panel-Weiß, 3.01:1 vs. Füllung (WCAG 1.4.11) */
  --text: #16202e;
  --muted: #5a6879;
  --accent: #2a55c9;        /* Enzianblau */
  --accent-deep: #1e409c;   /* Hover/aktiv */
  --accent-ink: #ffffff;    /* Text auf Akzentflächen */
  --accent-2: #0e7490;      /* Stahl-Cyan: privat/Schlüssel */
  --accent-weak: #e7edfb;
  --up: #107a44;            /* dunkel genug für Text auf Weiß/-bg (>=4.5:1) */
  --down: #cc3a31;
  --warn: #b97509;
  --ring: rgba(42, 85, 201, 0.25);
  --shadow: 0 1px 2px rgba(22, 32, 46, 0.05), 0 8px 24px rgba(22, 32, 46, 0.06);
  --shadow-lg: 0 24px 60px rgba(22, 32, 46, 0.18);
  --radius: 14px;
  --nav-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1118;
    --bg-grad: linear-gradient(180deg, rgba(127, 163, 255, 0.06), rgba(127, 163, 255, 0) 360px);
    --surface: #141b25;
    --surface-2: #1a2330;
    --border: #293544;
    --border-input: #5d7089; /* 3.42:1 vs. Panel, 3.12:1 vs. Füllung */
    --text: #e6ebf2;
    --muted: #92a0b2;
    --accent: #7fa3ff;
    --accent-deep: #9db9ff;
    --accent-ink: #0b1220;
    --accent-2: #3ec1dc;
    --accent-weak: #1d2a44;
    --up: #41ce85;
    --down: #f3705f;
    --warn: #e5a43b;
    --ring: rgba(127, 163, 255, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.6);
  }
}

/* ---------- Basis ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 0.4em; font-weight: 700; text-wrap: balance; }
h1 { font-weight: 750; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px;
}
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow);
}
.skip-link:focus { left: 8px; }

.container {
  max-width: 1180px; margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

/* Inline-SVG-Icons (currentColor) */
.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; vertical-align: -2px; }

/* ---------- Top-Navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface); /* Fallback für Browser ohne color-mix */
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px); /* iOS: nicht unter die Statusleiste rutschen */
}
.nav-inner { display: flex; align-items: center; gap: 14px; height: var(--nav-h); }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.12rem; letter-spacing: -0.02em; color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .logo { display: inline-flex; }
.brand .logo svg { width: 27px; height: 27px; display: block; }
.brand .dot { color: var(--accent); font-weight: 800; }
.brand-name { white-space: nowrap; }
.nav-spacer { flex: 1; }
.nav-actions { display: flex; align-items: center; gap: 8px; }
.nav-logout-form { display: flex; margin: 0; }
.nav .who {
  color: var(--muted); font-size: 0.85rem; max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-toggle { display: none; }
.nav .btn-ghost { border-color: transparent; }
.nav .btn-ghost:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.nav-toggle .icon { width: 22px; height: 22px; }
#vaultToggle .icon-unlock { display: none; }
#vaultToggle.unlocked .icon-lock { display: none; }
#vaultToggle.unlocked .icon-unlock { display: inline-block; }
#vaultToggle.unlocked { color: var(--up); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font: inherit; font-weight: 600; font-size: 0.9rem;
  padding: 9px 15px; min-height: 38px; border-radius: 11px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s, color 0.15s;
  text-decoration: none; white-space: nowrap;
}
.btn .icon { width: 16px; height: 16px; }
.btn:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 35%, var(--border)); background: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--down) 10%, transparent); border-color: var(--down); }
.btn-sm { padding: 6px 11px; min-height: 32px; font-size: 0.83rem; border-radius: 9px; }
.btn-icon { padding: 8px 10px; }

/* ---------- Hero ---------- */
.hero { padding: 38px 0 10px; }
.hero h1 { font-size: clamp(1.65rem, 3.4vw, 2.45rem); font-weight: 800; margin-bottom: 0.25em; }
.hero .accent { color: var(--accent); }
.hero p { color: var(--muted); font-size: 1.02rem; margin: 0; max-width: 62ch; }
.stat-chips { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 7px 14px; font-size: 0.85rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chip b { color: var(--text); }
.chip .icon { width: 15px; height: 15px; color: var(--accent); }

/* ---------- Toolbar (Suche + Filter) ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 22px 0 6px; }
.search {
  flex: 1; min-width: 220px; display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border-input); border-radius: 12px; padding: 0 13px;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.search .icon { color: var(--muted); }
.search input { border: none; background: transparent; color: var(--text); font: inherit; font-size: 1rem; padding: 11px 0; width: 100%; outline: none; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  padding: 8px 13px; min-height: 36px; border-radius: 10px; font: inherit; font-size: 0.84rem; cursor: pointer; font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.filter:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter.active { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.filter .led { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.filter .led.up { background: var(--up); }
.filter .led.down { background: var(--down); }
.filter.active .led.up, .filter.active .led.down { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-ink) 35%, transparent); }

/* ---------- Layout mit Login-Aside ---------- */
.layout { display: grid; grid-template-columns: 1fr; gap: 26px; align-items: start; }
.layout.with-aside { grid-template-columns: 1fr; }
/* Auf Smartphone/Tablet zuerst anmelden, nicht erst unter dem gesamten App-Katalog. */
@media (max-width: 939px) {
  .layout.with-aside > aside { grid-row: 1; }
}
@media (min-width: 940px) {
  .layout.with-aside { grid-template-columns: minmax(0, 1fr) 340px; }
}

/* ---------- Kategorien + App-Karten ---------- */
.cat { margin-top: 28px; }
.cat-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.cat-head h2 { font-size: 0.86rem; margin: 0; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 700; }
.cat-head .count { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.cat-rule { flex: 1; height: 1px; background: var(--border); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(255px, 100%), 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px;
  transition: transform 0.12s ease, box-shadow 0.18s ease, border-color 0.18s;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.card-top { display: flex; align-items: flex-start; gap: 12px; }
.card-title { min-width: 0; }
.app-icon {
  width: 46px; height: 46px; flex: none; border-radius: 12px;
  display: grid; place-items: center; font-size: 1.45rem;
  background: var(--surface-2); border: 1px solid var(--border);
}
.card h3 { font-size: 1rem; margin: 0 0 2px; }
.card .desc { color: var(--muted); font-size: 0.85rem; margin: 0; min-height: 2.3em; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.status .led { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status.up .led { background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 20%, transparent); }
.status.down .led { background: var(--down); box-shadow: 0 0 0 3px color-mix(in srgb, var(--down) 20%, transparent); }
.status.unknown .led { background: var(--warn); }
.tag { font-size: 0.72rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.tag.lock { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border)); }
.card-actions { display: flex; gap: 8px; margin-top: auto; }
.card-actions .btn:first-child { flex: 1; }

/* ---------- Panels + Formulare ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.panel h2 { font-size: 1.12rem; display: flex; align-items: center; gap: 9px; }
.panel h2 .icon { color: var(--accent); }
.panel .muted { color: var(--muted); font-size: 0.89rem; }
.muted { color: var(--muted); }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; font-size: 0.86rem; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 5px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border-input);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 1rem; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); background: var(--surface);
}
.field .err { color: var(--down); font-size: 0.79rem; margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.87rem; color: var(--muted); }
.check input { width: auto; accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); }
.form-actions { margin-top: 8px; }
.form-actions .btn { width: 100%; }

/* ---------- Auth-Einzelseiten ---------- */
.auth-wrap { max-width: 420px; margin: 6vh auto; }
.auth-wrap .panel { padding: 28px; }
.auth-wrap .back { display: inline-block; margin-bottom: 14px; color: var(--muted); font-size: 0.85rem; }
.back { color: var(--muted); }
.back::before { content: "‹ " / ""; }

/* ---------- Flash-Meldungen ---------- */
.flashes {
  position: fixed; top: calc(var(--nav-h) + 12px + env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right)); z-index: 60;
  display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 32px));
}
.flash {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--muted);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-lg); font-size: 0.88rem;
  display: flex; gap: 10px; align-items: flex-start; animation: slidein 0.2s ease;
}
.flash.success { border-left-color: var(--up); }
.flash.error { border-left-color: var(--down); }
.flash.warning { border-left-color: var(--warn); }
.flash.info { border-left-color: var(--accent); }
.flash .x { margin-left: auto; cursor: pointer; color: var(--muted); border: none; background: none; font-size: 1rem; padding: 6px 8px; margin-top: -6px; margin-right: -6px; border-radius: 8px; }
.flash .x:hover { background: var(--surface-2); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(8, 12, 20, 0.55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  z-index: 80; display: grid; place-items: center; padding: 18px;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
}
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; max-height: 88vh; max-height: 88dvh; overflow: auto;
}
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h3 { margin: 0; font-size: 1.05rem; }
.modal-head .x { margin-left: auto; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); padding: 6px 12px; border-radius: 8px; }
.modal-head .x:hover { background: var(--surface-2); }
.modal-body { padding: 20px; }
.hidden { display: none !important; }

/* ---------- Tresor: Zugangsdaten-Zeilen ---------- */
.cred-list { display: flex; flex-direction: column; gap: 10px; }
.cred {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; gap: 10px; align-items: center;
  background: var(--surface-2); font: inherit; color: var(--text); text-align: left; width: 100%;
}
button.cred, label.cred { cursor: pointer; }
button.cred:hover, label.cred:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.cred .info { display: block; min-width: 0; }
.cred .info .lbl { display: block; font-weight: 700; font-size: 0.9rem; }
.cred .info .usr { display: block; color: var(--muted); font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cred .ops { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.recovery-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.02rem;
  background: var(--surface-2); border: 1px dashed var(--accent); border-radius: 10px;
  padding: 14px; text-align: center; letter-spacing: 0.06em; word-break: break-all;
}
.backup-codes {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95rem;
  margin: 14px 0; padding: 0; list-style: none; user-select: all;
}
.backup-codes li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; text-align: center; letter-spacing: 0.05em; }
.env-block {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86rem;
  background: var(--surface-2); border: 1px dashed var(--accent); border-radius: 10px;
  padding: 14px; margin: 12px 0; overflow-x: auto; user-select: all; line-height: 1.7;
}

/* ---------- Tabellen (Admin) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 640px; }
.tbl th, .tbl td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 700; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.07em; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
/* Die Aktionszelle bleibt eine ECHTE Tabellenzelle. `display: flex` auf einem <td> nimmt sie
   aus dem Tabellenlayout: sie waechst dann nicht mehr mit der Zeilenhoehe, und ihr unterer
   Rahmen sitzt oberhalb der Zeilentrennlinie. Sichtbar wurde das, sobald eine andere Zelle
   derselben Zeile mehrzeilig wird (Entitlement-Spalte in admin/subscriptions). Die Knoepfe
   werden deshalb inline gesetzt, statt die Zelle selbst zum Flex-Kasten zu machen. */
.tbl td.row-actions { vertical-align: middle; }
.tbl .row-actions > form,
.tbl .row-actions > span,
.tbl .row-actions > a { display: inline-block; vertical-align: middle; margin: 2px 6px 2px 0; }
.tbl .row-actions > :last-child { margin-right: 0; }
.pill { font-size: 0.74rem; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.pill.public { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, var(--border)); }
.pill.authenticated { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.pill.restricted { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border)); }
.inline-form { display: inline; }

/* ---------- Admin ---------- */
.admin-nav { display: flex; gap: 8px; margin: 18px 0; flex-wrap: wrap; }
.admin-nav a {
  padding: 8px 14px; min-height: 36px; display: inline-flex; align-items: center; gap: 7px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 600; font-size: 0.88rem; color: var(--text);
}
.admin-nav a:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.admin-nav a.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 22px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Seiten-Gerüst ---------- */
.page { margin-top: 24px; }
.page-narrow { max-width: 820px; margin-top: 24px; }
.page-sm { max-width: 640px; margin-top: 24px; }
.form-actions-row { display: flex; gap: 10px; }
.form-actions-row .btn { flex: 1; }
.qr-wrap { text-align: center; margin: 16px 0; }
.qr-wrap img { border-radius: 12px; border: 8px solid #fff; background: #fff; box-shadow: var(--shadow); }
.error-mark { display: inline-flex; margin-bottom: 6px; }
.error-mark svg { width: 56px; height: 56px; }
.error-code { font-size: 2.6rem; margin: 0.1em 0; }
.center { text-align: center; }
footer.site { color: var(--muted); font-size: 0.82rem; text-align: center; padding: 44px 0 max(24px, env(safe-area-inset-bottom)); }
.empty { text-align: center; color: var(--muted); padding: 40px; border: 1px dashed var(--border); border-radius: 14px; }

/* ---------- Profil: Element-Listen (Passkeys, Sitzungen) ---------- */
.item-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.item-row {
  border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px;
  display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap;
}
.item-row .item-main { min-width: 0; }
.item-row .item-sub { color: var(--muted); font-size: 0.88rem; }
.this-device { color: var(--up); font-weight: 700; }

/* ---------- Passkey / WebAuthn ---------- */
.or-sep { display: flex; align-items: center; text-align: center; gap: 12px; margin: 18px 0; color: var(--muted); font-size: 0.88em; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.passkey-btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }

/* ===================== Hilfe / Anleitung ===================== */
.help-wrap { max-width: 880px; margin-top: 26px; }
.help-hero h1 { margin: 0 0 6px; }
.help-hero > .muted { max-width: 62ch; }
.help-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 6px; }
.help-toc a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; min-height: 34px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); font-size: 0.86rem; text-decoration: none; color: var(--text);
}
.help-toc a:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); text-decoration: none; }
.help-section { margin-top: 18px; scroll-margin-top: calc(var(--nav-h) + 22px + env(safe-area-inset-top, 0px)); }
.help-section h2 { margin-top: 0; scroll-margin-top: calc(var(--nav-h) + 22px + env(safe-area-inset-top, 0px)); }
.help-section h3 { margin: 22px 0 8px; scroll-margin-top: calc(var(--nav-h) + 22px + env(safe-area-inset-top, 0px)); }
.help-foot { margin: 22px 4px 8px; }

.role-badge {
  display: inline-block; vertical-align: 2px; margin-left: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.role-badge.user { background: var(--accent-weak); color: var(--accent); }
.role-badge.admin { background: var(--surface-2); background: color-mix(in srgb, var(--warn) 16%, transparent); color: #8a5606; }
@media (prefers-color-scheme: dark) {
  .role-badge.admin { color: var(--warn); }
}

.ui {
  display: inline-block; padding: 1px 8px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface-2); font-weight: 600; font-size: 0.92em; white-space: nowrap;
}

ol.steps { margin: 10px 0 4px; padding-left: 0; list-style: none; counter-reset: step; }
ol.steps > li { position: relative; padding: 0 0 12px 44px; counter-increment: step; }
ol.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -1px;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums;
}
ol.steps > li:not(:last-child)::after {
  content: ""; position: absolute; left: 13.5px; top: 30px; bottom: 2px; width: 1px;
  background: var(--border);
}

ul.plain { margin: 10px 0 4px; padding-left: 0; list-style: none; display: grid; gap: 9px; }
ul.plain > li { padding-left: 20px; position: relative; }
ul.plain > li::before { content: "›"; position: absolute; left: 4px; color: var(--accent); font-weight: 700; }

.callout {
  margin: 14px 0 4px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  background: var(--surface-2); font-size: 0.95rem;
}
.callout.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--surface-2)); }
.callout.tip { border-left-color: var(--up); background: color-mix(in srgb, var(--up) 7%, var(--surface-2)); }

details.faq { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 0; margin: 0 0 10px; }
details.faq summary {
  cursor: pointer; padding: 12px 14px; font-weight: 600; list-style: none;
  display: flex; align-items: center; gap: 10px;
}
details.faq summary::before { content: "›"; color: var(--accent); font-weight: 700; transition: transform 0.15s ease; }
details.faq[open] summary::before { transform: rotate(90deg); }
details.faq summary::-webkit-details-marker { display: none; }
details.faq > p { margin: 0; padding: 0 14px 14px 38px; color: var(--muted); }
details.faq[open] { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }

/* ============================================================
   Responsiv: Smartphone & Tablet
   ============================================================ */
@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; margin-left: auto;
    border: 1px solid var(--border); border-radius: 11px;
    background: var(--surface); color: var(--text); cursor: pointer;
  }
  .nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .nav-toggle .icon-close { display: none; }
  .nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
  .nav-toggle[aria-expanded="true"] .icon-close { display: block; }
  .nav-spacer { display: none; }
  .nav-actions {
    display: none;
    position: absolute; top: calc(var(--nav-h) + env(safe-area-inset-top, 0px)); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 6px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 12px max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
    box-shadow: var(--shadow-lg);
  }
  .nav-actions.open { display: flex; }
  .nav-actions .btn { width: 100%; min-height: 44px; font-size: 0.95rem; justify-content: flex-start; }
  .nav-logout-form { width: 100%; }
  .nav .who {
    order: -1; max-width: none; padding: 4px 2px 8px; font-size: 0.84rem;
    border-bottom: 1px solid var(--border); margin-bottom: 4px;
  }
}
@media (max-width: 640px) {
  .container { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .hero { padding: 26px 0 6px; }
  .auth-wrap { margin: 3vh auto; }
  .auth-wrap .panel { padding: 22px 18px; }
  .panel { padding: 18px 16px; }
  .flashes { left: 16px; right: 16px; max-width: none; }
  .modal-backdrop { padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); align-items: end; }
  .modal { max-height: 92dvh; border-radius: 16px 16px 12px 12px; }
  .card-actions { flex-wrap: wrap; }
  .tbl th, .tbl td { padding: 10px 11px; }
  ol.steps > li { padding-left: 40px; }
  details.faq > p { padding-left: 14px; }
}
@media (pointer: coarse) {
  .btn-sm { min-height: 44px; }
  .filter { min-height: 44px; }
  .nav-toggle { width: 44px; height: 44px; }
  .flash .x, .modal-head .x { padding: 10px 14px; }
}

/* ---------- Bewegung reduzieren ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
