/* PPWR Compliance Suite — Stylesheet ohne externe Abhaengigkeiten. */

:root {
  --bg: #f4f6f7;
  --bg-alt: #eceff1;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --fg: #15181d;
  --fg-muted: #5b636f;
  --fg-subtle: #868e9b;
  --line: #dfe4e9;
  --line-strong: #c6ced7;
  --accent: #0d5c52;
  --accent-fg: #ffffff;
  --accent-soft: #e4f2ef;
  --accent-hover: #0a4a42;
  --blocker: #b3261e;
  --blocker-soft: #fbeceb;
  --warning: #9a6100;
  --warning-soft: #fdf3e2;
  --info: #1f5b8f;
  --info-soft: #eaf2fa;
  --ok: #1c6b3f;
  --ok-soft: #e8f5ec;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --sidebar-w: 248px;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
}

:root[data-theme="dark"], html:not([data-theme="light"]) {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151a;
    --bg-alt: #171b21;
    --surface: #1b1f26;
    --surface-2: #21262e;
    --fg: #e6e9ee;
    --fg-muted: #a0a8b5;
    --fg-subtle: #7b8493;
    --line: #2b313a;
    --line-strong: #3b434e;
    --accent: #4fbfa8;
    --accent-fg: #06231f;
    --accent-soft: #16302c;
    --accent-hover: #63d2ba;
    --blocker: #f2867c;
    --blocker-soft: #331d1b;
    --warning: #e0aa4f;
    --warning-soft: #33291a;
    --info: #7fb6e6;
    --info-soft: #1a2836;
    --ok: #63c78d;
    --ok-soft: #17301f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #12151a;
  --bg-alt: #171b21;
  --surface: #1b1f26;
  --surface-2: #21262e;
  --fg: #e6e9ee;
  --fg-muted: #a0a8b5;
  --fg-subtle: #7b8493;
  --line: #2b313a;
  --line-strong: #3b434e;
  --accent: #4fbfa8;
  --accent-fg: #06231f;
  --accent-soft: #16302c;
  --accent-hover: #63d2ba;
  --blocker: #f2867c;
  --blocker-soft: #331d1b;
  --warning: #e0aa4f;
  --warning-soft: #33291a;
  --info: #7fb6e6;
  --info-soft: #1a2836;
  --ok: #63c78d;
  --ok-soft: #17301f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Das hidden-Attribut muss auch Elemente mit explizitem display ausschalten
   (.modal-backdrop nutzt display:grid, .shell display:flex). */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

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

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }

/* ───────────────────────── Anmeldung ───────────────────────── */

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--bg) 0%, var(--bg-alt) 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-brand { display: flex; gap: 14px; align-items: flex-start; color: var(--accent); margin-bottom: 8px; }
.login-brand h1 { font-size: 1.15rem; color: var(--fg); }
.login-brand p { margin: 4px 0 0; font-size: .8rem; color: var(--fg-muted); }
.login-hint { font-size: .78rem; color: var(--fg-subtle); margin: 4px 0 0; line-height: 1.7; }

/* ───────────────────────── Grundlayout ───────────────────────── */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  color: var(--accent);
  font-weight: 650;
  letter-spacing: -.01em;
  border-bottom: 1px solid var(--line);
}
.sidebar-brand span { color: var(--fg); font-size: .98rem; }

.nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-group { margin: 14px 0 6px; padding: 0 10px; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--fg-subtle); font-weight: 650; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--fg-muted); font-size: .875rem; cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--surface-2); color: var(--fg); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; flex: 0 0 18px; opacity: .85; }
.nav-item .badge { margin-left: auto; }

.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.ruleset { font-size: .7rem; color: var(--fg-subtle); line-height: 1.5; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.crumbs { flex: 1; min-width: 0; font-size: .9rem; color: var(--fg-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs strong { color: var(--fg); font-weight: 600; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.nav-toggle { display: none; }

.view { padding: 24px; max-width: 1500px; width: 100%; }

.usermenu { position: relative; }
.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); min-width: 230px; padding: 6px; z-index: 40;
}
.usermenu-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.usermenu-head strong { display: block; font-size: .875rem; }
.usermenu-head span { font-size: .76rem; color: var(--fg-muted); }
.usermenu-item {
  display: block; width: 100%; text-align: left; padding: 8px 12px;
  background: none; border: none; border-radius: var(--radius-sm);
  color: var(--fg); font-size: .85rem; cursor: pointer; font-family: inherit;
}
.usermenu-item:hover { background: var(--surface-2); text-decoration: none; }

/* ───────────────────────── Bausteine ───────────────────────── */

.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 1.35rem; }
.page-head .sub { margin: 5px 0 0; color: var(--fg-muted); font-size: .875rem; max-width: 80ch; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-head h2 { font-size: .95rem; }
.card-head h3 { font-size: .875rem; }
.card-head .article-ref { font-size: .72rem; color: var(--accent); background: var(--accent-soft);
  padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }
.card-note { padding: 12px 18px; background: var(--surface-2); border-top: 1px solid var(--line);
  font-size: .8rem; color: var(--fg-muted); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* Kennzahlen */
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--fg-subtle); font-weight: 650; }
.kpi .value { font-size: 1.7rem; font-weight: 650; margin: 6px 0 2px; letter-spacing: -.02em; }
.kpi .hint { font-size: .78rem; color: var(--fg-muted); }
.kpi.blocker .value { color: var(--blocker); }
.kpi.warning .value { color: var(--warning); }
.kpi.ok .value { color: var(--ok); }
.kpi.accent .value { color: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg);
  font: inherit; font-size: .85rem; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--fg-subtle); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--blocker); border-color: var(--blocker); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: none; border-color: transparent; color: var(--fg-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--fg); }
.btn-icon { padding: 6px 9px; }
.btn-sm { padding: 4px 10px; font-size: .78rem; }
.btn-block { width: 100%; }

/* Formulare */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field > span, .field > label { font-size: .8rem; font-weight: 600; color: var(--fg-muted); }
.field .help { font-size: .74rem; color: var(--fg-subtle); font-weight: 400; line-height: 1.45; }
.field .article-hint { font-size: .72rem; color: var(--accent); font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; padding: 7px 10px; font: inherit; font-size: .875rem;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
textarea { min-height: 86px; resize: vertical; line-height: 1.5; font-family: inherit; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; }
select[multiple] { min-height: 120px; }
.check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 10px; font-size: .85rem; }
.check input { margin-top: 2px; flex: 0 0 auto; }
.check span { font-weight: 500; }
.check .help { display: block; font-size: .74rem; color: var(--fg-subtle); font-weight: 400; margin-top: 2px; }
.form-grid { display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-grid.wide { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.form-actions { display: flex; gap: 8px; padding-top: 6px; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 18px; }
legend { font-size: .8rem; font-weight: 650; color: var(--accent); padding: 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border: 1px solid var(--line-strong); border-radius: 999px; font-size: .78rem; cursor: pointer;
  background: var(--surface);
}
.chip-check input { display: none; }
.chip-check:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip-check.disallowed:has(input:checked) { background: var(--blocker-soft); border-color: var(--blocker); color: var(--blocker); }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  text-align: left; padding: 9px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); font-size: .74rem; text-transform: uppercase;
  letter-spacing: .05em; color: var(--fg-subtle); font-weight: 650; white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--fg); }
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }
.table-empty { padding: 40px 20px; text-align: center; color: var(--fg-subtle); font-size: .875rem; }

/* Abzeichen */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 999px; font-size: .72rem; font-weight: 650; white-space: nowrap;
  background: var(--surface-2); color: var(--fg-muted); border: 1px solid var(--line);
}
.badge.blocker { background: var(--blocker-soft); color: var(--blocker); border-color: transparent; }
.badge.warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-grade { font-family: var(--mono); font-weight: 700; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.blocker { background: var(--blocker); }
.dot.warning { background: var(--warning); }
.dot.ok { background: var(--ok); }
.dot.info { background: var(--info); }
.dot.muted { background: var(--fg-subtle); }

/* Meldungen */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: .84rem; margin-bottom: 14px;
  border: 1px solid transparent; line-height: 1.55; }
.alert-error { background: var(--blocker-soft); color: var(--blocker); }
.alert-warning { background: var(--warning-soft); color: var(--warning); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert strong { font-weight: 650; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }

/* Definitionslisten */
dl.kv { display: grid; grid-template-columns: minmax(140px, 34%) 1fr; gap: 7px 16px; margin: 0; }
dl.kv dt { color: var(--fg-muted); font-size: .8rem; }
dl.kv dd { margin: 0; font-size: .875rem; word-break: break-word; }

/* Reiter */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line);
  margin-bottom: 20px; padding-bottom: 0; }
.tab {
  padding: 9px 14px; border: none; background: none; cursor: pointer;
  font: inherit; font-size: .85rem; color: var(--fg-muted); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab .badge { margin-left: 6px; }

/* Fortschritt */
.progress { height: 7px; background: var(--bg-alt); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.progress.blocker > i { background: var(--blocker); }
.progress.warning > i { background: var(--warning); }
.progress.ok > i { background: var(--ok); }

/* Befunde */
.finding { border: 1px solid var(--line); border-left: 3px solid var(--fg-subtle);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.finding.blocker { border-left-color: var(--blocker); background: var(--blocker-soft); }
.finding.warning { border-left-color: var(--warning); background: var(--warning-soft); }
.finding.info { border-left-color: var(--info); background: var(--info-soft); }
.finding.ok { border-left-color: var(--ok); }
.finding-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.finding-head h4 { font-size: .875rem; }
.finding-body { font-size: .82rem; color: var(--fg-muted); margin-top: 6px; line-height: 1.55; }
.finding-body p { margin: 4px 0; }
.finding-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: .74rem;
  color: var(--fg-subtle); margin-top: 8px; }
.finding-actions { margin-top: 9px; display: flex; gap: 6px; }

/* Roadmap */
.roadmap { display: flex; gap: 0; overflow-x: auto; padding: 6px 0 2px; }
.roadmap-stop { flex: 1 0 130px; text-align: center; padding: 0 6px; position: relative; }
.roadmap-stop::before { content: ''; position: absolute; top: 15px; left: 0; right: 0;
  height: 2px; background: var(--line); z-index: 0; }
.roadmap-stop:first-child::before { left: 50%; }
.roadmap-stop:last-child::before { right: 50%; }
.roadmap-dot { width: 30px; height: 30px; border-radius: 50%; margin: 0 auto 8px;
  display: grid; place-items: center; font-size: .78rem; font-weight: 700; position: relative; z-index: 1;
  border: 2px solid var(--surface); }
.roadmap-dot.ok { background: var(--ok-soft); color: var(--ok); box-shadow: 0 0 0 2px var(--ok); }
.roadmap-dot.bad { background: var(--blocker-soft); color: var(--blocker); box-shadow: 0 0 0 2px var(--blocker); }
.roadmap-date { font-size: .74rem; font-family: var(--mono); color: var(--fg-muted); }
.roadmap-label { font-size: .7rem; color: var(--fg-subtle); margin-top: 3px; line-height: 1.35; }

/* Balken */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 30%) 1fr auto; gap: 12px;
  align-items: center; font-size: .82rem; }
.bar-track { height: 18px; background: var(--bg-alt); border-radius: var(--radius-sm); overflow: hidden;
  display: flex; }
.bar-track > i { display: block; height: 100%; }
.bar-track > i.blocker { background: var(--blocker); }
.bar-track > i.warning { background: var(--warning); }
.bar-track > i.accent { background: var(--accent); }
.bar-value { font-variant-numeric: tabular-nums; color: var(--fg-muted); min-width: 46px; text-align: right; }

/* Dokumente */
.doc-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
.doc-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--surface); display: flex; flex-direction: column; }
.doc-thumb { height: 130px; background: var(--bg-alt); display: grid; place-items: center;
  overflow: hidden; position: relative; }
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb .ext { font-family: var(--mono); font-size: 1.5rem; color: var(--fg-subtle); font-weight: 700; }
.doc-info { padding: 11px 13px; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.doc-info .title { font-size: .82rem; font-weight: 600; line-height: 1.35; }
.doc-info .meta { font-size: .72rem; color: var(--fg-subtle); }
.doc-actions { padding: 9px 13px; border-top: 1px solid var(--line); display: flex; gap: 6px;
  background: var(--surface-2); }

/* Scanner */
.scanner-stage { background: #000; border-radius: var(--radius); overflow: hidden;
  position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.scanner-stage video, .scanner-stage canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.scanner-placeholder { color: #9aa1ae; font-size: .875rem; text-align: center; padding: 30px; }
.scanner-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.scan-pages { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.scan-page { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
  position: relative; background: var(--bg-alt); }
.scan-page img { width: 100%; display: block; aspect-ratio: 3/4; object-fit: cover; }
.scan-page .num { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.7); color: #fff;
  font-size: .68rem; padding: 1px 6px; border-radius: 999px; }
.scan-page .rm { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.7); color: #fff;
  border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: .7rem; }
.slider-row { display: grid; grid-template-columns: 100px 1fr 44px; gap: 10px; align-items: center;
  font-size: .8rem; margin-bottom: 8px; }
.slider-row input[type="range"] { width: 100%; accent-color: var(--accent); }

.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 34px 20px;
  text-align: center; color: var(--fg-muted); font-size: .875rem; cursor: pointer; background: var(--surface-2); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Filterleiste */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin-bottom: 0; min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 220px; }

/* Seitenweise */
.pager { display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-top: 1px solid var(--line); font-size: .82rem; color: var(--fg-muted); }
.pager .spacer { flex: 1; }

/* Toasts */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column;
  gap: 9px; z-index: 100; max-width: min(430px, calc(100vw - 36px)); }
.toast { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 11px 14px; font-size: .84rem;
  animation: slide-in .18s ease-out; }
.toast.error { border-left-color: var(--blocker); }
.toast.warn { border-left-color: var(--warning); }
.toast.ok { border-left-color: var(--ok); }
.toast strong { display: block; margin-bottom: 2px; }
@keyframes slide-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 14, 20, .55);
  display: grid; place-items: center; padding: 20px; z-index: 90; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 720px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { max-width: 1000px; }
.modal-head { padding: 15px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; }
.modal-head h2 { flex: 1; font-size: 1rem; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* Ladebalken */
.loading-bar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 200;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 40% 100%; background-repeat: no-repeat;
  animation: loading 1s linear infinite; }
@keyframes loading { 0% { background-position: -40% 0; } 100% { background-position: 140% 0; } }

/* Hilfsklassen */
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); }
.small { font-size: .8rem; }
.tiny { font-size: .74rem; }
.strong { font-weight: 650; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.mt-sm { margin-top: 8px; }
.mb { margin-bottom: 14px; }
.mb0 { margin-bottom: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.pre-wrap { white-space: pre-wrap; }
.scroll-y { max-height: 420px; overflow-y: auto; }
.ocr-text { font-family: var(--mono); font-size: .76rem; white-space: pre-wrap;
  background: var(--surface-2); padding: 12px; border-radius: var(--radius-sm);
  max-height: 320px; overflow-y: auto; line-height: 1.5; }

/* Schmale Bildschirme */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .nav-toggle { display: inline-flex; }
  .view { padding: 16px; }
  dl.kv { grid-template-columns: 1fr; gap: 2px 0; }
  dl.kv dd { margin-bottom: 8px; }
}

@media print {
  .sidebar, .topbar, .toasts, .loading-bar, .page-head .actions, .card-head .actions { display: none !important; }
  .view { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
}
