/* Erdbau Liebminger – Leitstand
   Stil angelehnt an Mission Control: Weltraum-Verlauf, Glasflaechen, Markenverlauf – mit warmem Bau-Akzent.
   Themen: [data-theme="nacht"] (Standard) und [data-theme="tag"]. Keine Inline-Styles (CSP). */

:root, [data-theme="nacht"] {
  --bg: #0b0a1f;
  --bg-2: #12102c;
  --ink: #f8fafc;
  --ink-2: #d4d6f0;
  --ink-3: #9ea3c9;
  --muted: #7178a6;
  --line: rgba(255, 255, 255, 0.10);
  --line-2: rgba(255, 255, 255, 0.18);
  --surface: rgba(26, 20, 64, 0.62);
  --surface-2: rgba(38, 31, 86, 0.66);
  --surface-solid: #1a1640;
  --input: rgba(10, 8, 30, 0.55);
  --brand: linear-gradient(110deg, #fbbf24 0%, #fb923c 30%, #f472b6 66%, #818cf8 100%);
  --brand-solid: #fb923c;
  --accent: #fbbf24;
  --accent-ink: #1b1300;
  --good: #4ade80;
  --warn: #fbbf24;
  --bad: #fb7185;
  --info: #60a5fa;
  --violet: #a78bfa;
  --cyan: #22d3ee;
  --shadow: 0 18px 48px -18px rgba(0, 0, 0, 0.65);
  --radius: 18px;
  --radius-sm: 12px;
  --nav-w: 248px;
  color-scheme: dark;
}

[data-theme="tag"] {
  --bg: #f4f1ea;
  --bg-2: #ece7dc;
  --ink: #1f1a14;
  --ink-2: #3c3428;
  --ink-3: #6b604f;
  --muted: #8a7f6c;
  --line: rgba(60, 45, 20, 0.12);
  --line-2: rgba(60, 45, 20, 0.22);
  --surface: rgba(255, 255, 255, 0.78);
  --surface-2: rgba(255, 252, 245, 0.92);
  --surface-solid: #ffffff;
  --input: #ffffff;
  --brand: linear-gradient(110deg, #d97706 0%, #ea580c 35%, #db2777 70%, #6d28d9 100%);
  --brand-solid: #ea580c;
  --accent: #d97706;
  --accent-ink: #ffffff;
  --good: #15803d;
  --warn: #b45309;
  --bad: #be123c;
  --info: #1d4ed8;
  --violet: #6d28d9;
  --cyan: #0e7490;
  --shadow: 0 14px 36px -18px rgba(80, 60, 20, 0.35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.tiny { font-size: .75rem; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.strong { font-weight: 700; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap { gap: .6rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack > * + * { margin-top: .8rem; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.ic.lg { width: 22px; height: 22px; }
.ic.xl { width: 30px; height: 30px; }

/* ---------------------------------------------------------------- Hintergrund */
.bg {
  position: fixed; inset: 0; z-index: -2; pointer-events: none; overflow: hidden;
  background:
    radial-gradient(70vmax 55vmax at 0% 0%, rgba(124, 58, 237, 0.50), transparent 62%),
    radial-gradient(60vmax 50vmax at 100% 4%, rgba(251, 146, 60, 0.30), transparent 60%),
    radial-gradient(65vmax 55vmax at 100% 100%, rgba(236, 72, 153, 0.30), transparent 62%),
    radial-gradient(55vmax 45vmax at 0% 100%, rgba(6, 182, 212, 0.22), transparent 60%),
    linear-gradient(155deg, #1b1248 0%, #121a4c 48%, #221046 100%);
}
.bg::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 80%);
}
.bg .orb { position: absolute; border-radius: 50%; mix-blend-mode: screen; animation: orb 30s ease-in-out infinite; }
.bg .orb.o1 { width: 58vmax; height: 58vmax; top: -24vmax; right: -18vmax; background: radial-gradient(circle, rgba(251, 191, 36, 0.30), transparent 65%); }
.bg .orb.o2 { width: 64vmax; height: 64vmax; bottom: -30vmax; left: -20vmax; background: radial-gradient(circle, rgba(217, 70, 239, 0.32), transparent 65%); animation-delay: -10s; }
.bg .orb.o3 { width: 42vmax; height: 42vmax; top: 34%; left: 40%; background: radial-gradient(circle, rgba(129, 140, 248, 0.22), transparent 65%); animation-duration: 36s; animation-delay: -18s; }
@keyframes orb { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(4vmax, -3vmax) scale(1.07); } 66% { transform: translate(-3vmax, 3vmax) scale(.95); } }
@media (prefers-reduced-motion: reduce) { .bg .orb { animation: none; } * { transition: none !important; animation-duration: 0s !important; } }
[data-theme="tag"] .bg { background: radial-gradient(60vmax 50vmax at 100% 0%, rgba(251, 191, 36, .22), transparent 60%), radial-gradient(60vmax 50vmax at 0% 100%, rgba(167, 139, 250, .16), transparent 60%), linear-gradient(160deg, #f7f3ea, #efe9dd); }
[data-theme="tag"] .bg::before, [data-theme="tag"] .bg .orb { display: none; }

/* ---------------------------------------------------------------- Rahmen: Navigation + Inhalt */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
.nav {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 1rem .8rem 1.4rem;
  background: rgba(14, 10, 40, 0.55);
  -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: .2rem;
}
[data-theme="tag"] .nav { background: rgba(255, 252, 245, .75); }
.brand { display: flex; align-items: center; gap: .7rem; padding: .3rem .5rem 1rem; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: conic-gradient(from 210deg, #fbbf24, #fb923c, #f472b6, #818cf8, #fbbf24);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.3), 0 10px 26px -8px rgba(251, 146, 60, .8);
  color: #1b1300;
}
.brand-mark .ic { width: 24px; height: 24px; stroke-width: 2.2; }
.brand-text { line-height: 1.1; }
.brand-text strong { display: block; font-size: 1.02rem; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-text span { font-size: .72rem; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; }
.nav-section { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: .9rem .7rem .3rem; }
.nav a.nav-item {
  display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 11px; text-decoration: none;
  color: var(--ink-2); font-weight: 500; position: relative;
}
.nav a.nav-item:hover { background: rgba(255,255,255,.06); color: var(--ink); }
[data-theme="tag"] .nav a.nav-item:hover { background: rgba(0,0,0,.04); }
.nav a.nav-item.active { background: linear-gradient(90deg, rgba(251, 191, 36, .18), rgba(244, 114, 182, .10)); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.nav a.nav-item.active::before { content: ""; position: absolute; left: -.8rem; top: 20%; bottom: 20%; width: 3px; border-radius: 3px; background: var(--brand); }
.nav .count { margin-left: auto; font-size: .72rem; font-weight: 700; padding: .05rem .45rem; border-radius: 99px; background: rgba(251, 191, 36, .2); color: var(--accent); }
.nav .count.bad { background: rgba(251, 113, 133, .2); color: var(--bad); }
.nav-foot { margin-top: auto; padding-top: 1rem; display: flex; flex-direction: column; gap: .2rem; }
.main { min-width: 0; padding: 0 clamp(1rem, 3vw, 2.4rem) 4rem; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .8rem;
  padding: .8rem 0; margin-bottom: 1rem;
  background: linear-gradient(180deg, rgba(11, 10, 31, .82) 60%, rgba(11, 10, 31, 0));
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
[data-theme="tag"] .topbar { background: linear-gradient(180deg, rgba(244, 241, 234, .9) 60%, rgba(244, 241, 234, 0)); }
.topbar h1 { margin: 0; font-size: 1.35rem; }
.topbar .crumbs { font-size: .8rem; color: var(--ink-3); }
.topbar .crumbs a { text-decoration: none; }
.topbar .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; }
.search-box { position: relative; min-width: 220px; max-width: 340px; flex: 1 1 260px; }
.search-box input { padding-left: 2.2rem; border-radius: 99px; }
.search-box .ic { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: fixed; z-index: 60; left: 0; top: 0; width: min(86vw, 300px); transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow); background: var(--surface-solid); }
  .nav.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .scrim { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.45); }
  .search-box { order: 5; flex-basis: 100%; max-width: none; }
}

/* ---------------------------------------------------------------- Flaechen */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%);
}
.card + .card { margin-top: 1rem; }
.card.tight { padding: .8rem .9rem; }
.card.flush { padding: 0; overflow: hidden; }
.card h2 { display: flex; align-items: center; gap: .5rem; }
.card-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head .actions { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); align-items: start; }
.grid.side-r { grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); align-items: start; }
@media (max-width: 1180px) { .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.side, .grid.side-r { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; } }

/* Begruessung + Kennzahlen (Leitstand) */
.hello { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: .4rem 0 1.2rem; }
.hello h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0; }
.hello h1 em { font-style: normal; background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hello .sub { color: var(--ink-3); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.kpi {
  position: relative; overflow: hidden; display: block; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .85rem 1rem;
  transition: transform .15s ease, border-color .15s ease;
}
.kpi:hover { transform: translateY(-2px); border-color: var(--line-2); }
.kpi .label { font-size: .75rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; }
.kpi .value { font-size: 1.55rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: .15rem; }
.kpi .hint { font-size: .78rem; color: var(--ink-3); }
.kpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--brand); opacity: .55; }
.kpi.good::after { background: var(--good); } .kpi.warn::after { background: var(--warn); } .kpi.bad::after { background: var(--bad); }
.kpi.bad .value { color: var(--bad); } .kpi.warn .value { color: var(--warn); }

/* Kacheln */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .9rem; }
.tile {
  --c1: #fbbf24; --c2: #fb923c;
  position: relative; display: flex; flex-direction: column; gap: .5rem; min-height: 118px; padding: 1rem;
  text-decoration: none; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  overflow: hidden; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tile:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: 0 18px 40px -16px color-mix(in srgb, var(--c2) 60%, transparent); }
.tile::before { content: ""; position: absolute; inset: -40% -40% auto auto; width: 70%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c1) 35%, transparent), transparent 70%); }
.tile .t-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--c1), var(--c2)); color: #fff; box-shadow: 0 8px 20px -8px var(--c2); }
.tile .t-ic .ic { width: 22px; height: 22px; }
.tile .t-title { font-weight: 700; }
.tile .t-sub { font-size: .8rem; color: var(--ink-3); }
.tile .t-badge { position: absolute; top: .8rem; right: .8rem; }
.tile.c-amber { --c1: #fbbf24; --c2: #f59e0b; } .tile.c-orange { --c1: #fb923c; --c2: #ea580c; }
.tile.c-pink { --c1: #f472b6; --c2: #db2777; } .tile.c-violet { --c1: #a78bfa; --c2: #7c3aed; }
.tile.c-blue { --c1: #60a5fa; --c2: #2563eb; } .tile.c-cyan { --c1: #22d3ee; --c2: #0891b2; }
.tile.c-green { --c1: #4ade80; --c2: #16a34a; } .tile.c-rose { --c1: #fb7185; --c2: #e11d48; }

/* To-dos */
.todos { list-style: none; margin: 0; padding: 0; }
.todo { display: flex; align-items: center; gap: .8rem; padding: .7rem .2rem; border-top: 1px solid var(--line); }
.todo:first-child { border-top: 0; }
.todo .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--info); box-shadow: 0 0 0 4px color-mix(in srgb, var(--info) 22%, transparent); }
.todo.bad .dot { background: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 22%, transparent); }
.todo.warn .dot { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 22%, transparent); }
.todo.good .dot { background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 22%, transparent); }
.todo .t { flex: 1; min-width: 0; }
.todo .t a { text-decoration: none; font-weight: 600; }
.todo .t .muted { display: block; font-size: .82rem; }

/* ---------------------------------------------------------------- Knoepfe */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .55rem .95rem; border-radius: 11px; border: 1px solid var(--line-2);
  background: rgba(255,255,255,.06); color: var(--ink); font: inherit; font-weight: 600; font-size: .92rem;
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .12s ease, transform .08s ease, border-color .12s;
}
[data-theme="tag"] .btn { background: #fff; }
.btn:hover { background: rgba(255,255,255,.12); border-color: var(--ink-3); }
[data-theme="tag"] .btn:hover { background: #faf7f0; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn.primary { background: var(--brand); border-color: transparent; color: #1b1300; box-shadow: 0 10px 24px -12px rgba(251, 146, 60, .9); }
[data-theme="tag"] .btn.primary { color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { border-color: color-mix(in srgb, var(--bad) 55%, transparent); color: var(--bad); }
.btn.danger:hover { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.btn.good { border-color: color-mix(in srgb, var(--good) 55%, transparent); color: var(--good); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(255,255,255,.07); }
.btn.sm { padding: .32rem .6rem; font-size: .82rem; border-radius: 9px; }
.btn.lg { padding: .85rem 1.3rem; font-size: 1.02rem; border-radius: 14px; }
.btn.block { width: 100%; }
.btn.icon { padding: .5rem; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--input); border: 1px solid var(--line); gap: 3px; }
.seg button, .seg a { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 700; padding: .4rem .85rem; border-radius: 9px; cursor: pointer; text-decoration: none; }
.seg button:hover, .seg a:hover { color: var(--ink); background: rgba(255,255,255,.06); }
.seg .on { background: var(--brand); color: #1b1300; box-shadow: 0 6px 16px -8px rgba(251,146,60,.9); }
[data-theme="tag"] .seg .on { color: #fff; }

/* ---------------------------------------------------------------- Formulare */
label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-2); margin-bottom: .3rem; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=time],
input[type=search], input[type=tel], input[type=url], input[type=month], select, textarea {
  width: 100%; padding: .6rem .75rem; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--input); color: var(--ink); font: inherit; font-size: .95rem;
  transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 5.5rem; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input.unclear, select.unclear, textarea.unclear { border-color: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); background: color-mix(in srgb, var(--warn) 8%, var(--input)); }
input.code { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; padding: .7rem; }
.field { margin-bottom: .9rem; }
.field .hint { font-size: .78rem; color: var(--ink-3); margin-top: .25rem; }
.fields { display: grid; gap: 0 .9rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .fields.two { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-solid); }
.inline-form { display: inline; }
.secret-state { font-size: .8rem; }

/* ---------------------------------------------------------------- Tabellen */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 600; padding: .55rem .6rem; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: rgba(255,255,255,.03); }
.table tr.clickable { cursor: pointer; }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; }
.table td.actions { text-align: right; white-space: nowrap; }
.table input, .table select { padding: .35rem .5rem; font-size: .88rem; }
.table .w-qty { width: 6.5rem; } .table .w-price { width: 8rem; } .table .w-unit { width: 5rem; }

/* ---------------------------------------------------------------- Kennzeichen */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 99px; font-size: .74rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.badge.good { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.badge.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.badge.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.badge.info { color: var(--info); background: color-mix(in srgb, var(--info) 14%, transparent); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.badge.muted { color: var(--ink-3); background: rgba(255,255,255,.05); border-color: var(--line); }
.badge.violet { color: var(--violet); background: color-mix(in srgb, var(--violet) 14%, transparent); }
.badge.ki { color: #1b1300; background: var(--brand); }
.pill { display: inline-flex; gap: .3rem; align-items: center; padding: .2rem .6rem; border-radius: 99px; background: rgba(255,255,255,.06); border: 1px solid var(--line); font-size: .8rem; }

/* ---------------------------------------------------------------- Meldungen */
.flash { padding: .75rem 1rem; border-radius: 12px; margin-bottom: 1rem; border: 1px solid var(--line-2); background: var(--surface); display: flex; gap: .6rem; align-items: center; }
.flash.good { border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.flash.good .ic { color: var(--good); }
.flash.bad, .flash.danger { border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.flash.bad .ic, .flash.danger .ic { color: var(--bad); }
.flash.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.flash.warn .ic { color: var(--warn); }
.callout { padding: .8rem 1rem; border-radius: 12px; border: 1px dashed var(--line-2); background: rgba(255,255,255,.03); }
.callout.warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 7%, transparent); }
.callout.bad { border-color: color-mix(in srgb, var(--bad) 50%, transparent); background: color-mix(in srgb, var(--bad) 7%, transparent); }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--ink-3); }
.empty .ic { width: 38px; height: 38px; opacity: .6; margin-bottom: .5rem; }

/* ---------------------------------------------------------------- Tabs + Filter */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .55rem .9rem; text-decoration: none; color: var(--ink-3); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: .4rem; align-items: center; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count { font-size: .7rem; padding: 0 .4rem; border-radius: 99px; background: rgba(255,255,255,.08); }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { margin: 0; min-width: 150px; }

/* ---------------------------------------------------------------- Dialog */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 1rem; background: rgba(5, 4, 18, .62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal .dialog { width: min(640px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; background: var(--surface-solid); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 1.3rem; box-shadow: 0 30px 80px -20px rgba(0,0,0,.8); animation: pop .18s ease; }
.modal .dialog.wide { width: min(980px, 100%); }
.modal .dialog h2 { display: flex; align-items: center; gap: .5rem; }
.modal .dialog .foot { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------------------------------------------------------------- Belegansicht */
.viewer { position: sticky; top: 5rem; background: #0d0b22; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
[data-theme="tag"] .viewer { background: #e8e2d4; }
.viewer-bar { display: flex; gap: .4rem; padding: .5rem; border-bottom: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.viewer-stage { height: calc(100vh - 10rem); min-height: 420px; overflow: auto; display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: .6rem; }
.viewer-stage img { max-width: 100%; box-shadow: 0 6px 24px rgba(0,0,0,.5); transform-origin: top center; background: #fff; }
.viewer-stage.zoom img { max-width: none; width: 180%; }
.viewer-stage iframe { width: 100%; height: 100%; border: 0; background: #fff; }
@media (max-width: 1180px) { .viewer { position: static; } .viewer-stage { height: 70vh; } }

.unclear-list { list-style: none; padding: 0; margin: 0; }
.unclear-list li { padding: .7rem .8rem; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 6%, transparent); margin-bottom: .6rem; }
.unclear-list li.done { border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 6%, transparent); }
.unclear-list .why { font-size: .8rem; color: var(--ink-3); }
.ki-read { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .85rem; padding: .05rem .35rem; border-radius: 6px; background: rgba(255,255,255,.07); }

/* ---------------------------------------------------------------- Kalender */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
.cal .dow { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); text-align: center; padding-bottom: .2rem; }
.cal .day { min-height: 108px; border-radius: 14px; padding: .5rem .55rem; background: var(--surface); border: 1px solid var(--line); text-decoration: none; display: flex; flex-direction: column; gap: .25rem; position: relative; }
.cal .day:hover { border-color: var(--line-2); }
.cal .day .n { font-weight: 800; font-size: .95rem; }
.cal .day.out { opacity: .35; }
.cal .day.weekend { background: rgba(255,255,255,.025); }
.cal .day.holiday { background: color-mix(in srgb, var(--violet) 10%, transparent); }
.cal .day.missing { border: 1px solid color-mix(in srgb, var(--bad) 65%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.cal .day.explained { border-style: dashed; border-color: color-mix(in srgb, var(--ink-3) 50%, transparent); background: rgba(255,255,255,.03); }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal .day .chip { font-size: .72rem; padding: .05rem .4rem; border-radius: 7px; background: rgba(255,255,255,.07); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .day .chip.sw { background: color-mix(in srgb, var(--info) 22%, transparent); }
.cal .day .chip.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.cal .day .flag { font-size: .7rem; font-weight: 700; color: var(--bad); }
@media (max-width: 760px) { .cal { gap: .25rem; } .cal .day { min-height: 64px; padding: .3rem; } .cal .day .chip { display: none; } .cal .day .dots { display: flex; } }

/* ---------------------------------------------------------------- Scanner (Handy) */
.scan-page { max-width: 560px; margin: 0 auto; padding: 1rem; }
.scan-hero { text-align: center; padding: 1.2rem 0 .6rem; }
.scan-hero .brand-mark { margin: 0 auto .8rem; width: 64px; height: 64px; border-radius: 20px; }
.scan-hero .brand-mark .ic { width: 36px; height: 36px; }
.big-actions { display: grid; grid-template-columns: 1fr; gap: .7rem; }
.big-actions .btn { padding: 1.1rem; font-size: 1.1rem; border-radius: 16px; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .6rem; margin-top: .8rem; }
.pages .pg { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); aspect-ratio: 3/4; background: #fff; }
.pages .pg img { width: 100%; height: 100%; object-fit: cover; }
.pages .pg .n { position: absolute; left: .3rem; top: .3rem; background: rgba(0,0,0,.6); color: #fff; font-size: .7rem; padding: .05rem .35rem; border-radius: 6px; }
.pages .pg button { position: absolute; right: .25rem; top: .25rem; border: 0; border-radius: 8px; background: rgba(0,0,0,.65); color: #fff; padding: .2rem; cursor: pointer; }
.progress { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; margin: .8rem 0; }
.progress > div { height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.success-box { text-align: center; }
.success-box .big { font-size: 3rem; line-height: 1; color: var(--good); }
.recent-uploads { list-style: none; padding: 0; margin: .5rem 0 0; font-size: .85rem; }
.recent-uploads li { padding: .35rem 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: .5rem; }

/* Zuschnitt (cropper.js) */
.cropper { position: fixed; inset: 0; z-index: 90; background: #000; display: flex; flex-direction: column; }
.cropper-hint { color: #ddd; font-size: .85rem; text-align: center; padding: .5rem; }
.cropper-stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; }
.cropper-stage canvas { max-width: 100%; max-height: 100%; }
.cropper-busy { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(0,0,0,.5); }
.cropper-bar { display: flex; gap: .4rem; padding: .6rem; flex-wrap: wrap; justify-content: center; background: #111; }
.cropper-bar .btn { color: #fff; border-color: #444; background: #222; }
.cropper-bar .btn.primary { background: var(--brand); color: #1b1300; }

/* ---------------------------------------------------------------- Login */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.2rem; }
.auth-card { width: min(420px, 100%); }
.auth-card .brand { justify-content: center; padding-bottom: 1.2rem; }
.qr { display: grid; place-items: center; padding: 1rem; background: #fff; border-radius: 14px; margin: .8rem auto; width: 236px; }
.qr svg { width: 204px; height: 204px; }
.secret-code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .85rem; letter-spacing: .08em; word-break: break-all; text-align: center; padding: .5rem; border-radius: 10px; background: rgba(255,255,255,.06); }

/* ---------------------------------------------------------------- Mail */
.mail-split { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1000px) { .mail-split { grid-template-columns: 1fr; } }
.mail-list { list-style: none; margin: 0; padding: 0; }
.mail-list li a { display: block; padding: .7rem .9rem; text-decoration: none; border-bottom: 1px solid var(--line); }
.mail-list li a:hover { background: rgba(255,255,255,.04); }
.mail-list li a.on { background: linear-gradient(90deg, rgba(251,191,36,.14), transparent); }
.mail-list li.unread .subj { font-weight: 800; }
.mail-list .from { font-size: .85rem; color: var(--ink-2); display: flex; justify-content: space-between; gap: .5rem; }
.mail-list .subj { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-list .snip { font-size: .8rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-body { font-size: .95rem; line-height: 1.6; overflow-wrap: anywhere; }
.mail-body .html { background: #fff; color: #111; border-radius: 12px; padding: 1rem; }
.mail-body pre { white-space: pre-wrap; font-family: inherit; margin: 0; }
.thread-item { border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; margin-bottom: .7rem; background: rgba(255,255,255,.02); }
.thread-item.out { border-left: 3px solid var(--accent); }
.draft-box { border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 14px; padding: 1rem; }

/* ---------------------------------------------------------------- Diverses */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .9rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }
.sum-box { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1.2rem; max-width: 360px; margin-left: auto; font-variant-numeric: tabular-nums; }
.sum-box .total { font-size: 1.15rem; font-weight: 800; border-top: 1px solid var(--line-2); padding-top: .4rem; }
.bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.08); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); }
.bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }
.thumbs { display: flex; gap: .5rem; flex-wrap: wrap; }
.thumbs img { width: 86px; height: 112px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 1.4rem; text-align: center; color: var(--ink-3); }
.dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 95; display: flex; flex-direction: column; gap: .5rem; }
.toast .flash { box-shadow: var(--shadow); margin: 0; min-width: 260px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--ink-3); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: .3rem; }
.legend .l-missing { background: color-mix(in srgb, var(--bad) 40%, transparent); border: 1px solid var(--bad); }
.legend .l-ok { background: var(--surface-2); border: 1px solid var(--line-2); }
.legend .l-holiday { background: color-mix(in srgb, var(--violet) 30%, transparent); }
.legend .l-explained { border: 1px dashed var(--ink-3); }
.print-only { display: none; }
@media print {
  .nav, .topbar .actions, .bg, .no-print, .toast { display: none !important; }
  .shell { display: block; } .main { padding: 0; } body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 1px solid #ccc; background: #fff; backdrop-filter: none; }
  .print-only { display: block; }
}
.pager { justify-content: center; margin-top: 1rem; }
.mt { margin-top: 1rem; } .mt-s { margin-top: .5rem; } .mb { margin-bottom: 1rem; } .mb-0 { margin-bottom: 0; } .ml-auto { margin-left: auto; }
.w-full { width: 100%; } .maxw-sm { max-width: 520px; } .maxw-md { max-width: 760px; }
.thumb-sm { width: 44px; height: 58px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line-2); background: #fff; display: block; }
.seg .tier-sum { display: block; font-size: .72rem; font-weight: 600; opacity: .8; }
.seg button { text-align: center; line-height: 1.2; }
.inv-lines tr.kind-titel td { background: rgba(255,255,255,.03); }
.inv-lines tr.manual input[name="ln_price"] { border-color: var(--warn); }
.inv-lines input[name="ln_desc"] { min-width: 200px; }
.table .w-date { width: 9.5rem; }
input.strong { font-weight: 700; }
.vat-sel { margin-top: .3rem; font-size: .78rem !important; padding: .2rem .4rem !important; width: auto !important; }
.seg-radio { position: relative; }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg-radio span { display: inline-block; padding: .4rem .9rem; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--ink-2); }
.seg-radio input:checked + span { background: var(--brand); color: #1b1300; }
.seg-radio input:focus-visible + span { outline: 2px solid var(--accent); }
tr.muted td { opacity: .55; }
.spark { width: 100%; height: 120px; display: block; }

@media (max-width: 960px) {
  .topbar { flex-wrap: wrap; row-gap: .5rem; }
  .topbar .grow { flex: 1 1 calc(100% - 60px); }
  .topbar .actions { flex: 1 1 100%; justify-content: flex-start; }
  .search-box { min-width: 0; flex: 1 1 100%; }
  .topbar h1 { font-size: 1.15rem; }
}
@media (max-width: 480px) {
  .main { padding: 0 .8rem 3rem; }
  .card { padding: .9rem; }
  .btn { padding: .5rem .75rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.inv-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1280px) { .inv-grid { grid-template-columns: 1fr; } }
.inv-lines { table-layout: auto; }
.inv-lines td:first-child { width: 3.6rem; }
.inv-lines .w-qty { width: 5.2rem; } .inv-lines .w-price { width: 6.8rem; } .inv-lines .w-unit { width: 5.4rem; }

.nav a.nav-item > span:not(.count) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a.nav-item .count { flex: none; }
