/* Chronobill – Design-System */
:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --line: #e6e8ec;
  --line-2: #eef0f3;
  --text: #1d2330;
  --text-2: #5b6474;
  --text-3: #8b93a1;
  --accent: #ee6a1f;
  --accent-2: #f58a1f;
  --accent-soft: #fff1e8;
  --accent-text: #c4500f;
  --ink: #161b2e;
  --ok: #1f9d55;
  --ok-soft: #e7f6ee;
  --warn: #c98a00;
  --warn-soft: #fff6dc;
  --bad: #d93a3a;
  --bad-soft: #fdeceb;
  --info: #2f6fdd;
  --info-soft: #eaf1fd;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .16);
  --radius: 10px;
  --radius-sm: 7px;
  --side-w: 236px;
  --top-h: 56px;
  --font: "Segoe UI", system-ui, -apple-system, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", monospace;
  --ink-text: #ffffff;
  color-scheme: light;
}
/* Dunkles Theme: Anthrazit / Dunkelgrau statt Schwarz, helle Schrift */
:root[data-theme="dark"] {
  --bg: #26292e;
  --panel: #2f3338;
  --panel-2: #373b41;
  --line: #454a52;
  --line-2: #3b4047;
  --text: #eceef1;
  --text-2: #b9bfc8;
  --text-3: #8e95a0;
  --accent: #f07a33;
  --accent-soft: #4a3427;
  --accent-text: #ffa468;
  --ink: #eceef1;
  --ink-text: #1f2226;
  --ok: #3cbf72;
  --ok-soft: #27402f;
  --warn: #e0a82e;
  --warn-soft: #463d24;
  --bad: #f06363;
  --bad-soft: #4a2c2c;
  --info: #5c95f0;
  --info-soft: #2a3a52;
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 1px 3px rgba(0, 0, 0, .2);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
:root[data-theme="dark"] .btn:hover { border-color: #5a6069; }
:root[data-theme="dark"] .side, :root[data-theme="dark"] .top { background: #2b2f34; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
small, .muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }

/* ---------- Layout */
.app { display: grid; grid-template-columns: var(--side-w) 1fr; grid-template-rows: var(--top-h) 1fr; height: 100vh; }
.side { grid-row: 1 / 3; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; height: var(--top-h); padding: 0 18px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; color: var(--ink); flex: none; }
.brand img { width: 30px; height: 30px; }
.brand span b { color: var(--accent); font-weight: 700; }
.nav { padding: 6px 10px 20px; }
.nav-sec { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin: 16px 10px 6px; display: flex; justify-content: space-between; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--accent-text); }
.nav a .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 12px 18px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--line); }

.top { grid-column: 2; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.top .search { flex: 1; max-width: 420px; position: relative; }
.top .search input { padding-left: 34px; background: var(--panel-2); }
.top .search svg { position: absolute; left: 10px; top: 9px; color: var(--text-3); }
.search-results { position: absolute; top: 40px; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 420px; overflow: auto; z-index: 50; }
.search-results a { display: flex; gap: 10px; padding: 9px 12px; color: var(--text); border-bottom: 1px solid var(--line-2); text-decoration: none; }
.search-results a:hover, .search-results a.on { background: var(--panel-2); }
.search-results .t { font-size: 11px; color: var(--text-3); width: 70px; flex: none; padding-top: 1px; }
.top .spacer { flex: 1; }
.menu-btn { display: none; }

.main { grid-column: 2; overflow-y: auto; padding: 22px 26px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin-right: auto; }
.page-head .sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* ---------- Firmen-Umschalter: Farbe der aktiven Firma als Streifen oben */
.top { box-shadow: inset 0 3px 0 var(--co, var(--accent)); }
.co-switch { position: relative; flex: none; }
.co-btn { display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 12px 0 5px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel-2); cursor: pointer; color: var(--text); font-weight: 650; max-width: 260px; }
.co-btn:hover { border-color: var(--co, var(--accent)); }
.co-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-badge { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11.5px; font-weight: 750; flex: none; letter-spacing: .02em; text-shadow: 0 1px 1px rgba(0,0,0,.2); }
.co-badge.logo { background: #fff; border: 2px solid; overflow: hidden; }
.co-badge.logo img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.co-menu { position: absolute; top: 46px; left: 0; min-width: 290px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; }
.co-head { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 700; padding: 6px 8px; }
.co-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); text-align: left; font: inherit; text-decoration: none !important; }
.co-item:hover { background: var(--panel-2); }
.co-item.on { background: var(--accent-soft); font-weight: 650; }
.co-item .grow { flex: 1; }
.co-item kbd { font-size: 10.5px; color: var(--text-3); font-family: var(--mono); }

/* ---------- Timer im Kopf */
.timer { display: flex; align-items: center; gap: 0; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); height: 36px; padding: 0 4px 0 12px; }
.timer select { border: 0; background: transparent; height: 32px; padding: 0 6px; max-width: 170px; box-shadow: none; }
.timer input { border: 0; background: transparent; height: 32px; width: 180px; box-shadow: none; }
.timer .clock { font-family: var(--mono); font-weight: 600; min-width: 64px; text-align: center; color: var(--text); }
.timer.run { border-color: var(--ok); background: var(--ok-soft); }
.timer.run .clock { color: var(--ok); }
.timer .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.timer.paused { border-color: var(--warn); background: var(--warn-soft); }

/* ---------- Bausteine */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-h h2 { margin-right: auto; }
.card-b { padding: 16px 18px; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; justify-content: flex-end; }
.grid { display: grid; gap: 16px; }
.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)); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.g-side-wide { grid-template-columns: minmax(0, 1fr) minmax(380px, 46%); align-items: start; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }

.kpi { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.kpi .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.kpi .lab { font-size: 12px; color: var(--text-2); }
.kpi .val { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .hint { font-size: 11.5px; color: var(--text-3); }
.kpi a.kpi-link { color: inherit; text-decoration: none; display: contents; }
.ic.orange { background: var(--accent-soft); color: var(--accent); }
.ic.green { background: var(--ok-soft); color: var(--ok); }
.ic.red { background: var(--bad-soft); color: var(--bad); }
.ic.blue { background: var(--info-soft); color: var(--info); }
.ic.yellow { background: var(--warn-soft); color: var(--warn); }

/* ---------- Formulare */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); min-width: 0; }
label.f > span .req { color: var(--bad); }
label.f .help { font-weight: 400; color: var(--text-3); font-size: 11.5px; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=search], input[type=tel], input[type=url], input:not([type]), select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); outline: none; transition: border-color .12s, box-shadow .12s; min-width: 0;
}
textarea { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
input.money, input.r { text-align: right; font-variant-numeric: tabular-nums; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; color: var(--text); font-size: 13.5px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.fgrid { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fgrid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fgrid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fgrid .full { grid-column: 1 / -1; }
.fgrid .s2 { grid-column: span 2; }
.input-suffix { position: relative; }
.input-suffix input { padding-right: 46px; }
.input-suffix em { position: absolute; right: 10px; top: 9px; font-style: normal; color: var(--text-3); font-size: 12.5px; pointer-events: none; }
fieldset { border: 0; padding: 0; margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: none; padding: 0 12px; height: 34px; cursor: pointer; color: var(--text-2); font-weight: 500; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: var(--panel); }
:root[data-theme="dark"] .seg button.on { color: var(--ink-text); }

/* ---------- Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--panel-2); border-color: #d5d9e0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.pri { background: var(--ink); border-color: var(--ink); color: #fff; }
:root[data-theme="dark"] .btn.pri { color: var(--ink-text); }
.btn.pri:hover { filter: brightness(1.15); }
.btn.acc { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.acc:hover { filter: brightness(1.06); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn.round { border-radius: 999px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn.on { background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--ink); z-index: 1; }

/* ---------- Tabellen */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--panel-2); }
.tbl tr.sel td { background: var(--accent-soft); }
.tbl tr.group td { background: var(--panel-2); font-weight: 650; font-size: 12.5px; color: var(--text-2); padding: 7px 12px; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
.tbl .acts { text-align: right; white-space: nowrap; width: 1%; }
.tbl .acts .btn { opacity: .55; }
.tbl tr:hover .acts .btn { opacity: 1; }
.tbl .chk { width: 34px; }
.tbl input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.empty { padding: 40px 20px; text-align: center; color: var(--text-3); }
.empty svg.i { width: 34px; height: 34px; margin-bottom: 8px; opacity: .6; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }

/* ---------- Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; background: var(--panel-2); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.acc { background: var(--accent-soft); color: var(--accent-text); }
.badge.n { min-width: 20px; justify-content: center; padding: 0 6px; background: var(--accent); color: #fff; height: 19px; font-size: 11px; }

/* ---------- Toolbar & Filter */
.toolbar { display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .grow { flex: 1; min-width: 160px; }
.toolbar select, .toolbar input { width: auto; }
.toolbar .search-in { min-width: 220px; flex: 1; max-width: 340px; }
.range { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); }
.range button { border: 0; background: none; height: 34px; width: 32px; cursor: pointer; color: var(--text-2); }
.range button:hover { background: var(--panel-2); }
.range select { border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 0; height: 34px; width: auto; box-shadow: none; }
.range input[type=date] { border: 0; height: 34px; width: 140px; box-shadow: none; }
.bulkbar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--ink); color: var(--ink-text); border-radius: var(--radius); position: sticky; bottom: 14px; margin-top: 12px; box-shadow: var(--shadow-lg); flex-wrap: wrap; }
.bulkbar .btn { height: 32px; }

/* ---------- Kalender */
.cal { display: flex; flex-direction: column; height: calc(100vh - var(--top-h) - 140px); min-height: 520px; }
.cal-head { display: grid; border-bottom: 1px solid var(--line); background: var(--panel); position: relative; z-index: 2; }
.cal-head div { padding: 8px 4px; text-align: center; font-size: 12.5px; color: var(--text-2); border-left: 1px solid var(--line-2); }
.cal-head div b { display: block; color: var(--text); font-weight: 600; }
.cal-head div.today b { color: var(--accent); }
.cal-head .wk { font-size: 11px; color: var(--text-3); display: flex; align-items: center; justify-content: center; }
.cal-body { flex: 1; overflow-y: auto; position: relative; }
.cal-grid { display: grid; position: relative; }
.cal-times div { height: 48px; font-size: 11px; color: var(--text-3); text-align: right; padding: 0 6px; transform: translateY(-7px); }
.cal-col { position: relative; border-left: 1px solid var(--line-2); cursor: crosshair; user-select: none; }
.cal-col.we { background: var(--panel-2); }
.cal-col.today { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.cal-col .slot { height: 24px; border-bottom: 1px solid var(--line-2); }
.cal-col .slot:nth-child(2n) { border-bottom-color: var(--line); }
.cal-ev { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 6px; font-size: 11.5px; line-height: 1.3; overflow: hidden; cursor: pointer; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.15); border-left: 3px solid rgba(0,0,0,.18); z-index: 1; }
.cal-ev b { display: block; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev span { opacity: .92; }
.cal-ev.ghost { background: var(--accent) !important; opacity: .5; pointer-events: none; }
.cal-ev.running { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.18) 0 6px, transparent 6px 12px); }
.cal-ev .rs { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; cursor: ns-resize; }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.month { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); }
.month .d { min-height: 104px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 6px; cursor: pointer; }
.month .d:hover { background: var(--panel-2); }
.month .d.off { color: var(--text-3); background: var(--panel-2); }
.month .d.today .n { background: var(--accent); color: #fff; border-radius: 999px; padding: 0 7px; }
.month .d .n { font-size: 12px; font-weight: 600; }
.month .d .tot { float: right; font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.month .d .it { font-size: 11px; border-radius: 4px; padding: 1px 5px; margin-top: 3px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Seitenleiste Übersicht */
.side-panel .start { width: 100%; height: 46px; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; border-radius: var(--radius-sm); }
.stat3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.stat3 > div { padding: 12px 14px; border-left: 1px solid var(--line); }
.stat3 > div:first-child { border-left: 0; }
.stat3 .lab { font-size: 12px; color: var(--text-2); }
.stat3 .val { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 18, 28, .45); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 6vh 16px 16px; overflow-y: auto; animation: fade .12s; }
.modal { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 620px; animation: pop .14s ease-out; }
.modal.wide { max-width: 900px; }
.modal.xwide { max-width: 1200px; }
.modal-h { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin-right: auto; font-size: 17px; }
.modal-b { padding: 18px 20px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--panel-2); border-radius: 0 0 14px 14px; flex-wrap: wrap; }
.modal-f .left { margin-right: auto; display: flex; gap: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* ---------- Toast */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 380px; animation: pop .16s; font-weight: 500; }
:root[data-theme="dark"] .toast { color: var(--ink-text); }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* ---------- Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; color: var(--text-2); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; display: inline-flex; gap: 7px; align-items: center; }
.tabs .on { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- Dokument-Editor */
.items { width: 100%; border-collapse: collapse; }
.items th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); text-align: left; padding: 6px 4px; font-weight: 700; }
.items td { padding: 4px; vertical-align: top; border-top: 1px solid var(--line-2); }
.items input, .items textarea, .items select { height: 32px; font-size: 13px; }
.items textarea { min-height: 32px; height: 32px; padding: 6px 8px; margin-top: 4px; font-size: 12.5px; color: var(--text-2); }
.items .drag { cursor: grab; color: var(--text-3); padding-top: 8px; text-align: center; width: 22px; }
.items tr.dragging { opacity: .4; }
.totals { margin-left: auto; width: 300px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; font-variant-numeric: tabular-nums; }
.totals .big { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 8px; font-size: 17px; font-weight: 700; }
.pdf-frame { width: 100%; height: calc(100vh - 170px); min-height: 600px; border: 1px solid var(--line); border-radius: var(--radius); background: #525659; }
.sticky-preview { position: sticky; top: 0; }
.doc-status { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Beleg-Erfassung */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--text-2); cursor: pointer; transition: border-color .12s, background .12s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { color: var(--text); }
.receipt-view { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); min-height: 420px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.receipt-view img { max-width: 100%; max-height: 70vh; display: block; }
.receipt-view iframe { width: 100%; height: 70vh; border: 0; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.thumb { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); cursor: pointer; position: relative; }
.thumb .im { height: 150px; background: var(--panel-2) center/cover no-repeat; display: grid; place-items: center; color: var(--text-3); }
.thumb .cap { padding: 7px 9px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb:hover { border-color: var(--accent); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-box { background: linear-gradient(135deg, var(--accent-soft), var(--info-soft)); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 10px; align-items: center; }

/* ---------- Charts */
.chart { width: 100%; display: block; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .grid-l { stroke: var(--line-2); }
.chart .axis { stroke: var(--line); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); justify-content: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tip { position: fixed; pointer-events: none; background: var(--ink); color: #fff; padding: 6px 9px; border-radius: 7px; font-size: 12px; z-index: 300; white-space: nowrap; box-shadow: var(--shadow-lg); }
:root[data-theme="dark"] .tip { color: var(--ink-text); }
.bar-list .bl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 7px 0; font-size: 13px; }
.bar-list .bl .track { grid-column: 1 / -1; height: 7px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar-list .bl .track i { display: block; height: 100%; border-radius: 99px; }

/* ---------- USt-VA */
.kz { display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 6px; border-radius: 6px; background: var(--ink); color: #fff; font-family: var(--mono); font-weight: 700; font-size: 12.5px; }
:root[data-theme="dark"] .kz { color: var(--ink-text); }
.ustva-total { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; background: var(--accent-soft); border-radius: var(--radius); font-size: 15px; }
.ustva-total b { font-size: 22px; }
.copy { cursor: copy; border-bottom: 1px dashed var(--text-3); }

/* ---------- Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, var(--info-soft), transparent 60%), var(--bg); }
.auth .box { width: 100%; max-width: 410px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 30px 30px 26px; }
.auth .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth .logo img { width: 46px; height: 46px; }
.auth .logo div { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.auth .logo small { display: block; font-size: 12.5px; font-weight: 500; }
.auth form { display: flex; flex-direction: column; gap: 14px; }
.auth .btn { height: 42px; }
.code-input { font-family: var(--mono); font-size: 26px !important; letter-spacing: .4em; text-align: center; height: 52px !important; }
.qr { display: grid; place-items: center; padding: 10px; background: #fff; border-radius: 10px; border: 1px solid var(--line); }
.qr img, .qr svg { width: 190px; height: 190px; image-rendering: pixelated; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: var(--mono); background: var(--panel-2); padding: 12px; border-radius: 8px; font-size: 14px; text-align: center; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps i { flex: 1; height: 4px; border-radius: 9px; background: var(--line); }
.steps i.on { background: var(--accent); }

/* ---------- Mobile */
.mob-nav { display: none; }
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-side, .g-side-wide { grid-template-columns: 1fr; }
  .timer input { width: 120px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: var(--top-h) 1fr 62px; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 90; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .app.nav-open .side { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 80; }
  .top { grid-column: 1; padding: 0 12px; gap: 8px; }
  .top .search { display: none; }
  .co-name { display: none; }
  .co-btn { padding: 0 8px 0 4px; }
  .menu-btn { display: inline-flex; }
  .main { grid-column: 1; padding: 16px 14px 40px; }
  .g2, .g3, .g4, .fgrid, .fgrid.c3, .fgrid.c4 { grid-template-columns: 1fr; }
  .fgrid .s2 { grid-column: auto; }
  .timer input { display: none; }
  .timer select { max-width: 110px; }
  .mob-nav { display: grid; grid-template-columns: repeat(5, 1fr); grid-column: 1; background: var(--panel); border-top: 1px solid var(--line); z-index: 30; }
  .mob-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10.5px; color: var(--text-2); text-decoration: none; }
  .mob-nav a.on { color: var(--accent); }
  .mob-nav a.cam { color: #fff; }
  .mob-nav a.cam span.c { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; margin-top: -20px; box-shadow: var(--shadow-lg); }
  .cal { height: auto; }
  .modal-bg { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
  .totals { width: 100%; }
  .hide-m { display: none !important; }
  .tbl th, .tbl td { padding: 8px 8px; }
}
@media print {
  .side, .top, .mob-nav, .no-print, .toolbar, .page-head .btn { display: none !important; }
  .app { display: block; height: auto; }
  .main { padding: 0; overflow: visible; }
  .card { box-shadow: none; border: 0; }
  body { background: #fff; }
}
