/* Familienarchiv – Gestaltung
   Ruhig und modern: Inter, viel Weissraum, weiche Karten, Seitenleiste links (Handy: Leiste unten).
   Dossiers tragen Fotos; ohne Foto gibt es eine Farbfläche mit Initialen. */

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/vendor/fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  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: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/static/vendor/fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  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;
}

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --ink: #101828;
  --muted: #5d6879;
  --line: #e4e7ec;
  --primary: #4f46e5;
  --primary-ink: #ffffff;
  --danger: #c0262d;
  --ok: #138a63;
  --focus: #6d63f5;
  --family: #7c3aed;
  --supplier: #d9730d;
  --doctype: #2563eb;
  --topic: #0d9488;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 0.05);
  --shadow: 0 1px 3px rgb(16 24 40 / 0.06), 0 12px 28px -12px rgb(16 24 40 / 0.18);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 16px;
  --side-w: 248px;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark;
    --bg: #0c0f14;
    --surface: #151a22;
    --surface-2: #1d2430;
    --ink: #eef1f6;
    --muted: #97a2b3;
    --line: #262e3a;
    --primary: #8b85ff;
    --primary-ink: #0c0b24;
    --danger: #ff8d92;
    --ok: #4fd1a5;
    --focus: #a09bff;
    --family: #b79bff;
    --supplier: #f4a259;
    --doctype: #7db3ff;
    --topic: #4fd1c5;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow: 0 1px 3px rgb(0 0 0 / 0.45), 0 16px 32px -14px rgb(0 0 0 / 0.7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark;
    --bg: #0c0f14;
    --surface: #151a22;
    --surface-2: #1d2430;
    --ink: #eef1f6;
    --muted: #97a2b3;
    --line: #262e3a;
    --primary: #8b85ff;
    --primary-ink: #0c0b24;
    --danger: #ff8d92;
    --ok: #4fd1a5;
    --focus: #a09bff;
    --family: #b79bff;
    --supplier: #f4a259;
    --doctype: #7db3ff;
    --topic: #4fd1c5;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow: 0 1px 3px rgb(0 0 0 / 0.45), 0 16px 32px -14px rgb(0 0 0 / 0.7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15.5px/1.55 var(--sans); font-feature-settings: "cv11", "ss03"; letter-spacing: -0.005em;
  min-height: 100vh; -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-underline-offset: 3px; }
h1, h2, h3 { font-weight: 650; line-height: 1.2; margin: 0; letter-spacing: -0.02em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
kbd { font: 600 0.72rem var(--sans); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--muted); background: var(--surface-2); }
code { font-size: 0.9em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.big { width: 44px; height: 44px; stroke-width: 1.4; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* ---------- Navigation: Seitenleiste (Desktop) / untere Leiste (Handy) ---------- */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30;
  display: flex; flex-direction: column; gap: 16px; padding: 18px 14px;
  background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.02em; padding: 2px 6px; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff; overflow: hidden; box-shadow: 0 4px 10px -3px rgb(79 70 229 / 0.55); }
.brand-mark img { display: block; width: 100%; height: 100%; }
.brand-mark .ic { width: 19px; height: 19px; }
.spot-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--muted);
  font: inherit; cursor: pointer; text-align: left;
}
.spot-btn span { flex: 1; }
.spot-btn:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); color: var(--ink); }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-weight: 550;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: color-mix(in srgb, var(--primary) 11%, var(--surface)); color: var(--primary); }
.badge {
  margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 999px; text-align: center;
  background: var(--supplier); color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 22px;
}
[data-theme="dark"] .badge { color: #1a1206; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge { color: #1a1206; } }
.side-foot { margin-top: auto; display: grid; gap: 2px; }
.side-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 40px; padding: 0 12px; border: 0; border-radius: 12px;
  background: transparent; color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; text-align: left;
}
.side-btn:hover { background: var(--surface-2); color: var(--ink); }
.side-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[aria-busy="true"] > .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { [aria-busy="true"] > .ic { animation: none; } }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; height: 40px; padding: 0 10px;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; font: inherit; text-decoration: none;
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn[aria-disabled="true"] { opacity: 0.35; pointer-events: none; }
.mtop { display: none; }

main { margin-left: var(--side-w); max-width: calc(1180px + var(--side-w)); padding: 32px 36px 64px; }
body:not(.has-nav) main { margin: 0 auto; max-width: 1180px; }
main.wide { max-width: none; padding: 0; margin: 0; }

@media (max-width: 860px) {
  .side {
    inset: auto 0 0 0; width: auto; flex-direction: row; padding: 0 0 env(safe-area-inset-bottom); gap: 0;
    border-right: 0; border-top: 1px solid var(--line);
  }
  .side .brand, .side .spot-btn, .side-foot { display: none; }
  .nav { grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; gap: 0; }
  .nav a { flex-direction: column; justify-content: center; gap: 2px; height: 58px; padding: 0; border-radius: 0; font-size: 0.72rem; position: relative; }
  .nav a[aria-current="page"] { background: transparent; box-shadow: inset 0 2px 0 var(--primary); }
  .nav .nav-long { display: none; }
  .nav .badge { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; min-width: 18px; line-height: 18px; font-size: 0.68rem; padding: 0 5px; }
  .mtop { display: flex; align-items: center; gap: 4px; position: sticky; top: 0; z-index: 25; height: 54px; padding: 0 10px 0 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .mtop .brand { margin-right: auto; padding: 0; }
  main { margin-left: 0; padding: 18px 14px 88px; }
  body.docpage .mtop { display: none; }
}

/* ---------- Formularelemente ---------- */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px; min-height: 44px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent); outline-offset: 0; border-color: var(--focus); }
label, .label { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin: 0;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--primary) 70%, transparent); }
.btn.primary:hover { filter: brightness(1.08); background: var(--primary); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 0.8125rem; border-radius: 10px; }
.btn.small .ic { width: 16px; height: 16px; }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn.glass { background: rgb(255 255 255 / 0.18); border-color: rgb(255 255 255 / 0.35); color: #fff; backdrop-filter: blur(8px); box-shadow: none; }
.btn.glass:hover { background: rgb(255 255 255 / 0.3); }
.link { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; font: inherit; text-decoration: underline; }

/* ---------- Labels ---------- */
.chip {
  --c: var(--muted);
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 2px 11px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; line-height: 1.65;
  color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 26%, transparent); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip[data-kind="family"] { --c: var(--family); }
.chip[data-kind="supplier"] { --c: var(--supplier); }
.chip[data-kind="doctype"] { --c: var(--doctype); }
.chip[data-kind="topic"] { --c: var(--topic); }
a.chip:hover { background: color-mix(in srgb, var(--c) 20%, var(--surface)); }
.chip.solid { background: var(--c); color: #fff; border-color: transparent; }
[data-theme="dark"] .chip.solid { color: #0c0f14; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.solid { color: #0c0f14; } }
.chip.solid:not([data-kind]) { --c: var(--ink); color: var(--bg); }
.chip button { all: unset; cursor: pointer; padding: 0 2px; font-size: 1rem; line-height: 1; opacity: 0.7; }
.chip button:hover { opacity: 1; }
.chip .n { font-weight: 500; opacity: 0.7; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Seitenköpfe ---------- */
.pagehead { margin-bottom: 24px; }
.pagehead h1 { font-size: 1.9rem; }
.pagehead p { margin: 6px 0 0; color: var(--muted); max-width: 60ch; }
.pagehead.row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.pagehead.hero { margin-bottom: 18px; }
.pagehead.hero h1 { font-size: 2.1rem; }
.crumbs { display: flex; align-items: center; gap: 8px; margin: -8px 0 14px; font-size: 0.875rem; color: var(--muted); flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 500; }
.crumbs a:hover { color: var(--primary); }
.crumbs span:last-child { color: var(--ink); font-weight: 600; }

/* ---------- Suche ---------- */
.searchbar { position: relative; margin-bottom: 14px; }
.searchbar > .ic { position: absolute; left: 18px; top: 29px; transform: translateY(-50%); color: var(--muted); width: 22px; height: 22px; pointer-events: none; }
.searchbar input[type="search"] {
  height: 58px; padding: 0 56px 0 52px; font-size: 1.0625rem; border-radius: 18px; border-color: transparent;
  box-shadow: var(--shadow); -webkit-appearance: none; appearance: none;
}
.searchbar input[type="search"]:focus { border-color: var(--focus); }
.searchbar kbd { position: absolute; right: 16px; top: 18px; }
@media (pointer: coarse) { .searchbar kbd { display: none; } }
.suggest-pop {
  position: absolute; z-index: 20; left: 0; right: 0; top: 64px; padding: 8px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto;
}
.sg-head { padding: 6px 10px 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.sg-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; cursor: pointer; }
.sg-item[aria-selected="true"], .sg-item:hover { background: var(--surface-2); }
.sg-item .sg-main { flex: 1; min-width: 0; display: grid; }
.sg-item b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-item small { color: var(--muted); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-item .sg-act { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }
.sg-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) 12%, var(--surface)); }
.sg-ico[data-kind="family"] { --c: var(--family); }
.sg-ico[data-kind="supplier"] { --c: var(--supplier); }
.sg-ico[data-kind="doctype"] { --c: var(--doctype); }
.sg-ico[data-kind="topic"] { --c: var(--topic); }
.sg-empty { padding: 18px 10px; color: var(--muted); text-align: center; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.pop-wrap { position: relative; }
.pop-wrap > summary { list-style: none; }
.pop-wrap > summary::-webkit-details-marker { display: none; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 550; font-size: 0.875rem; box-shadow: var(--shadow-sm);
}
.pill:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.pill .ic { width: 16px; height: 16px; color: var(--muted); }
.pill .caret { width: 14px; height: 14px; }
.pill.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.pill-n { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.pop-wrap[data-kind="family"] .pill .ic:first-child { color: var(--family); }
.pop-wrap[data-kind="supplier"] .pill .ic:first-child { color: var(--supplier); }
.pop-wrap[data-kind="doctype"] .pill .ic:first-child { color: var(--doctype); }
.pop-wrap[data-kind="topic"] .pill .ic:first-child { color: var(--topic); }
.pop {
  position: absolute; z-index: 15; top: 44px; left: 0; width: min(420px, 90vw); max-height: 55vh; overflow: auto; padding: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.years { display: flex; flex-wrap: wrap; gap: 6px; }
.year {
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); text-decoration: none; font-size: 0.875rem; font-variant-numeric: tabular-nums; font-weight: 500;
}
.year:hover { background: var(--surface-2); }
.year[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.selected-filters { display: contents; }
.selected-filters .chip { height: 38px; padding: 0 6px 0 14px; font-size: 0.875rem; }
.selected-filters .chip a { all: unset; cursor: pointer; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 1.1rem; line-height: 1; }
.selected-filters .chip a:hover { background: rgb(0 0 0 / 0.18); }
/* Mobil: Auswahl klappt direkt unter den Filter-Knöpfen (oben) auf, nicht am unteren Bildschirmrand */
@media (max-width: 860px) {
  .pills { position: relative; }
  .pop-wrap { position: static; }
  .pop { position: absolute; left: 0; right: 0; width: auto; top: calc(100% + 6px); max-height: 60vh; overflow: auto; z-index: 30; }
}

.resultbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; color: var(--muted); font-size: 0.875rem; }
.resultbar select { width: auto; min-height: 36px; padding: 4px 28px 4px 12px; border-radius: 10px; font-size: 0.875rem; }
.results { transition: opacity 0.15s; }
.results.loading { opacity: 0.5; }
.result {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; display: flex; gap: 16px; position: relative; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.result:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); box-shadow: var(--shadow); }
.thumb-sm {
  flex: none; width: 72px; height: 96px; border-radius: 10px; overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--line); display: grid; place-items: center; position: relative;
}
.thumb-sm::before { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / 0.5) 50%, transparent 70%); background-size: 200% 100%; animation: shimmer 1.4s infinite; opacity: 0.5; }
.thumb-sm img { position: relative; width: 100%; height: 100%; object-fit: cover; object-position: top; background: #fff; }
.thumb-sm img.failed { display: none; }
.thumb-sm.failed::before { animation: none; background: none; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .thumb-sm::before { animation: none; } }
.result-body { flex: 1; min-width: 0; display: grid; gap: 8px; align-content: start; }
.result-main { color: inherit; text-decoration: none; display: grid; gap: 4px; }
.result-main::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.result .chips { position: relative; z-index: 1; }
.result-title { font-size: 1.0625rem; overflow-wrap: anywhere; font-weight: 600; }
.result-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 0; font-size: 0.8125rem; color: var(--muted); }
.snippet { margin: 2px 0 0; color: var(--ink); opacity: 0.85; font-size: 0.875rem; overflow-wrap: anywhere; max-width: 75ch; }
mark { background: color-mix(in srgb, #fbbf24 55%, transparent); color: inherit; border-radius: 4px; padding: 0 2px; }
.tag-new, .tag-warn { font-size: 0.72rem; font-weight: 700; padding: 0 8px; border-radius: 999px; line-height: 1.7; }
.tag-new { background: color-mix(in srgb, var(--supplier) 16%, var(--surface)); color: var(--supplier); }
.tag-warn { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.yearhead { font-size: 1.1rem; margin: 26px 0 10px; color: var(--muted); font-weight: 650; display: flex; align-items: center; gap: 12px; }
.yearhead::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.yearhead:first-child { margin-top: 0; }
.empty { text-align: center; padding: 56px 16px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty h2 { color: var(--ink); margin-bottom: 8px; }
.more { display: flex; margin: 16px auto; }
.inbox-row .go { align-self: center; color: var(--muted); }
.inbox-row:hover .go { color: var(--primary); }
@media (max-width: 560px) { .thumb-sm { width: 56px; height: 76px; } .result { gap: 12px; } }

/* ---------- Dossiers ---------- */
.kindtiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.kindtile {
  --c: var(--muted); display: grid; grid-template-rows: 190px auto; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform 0.18s, box-shadow 0.18s;
}
.kindtile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
@media (prefers-reduced-motion: reduce) { .kindtile:hover, .dcard:hover { transform: none; } }
.kindtile[data-kind="family"] { --c: var(--family); }
.kindtile[data-kind="supplier"] { --c: var(--supplier); }
.kindtile[data-kind="doctype"] { --c: var(--doctype); }
.kindtile[data-kind="topic"] { --c: var(--topic); }
.kindtile-cover { display: grid; gap: 2px; place-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--c) 70%, #fff), color-mix(in srgb, var(--c) 95%, #000)); color: #fff; overflow: hidden; }
.kindtile-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kindtile-cover.n2 { grid-template-columns: 1fr 1fr; }
.kindtile-cover.n3, .kindtile-cover.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.kindtile-cover.n3 img:first-child { grid-row: span 2; }
.kindtile-cover.n1 img, .kindtile-cover.n2 img, .kindtile-cover.n3 img, .kindtile-cover.n4 img { min-height: 0; }
.kindtile-body { padding: 16px 20px 20px; display: grid; gap: 2px; }
.kindtile-body h2 { font-size: 1.35rem; }
.kindtile-body p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.kindtile-meta { margin-top: 8px; font-size: 0.8125rem; font-weight: 600; color: var(--c); }

.dcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.dcard {
  --c: var(--muted); display: grid; text-decoration: none; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-sm);
  transition: transform 0.18s, box-shadow 0.18s;
}
.dcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.dcard[data-kind="family"] { --c: var(--family); }
.dcard[data-kind="supplier"] { --c: var(--supplier); }
.dcard[data-kind="doctype"] { --c: var(--doctype); }
.dcard[data-kind="topic"] { --c: var(--topic); }
.dcard-cover, .avatar {
  aspect-ratio: 3 / 2; display: grid; place-items: center; overflow: hidden; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h, 220) 62% 58%), hsl(calc(var(--h, 220) + 40) 60% 40%));
}
.dcard-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.initials { font-size: 2.2rem; font-weight: 700; letter-spacing: 0.02em; opacity: 0.92; text-shadow: 0 2px 8px rgb(0 0 0 / 0.25); }
.dcard-body { display: grid; gap: 1px; padding: 12px 14px 14px; border-top: 3px solid var(--c); }
.dcard-body b { font-weight: 650; overflow-wrap: anywhere; }
.dcard-body span { font-size: 0.8125rem; color: var(--muted); }

.banner {
  --c: var(--primary); position: relative; display: flex; align-items: flex-end; min-height: 200px; margin-bottom: 20px;
  border-radius: 24px; overflow: hidden; color: #fff; padding: 24px 26px;
  background: linear-gradient(135deg, hsl(var(--h, 220) 62% 52%), hsl(calc(var(--h, 220) + 40) 60% 34%));
  box-shadow: var(--shadow);
}
.banner-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner-shade { position: absolute; inset: 0; background: linear-gradient(0deg, rgb(0 0 0 / 0.62), rgb(0 0 0 / 0.05) 70%); }
.banner-body { position: relative; display: grid; gap: 2px; }
.banner h1 { font-size: 2.3rem; text-shadow: 0 2px 12px rgb(0 0 0 / 0.35); overflow-wrap: anywhere; }
.banner p { margin: 0; opacity: 0.9; }
.kindtag { justify-self: start; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 10px; border-radius: 999px; background: rgb(255 255 255 / 0.22); backdrop-filter: blur(6px); margin-bottom: 6px; }
.banner-actions { position: absolute; top: 14px; right: 14px; display: flex; gap: 8px; }
@media (max-width: 560px) { .banner { min-height: 160px; padding: 18px; border-radius: 20px; } .banner h1 { font-size: 1.7rem; } }

/* ---------- Spotlight (Strg+K) ---------- */
.spot { position: fixed; inset: 0; z-index: 90; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 14px 14px; background: rgb(8 12 20 / 0.55); backdrop-filter: blur(4px); }
.spot-card { width: min(680px, 100%); max-height: 76vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.5); overflow: hidden; }
.spot-input { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 18px; border-bottom: 1px solid var(--line); }
.spot-input .ic { color: var(--muted); }
.spot-input input { border: 0; box-shadow: none; outline: 0 !important; min-height: 48px; font-size: 1.0625rem; background: transparent; padding: 0 4px; }
.spot-list { overflow: auto; padding: 8px; flex: 1; min-height: 60px; }
.spot-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; background: var(--surface-2); }
.spot-foot kbd { margin-right: 4px; }
@media (pointer: coarse) { .spot-foot { display: none; } }
@media (max-width: 860px) { .spot { padding-top: 8px; } .spot-card { max-height: 92vh; } }

/* ---------- Anmeldung ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--primary) 16%, transparent), transparent); }
.login { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 32px; box-shadow: var(--shadow); display: grid; gap: 18px; }
.login h1 { font-size: 1.5rem; display: flex; gap: 12px; align-items: center; }
.alert { padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); font-weight: 500; }
.hint { font-size: 0.8125rem; color: var(--muted); margin: 5px 0 0; }

/* ---------- Dokumentseite ---------- */
body.docpage main { padding: 0; max-width: none; margin-left: var(--side-w); }
.docview {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(460px, 42vw, 640px); grid-template-rows: auto minmax(0, 1fr);
  height: 100vh; height: 100dvh;
}
.docnav {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 14px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.docnav-back { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px 6px 6px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 550; white-space: nowrap; }
.docnav-back:hover { background: var(--surface-2); color: var(--ink); }
.docnav-title { flex: 1; min-width: 0; font-size: 1rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docnav-step { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.docnav-step .iconbtn { height: 36px; min-width: 36px; }
.docnav-step .iconbtn:hover { background: var(--surface); }
.docnav-pos { min-width: 64px; text-align: center; font-size: 0.8125rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.viewer-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #2a3238; position: relative; }
.panel { overflow: auto; background: var(--surface); border-left: 1px solid var(--line); padding: 24px; display: grid; gap: 18px; align-content: start; }
.mobile-tabs { display: none; }
@media (max-width: 860px) {
  body.docpage main { margin-left: 0; padding: 0; }
  .docview { grid-template-columns: 1fr; grid-template-rows: auto auto minmax(0, 1fr); height: calc(100dvh - 59px); }
  .docnav { height: 52px; padding: 0 6px; gap: 4px; }
  .docnav-back span { display: none; }
  .mobile-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-bottom: 1px solid var(--line); }
  .mobile-tabs button { all: unset; text-align: center; padding: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
  .mobile-tabs button[aria-selected="true"] { color: var(--primary); box-shadow: inset 0 -3px 0 var(--primary); }
  .docview[data-tab="doc"] .panel, .docview[data-tab="details"] .viewer-pane { display: none; }
  .panel { border-left: 0; }
}
@media (min-width: 861px) and (max-width: 1180px) { .docview { grid-template-columns: minmax(0, 1fr) clamp(380px, 44vw, 460px); } }
.queue { margin: 0; font-size: 0.8125rem; color: var(--supplier); font-weight: 650; }
.field { position: relative; }
.tagbox { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-height: 46px; cursor: text; }
.tagbox:focus-within { outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent); border-color: var(--focus); }
.tagbox input { border: 0; outline: 0 !important; flex: 1 1 120px; min-width: 90px; min-height: 30px; padding: 2px 6px; background: transparent; box-shadow: none; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick button.chip { cursor: pointer; font-family: inherit; }
.quick button.chip.on { background: var(--c); color: var(--surface); }
.quick .hintlabel { font-size: 0.75rem; color: var(--muted); align-self: center; }
.dropdown { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% - 2px); margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 240px; overflow: auto; }
.dropdown li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.dropdown li[aria-selected="true"], .dropdown li:hover { background: var(--surface-2); }
.dropdown .create { color: var(--primary); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions .btn.primary { flex: 1 1 auto; }
.form-msg { margin: 0; min-height: 1.4em; font-size: 0.9375rem; }
.form-msg.error { color: var(--danger); }
.form-msg.ok { color: var(--ok); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 0.8125rem; padding-top: 16px; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.suggest { font-size: 0.8125rem; }

/* ---------- PDF-Viewer ---------- */
.pdf-toolbar {
  display: flex; align-items: center; gap: 4px; padding: 6px 8px; flex-wrap: wrap;
  background: #1d2328; color: #e6ecef; border-bottom: 1px solid #000;
}
.pdf-toolbar .iconbtn { color: #cfd8dd; height: 36px; min-width: 36px; }
.pdf-toolbar .iconbtn:hover { background: #2f3940; color: #fff; }
.pdf-toolbar .iconbtn[aria-pressed="true"] { background: #36444d; color: #fff; }
.pdf-toolbar .sep { width: 1px; height: 22px; background: #3a464e; margin: 0 4px; }
.pdf-toolbar input, .pdf-toolbar select { background: #11161a; color: #e6ecef; border-color: #3a464e; min-height: 34px; padding: 3px 8px; }
.pdf-toolbar .pageinput { width: 54px; text-align: center; }
.pdf-toolbar .pagecount { color: #9fb0ba; font-size: 0.875rem; margin-right: 4px; }
.pdf-toolbar select { width: auto; }
.pdf-toolbar .spacer { flex: 1; }
.pdf-find { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: #1d2328; border-bottom: 1px solid #000; }
.pdf-find input { background: #11161a; color: #e6ecef; border-color: #3a464e; min-height: 34px; padding: 3px 10px; flex: 1; max-width: 360px; }
.pdf-find .iconbtn { color: #cfd8dd; height: 34px; }
.pdf-find .status { color: #9fb0ba; font-size: 0.8125rem; min-width: 90px; }
.pdf-find label { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px; color: #cfd8dd; font-weight: 400; white-space: nowrap; }
.pdf-find label input { width: auto; min-height: 0; }
.pdf-main { position: relative; flex: 1; min-height: 0; display: flex; }
.pdf-sidebar { width: 150px; overflow: auto; background: #1d2328; padding: 10px; display: grid; gap: 12px; align-content: start; border-right: 1px solid #000; }
.pdf-sidebar[hidden] { display: none; }
.thumb { all: unset; cursor: pointer; display: grid; gap: 4px; justify-items: center; color: #9fb0ba; font-size: 0.75rem; }
.thumb canvas { background: #fff; width: 100%; height: auto; box-shadow: 0 1px 4px rgb(0 0 0 / 0.5); outline: 2px solid transparent; }
.thumb[aria-current="true"] canvas { outline-color: #5bb4d8; }
.thumb:focus-visible canvas { outline-color: #fff; }
@media (max-width: 760px) { .pdf-sidebar { position: absolute; z-index: 5; top: 0; bottom: 0; left: 0; width: 120px; } }
#viewerContainer { position: absolute; inset: 0; overflow: auto; background: #2a3238; -webkit-overflow-scrolling: touch; }
.pdf-main .pdf-sidebar:not([hidden]) ~ #viewerContainer { left: 150px; }
@media (max-width: 760px) { .pdf-main .pdf-sidebar:not([hidden]) ~ #viewerContainer { left: 0; } }
#viewerContainer .pdfViewer { padding: 8px 0; }
.pdfViewer .page { margin: 8px auto; border: 0; box-shadow: 0 2px 10px rgb(0 0 0 / 0.45); background: #fff; }
.pdfViewer.removePageBorders .page { margin: 8px auto; }
.pdf-status { position: absolute; inset: 0; display: grid; place-items: center; color: #cfd8dd; text-align: center; padding: 20px; pointer-events: none; }
.pdf-status .box { max-width: 380px; }
.pdf-progress { position: absolute; top: 0; left: 0; height: 3px; background: #5bb4d8; width: 0; transition: width 0.2s; z-index: 3; }
:root { --pdf-find-highlight-color: rgb(255 210 60 / 0.45); }
.pdfViewer .textLayer .highlight { background-color: rgb(255 210 60 / 0.45) !important; border-radius: 2px; }
.pdfViewer .textLayer .highlight.selected { background-color: rgb(255 140 0 / 0.65) !important; }

/* ---------- Verwaltung ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.card h2 { font-size: 1.15rem; margin-bottom: 12px; }
.section-title { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 22px 0 8px; }
.stats { display: flex; flex-wrap: wrap; gap: 14px 36px; margin-bottom: 12px; }
.stat b { display: block; font-size: 1.9rem; line-height: 1.1; letter-spacing: -0.03em; }
.stat span { color: var(--muted); font-size: 0.8125rem; }
.labelrow { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.labelrow:last-child { border-bottom: 0; }
.labelrow input { flex: 1 1 160px; max-width: 260px; min-height: 36px; padding: 4px 10px; border-radius: 10px; }
.labelrow .count { margin-left: auto; color: var(--muted); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.avatar { width: 48px; aspect-ratio: 3 / 2; border-radius: 10px; font-size: 0.8rem; font-weight: 700; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.8125rem; }
.errlist { margin: 8px 0 0; padding-left: 20px; color: var(--danger); font-size: 0.9rem; }

/* ---------- Hinweise ---------- */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
@media (max-width: 860px) { .toasts { bottom: 76px; } }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); font-weight: 500; }
.toast.error { background: var(--danger); color: #fff; }
[data-theme="dark"] .toast.error { color: #2a0608; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast.error { color: #2a0608; } }
.errorpage { text-align: center; padding: 72px 16px; }
.errorpage .code { font-size: 4rem; font-weight: 700; color: var(--muted); }

/* ---------- Feinschliff ---------- */
.spot-input input[type="search"]::-webkit-search-cancel-button, .pdf-find input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
#meta-form { display: grid; gap: 18px; }
/* Auf der Dokumentseite schrumpft die Seitenleiste zur Symbolleiste – mehr Platz für das PDF */
@media (min-width: 861px) {
  body.docpage { --side-w: 68px; }
  body.docpage .side { padding: 18px 10px; align-items: center; }
  body.docpage .side .brand-name, body.docpage .nav a span:not(.badge), body.docpage .side-btn span, body.docpage .spot-btn span, body.docpage .spot-btn kbd { display: none; }
  body.docpage .brand { padding: 0; }
  body.docpage .nav a, body.docpage .side-btn, body.docpage .spot-btn { width: 44px; padding: 0; justify-content: center; position: relative; }
  body.docpage .nav .badge { position: absolute; top: 2px; right: 0; margin: 0; min-width: 18px; line-height: 18px; font-size: 0.68rem; padding: 0 5px; }
  body.docpage .side-foot { justify-items: center; }
}
@media (max-width: 560px) {
  .dcards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .initials { font-size: 1.7rem; }
  .pdf-toolbar #btn-rotate, .pdf-toolbar #btn-print, .pdf-toolbar #btn-fullscreen, .pdf-toolbar .sep { display: none; }
}

/* ---------- Gruppierung nach Jahr/Monat, Zusammenfassung ---------- */
.monthhead { margin: 16px 0 8px; font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.yearhead + .monthhead { margin-top: 4px; }
.summary { margin: 0; color: var(--muted); font-size: 0.875rem; max-width: 80ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.snippet { font-size: 0.8125rem; }

/* ---------- Benutzerverwaltung, Dialoge, Darstellung ---------- */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.card-head h2 { margin: 0; }
.userlist { display: grid; margin-top: 8px; }
.userrow { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.userrow:last-child { border-bottom: 0; }
.userrow.disabled .userinfo { opacity: 0.6; }
.userinfo { flex: 1 1 260px; min-width: 0; display: grid; gap: 2px; }
.userinfo small { color: var(--muted); font-size: 0.8125rem; }
.userbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar.round { width: 44px; height: 44px; aspect-ratio: auto; border-radius: 50%; font-size: 0.9rem; }
.dlg { width: min(460px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgb(0 0 0 / 0.5); }
.dlg::backdrop { background: rgb(8 12 20 / 0.55); backdrop-filter: blur(4px); }
.dlg h2 { font-size: 1.2rem; margin-bottom: 8px; }
.dlg form, .dlg > div { display: grid; gap: 14px; }
.btn.danger.primary, #dlg-ok.danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: none; }
.qrbox { width: 220px; max-width: 100%; margin: 0 auto; padding: 10px; background: #fff; border-radius: 14px; }
.qrbox svg { width: 100%; height: auto; display: block; }
.secretkey { display: block; padding: 10px 12px; text-align: center; letter-spacing: 0.08em; overflow-wrap: anywhere; user-select: all; }
.codes { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: ui-monospace, monospace; }
.codes li { background: var(--surface-2); border-radius: 8px; padding: 6px 10px; text-align: center; user-select: all; }
.segmented { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.seg { border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 9px; cursor: pointer; }
.seg[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.panel input, .panel textarea { font-size: 1rem; }
.chip.suggest-chip { --c: var(--primary); cursor: pointer; font-family: inherit; max-width: 100%; }
.uname { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.amountrow { display: flex; gap: 8px; }
.amountrow select { width: auto; flex: none; }
.amountrow input { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; }
.result-meta .amount { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.resultbar .sum { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Verwaltung: einklappbare Label-Gruppen */
.labelgroup { border: 1px solid var(--line); border-radius: 14px; margin-top: 10px; background: var(--surface); }
.labelgroup > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; min-height: 52px; }
.labelgroup > summary::-webkit-details-marker { display: none; }
.labelgroup > summary b { font-size: 1rem; }
.labelgroup > summary .count { margin-left: auto; color: var(--muted); font-size: 0.8125rem; }
.labelgroup > summary .caret { transition: transform 0.15s; }
.labelgroup[open] > summary .caret { transform: rotate(180deg); }
.labelgroup[data-kind="family"] > summary b { color: var(--family); }
.labelgroup[data-kind="supplier"] > summary b { color: var(--supplier); }
.labelgroup[data-kind="doctype"] > summary b { color: var(--doctype); }
.labelgroup[data-kind="topic"] > summary b { color: var(--topic); }
.labelgroup .covers { display: flex; }
.labelgroup .covers img { width: 36px; height: 26px; object-fit: cover; border-radius: 6px; border: 2px solid var(--surface); margin-left: -8px; }
.labelgroup .covers img:first-child { margin-left: 0; }
.labelgroup-body { padding: 4px 14px 12px; border-top: 1px solid var(--line); max-height: 70vh; overflow: auto; }
.labelgroup-body .labelfilter { width: 100%; margin: 10px 0 4px; }
.labelrow[hidden] { display: none; }
.folderrow { display: flex; gap: 8px; flex-wrap: wrap; }
.folderrow input { flex: 1 1 220px; min-width: 0; }
#folder-msg.ok { color: var(--ok); }
#folder-msg.error { color: var(--danger, #c0362c); }

/* Batch Import */
.irow { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.irow:last-child { border-bottom: 0; }
.irow[hidden] { display: none; }
.irow .iname { flex: 1 1 200px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.irow input:not([type="checkbox"]) { flex: 1 1 180px; max-width: 280px; min-height: 36px; padding: 4px 10px; border-radius: 10px; }
.irow .muted { font-size: 0.8125rem; }
#import-progress { width: 100%; margin-top: 10px; }
#import-folder-msg.ok { color: var(--ok); }
#import-folder-msg.error { color: var(--danger); }

/* Startseite */
.hero { position: relative; overflow: hidden; border-radius: 24px; padding: 28px 28px 24px; margin-bottom: 20px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #6d63f5 0%, #4338ca 55%, #312e81 100%); box-shadow: 0 18px 40px -22px rgb(67 56 202 / 0.8); }
.hero-art { position: absolute; inset: 0; color: #fff; pointer-events: none; }
.hero-art svg { width: 100%; height: 100%; }
.hero-main { position: relative; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero-main .logo { flex: none; border-radius: 18px; box-shadow: 0 10px 24px -8px rgb(0 0 0 / 0.45); }
.hero h1 { margin: 2px 0 4px; font-size: clamp(1.75rem, 4.5vw, 2.6rem); line-height: 1.1; letter-spacing: -0.02em; color: #fff; }
.hero-greet { margin: 0; font-size: 0.9375rem; font-weight: 600; opacity: 0.85; }
.hero-sub { margin: 0; opacity: 0.8; max-width: 46ch; }
.hero-search { position: relative; display: flex; align-items: center; gap: 10px; margin-top: 20px; max-width: 640px; background: var(--surface); color: var(--ink); border-radius: 16px; padding: 6px 6px 6px 14px; box-shadow: 0 10px 24px -12px rgb(0 0 0 / 0.5); }
.hero-search .ic { color: var(--muted); flex: none; }
.hero-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 1rem; min-height: 44px; color: inherit; box-shadow: none; padding: 0 4px; }
.kpirow-h { margin: 0 0 8px; font-size: 0.9375rem; color: var(--muted); font-weight: 600; }
.kpirow-h small { font-weight: 400; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: inherit; text-decoration: none; box-shadow: var(--shadow-sm); }
a.kpi:hover { border-color: var(--primary); }
.kpi-ico { grid-row: span 2; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: color-mix(in srgb, var(--primary) 14%, var(--surface)); color: var(--primary); }
.kpi b { font-size: 1.5rem; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.kpi > span:last-child { color: var(--muted); font-size: 0.8125rem; }
.kpi.warn .kpi-ico { background: color-mix(in srgb, var(--supplier) 18%, var(--surface)); color: var(--supplier); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; margin-bottom: 8px; }
.dash-grid .card { margin: 0; }
.minilist { list-style: none; margin: 0; padding: 0; }
.minilist li + li { border-top: 1px solid var(--line); }
.minilist a { display: flex; align-items: center; gap: 12px; padding: 8px 4px; color: inherit; text-decoration: none; border-radius: 10px; }
.minilist a:hover { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.mini-thumb { flex: none; width: 30px; height: 40px; border-radius: 5px; overflow: hidden; background: var(--line); border: 1px solid var(--line); }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini-main { flex: 1; min-width: 0; display: grid; }
.mini-main b { font-weight: 600; font-size: 0.9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-main small, .mini-meta small { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-meta { flex: none; display: grid; justify-items: end; gap: 2px; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 190px; padding-top: 6px; }
.bar { display: grid; grid-template-rows: 16px 1fr 32px; justify-items: center; height: 100%; min-width: 0; }
.bar-fill { align-self: end; width: 100%; max-width: 28px; min-height: 3px; border-radius: 7px 7px 3px 3px; background: color-mix(in srgb, var(--primary) 45%, var(--surface)); transition: height 0.4s; }
.bar.now .bar-fill { background: var(--primary); }
.bar-n { font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-l { font-size: 0.7rem; color: var(--muted); text-align: center; line-height: 1.15; }
.bar-l small { display: block; font-size: 0.62rem; opacity: 0.8; }
.section-h { margin: 26px 0 12px; font-size: 1.125rem; }
.people { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }
.person { display: grid; gap: 12px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: inherit; text-decoration: none; box-shadow: var(--shadow-sm); align-content: start; }
.person:hover { border-color: var(--primary); }
.person-head { display: flex; align-items: center; gap: 12px; }
.person-head > div { flex: 1; min-width: 0; display: grid; }
.person-head small { color: var(--muted); }
.avatar.big { width: 48px; height: 48px; font-size: 1.05rem; }
.person-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.person-stats div { background: color-mix(in srgb, var(--primary) 6%, var(--surface)); border-radius: 12px; padding: 8px 10px; }
.person-stats dt { font-size: 0.72rem; color: var(--muted); }
.person-stats dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.person-sum { margin: 0; font-size: 0.8125rem; color: var(--muted); }
@media (max-width: 860px) {
  .kpis { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .dash-grid { grid-template-columns: 1fr; }
  .hero { padding: 20px 16px 16px; border-radius: 20px; }
  .hero-main .logo { width: 56px; height: 56px; }
  .hero-art { opacity: 0.35; }
  .kpi b { font-size: 1.25rem; white-space: nowrap; }
}
.dash-grid > .card { display: flex; flex-direction: column; }
.dash-grid .bars { flex: 1; min-height: 190px; }
#import-card .btn, #import-plan .actions { margin-top: 14px; }
#import-plan .labelgroup { margin-top: 10px; }
.card .stats { margin-top: 14px; }
.folderform { margin-top: 12px; }

/* Ordnerauswahl */
.dlg.fd { width: min(520px, calc(100% - 24px)); }
.fd-crumbs { font-size: 0.875rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.fd-list { list-style: none; margin: 0; padding: 0; max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.fd-list:empty { display: none; }
.fd-list li + li { border-top: 1px solid var(--line); }
.fd-list button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 8px 14px; background: transparent; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fd-list button:hover, .fd-list button:focus-visible { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.fd-list button span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-list .chev { color: var(--muted); }
#fd-msg.error { color: var(--danger); }

.syncprog { margin: 12px 0; }
.syncprog progress { width: 100%; height: 10px; }

.fd-list li.fd-multi { display: flex; align-items: center; }
.fd-list li.fd-multi > input, .fd-list li.fd-all input { width: 20px; height: 20px; margin: 0 4px 0 14px; flex: none; accent-color: var(--accent, #8b7cff); }
.fd-list li.fd-multi > button { flex: 1; min-width: 0; }
.fd-list li.fd-all label { display: flex; align-items: center; gap: 10px; padding: 12px 0; font-weight: 600; cursor: pointer; }

/* Checkboxen in der Ordnerauswahl: klein, nicht über die globalen Eingabefelder gestreckt */
.fd-list li input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0 4px 0 14px; flex: none; accent-color: var(--primary); }
.fd-list li.fd-all label { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 600; cursor: pointer; }
.fd-list li.fd-all input[type="checkbox"] { margin: 0; }
.fd-list li.fd-multi { display: flex; flex-direction: row; align-items: center; }
.fd-list li.fd-multi > button { flex: 1; min-width: 0; }

/* Fortschrittsbalken */
progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 12px; border: 0; border-radius: 99px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 99px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #5bb4d8)); border-radius: 99px; transition: width 0.4s ease; }
progress::-moz-progress-bar { background: var(--primary); border-radius: 99px; }
progress:not([value]) { background: linear-gradient(90deg, var(--line) 0 30%, var(--primary) 50%, var(--line) 70%) 0 0 / 200% 100%; animation: prog-ind 1.2s linear infinite; }
progress:not([value])::-webkit-progress-bar { background: transparent; }
@keyframes prog-ind { from { background-position: 200% 0; } to { background-position: -200% 0; } }
#import-progress { margin-top: 12px; }

/* Bestätigungsdialog */
.dlg.confirm .facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--primary) 6%, transparent); }
.dlg.confirm .facts dt { color: var(--muted, #9aa3b5); font-size: 0.9rem; }
.dlg.confirm .facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.dlg.confirm .actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.dlg.busy { width: min(380px, calc(100% - 24px)); }
.dlg.busy .busyrow { display: flex; align-items: center; gap: 14px; }
.dlg.busy .spinner { width: 26px; height: 26px; }
.dlg.busy h2 { margin: 0; }
#import-folder[readonly] { cursor: pointer; }

.ic.st-ok { color: #22a55b; }
.ic.st-warn { color: #e0a100; }
.ic.st-muted { color: var(--muted); }
.irow .iname { display: inline-flex; align-items: center; gap: 8px; }

/* Lauf-Anzeige */
.runpanel { margin-top: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--primary) 5%, transparent); display: grid; gap: 10px; }
.runpanel[hidden] { display: none; }
.runhead { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.runhead b { flex: 1; font-variant-numeric: tabular-nums; }
.runtime { color: var(--muted); font-variant-numeric: tabular-nums; }
.runpanel .hint { margin: 0; min-height: 1em; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; flex: none; }
.spinner[hidden], .runhead .ic[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
#import-progress { margin-top: 0; }

.layoutgrid { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 12px 16px; align-items: center; margin: 8px 0 14px; }
.layoutgrid label { display: grid; gap: 2px; font-weight: 600; }
.layoutgrid .hint { font-weight: 400; margin: 0; }
@media (max-width: 640px) { .layoutgrid { grid-template-columns: 1fr; } }

.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); align-items: center; }

a.stat { color: inherit; text-decoration: none; }
a.stat:hover span { text-decoration: underline; }
.pathcell { overflow-wrap: anywhere; text-align: right; max-width: 55%; }
.irow.head { font-weight: 600; opacity: 0.7; }
