[hidden] { display: none !important; }
/* Faku-Farben wie auf faku.at: Schwarz, Magenta (Akzent), Lime (Hover) */
:root {
  --bg: #f4f4f2; --card: #ffffff; --ink: #161616; --muted: #5f5f5a; --line: #e2e2de; --chip: #efefeb;
  --brand: #000000; --brand-ink: #ffffff;
  --accent: #d7107e; --accent-ink: #ffffff; --accent-soft: #fbe3f0; --hover: #a3bf18;
  --warn: #9a5b00; --warn-soft: #fff4e0; --bad: #b42318; --bad-soft: #fdecea; --ok: #1a7f37;
  --series-1: #2a78d6; --series-2: #eb6834; --grid: #e8e8e4;
  --radius: 16px; --shadow: 0 1px 2px rgba(0,0,0,.06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0d; --card: #1a1a19; --ink: #f0efec; --muted: #a3a29c; --line: #2c2c2a; --chip: #262624;
    --accent-soft: #3d1029; --warn: #f2b33d; --warn-soft: #3a2f16; --bad: #ff8a80; --bad-soft: #3b1f1d; --ok: #b5d23a;
    --series-1: #3987e5; --series-2: #d95926; --grid: #2c2c2a; --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0d; --card: #1a1a19; --ink: #f0efec; --muted: #a3a29c; --line: #2c2c2a; --chip: #262624;
  --accent-soft: #3d1029; --warn: #f2b33d; --warn-soft: #3a2f16; --bad: #ff8a80; --bad-soft: #3b1f1d; --ok: #b5d23a;
  --series-1: #3987e5; --series-2: #d95926; --grid: #2c2c2a; --shadow: none;
  color-scheme: dark;
}
@font-face { font-family: "Space Grotesk"; src: url(fonts/space-grotesk-latin.woff2) format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Readex Pro"; src: url(fonts/readex-pro-latin.woff2) format("woff2"); font-weight: 160 700; font-display: swap; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 "Readex Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; font-family: "Space Grotesk", system-ui, sans-serif; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
h4 { text-transform: none; letter-spacing: 0; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.warn { color: var(--warn); } .ok { color: var(--ok); } .err { color: var(--bad); }
.center { text-align: center; } .strong { font-weight: 700; } .grow { flex: 1; }

/* --- Startbildschirm --- */
#splash { position: fixed; inset: 0; z-index: 100; background: var(--brand); display: grid; place-content: center; justify-items: center; gap: 28px; transition: opacity .35s ease; }
#splash img { width: min(46vw, 200px); height: auto; animation: pop .5s ease both; }
#splash.out { opacity: 0; pointer-events: none; }
.splash-bar { width: 96px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.15); overflow: hidden; position: relative; }
.splash-bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent); border-radius: 2px; animation: slide 1s ease-in-out infinite; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* --- Formulare --- */
input, select, button { font: inherit; color: inherit; }
input:not([type=checkbox]), select {
  width: 100%; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card); min-height: 44px;
}
input:disabled, select:disabled { background: transparent; border-style: dashed; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
select.auto { width: auto; }
label { display: grid; gap: .3rem; font-size: .9rem; color: var(--muted); }
label > input, label > select { color: var(--ink); }
label.check { display: flex; align-items: center; gap: .5rem; color: var(--ink); }
label.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.stack { display: grid; gap: .85rem; }

.btn { border: 1px solid var(--line); background: var(--card); padding: .65rem 1rem; border-radius: 10px; cursor: pointer; min-height: 44px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; text-align: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
@media (hover: hover) { .btn.primary:hover { background: var(--hover); border-color: var(--hover); color: #000; } }
.btn:focus-visible, .chip:focus-visible, .list-btn:focus-visible { outline: 2px solid var(--hover); outline-offset: 2px; }
.btn.ghost { background: transparent; }
.btn.danger, .danger { color: var(--bad); }
.btn.sm { min-height: 36px; padding: .35rem .7rem; font-size: .9rem; }
.btn.block { width: 100%; }
.btn.gap { margin-bottom: .75rem; }
.btn:disabled { opacity: .5; }
.btn small { font-weight: 400; }
.grid2 .btn { flex-direction: column; gap: 0; }
.icon-btn { border: 1px solid var(--line); background: var(--card); width: 44px; height: 44px; border-radius: 10px; cursor: pointer; display: inline-grid; place-items: center; flex: none; color: inherit; }
.icon-btn.sm { width: 34px; height: 34px; }
.link-btn { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: .25rem 0; font-size: .85rem; }
.ic { width: 20px; height: 20px; flex: none; }
.upload { cursor: pointer; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin: 0 0 .75rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.row-between.gap { margin-bottom: .75rem; }
.row-end { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.row-end.tight { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; }
.empty { color: var(--muted); text-align: center; padding: 1rem 0; margin: 0; }
.inline-form { display: flex; gap: .5rem; align-items: center; margin-top: .75rem; flex-wrap: wrap; }
.inline-form > input, .inline-form > select { flex: 1 1 140px; width: auto; }
.inline-form .w-amount { flex: 0 1 90px; }

/* --- Login --- */
.auth { max-width: 420px; margin: 0 auto; padding: 2rem 16px; }
.auth form, .auth .card { display: grid; gap: .85rem; }
.brand { text-align: center; margin-bottom: 1.25rem; }
.brand-logo { width: 112px; height: auto; }
.brand h1 { margin: .5rem 0 0; }
.brand p { color: var(--muted); margin: .25rem 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { border: 1px solid var(--line); background: var(--chip); border-radius: 999px; padding: .55rem .95rem; cursor: pointer; min-height: 44px; display: inline-flex; gap: .4rem; align-items: baseline; }
.spinner { width: 32px; height: 32px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 1rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Kopf, Inhalt, Tab-Leiste --- */
.demo-bar { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: .85rem; padding: .35rem 16px; }
.top { position: sticky; top: 0; z-index: 10; background: var(--brand); color: var(--brand-ink); display: flex; align-items: center; gap: .75rem; padding: .5rem 16px; padding-top: max(.5rem, env(safe-area-inset-top)); }
.top .icon-btn { background: transparent; border-color: rgba(255,255,255,.2); color: var(--brand-ink); }
.top-logo { width: 34px; height: auto; }
.page-title { flex: 1; font-size: 1.15rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; }
.main { max-width: 720px; margin: 0 auto; padding: 1rem 16px calc(88px + env(safe-area-inset-bottom)); }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { flex: 1; border: 0; background: none; padding: .5rem .1rem .45rem; display: grid; justify-items: center; gap: 2px; font-size: .72rem; color: var(--muted); cursor: pointer; min-height: 56px; }
.tabbar button.on { color: var(--ink); font-weight: 700; }
.tabbar button.on .ic { color: var(--ink); stroke-width: 2.4; }

/* --- Listen & Tabellen --- */
.list { list-style: none; margin: 0; padding: 0; }
.list li + li { border-top: 1px solid var(--line); }
ul.card.list { padding: 0 1rem; }
.list-btn { width: 100%; border: 0; background: none; text-align: left; padding: .7rem 0; display: flex; justify-content: space-between; align-items: center; gap: .75rem; cursor: pointer; min-height: 48px; }
.list-btn.inactive { opacity: .55; }
.cat-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .9rem 0 .2rem; margin: 0; }
.list li.cat-h + li { border-top: 0; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl td, .tbl th { padding: .5rem .25rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl thead th { font-size: .8rem; color: var(--muted); font-weight: 600; }
.tbl tr.cat th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: .9rem; }
.tbl tr.total td { font-weight: 700; border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl-scroll { overflow-x: auto; margin: 0 -.25rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: var(--chip); color: var(--muted); }
.badge.bestellt { background: var(--warn-soft); color: var(--warn); }
.badge.geliefert { background: var(--accent-soft); color: var(--ink); }
.qty-in { width: 84px !important; text-align: right; min-height: 38px !important; padding: .35rem .5rem !important; }
.order-lines td:last-child { width: 40px; }

/* --- Planung --- */
.plan-row { padding: .6rem 0; display: grid; gap: .35rem; }
.plan-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; font-variant-numeric: tabular-nums; }
.plan-nums span { display: grid; align-content: start; }
.plan-nums small { display: block; font-size: .72rem; color: var(--muted); font-weight: 400; }

/* --- Zählen --- */
.count-row { display: flex; gap: .75rem; align-items: flex-end; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.count-name { display: grid; gap: 2px; min-width: 0; }
.count-in { display: flex; gap: .4rem; flex: none; }
.count-in label.mini { font-size: .72rem; width: 84px; }
.count-in input { text-align: right; font-size: 1.1rem; }
.count-form .cat-h { margin-top: .5rem; }
.count-form > label { margin: 1rem 0; }

/* --- Kassa --- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin-bottom: .5rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; display: grid; gap: .15rem; }
.kpi small { color: var(--muted); }
.kpi b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: .5rem 0 1rem; }
.seg button { border: 0; background: none; padding: .5rem 1rem; cursor: pointer; min-height: 40px; }
.seg button.on { background: var(--brand); color: var(--brand-ink); font-weight: 700; }

/* --- Diagramme --- */
.chart { margin: 0; }
.chart figcaption { font-weight: 700; margin-bottom: .4rem; }
.chart-scroll { overflow-x: auto; }
.chart svg { display: block; max-width: none; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--muted); stroke-width: 1; }
.chart .tick, .chart .lab { fill: var(--muted); font-size: 11px; }
.chart .bar.s1, .legend .sw.s1 { fill: var(--series-1); background: var(--series-1); }
.chart .bar.s2, .legend .sw.s2 { fill: var(--series-2); background: var(--series-2); }
.chart .hit { fill: transparent; }
.chart .bar-grp { cursor: pointer; }
.chart .bar-grp.on .hit { fill: var(--chip); }
.legend { display: flex; gap: 1rem; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-tip { position: absolute; z-index: 50; background: var(--ink); color: var(--bg); font-size: .82rem; padding: .4rem .6rem; border-radius: 8px; white-space: pre-line; pointer-events: none; max-width: 240px; }

.toast { position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; opacity: 0; transition: .2s; z-index: 60; max-width: calc(100% - 32px); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }

@media print {
  .top, .tabbar, .demo-bar, .btn, .icon-btn, .link-btn, select, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .main { padding: 0; max-width: none; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .chart-scroll { overflow: visible; }
}
