/* OPUS – Oberfläche
   Ruhig, hell, viel Abstand. Eine Akzentfarbe (Signalgelb) für aktive Funktionen.
   Farbe nur dort, wo sie Bedeutung hat. */

@font-face { font-family: "OPUS Sans"; src: url("../fonts/opus-sans-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "OPUS Sans"; src: url("../fonts/opus-sans-500.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "OPUS Sans"; src: url("../fonts/opus-sans-600.woff") format("woff"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "OPUS Cond"; src: url("../fonts/opus-cond-700.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  --paper: #F3F4F1;
  --surface: #FFFFFF;
  --surface-2: #F8F9F6;
  --ink: #1A1F1E;
  --ink-2: #59625F;
  --ink-3: #8A928E;
  --line: #E2E5E0;
  --line-strong: #CDD2CB;
  --accent: #F2B705;
  --accent-ink: #1A1F1E;
  --accent-soft: #FFF4CC;
  --accent-line: #E3AA00;
  --danger: #C2361F;
  --danger-soft: #FBE9E5;
  --ok: #2E7A4E;
  --ok-soft: #E5F2EA;
  --info: #2D5D8A;
  --plate-blue: #1D4FA3;
  --shadow-pop: 0 18px 50px -12px rgba(20, 26, 24, .28), 0 2px 6px rgba(20, 26, 24, .06);
  --radius: 14px;
  --radius-s: 9px;
  --sidebar: 236px;
  --font: "OPUS Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --cond: "OPUS Cond", "Arial Narrow", "Roboto Condensed", var(--font);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131615; --surface: #1B1F1E; --surface-2: #202524; --ink: #ECEFEA; --ink-2: #A3ACA8; --ink-3: #747D79;
    --line: #2A302E; --line-strong: #39403D; --accent-soft: #3A3210; --danger-soft: #3A1E19; --ok-soft: #17301F;
    --shadow-pop: 0 18px 50px -12px rgba(0,0,0,.7); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #131615; --surface: #1B1F1E; --surface-2: #202524; --ink: #ECEFEA; --ink-2: #A3ACA8; --ink-3: #747D79;
  --line: #2A302E; --line-strong: #39403D; --accent-soft: #3A3210; --danger-soft: #3A1E19; --ok-soft: #17301F;
  --shadow-pop: 0 18px 50px -12px rgba(0,0,0,.7); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.5 var(--font);
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--accent-line); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }

.num, .tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.strong { font-weight: 600; }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.h1 { font: 700 clamp(30px, 4.2vw, 40px)/1.05 var(--cond); letter-spacing: .005em; margin: 0; }
.h2 { font: 600 21px/1.25 var(--font); margin: 0; letter-spacing: -.01em; }
.h3 { font: 600 17px/1.3 var(--font); margin: 0; letter-spacing: -.005em; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }
@media (max-width: 620px) { .grid2, .grid3 { grid-template-columns: 1fr; } .span2 { grid-column: auto; } }

/* ---------- Boot */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 16px; color: var(--ink-2); }
.boot img { border-radius: 18px; }

/* ---------- Grundgerüst */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 22px 14px 18px; border-right: 1px solid var(--line); background: var(--paper);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 22px; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand span { font: 700 26px/1 var(--cond); letter-spacing: .06em; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 500;
}
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: var(--surface); color: var(--ink); }
.nav a.active { background: var(--surface); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.nav .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding: 12px; font-size: 13px; color: var(--ink-3); }
.sidebar-foot a { color: var(--ink-2); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: calc(14px + var(--safe-t)) 32px 14px; background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.topbar .m-brand { display: none; }
.topbar [data-chip] { display: flex; flex: none; min-width: 0; }
.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 8px 32px 64px; }
.content.narrow { max-width: 860px; }

.tabbar { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: calc(10px + var(--safe-t)) 16px 10px; gap: 8px; }
  .topbar .m-brand { display: flex; align-items: center; gap: 8px; font: 700 22px/1 var(--cond); letter-spacing: .06em; }
  .topbar .m-brand img { width: 28px; height: 28px; border-radius: 8px; }
  .content { padding: 4px 16px calc(96px + var(--safe-b)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 40;
    padding: 6px 6px calc(6px + var(--safe-b)); background: color-mix(in srgb, var(--surface) 94%, transparent);
    border-top: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  .tabbar a { display: grid; justify-items: center; gap: 3px; padding: 6px 0 4px; font-size: 11.5px; font-weight: 500; color: var(--ink-3); border-radius: 10px; }
  .tabbar a svg { width: 23px; height: 23px; }
  .tabbar a.active { color: var(--ink); }
  .tabbar a.active svg { color: var(--ink); }
  .tabbar a.active::after { content: ""; width: 18px; height: 3px; border-radius: 3px; background: var(--accent); margin-top: 1px; }
}

/* ---------- Topbar-Elemente */
.timer-chip {
  display: inline-flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; white-space: nowrap; min-width: 0;
}
.timer-chip svg { width: 18px; height: 18px; flex: none; }
.timer-chip .t { font: 700 20px/1 var(--cond); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.timer-chip .ctx { font-size: 13px; font-weight: 500; color: var(--ink-2); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.timer-chip.running { background: var(--accent); border-color: var(--accent-line); color: var(--accent-ink); }
.timer-chip.running .ctx { color: var(--accent-ink); opacity: .75; }
.timer-chip.paused { background: var(--accent-soft); border-color: var(--accent-line); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.running .pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.search-trigger {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-3); text-align: left;
}
.search-trigger svg { width: 18px; height: 18px; }
.search-trigger kbd { margin-left: auto; font: 500 12px var(--font); color: var(--ink-3); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
@media (max-width: 960px) {
  .search-trigger { flex: none; width: 42px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .timer-chip .ctx { display: none; }
  .topbar .new-order span { display: none; }
  .topbar .new-order { width: 42px; padding: 0; justify-content: center; }
}

/* ---------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--paper)); border-color: transparent; }
.btn-accent { background: var(--accent); border-color: var(--accent-line); color: var(--accent-ink); }
.btn-accent:hover { background: #F8C21D; border-color: var(--accent-line); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface); border-color: var(--line); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn-lg { height: 52px; padding: 0 24px; font-size: 16px; }
.btn-icon { width: 42px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn-block { width: 100%; }
.link { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; background: none; border: 0; padding: 0; }
.link:hover { text-decoration-color: var(--ink); }

/* ---------- Seitenkopf */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 18px 0 22px; }
.page-head .grow { flex: 1; min-width: 220px; }
.page-head .sub { margin-top: 6px; color: var(--ink-2); }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; font-weight: 500; margin-top: 10px; }
.back svg { width: 16px; height: 16px; }
.back:hover { color: var(--ink); }

/* ---------- Flächen & Listen */
.panel { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); }
.panel-pad { padding: 20px 22px; }
.panel + .panel, .section + .section { margin-top: 18px; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 30px 0 10px; }
.section-title h2 { font: 600 17px/1.3 var(--font); margin: 0; }
.section-title .count { color: var(--ink-3); font-weight: 500; }
.section-title .spacer { flex: 1; }
.section-title:first-child { margin-top: 6px; }

.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > li + li { border-top: 1px solid var(--line); }
.li {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; min-height: 64px; width: 100%; background: none; border: 0; text-align: left;
}
a.li:hover, button.li:hover { background: var(--surface-2); }
.li .main-col { flex: 1; min-width: 0; }
.li .t1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .t2 { color: var(--ink-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.li .side { text-align: right; flex: none; font-size: 14px; color: var(--ink-2); }
.li .side .v { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.li .chev { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.li .num-tag { font: 700 17px/1 var(--cond); letter-spacing: .02em; color: var(--ink-2); width: 74px; flex: none; font-variant-numeric: tabular-nums; }
@media (max-width: 620px) { .li { padding: 12px 14px; gap: 12px; } .li .num-tag { width: auto; } }
.empty { padding: 34px 22px; text-align: center; color: var(--ink-2); }
.empty .btn { margin-top: 14px; }
.empty-inline { padding: 18px; color: var(--ink-3); font-size: 14px; }

/* ---------- Status */
.status { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; border: 1px solid var(--line-strong); color: var(--ink-2); }
.status.s-accepted { color: var(--ink); border-color: var(--ink-3); }
.status.s-in_progress { background: var(--accent); border-color: var(--accent-line); color: var(--accent-ink); }
.status.s-done { border-color: transparent; background: var(--surface-2); color: var(--ink-3); }
.status.p-paid { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.status.p-overdue, .status.s-overdue { background: var(--danger); border-color: var(--danger); color: #fff; }
.status.p-open, .status.p-partial { color: var(--ink); border-color: var(--ink-3); }
.status.d-draft { border-style: dashed; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 600; }
.badge.danger { background: var(--danger); color: #fff; }
.badge.soft { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }

/* ---------- Kennzeichen */
.plate {
  display: inline-flex; align-items: stretch; height: 24px; border: 1.5px solid var(--ink); border-radius: 4px; background: #fff; color: #111;
  font: 700 15px/1 var(--cond); letter-spacing: .06em; overflow: hidden; white-space: nowrap; vertical-align: middle;
}
.plate::before { content: "D"; display: grid; place-items: end center; width: 13px; padding-bottom: 2px; background: var(--plate-blue); color: #fff; font: 600 8.5px/1 var(--font); }
.plate span { display: grid; place-items: center; padding: 0 7px 0 6px; }
.plate.lg { height: 32px; font-size: 21px; }
.plate.lg::before { width: 17px; font-size: 10px; }

/* ---------- Heute: Stempeluhr */
.clock {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px 28px 24px;
}
.clock::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 7px; opacity: 0;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 14px, var(--ink) 14px 28px); transition: opacity .3s;
}
.clock.running { border-color: var(--accent-line); }
.clock.running::before { opacity: 1; }
.clock.paused::before { opacity: .45; }
.clock-grid { display: grid; grid-template-columns: 1fr auto; gap: 18px 28px; align-items: end; }
.clock-label { color: var(--ink-2); font-weight: 500; display: flex; gap: 10px; align-items: center; }
.clock-time { font: 700 clamp(64px, 11vw, 108px)/.9 var(--cond); letter-spacing: .01em; font-variant-numeric: tabular-nums; margin: 10px 0 0; }
.clock-time .sec { color: var(--ink-3); font-size: .55em; margin-left: .06em; }
.clock-ctx { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.clock-ctx .order-link { font-weight: 600; }
.clock-ctx .order-link .nr { font-family: var(--cond); font-size: 18px; letter-spacing: .02em; margin-right: 6px; }
.clock-actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: 220px; }
.clock-actions .btn { height: 52px; font-size: 16px; }
.clock-today { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 14px; display: flex; gap: 18px; flex-wrap: wrap; }
@media (max-width: 720px) {
  .clock { padding: 22px 18px 18px; border-radius: 18px; }
  .clock-grid { grid-template-columns: 1fr; }
  .clock-actions { min-width: 0; flex-direction: row; flex-wrap: wrap; }
  .clock-actions .btn { flex: 1 1 140px; }
}

.resume {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--radius); background: var(--surface);
  border: 1px dashed var(--line-strong); margin-top: 18px;
}
.resume .main-col { flex: 1; min-width: 0; }
.receipt-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 0 28px; align-items: start; }
@media (max-width: 1060px) { .receipt-grid { grid-template-columns: 1fr; } .receipt-grid .sticky-prev { position: static !important; } .receipt-grid .sticky-prev iframe { height: 340px !important; } .receipt-grid .sticky-prev img { max-height: 360px; object-fit: contain; } }
.today-grid .section-title:first-child { margin-top: 30px; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
@media (max-width: 1060px) { .today-grid { grid-template-columns: 1fr; } }

.alert { padding: 12px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 15px; }
.alert-bad { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.alert-warn { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); }
.alert-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.alert strong { font-weight: 600; }

/* ---------- Formulare */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface);
  outline: none; transition: border-color .12s, box-shadow .12s; font-size: 16px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.input-affix { position: relative; }
.input-affix input { padding-right: 40px; }
.input-affix .affix { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 14px; pointer-events: none; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); gap: 2px; flex-wrap: wrap; }
.seg button, .seg a { height: 34px; padding: 0 14px; border-radius: 999px; border: 0; background: transparent; font-weight: 500; font-size: 14px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.seg .on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px; font-weight: 500; }
.chip svg, .tag svg, .code svg { width: 16px; height: 16px; flex: none; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .x { width: 14px; height: 14px; opacity: .6; }
.searchbar { position: relative; }
.searchbar svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); }
.searchbar input { padding-left: 42px !important; border-radius: 999px !important; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 22px; }

/* ---------- Seitenpanel / Bottom-Sheet */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(16, 20, 19, .32); opacity: 0; transition: opacity .2s; }
.scrim.show { opacity: 1; }
.sheet {
  position: fixed; z-index: 81; top: 10px; right: 10px; bottom: 10px; width: min(560px, calc(100vw - 20px)); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-pop); transform: translateX(24px); opacity: 0; transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .18s;
}
.sheet.wide { width: min(880px, calc(100vw - 20px)); }
.sheet.show { transform: none; opacity: 1; }
.sheet-head { display: flex; align-items: flex-start; gap: 12px; padding: 20px 22px 12px; }
.sheet-head .h2 { flex: 1; padding-top: 6px; }
.sheet-head .sub { font-size: 14px; color: var(--ink-2); margin-top: 2px; font-weight: 400; }
.sheet-body { flex: 1; overflow: auto; padding: 6px 22px 22px; overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sheet-foot .left { margin-right: auto; }
@media (max-width: 720px) {
  .sheet, .sheet.wide { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 94vh; border-radius: 20px 20px 0 0; transform: translateY(40px); }
  .sheet::before { content: ""; width: 40px; height: 5px; border-radius: 4px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
  .sheet-head { padding: 10px 18px 8px; }
  .sheet-body { padding: 4px 18px 18px; }
  .sheet-foot { padding: 12px 18px calc(12px + var(--safe-b)); }
  .sheet-foot .btn { flex: 1; }
  .sheet-foot .left { flex: none; }
}

/* ---------- Dialog / Toast */
.dialog { position: fixed; z-index: 91; left: 50%; top: 50%; transform: translate(-50%, -46%); width: min(440px, calc(100vw - 32px)); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-pop); padding: 22px; opacity: 0; transition: .18s; }
.dialog.show { opacity: 1; transform: translate(-50%, -50%); }
.dialog p { margin: 10px 0 0; color: var(--ink-2); }
.dialog .form-actions { margin-top: 20px; }
.toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
@media (max-width: 960px) { .toasts { bottom: calc(86px + var(--safe-b)); } }
.toast { pointer-events: auto; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow-pop); font-size: 15px; display: flex; gap: 12px; align-items: center; animation: toast-in .22s ease-out; }
.toast.bad { background: var(--danger); color: #fff; }
.toast .act { margin-left: auto; color: var(--accent); font-weight: 600; background: none; border: 0; padding: 0; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }

/* ---------- Suche */
.palette { position: fixed; z-index: 91; left: 50%; top: 9vh; transform: translateX(-50%); width: min(640px, calc(100vw - 24px)); max-height: 78vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-pop); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 6px 18px; border-bottom: 1px solid var(--line); }
.palette-input svg { width: 20px; height: 20px; color: var(--ink-3); flex: none; }
.palette-input input { border: 0 !important; box-shadow: none !important; padding: 14px 0 !important; font-size: 18px !important; background: transparent !important; }
.palette-results { overflow: auto; padding: 8px 8px 12px; }
.palette-group { padding: 12px 12px 4px; font-size: 13px; color: var(--ink-3); font-weight: 600; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; width: 100%; border: 0; background: none; text-align: left; }
.palette-item:hover, .palette-item.sel { background: var(--surface-2); }
.palette-item svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.palette-item .t2 { color: var(--ink-2); font-size: 14px; margin-left: auto; text-align: right; }
@media (max-width: 720px) { .palette { top: 0; max-height: 100vh; height: 100vh; width: 100%; border-radius: 0; padding-top: var(--safe-t); } }

/* ---------- Auftrag */
.order-head { margin: 14px 0 6px; }
.order-head .nr { font: 700 22px/1 var(--cond); letter-spacing: .03em; color: var(--ink-2); }
.order-head .title { font: 700 clamp(32px, 4.6vw, 46px)/1.02 var(--cond); margin: 6px 0 10px; }
.order-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--ink-2); }
.order-meta a:hover { color: var(--ink); text-decoration: underline; }
.steps { display: flex; gap: 0; margin: 20px 0 6px; flex-wrap: wrap; row-gap: 8px; }
.steps button { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 10px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 500; color: var(--ink-3); margin-right: -1px; }
.steps button:first-child { border-radius: 999px 0 0 999px; }
.steps button:last-child { border-radius: 0 999px 999px 0; }
.steps .dot { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; }
.steps .past { color: var(--ink-2); }
.steps .past .dot { background: currentColor; }
.steps .cur { color: var(--ink); font-weight: 600; background: var(--surface-2); }
.steps .cur .dot { background: var(--accent); border-color: var(--accent-line); width: 11px; height: 11px; }
.order-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 8px; }

.block { margin-top: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.block > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; user-select: none; }
.block > summary::-webkit-details-marker { display: none; }
.block > summary h2 { font: 600 17px/1.2 var(--font); margin: 0; }
.block > summary .sum { margin-left: auto; color: var(--ink-2); font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.block > summary .tw { width: 18px; height: 18px; color: var(--ink-3); transition: transform .15s; flex: none; }
.block[open] > summary .tw { transform: rotate(90deg); }
.block-body { padding: 0 20px 20px; overflow-x: auto; }
.block-body > .tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
@media (max-width: 620px) { .block > summary { padding: 14px 16px; flex-wrap: wrap; } .block > summary .sum { flex-basis: 100%; text-align: left; margin-left: 30px; } .block-body { padding: 0 16px 16px; } .steps button { padding: 0 10px 0 8px; font-size: 13px; height: 32px; } .tbl td, .tbl th { padding-left: 6px; padding-right: 6px; } }
.prose { white-space: pre-wrap; line-height: 1.55; }

.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.tbl .sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.tbl-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.tbl td.first, .tbl th.first { padding-left: 0; }
.tbl td.last, .tbl th.last { padding-right: 0; }

.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.tag.warn { background: var(--accent-soft); color: var(--ink); border-color: var(--accent-line); }
.tag.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 12px; }
.kpi { background: var(--surface); padding: 12px 14px; }
.kpi .k { font-size: 13px; color: var(--ink-2); }
.kpi .v { font: 600 19px/1.3 var(--font); font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .d { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }

.compare { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.compare th { font-size: 13px; color: var(--ink-3); font-weight: 500; text-align: right; padding: 6px 10px; }
.compare th:first-child { text-align: left; padding-left: 0; }
.compare td { padding: 9px 10px; text-align: right; border-top: 1px solid var(--line); }
.compare td:first-child { text-align: left; padding-left: 0; }
.compare tr.total td { font-weight: 600; border-top: 1.5px solid var(--line-strong); }

.warnbox { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent-line); margin: 12px 0; }
.warnbox svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.warnbox .vals { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; margin-top: 4px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.note-card { padding: 14px 0; border-top: 1px solid var(--line); }
.note-card:first-child { border-top: 0; padding-top: 4px; }
.note-card .nh { display: flex; gap: 10px; align-items: baseline; }
.note-card .nh .d { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; text-align: center; font-size: 11.5px; color: var(--ink-2); padding: 6px; word-break: break-all; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb .ext { font: 700 16px/1 var(--cond); color: var(--ink); letter-spacing: .04em; margin-bottom: 4px; }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: 12px; padding: 18px; text-align: center; color: var(--ink-2); background: var(--surface-2); }
.dropzone.over { border-color: var(--accent-line); background: var(--accent-soft); }

.alloc-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 96px 34px; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.alloc-row:first-child { border-top: 0; }
.alloc-row .pick { justify-content: flex-start; overflow: hidden; height: 44px; border-radius: 10px; font-weight: 500; text-align: left; }
.alloc-row .pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 620px) { .alloc-row { grid-template-columns: 1fr 96px 34px; } .alloc-row .stype { grid-column: 1 / 2; grid-row: 2; } }
.remain { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); margin: 10px 0 4px; }
.remain .big { font: 700 30px/1 var(--cond); font-variant-numeric: tabular-nums; }
.remain.done .big { color: var(--ok); }
.remain.over .big { color: var(--danger); }

.tree-path { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 14px; color: var(--ink-2); margin-bottom: 12px; }
.tree-path button { border: 0; background: none; padding: 4px 6px; border-radius: 6px; color: var(--ink-2); font-weight: 500; }
.tree-path button:hover { background: var(--surface); color: var(--ink); }
.tree-path .sep { color: var(--ink-3); }
.ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; border: 1px solid var(--line); }
.ico svg { width: 18px; height: 18px; }
.ico.group { background: var(--accent-soft); border-color: transparent; color: var(--ink); }

.codes { display: flex; flex-wrap: wrap; gap: 6px; }
.code { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 14px; }
.code b { font: 700 16px/1 var(--cond); letter-spacing: .05em; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 15px; }
.dl dt { color: var(--ink-2); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) { .dl { grid-template-columns: 1fr; gap: 0; } .dl dd { margin-bottom: 8px; } }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 22px 24px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: -8px; width: 1.5px; background: var(--line-strong); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-2); }
.timeline .tl-h { font-size: 14px; color: var(--ink-2); }
.timeline .tl-t { font-weight: 600; margin-top: 2px; }
.timeline .tl-b { color: var(--ink-2); margin-top: 4px; font-size: 15px; }
.timeline .tl-i { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; align-items: end; height: 160px; margin-top: 14px; }
.bars .b { display: grid; align-content: end; gap: 6px; height: 100%; text-align: center; font-size: 12px; color: var(--ink-3); }
.bars .b i { display: block; border-radius: 6px 6px 2px 2px; background: var(--ink); min-height: 2px; }
.bars .b i.cur { background: var(--accent); }

.rl-grid { display: grid; grid-template-columns: 1.2fr 1fr .7fr .7fr 1fr 1fr; gap: 8px; margin-top: 8px; }
.mini { display: grid; gap: 3px; min-width: 0; }
.mini > span { font-size: 11.5px; color: var(--ink-3); font-weight: 500; padding-left: 2px; }
.dl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.dl-grid.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .rl-grid { grid-template-columns: 1fr 1fr 1fr; } .dl-grid { grid-template-columns: 1fr 1fr; } .hide-s { display: none !important; } }

/* ---------- Anmeldung */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--paper); }
.auth { width: min(420px, 100%); }
.auth-wide { width: min(720px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.auth-brand img { border-radius: 14px; }
.auth-title { font: 700 32px/1 var(--cond); letter-spacing: .02em; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px; }
.auth-section { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin-bottom: 16px; }
.checklist { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 10px; }
.checklist .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; }
.checklist .bad .dot { background: var(--danger); }
.checklist .warn .dot { background: var(--accent); }

/* ---------- Druck in der App ausblenden */
@media print { .sidebar, .topbar, .tabbar, .toasts { display: none !important; } .shell { display: block; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
