/* =========================================================
   Werkstatt – Kassenbuch & Kalender
   Helles, modernes Layout mit Dunkelmodus
   ========================================================= */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f4;
  --line: #e3e6ec;
  --line-strong: #d3d8e0;
  --text: #15181e;
  --text-2: #4b5260;
  --muted: #7a8291;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #e8eefe;
  --on-primary: #ffffff;
  --in: #0f8a4c;
  --in-soft: #e5f6ec;
  --out: #d13a2f;
  --out-soft: #fdecea;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --now: #e11d48;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 6px 16px rgba(16, 24, 40, .06);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --hour: 52px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014; --surface: #161920; --surface-2: #1b1f27; --surface-3: #222732;
    --line: #262b36; --line-strong: #323846; --text: #eceef2; --text-2: #b8bfcc; --muted: #8790a0;
    --primary: #5b8cff; --primary-hover: #7aa2ff; --primary-soft: #1b2744; --on-primary: #0b1020;
    --in: #34c77b; --in-soft: #12291d; --out: #ff6b5e; --out-soft: #331816; --warn: #f0a548; --warn-soft: #2e2213;
    --now: #ff4d6d;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1014; --surface: #161920; --surface-2: #1b1f27; --surface-3: #222732;
  --line: #262b36; --line-strong: #323846; --text: #eceef2; --text-2: #b8bfcc; --muted: #8790a0;
  --primary: #5b8cff; --primary-hover: #7aa2ff; --primary-soft: #1b2744; --on-primary: #0b1020;
  --in: #34c77b; --in-soft: #12291d; --out: #ff6b5e; --out-soft: #331816; --warn: #f0a548; --warn-soft: #2e2213;
  --now: #ff4d6d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-in { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 10px 20px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { border-radius: 9px; flex: none; }
.brand strong { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand span { display: block; font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 4px; background: var(--surface-3); padding: 4px; border-radius: 12px; margin-left: 12px; }
.tab {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; cursor: pointer;
  color: var(--text-2); font-weight: 600; display: inline-flex; align-items: center; gap: 7px;
}
.tab svg { width: 17px; height: 17px; }
.tab[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.spacer { flex: 1; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  display: inline-grid; place-items: center; cursor: pointer; color: var(--text-2); flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center;
  font-weight: 700; font-size: 14px; color: #fff; border: 0; cursor: pointer; flex: none;
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* Untere Navigation (Handy) */
.bottomnav { display: none; }

main.page { max-width: 1280px; margin: 0 auto; padding: 22px 20px 60px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  padding: 9px 15px; border-radius: 10px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .12s, border-color .12s, transform .06s; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.in { background: var(--in); border-color: var(--in); color: #fff; }
.btn.out { background: var(--out); border-color: var(--out); color: #fff; }
.btn.danger { color: var(--out); border-color: color-mix(in srgb, var(--out) 40%, var(--line)); }
.btn.danger:hover { background: var(--out-soft); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.big { padding: 14px 18px; font-size: 16px; border-radius: 12px; width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- Karten ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2 { font-size: 16px; }

/* ---------- Kasse ---------- */
.cash-top { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 16px; }
.balance-card { padding: 22px 24px; position: relative; overflow: hidden; }
.balance-card .label { color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.balance-card .amount { font-size: clamp(34px, 6vw, 48px); font-weight: 800; letter-spacing: -.02em; margin: 6px 0 4px; }
.balance-card .amount.neg { color: var(--out); }
.balance-card .sub { color: var(--text-2); font-size: 13px; }
.balance-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.balance-actions .btn { padding: 14px; font-size: 16px; border-radius: 12px; }
.balance-actions .btn svg { width: 20px; height: 20px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 18px; align-content: start; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .v { font-size: 20px; font-weight: 750; margin-top: 2px; }
.stat.in .v { color: var(--in); }
.stat.out .v { color: var(--out); }
.stat.wide { grid-column: 1 / -1; }
.catbars { display: grid; gap: 7px; margin-top: 6px; }
.catbar { display: grid; grid-template-columns: minmax(80px, 130px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.catbar .bar { height: 8px; border-radius: 6px; background: var(--surface-3); overflow: hidden; display: flex; }
.catbar .bar i { display: block; height: 100%; }
.catbar .bar i.in { background: var(--in); }
.catbar .bar i.out { background: var(--out); }
.catbar .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.period { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.period button { border: 0; background: transparent; padding: 8px 10px; cursor: pointer; color: var(--text-2); display: grid; place-items: center; }
.period button svg { width: 16px; height: 16px; }
.period .lbl { min-width: 128px; text-align: center; font-weight: 650; padding: 0 4px; }
.select, .input {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 8px 12px; min-height: 38px;
}
.input.search { min-width: 160px; flex: 1; }

.entries { list-style: none; margin: 0; padding: 0; }
.day-head {
  position: sticky; top: 62px; z-index: 2; background: var(--surface-2); border-bottom: 1px solid var(--line);
  padding: 7px 18px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
}
.entry { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.entry:hover { background: var(--surface-2); }
.entry .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.entry .ico svg { width: 20px; height: 20px; }
.entry.in .ico { background: var(--in-soft); color: var(--in); }
.entry.out .ico { background: var(--out-soft); color: var(--out); }
.entry .t { font-weight: 650; }
.entry .m { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .main { min-width: 0; }
.entry .amt { text-align: right; font-weight: 750; font-size: 16px; }
.entry.in .amt { color: var(--in); }
.entry.out .amt { color: var(--out); }
.entry .after { font-size: 12px; color: var(--muted); font-weight: 500; }
.entry.cancelled .t, .entry.cancelled .amt { text-decoration: line-through; opacity: .55; }
.entry.cancelled .ico { opacity: .5; }
.entry.opening { cursor: default; }
.entry.opening .ico { background: var(--primary-soft); color: var(--primary); }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 20px; background: var(--surface-3); color: var(--text-2); vertical-align: 1px; margin-left: 6px; text-decoration: none; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: 6px; }

/* ---------- Kalender ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-title { font-size: 20px; font-weight: 750; }
.cal-title small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.seg { display: inline-flex; background: var(--surface-3); padding: 3px; border-radius: 10px; gap: 2px; }
.seg button, .seg label { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--text-2); display: inline-flex; gap: 6px; align-items: center; }
.seg button[aria-pressed="true"], .seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg input[type=radio] { display: none; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px;
  color: var(--text-2); user-select: none; transition: background .12s, border-color .12s;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { border-color: var(--c, var(--primary)); background: color-mix(in srgb, var(--c, var(--primary)) 14%, var(--surface)); color: var(--text); }
.chip .dot { background: var(--c, var(--primary)); }
.chip { white-space: nowrap; }
.chip svg { width: 16px; height: 16px; }
.chip.add { border-style: dashed; }

.status-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-bottom: 12px; }
.status {
  display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line); border-left: 4px solid var(--c); cursor: pointer; text-align: left;
}
.status .n { font-weight: 650; font-size: 14px; }
.status .s { font-size: 12px; }
.status .s.free { color: var(--in); font-weight: 650; }
.status .s.busy { color: var(--out); font-weight: 650; }

.cal-wrap { overflow: hidden; }
.cal-scroll { overflow: auto; max-height: calc(100vh - 290px); min-height: 380px; position: relative; overscroll-behavior: contain; }
.cal-grid { display: grid; grid-template-columns: 56px repeat(var(--cols), minmax(var(--colmin, 0px), 1fr)); min-width: 100%; }
.cal-head { position: sticky; top: 0; z-index: 6; background: var(--surface); border-bottom: 1px solid var(--line); }
.cal-head.corner { left: 0; z-index: 7; }
.cal-colhead { padding: 8px 6px; text-align: center; border-left: 1px solid var(--line); cursor: pointer; }
.cal-colhead .wd { font-size: 12px; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.cal-colhead .d { font-size: 20px; font-weight: 750; line-height: 1.15; }
.cal-colhead.today .d { color: var(--on-primary); background: var(--primary); border-radius: 10px; display: inline-block; padding: 0 8px; }
.cal-colhead.res { display: flex; align-items: center; justify-content: center; gap: 7px; font-weight: 700; font-size: 14px; padding: 12px 6px; cursor: default; }
.cal-times { position: sticky; left: 0; z-index: 4; background: var(--surface); }
.cal-time { height: var(--hour); font-size: 11px; color: var(--muted); text-align: right; padding-right: 8px; transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.cal-col { position: relative; border-left: 1px solid var(--line); cursor: copy;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(color-mix(in srgb, var(--line) 50%, transparent) 1px, transparent 1px);
  background-size: 100% var(--hour), 100% calc(var(--hour) / 2);
}
.cal-col.today { background-color: color-mix(in srgb, var(--primary) 4%, transparent); }
.cal-col.weekend { background-color: var(--surface-2); }
.ev {
  position: absolute; border-radius: 8px; padding: 4px 6px; overflow: hidden; cursor: pointer;
  background: color-mix(in srgb, var(--c) 17%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-left: 4px solid var(--c); font-size: 12px; line-height: 1.25; color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform .08s;
}
.ev:hover { z-index: 5; transform: scale(1.01); box-shadow: var(--shadow); }
.ev b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { display: block; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.mine { box-shadow: inset 0 0 0 1px var(--c), var(--shadow-sm); }
.ev.short b { display: inline; } .ev.short span { display: inline; margin-left: 4px; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--now); z-index: 4; pointer-events: none; }
.now-line.nd::before { display: none; }
.now-line::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ---------- Verwaltung ---------- */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-grid .span2 { grid-column: 1 / -1; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .t { font-weight: 650; }
.row .m { font-size: 13px; color: var(--muted); }
.row.inactive { opacity: .55; }

/* ---------- Formulare ---------- */
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 650; color: var(--text-2); }
.form input:not([type=checkbox]):not([type=radio]):not([type=color]), .form select, .form textarea {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 10px; padding: 10px 12px; font-size: 16px; font-weight: 400; color: var(--text); width: 100%;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.form .check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14px; color: var(--text); }
.form .check input { width: 18px; height: 18px; accent-color: var(--primary); }
.form input[type=color] { width: 46px; height: 40px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 3px; background: var(--surface); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.amount-input { position: relative; }
.amount-input input { font-size: 34px !important; font-weight: 750 !important; padding: 12px 52px 12px 16px !important; text-align: right; font-variant-numeric: tabular-nums; }
.amount-input .cur { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 26px; font-weight: 700; color: var(--muted); }
.dir-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dir-switch button { padding: 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--text-2); }
.dir-switch button svg { width: 18px; height: 18px; }
.dir-switch button.in[aria-pressed="true"] { border-color: var(--in); background: var(--in-soft); color: var(--in); }
.dir-switch button.out[aria-pressed="true"] { border-color: var(--out); background: var(--out-soft); color: var(--out); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button { border: 1px solid var(--line-strong); background: var(--surface-2); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); }
.quick button:hover { background: var(--surface-3); color: var(--text); }
.alert { background: var(--out-soft); color: var(--out); padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.note-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.note-box ol { margin: 6px 0 0; padding-left: 20px; }
.note-box li { margin: 3px 0; }
.copyrow { display: flex; gap: 8px; }
.copyrow input { flex: 1; font-family: var(--mono); font-size: 12px !important; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 0; display: grid; gap: 12px; }
legend { font-weight: 700; padding: 0 6px; }

/* ---------- Dialog / Sheet ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(10, 14, 22, .45); display: grid; place-items: center; padding: 20px;
  animation: fade .15s ease;
}
.sheet {
  width: min(520px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: 18px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: pop .18s ease;
}
.sheet.wide { width: min(680px, 100%); }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 6px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.sheet-head h2 { font-size: 18px; flex: 1; }
.sheet-body { padding: 10px 18px 18px; }
.sheet-foot { display: flex; gap: 10px; padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
.sheet-foot .grow { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes up { from { transform: translateY(100%); } }

.menu { position: absolute; right: 16px; top: 58px; width: 280px; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; animation: pop .14s ease; }
.menu .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu .who b { display: block; }
.menu button.item { display: flex; width: 100%; gap: 10px; align-items: center; border: 0; background: transparent; padding: 10px 12px; border-radius: 9px; cursor: pointer; text-align: left; font-weight: 550; }
.menu button.item:hover { background: var(--surface-2); }
.menu button.item svg { width: 18px; height: 18px; color: var(--muted); }
.menu .theme-row { padding: 8px 12px; display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 650; }
.menu .seg { width: 100%; } .menu .seg button { flex: 1; justify-content: center; padding: 6px 4px; font-size: 13px; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 80; display: grid; gap: 8px; pointer-events: none; width: min(420px, calc(100% - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: 11px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; font-size: 14px; animation: pop .18s ease; }
.toast.err { background: var(--out); color: #fff; }

/* ---------- Anmeldung / Installation ---------- */
.login, body.install { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card, .install-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 28px; }
.install-card { width: min(640px, 100%); }
.login-card .brand, .install-card .brand { margin-bottom: 20px; }
.login-card h1, .install-card h1 { font-size: 22px; margin-bottom: 6px; }
.install-card p { color: var(--text-2); }
.install-card .warn { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 10px; }
.install-card .form > .btn { margin-top: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .cash-top { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  .topbar-in { padding: 8px 14px; }
  .tabs { display: none; }
  main.page { padding: 14px 12px calc(96px + env(safe-area-inset-bottom)); }
  .bottomnav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav button { border: 0; background: transparent; display: grid; justify-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 650; color: var(--muted); cursor: pointer; border-radius: 10px; }
  .bottomnav button svg { width: 24px; height: 24px; }
  .bottomnav button[aria-current="page"] { color: var(--primary); }
  .overlay { place-items: end center; padding: 0; }
  .sheet, .sheet.wide { width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; animation: up .22s cubic-bezier(.2, .8, .2, 1); border-bottom: 0; }
  .grid2 { grid-template-columns: 1fr; }
  .grid2.keep { grid-template-columns: 1fr 1fr; }
  .card-head { padding: 12px 14px; }
  .entry { padding: 11px 14px; grid-template-columns: 36px 1fr auto; gap: 10px; }
  .entry .ico { width: 36px; height: 36px; border-radius: 10px; }
  .day-head { top: 55px; padding: 6px 14px; }
  .stats { padding: 14px; gap: 10px; }
  .cal-scroll { max-height: none; height: calc(100dvh - 262px); min-height: 400px; }
  .cal-toolbar { gap: 8px; margin-bottom: 10px; }
  .cal-toolbar .spacer { display: none; }
  .cal-toolbar .cal-title { flex: 1; min-width: 150px; }
  .cal-toolbar .seg { order: 3; }
  .cal-toolbar [data-add] { order: 4; flex: 1; }
  .cal-chips, .status-strip {
    display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-left: -12px; margin-right: -12px; padding: 0 12px 2px; margin-bottom: 10px !important;
  }
  .cal-chips::-webkit-scrollbar, .status-strip::-webkit-scrollbar { display: none; }
  .cal-chips .chip { flex: none; padding: 6px 11px; font-size: 13px; }
  .status { flex: 0 0 auto; min-width: 148px; max-width: 200px; padding: 7px 10px; }
  .cal-colhead.res { font-size: 13px; padding: 10px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
  .cal-colhead.res .dot { margin-right: 5px; vertical-align: 0; }
  .cal-colhead .d { font-size: 17px; }
  .legend { display: none; }
  .cal-title { font-size: 17px; }
  .status-strip { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .menu { right: 8px; left: 8px; width: auto; }
  .hide-sm { display: none !important; }
  .row { padding: 11px 14px; }
}
@media (min-width: 721px) { .show-sm { display: none !important; } }
@media print {
  .topbar, .bottomnav, .toolbar, .balance-actions, #toasts { display: none !important; }
  .card { box-shadow: none; }
}
