/* Umsatz-Dashboard: SaaS layout (sidebar on desktop, tab bar on phone), neutral palette with Minimatch sage as accent. */
:root {
  --bg: #F6F6F4; --surface: #FFFFFF; --sunken: #F1F1EE; --line: #E6E6E2; --line-strong: #D5D5CF;
  --text: #121413; --muted: #636965; --faint: #8A908C;
  --accent: #465C4A; --accent-soft: #E3ECE3; --accent-mid: #A6BFA6;
  --good: #2F7A47; --good-soft: #E2F1E6; --bad: #B4442F; --bad-soft: #F8E6E1; --warn-soft: #F5EEDC; --warn: #8A6414;
  --on-accent: #FFFFFF; --bar: #1F2421;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0D0F0E; --surface: #151816; --sunken: #1B1F1C; --line: #252A27; --line-strong: #323833;
  --text: #ECEFEC; --muted: #A2AAA4; --faint: #7D857F;
  --accent: #A6BFA6; --accent-soft: #223026; --accent-mid: #5E7A62;
  --good: #7FCB95; --good-soft: #1B2E21; --bad: #EE8F7B; --bad-soft: #3A1F19; --warn-soft: #2F2817; --warn: #E2C16E;
  --on-accent: #0D0F0E; --bar: #DDE3DE; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0D0F0E; --surface: #151816; --sunken: #1B1F1C; --line: #252A27; --line-strong: #323833;
  --text: #ECEFEC; --muted: #A2AAA4; --faint: #7D857F;
  --accent: #A6BFA6; --accent-soft: #223026; --accent-mid: #5E7A62;
  --good: #7FCB95; --good-soft: #1B2E21; --bad: #EE8F7B; --bad-soft: #3A1F19; --warn-soft: #2F2817; --warn: #E2C16E;
  --on-accent: #0D0F0E; --bar: #DDE3DE; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
svg { display: block; }
button { font: inherit; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100svh; }
.side { position: sticky; top: 0; height: 100svh; border-right: 1px solid var(--line); background: var(--surface); padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 650; font-size: 15px; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.navgrp { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 14px 10px 6px; }
.nav { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; color: var(--muted); padding: 0 10px; min-height: 36px; border-radius: 8px; cursor: pointer; text-align: left; font-weight: 500; text-decoration: none; }
.nav:hover { background: var(--sunken); color: var(--text); }
.nav[aria-current="page"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav svg { width: 17px; height: 17px; flex: none; }
.side .spacer { flex: 1; }
.side .foot { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.side .stand { font-size: 12px; color: var(--muted); padding: 4px 10px 8px; }

main { min-width: 0; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.top .meta { display: flex; align-items: center; gap: 8px; }
.top .stand-m { display: none; font-size: 12px; color: var(--muted); }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 8px; min-height: 36px; padding: 0 12px; font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--sunken); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 15px; height: 15px; }
.content { padding: 24px 28px 64px; max-width: 1240px; display: flex; flex-direction: column; gap: 20px; }
.view { display: flex; flex-direction: column; gap: 20px; }

.notice { display: flex; gap: 10px; align-items: flex-start; border-radius: 10px; padding: 10px 14px; background: var(--warn-soft); color: var(--warn); font-size: 13px; font-weight: 500; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.panel h2 { margin: 0; font-size: 14px; font-weight: 600; }
.panel .hint { margin: 0; color: var(--muted); font-size: 12.5px; }
.lbl { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.val { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.val.sm { font-size: 22px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 2px 7px; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.chip.up { background: var(--good-soft); color: var(--good); }
.chip.dn { background: var(--bad-soft); color: var(--bad); }
.chip.ok { background: var(--good-soft); color: var(--good); }
.chip.wait { background: var(--sunken); color: var(--text); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

.row-2 { display: grid; gap: 20px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.row-even { display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Heute (Whop-style) */
.today-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 32px; align-items: end; }
.today-grid .sub { display: flex; flex-direction: column; gap: 2px; }
.today-grid .main { display: flex; flex-direction: column; gap: 6px; }

/* KPI strip (Stripe/Fresha) */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.kpi { padding: 16px 18px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi .val { font-size: 22px; }
.kpi .foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* Balance (Stripe-style) */
.bbar { display: flex; height: 10px; border-radius: 3px; overflow: hidden; background: var(--sunken); gap: 2px; }
.bbar span { display: block; height: 100%; }
.bbar .paid { background: var(--accent); } .bbar .due { background: var(--accent-mid); } .bbar .open { background: var(--line-strong); }
.brows { display: flex; flex-direction: column; }
.brow { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.brow:first-child { border-top: 0; }
.brow i { width: 10px; height: 10px; border-radius: 3px; }
.brow small { display: block; color: var(--muted); font-size: 12px; }
.brow b { font-weight: 600; white-space: nowrap; }

/* tables */
.tw { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t th:first-child, .t td:first-child { padding-left: 0; }
.t th:last-child, .t td:last-child { padding-right: 0; }
.t tr:last-child td { border-bottom: 0; }
.t .r { text-align: right; }
.t td.neg { color: var(--bad); }
.t tr.sum td { font-weight: 600; border-top: 1px solid var(--line-strong); }
.appcell { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.appcell small { font-weight: 500; }
.appcell i { width: 22px; height: 22px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 700; }
.share { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.share span { display: block; height: 6px; border-radius: 3px; background: var(--accent); }

/* charts (Midday-style) */
.chart { position: relative; min-height: 150px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--faint); font-family: var(--font); font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -115%); z-index: 2; }

/* statements */
.stmt { border-top: 1px solid var(--line); }
.stmt:first-child { border-top: 0; }
.stmt summary { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; cursor: pointer; min-height: 52px; }
.stmt summary::-webkit-details-marker { display: none; }
.stmt .t1 { font-weight: 600; } .stmt .s { font-size: 12px; color: var(--muted); }
.stmt .v { font-weight: 600; white-space: nowrap; }
.stmt .chev { color: var(--faint); transition: transform .15s; }
.stmt[open] .chev { transform: rotate(90deg); }
.stmt .body { padding: 4px 0 16px; display: flex; flex-direction: column; gap: 12px; }

.list { display: flex; flex-direction: column; }
.li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .t1 { font-weight: 600; } .li .s { grid-column: 1; font-size: 12px; color: var(--muted); }
.li .v { grid-column: 2; grid-row: 1 / 3; text-align: right; display: flex; gap: 8px; align-items: center; }

/* forms */
form.f { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
form.f label { min-width: 0; display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
form.f label.wide { grid-column: span 2; }
input, select { font: inherit; font-size: 14px; color: var(--text); padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); min-height: 38px; width: 100%; min-width: 0; }
input[type="file"] { padding: 6px; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.msg { font-size: 12.5px; color: var(--muted); }
.log { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted); white-space: pre-wrap; word-break: break-word; margin: 0; max-height: 240px; overflow: auto; background: var(--sunken); border-radius: 8px; padding: 10px 12px; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 28px 0; }
.empty b { display: block; color: var(--text); font-size: 14px; margin-bottom: 2px; }

/* phone tab bar */
.bnav { display: none; }

@media (max-width: 1000px) {
  .row-2, .row-even { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .top { padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
  .top .stand-m { display: block; }
  .top .btn .lbl-long { display: none; }
  .content { padding: 16px max(16px, env(safe-area-inset-right)) calc(88px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); gap: 16px; }
  .view { gap: 16px; }
  .panel { padding: 16px; }
  .tw { margin: 0 -16px; padding: 0 16px; }
  .today-grid { grid-template-columns: 1fr 1fr; gap: 14px 16px; }
  .today-grid .main { grid-column: 1 / -1; }
  .val { font-size: 32px; }
  form.f { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  form.f label.wide { grid-column: 1 / -1; }
  .hide-m { display: none; }
  .bnav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 6px max(6px, env(safe-area-inset-bottom)); }
  .bnav button { border: 0; background: none; color: var(--faint); display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; min-height: 48px; justify-content: center; cursor: pointer; border-radius: 10px; }
  .bnav button svg { width: 22px; height: 22px; }
  .bnav button[aria-current="page"] { color: var(--text); }
}

/* login */
.login { min-height: 100svh; display: grid; place-items: center; padding: 16px; }
.login .panel { width: 100%; max-width: 360px; gap: 14px; padding: 24px; }
.login h1 { margin: 0; font-size: 18px; font-weight: 650; display: flex; align-items: center; gap: 10px; }
.login h1 img { width: 28px; height: 28px; border-radius: 7px; }
.login input { min-height: 44px; font-size: 16px; }
.login .btn { min-height: 44px; justify-content: center; }
.msg.bad { color: var(--bad); }
