/* ==========================================================================
   STP BOOKING · Works · Design-System
   Hausschrift Open Sans. Schwarz/Weiss wie das Logo, Farbe nur fuer Status.
   Signatur: der Ticketabriss (gestrichelte Perforation) an Terminen.
   ========================================================================== */
@font-face { font-family: 'Open Sans'; font-weight: 300; font-style: normal; font-display: swap; src: url('/assets/fonts/open-sans-300.woff2') format('woff2'); }
@font-face { font-family: 'Open Sans'; font-weight: 400; font-style: normal; font-display: swap; src: url('/assets/fonts/open-sans-400.woff2') format('woff2'); }
@font-face { font-family: 'Open Sans'; font-weight: 700; font-style: normal; font-display: swap; src: url('/assets/fonts/open-sans-700.woff2') format('woff2'); }

:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f9f9fb;
  --surface-3: #eeeef1;
  --ink: #1d1d1f;
  --ink-2: #424245;
  --ink-3: #6e6e73;          /* 4.9:1 auf Weiss */
  --line: #d2d2d7;
  --line-2: #e6e6eb;
  --accent: #000000;          /* Primaeraktion: schwarz wie das Logo */
  --accent-ink: #ffffff;
  --focus: #0071e3;
  --hover: rgba(0,0,0,.04);
  --sel: rgba(0,113,227,.10);
  /* Status: Farbe nie allein, immer mit Text */
  --ok: #1b7f3b;   --ok-bg: #e7f5ec;
  --warn: #8a5a00; --warn-bg: #fdf3dc;
  --bad: #c4281c;  --bad-bg: #fde9e7;
  --info: #0058b0; --info-bg: #e6f0fb;
  /* Verfuegbarkeit */
  --st-frei: #1e9e4a; --st-frei-ink: #ffffff;
  --st-opt: #c4ecd0; --st-opt-ink: #145c2c;
  --st-bel: #d93a2f; --st-bel-ink: #ffffff;
  --st-unb: #e2e2e7; --st-unb-ink: #5f5f64;
  --muted-bg: #ededf0;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06);
  --radius: 12px;
  --radius-s: 8px;
  --font: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --top: 56px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --surface: #1c1c1e; --surface-2: #232325; --surface-3: #2c2c2e;
    --ink: #f5f5f7; --ink-2: #d1d1d6; --ink-3: #98989d;
    --line: #3a3a3c; --line-2: #2c2c2e;
    --accent: #ffffff; --accent-ink: #000000; --focus: #4ea1ff;
    --hover: rgba(255,255,255,.06); --sel: rgba(78,161,255,.16);
    --ok: #4cd477; --ok-bg: rgba(76,212,119,.14);
    --warn: #f2c14e; --warn-bg: rgba(242,193,78,.14);
    --bad: #ff6b5f; --bad-bg: rgba(255,107,95,.14);
    --info: #6cb4ff; --info-bg: rgba(108,180,255,.14);
    --st-frei: #2fb35d; --st-frei-ink: #04170b;
    --st-opt: rgba(76,212,119,.26); --st-opt-ink: #a6f0bf;
    --st-bel: #e5534b; --st-bel-ink: #ffffff;
    --st-unb: #3a3a3c; --st-unb-ink: #b0b0b5;
    --muted-bg: #2c2c2e;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0 0 10px; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
hr { border: 0; border-top: 1px solid var(--line-2); margin: 16px 0; }

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; height: var(--top); display: flex; align-items: center; gap: 24px;
  padding: 0 20px; background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px); border-bottom: 1px solid var(--line-2); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand .stp { width: 30px; height: 30px; display: block; }
.brand .bk { height: 11px; width: auto; display: block; }
.brand small { font-size: 10px; letter-spacing: .14em; color: var(--ink-3); font-weight: 700; padding-left: 10px; border-left: 1px solid var(--line); }
.mainnav { display: flex; gap: 2px; height: 100%; }
.mainnav a { display: flex; align-items: center; padding: 0 14px; text-decoration: none; font-weight: 700; font-size: 12.5px;
  letter-spacing: .08em; color: var(--ink-3); position: relative; }
.mainnav a:hover { color: var(--ink); }
.mainnav a[aria-current="page"] { color: var(--ink); }
.mainnav a[aria-current="page"]::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--ink); border-radius: 2px; }
.topbar .spacer { flex: 1; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.iconbtn { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--ink-2); text-decoration: none; }
.iconbtn:hover { background: var(--hover); color: var(--ink); }
.iconbtn[aria-current="page"] { color: var(--ink); background: var(--hover); }
.iconbtn svg { width: 19px; height: 19px; }
.searchbtn { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 9px; min-width: 200px; border: 1px solid var(--line-2);
  border-radius: 8px; background: var(--surface-2); color: var(--ink-3); cursor: pointer; font-size: 13px; }
.searchbtn svg { width: 15px; height: 15px; flex: none; }
.searchbtn kbd { margin-left: auto; font: 11px var(--font); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.userbtn { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 4px; border: 0; background: none; border-radius: 17px; cursor: pointer; font-weight: 700; font-size: 13px; }
.userbtn:hover { background: var(--hover); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--surface); display: grid; place-items: center; font-size: 11px; font-weight: 700; text-transform: uppercase; }

/* ---------- Subnav (segmentiert) ---------- */
.subnav { position: sticky; top: var(--top); z-index: 40; display: flex; justify-content: center; padding: 10px 20px; background: var(--bg); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 10px; }
.seg a, .seg button { border: 0; background: none; padding: 6px 14px; min-height: 30px; border-radius: 8px; font-size: 13px; font-weight: 400; color: var(--ink-2); text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg a:hover, .seg button:hover { color: var(--ink); }
.seg a[aria-current="page"], .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* ---------- Seite ---------- */
main#view { max-width: 1320px; margin: 0 auto; padding: 18px 24px 80px; }
main#view.wide { max-width: none; }
.pagehead { display: flex; align-items: flex-end; gap: 16px; margin: 6px 0 20px; flex-wrap: wrap; }
.pagehead .t { flex: 1; min-width: 240px; }
.pagehead h1 { font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.pagehead .sub { color: var(--ink-3); margin-top: 4px; }
.pagehead .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--ink); text-decoration: underline; }
.section-t { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 26px 0 10px; display: flex; align-items: center; gap: 10px; }
.section-t .grow { flex: 1; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { opacity: .86; }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--bad); }
.btn.small { min-height: 28px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 15px; height: 15px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: inherit; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span, .lbl { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.inp, .field input, .field select, .field textarea, select.inp, textarea.inp {
  width: 100%; min-height: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 14px; }
.field textarea, textarea.inp { min-height: 80px; resize: vertical; line-height: 1.45; }
.inp:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--sel); }
.field input[type="checkbox"] { width: auto; min-height: 0; }
.grid { display: grid; gap: 12px 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .span4 { grid-column: span 4; } .spanall { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); }
.searchinp { position: relative; }
.searchinp input { padding-left: 32px; }
.searchinp svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }

/* ---------- Karten & Listen ---------- */
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); }
.card.pad { padding: 16px 18px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.card-h h3 { font-size: 14px; font-weight: 700; flex: 1; }
.card-b { padding: 14px 16px; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line-2); }
.list > li:first-child { border-top: 0; }
.list > li a.row-link { flex: 1; text-decoration: none; min-width: 0; }
.list .meta { color: var(--ink-3); font-size: 12px; }
.list > li.hov:hover { background: var(--hover); cursor: pointer; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Tabelle */
.tblwrap { overflow: auto; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-weight: 700; font-size: 12px; color: var(--ink-3); padding: 9px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; user-select: none; }
.tbl th.sort { cursor: pointer; }
.tbl th.sort:hover { color: var(--ink); }
.tbl th .arr { opacity: .6; font-size: 10px; margin-left: 4px; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover td { background: var(--sel); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td.act { text-align: right; white-space: nowrap; }
.tbl input.inp, .tbl select.inp { min-height: 30px; padding: 4px 8px; font-size: 13px; }

/* Status-Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 12px; font-weight: 700; background: var(--muted-bg); color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip.nodot::before { display: none; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--info-bg); color: var(--info); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; background: var(--surface-3); color: var(--ink-2); margin: 2px 4px 2px 0; }
.tag button { border: 0; background: none; padding: 0 0 0 6px; cursor: pointer; color: var(--ink-3); }

/* ---------- Signatur: Ticket mit Abriss ---------- */
.ticket { display: grid; grid-template-columns: 78px 1fr; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); position: relative; min-height: 78px; }
.ticket:hover { border-color: var(--line); box-shadow: var(--shadow); }
.ticket .stub { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 4px; position: relative; }
.ticket .stub::after { content: ''; position: absolute; right: 0; top: 10px; bottom: 10px; border-right: 2px dashed var(--line); }
.ticket::before, .ticket::after { content: ''; position: absolute; left: 70px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line-2); }
.ticket::before { top: -9px; clip-path: inset(50% 0 0 0); }
.ticket::after { bottom: -9px; clip-path: inset(0 0 50% 0); }
.ticket .wd { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.ticket .d { font-size: 26px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.ticket .my { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ticket .body { padding: 12px 14px 12px 18px; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.ticket .body .t1 { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket .body .t2 { color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perf { border: 0; border-top: 2px dashed var(--line); margin: 18px 0; }

/* ---------- Projekt-Karten ---------- */
.pcard { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.pcard:hover { border-color: var(--line); box-shadow: var(--shadow); }
.pcard .k { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.pcard h3 { font-size: 18px; }
.pcard .sub { color: var(--ink-3); font-size: 13px; }
.pcard .foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; padding-top: 10px; border-top: 2px dashed var(--line-2); font-size: 12px; color: var(--ink-3); }
.bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }

/* ---------- Tourbuch (Termin) ---------- */
.dayhead { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; background: #1d1d1f; color: #f5f5f7; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; }
.dayhead a { color: inherit; text-decoration: none; opacity: .7; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dayhead a:hover { opacity: 1; }
.dayhead .now { text-align: center; font-size: 20px; font-weight: 700; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.dayhead .now .art { font-size: 12px; letter-spacing: .1em; padding: 2px 8px; border-radius: 5px; background: rgba(255,255,255,.2); }
.dayhead .nx { text-align: right; }
.tb-cols { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,.85fr) minmax(0,1.35fr) minmax(0,1fr); gap: 14px; align-items: start; }
.tb-tools { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 0 0 16px; }
.stat3 { display: grid; grid-template-columns: 1fr; gap: 0; }
.stat3 label { display: grid; grid-template-columns: 6px 118px 1fr; align-items: center; gap: 0 10px; padding: 6px 12px 6px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.stat3 label:first-child { border-top: 0; }
.stat3 i { align-self: stretch; border-radius: 0 3px 3px 0; background: var(--bad); }
.stat3 i.in_arbeit { background: var(--warn); } .stat3 i.fertig { background: var(--ok); } .stat3 i.na { background: var(--line); }
.stat3 select { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 28px; padding: 2px 4px; background: transparent; }
.konv { max-height: 260px; overflow: auto; }
.konv .m { padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.konv .m .who { font-size: 11px; color: var(--ink-3); }
.todo label { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; font-size: 13.5px; }
.todo label.done span { text-decoration: line-through; color: var(--ink-3); }
.tb-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.blk { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.blk-h { display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--line-2); }
.blk-h .t { flex: 1; }
.blk-h .iconbtn { width: 28px; height: 28px; }
.blk-h .iconbtn svg { width: 16px; height: 16px; }
.blk.leer .blk-h { border-bottom: 0; color: var(--ink-3); }
.blk-b { padding: 10px 12px; font-size: 13.5px; }
.blk-b .kv { grid-template-columns: 96px 1fr; font-size: 13.5px; }
.zeitplan .z { display: grid; grid-template-columns: 52px 1fr; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line-2); }
.zeitplan .z:last-child { border-bottom: 0; }
.zeitplan .z b { font-variant-numeric: tabular-nums; }
.pre { white-space: pre-wrap; }

/* ---------- Grid (Routing) ---------- */
.rgrid { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.rgrid th, .rgrid td { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.rgrid thead th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); padding: 4px 0; min-width: 34px; text-align: center; font-weight: 700; }
.rgrid thead th.we { background: var(--surface-3); }
.rgrid thead th .wd { display: block; font-size: 10px; color: var(--ink-3); font-weight: 400; }
.rgrid th.city { position: sticky; left: 0; z-index: 3; background: var(--surface); text-align: left; padding: 6px 10px; min-width: 220px; max-width: 260px; font-weight: 400; }
.rgrid th.city b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rgrid th.city span { color: var(--ink-3); font-size: 11px; }
.rgrid td { width: 34px; height: 34px; text-align: center; cursor: pointer; padding: 0; font-weight: 700; }
.rgrid td:hover { outline: 2px solid var(--focus); outline-offset: -2px; }
.rgrid td.frei { background: var(--st-frei); color: var(--st-frei-ink); }
.rgrid td.option { background: var(--st-opt); color: var(--st-opt-ink); }
.rgrid td.belegt { background: var(--st-bel); color: var(--st-bel-ink); }
.rgrid td.unbekannt { background: var(--st-unb); color: var(--st-unb-ink); }
/* Verfuegbarkeit als Pille, Auswahlfeld und Legende */
.stn { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px; border-radius: 10px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.s-frei { background: var(--st-frei); color: var(--st-frei-ink); }
.s-option { background: var(--st-opt); color: var(--st-opt-ink); }
.s-belegt { background: var(--st-bel); color: var(--st-bel-ink); }
.s-unbekannt { background: var(--st-unb); color: var(--st-unb-ink); }
select.stsel { font-weight: 700; border-color: transparent; }
select.stsel.s-frei { background-color: var(--st-frei); color: var(--st-frei-ink); }
select.stsel.s-option { background-color: var(--st-opt); color: var(--st-opt-ink); }
select.stsel.s-belegt { background-color: var(--st-bel); color: var(--st-bel-ink); }
select.stsel.s-unbekannt { background-color: var(--st-unb); color: var(--st-unb-ink); }
select.stsel option { background: var(--surface); color: var(--ink); font-weight: 400; }
.list > li.click { cursor: pointer; }
.list > li.click:hover { background: var(--hover); }
.list > li.sel { background: var(--sel); box-shadow: inset 3px 0 0 var(--focus); }
.subnav .cnt { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--st-bel); color: var(--st-bel-ink); font-size: 11px; font-weight: 700; }
[hidden] { display: none !important; }
.rgrid td.gewaehlt { background: var(--ink); color: var(--surface); }
.rgrid td.we { background-image: linear-gradient(var(--hover), var(--hover)); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); align-items: center; }
.legend i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 4px; margin-right: 5px; font-style: normal; font-weight: 700; font-size: 11px; vertical-align: -4px; }

/* ---------- Sheet (Dialog) ---------- */
dialog.sheet { border: 0; padding: 0; border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3);
  width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; }
dialog.sheet:not([open]) { display: none; }
dialog.sheet.wide { width: min(1080px, calc(100vw - 32px)); }
dialog.sheet::backdrop { background: rgba(0,0,0,.35); }
.sheet-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.sheet-h h2 { font-size: 17px; flex: 1; }
.sheet-b { padding: 16px 18px; overflow: auto; flex: 1; }
.sheet-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line-2); align-items: center; }
.sheet-f .grow { flex: 1; }

/* Palette (Suche) */
.palette .sheet-b { padding: 0; }
.palette input { border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; font-size: 17px; padding: 14px 18px; width: 100%; background: transparent; outline: none; }
.palette .res a { display: flex; gap: 10px; align-items: center; padding: 9px 18px; text-decoration: none; }
.palette .res a:hover, .palette .res a.sel { background: var(--sel); }
.palette .res .k { font-size: 11px; color: var(--ink-3); width: 76px; flex: none; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }

/* Toast */
#toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow); pointer-events: auto; max-width: min(640px, 92vw); }
.toast.bad { background: var(--bad); color: #fff; }

/* Leer / Laden */
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty h3 { color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }
.skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; margin: 10px 0; }
@keyframes sk { to { background-position: -200% 0; } }
.note { padding: 10px 12px; border-radius: 8px; background: var(--info-bg); color: var(--ink-2); font-size: 13px; }
.note.warn { background: var(--warn-bg); }
.note.bad { background: var(--bad-bg); }
details.debug { margin-top: 10px; font-size: 12px; }
details.debug pre { white-space: pre-wrap; background: var(--surface-2); padding: 10px; border-radius: 8px; max-height: 320px; overflow: auto; }

/* Menue (Popover) */
.menu { position: absolute; z-index: 200; min-width: 200px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; }
.menu button, .menu a { display: flex; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 6px; cursor: pointer; text-decoration: none; font-size: 13.5px; }
.menu button:hover, .menu a:hover { background: var(--sel); }
.menu .sep { height: 1px; background: var(--line-2); margin: 4px 0; }

/* Layout-Helfer */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.split3 { display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.version { position: fixed; left: 10px; bottom: 6px; font-size: 10px; color: var(--ink-3); z-index: 5; }

/* Druck (Vertrag, Rechnung, Daysheet) */
.paper { background: #fff; color: #111; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 18mm 18mm 20mm; box-shadow: var(--shadow); font-size: 10pt; line-height: 1.5; }
.paper h1 { font-size: 17pt; margin-bottom: 4px; }
.paper h2 { font-size: 11pt; margin: 14px 0 6px; }
.paper .phead { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 2px dashed #bbb; padding-bottom: 12px; margin-bottom: 16px; font-size: 8.5pt; color: #444; }
.paper .phead svg { width: 46px; height: 46px; }
.paper table { width: 100%; border-collapse: collapse; }
.paper td, .paper th { padding: 5px 6px; border-bottom: 1px solid #ddd; text-align: left; vertical-align: top; }
.paper [contenteditable]:hover { background: #fffbe6; }
.paper [contenteditable]:focus { outline: 1px dashed #999; background: #fffbe6; }
.paper .fill { border-bottom: 1px dotted #999; min-width: 40px; display: inline-block; }
.paper .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 40px; }
.paper .sign div { border-top: 1px solid #333; padding-top: 6px; font-size: 8.5pt; }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .topbar, .subnav, .noprint, .version, #toasts, .pagehead { display: none !important; }
  main#view { padding: 0; max-width: none; }
  .paper { box-shadow: none; margin: 0; width: auto; min-height: 0; }
  .split, .split3 { display: block; }
}

/* Responsiv */
@media (max-width: 1500px) { .tb-cols { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 1180px) { .tb-cols { grid-template-columns: repeat(2, minmax(0,1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .mainnav a { padding: 0 9px; font-size: 11.5px; }
  .searchbtn { min-width: 0; } .searchbtn span, .searchbtn kbd { display: none; }
  .brand small { display: none; }
  .g3, .g4, .g6 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .split3 { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar { gap: 8px; padding: 0 12px; overflow-x: auto; }
  .brand .bk { display: none; }
  main#view { padding: 12px 14px 80px; }
  .tb-cols, .g2 { grid-template-columns: 1fr; }
  .pagehead h1 { font-size: 23px; }
  .kv { grid-template-columns: 110px 1fr; }
  .subnav { overflow-x: auto; justify-content: flex-start; }
  .version { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
