/* Rakel – Farben und Maße aus dem Design-System "Rakel".
   Hell für Handys und Einrichten, dunkel für das Board an der Wand. */
:root {
  --surface: #f3f3ef; --raised: #ffffff; --sunken: #e8e8e2;
  --ink: #15171a; --muted: #555b62; --line: #d4d4cc; --line-strong: #868a84;
  --accent: #5a3ae0; --on-accent: #ffffff; --accent-soft: #ece8ff;
  --run: #13703a; --run-soft: #dcf3e3;
  --setup: #1d5fd1; --setup-soft: #dfe9fb;
  --wait: #8f5300; --wait-soft: #fbeccd;
  --fault: #c42b17; --fault-soft: #fde2dd;
  --idle: #555b62; --idle-soft: #e8e8e2;
  --shadow: 0 1px 2px rgba(21,23,26,.06), 0 2px 8px rgba(21,23,26,.06);
  --r-s: 4px; --r-m: 8px; --r-l: 14px;
  --font: Archivo, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
.dark {
  --surface: #0e1012; --raised: #171a1d; --sunken: #090a0c;
  --ink: #eceef0; --muted: #9ba2a9; --line: #2a2e33; --line-strong: #6a7078;
  --accent: #a593ff; --on-accent: #14102b; --accent-soft: #241d4a;
  --run: #4cc97a; --run-soft: #11301d;
  --setup: #6fa6ff; --setup-soft: #142742;
  --wait: #f2b544; --wait-soft: #35270b;
  --fault: #ff7a66; --fault-soft: #3d1813;
  --idle: #9ba2a9; --idle-soft: #23272b;
  --shadow: none;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--surface); color: var(--ink); font: 500 16px/1.4 var(--font);
  -webkit-tap-highlight-color: transparent; min-height: 100vh;
  padding: env(safe-area-inset-top, 0) max(0px, env(safe-area-inset-right, 0)) env(safe-area-inset-bottom, 0) max(0px, env(safe-area-inset-left, 0));
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.lbl { font: 700 12px/16px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 14px; }
.h1 { font-size: 24px; line-height: 30px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
h2, .h2 { font-size: 18px; line-height: 24px; font-weight: 700; margin: 0; }
.big-num { font: 700 32px/36px var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.warn-text { color: var(--wait); font-weight: 700; }

/* ---------- Gerüst */
.shell { max-width: 1400px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-left, 0)) 40px; display: flex; flex-direction: column; gap: 16px; }
.phone { max-width: 520px; }
.topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-mark { width: 44px; height: 44px; border-radius: var(--r-m); background: var(--accent); color: var(--on-accent); display: grid; place-items: center; flex: none; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; flex-grow: 1; }
.tab { height: 44px; padding: 0 14px; border-radius: var(--r-m); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 15px; }
.tab:hover { background: var(--sunken); color: var(--ink); }
.tab.on { background: var(--accent-soft); color: var(--accent); }
.clock { text-align: right; }

.grid { display: grid; gap: 12px; }
.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)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.split-32 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.split-23 { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
.mixer-grid { grid-template-columns: 300px minmax(0, 1fr) minmax(0, 1.25fr); }
@media (max-width: 1000px) {
  .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .split-32, .split-23, .mixer-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) { .g2 { grid-template-columns: minmax(0, 1fr); } .g4.keep, .g5.keep { grid-template-columns: repeat(2, minmax(0,1fr)); } }

.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex-grow: 1; min-width: 0; }
.right { margin-left: auto; }

.card { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.tight { gap: 8px; }
.card.accent { border-color: var(--accent); }
.card.warn { background: var(--wait-soft); border-color: var(--wait); }
.card.warn h2 { color: var(--wait); }
.sunken { background: var(--sunken); border-radius: var(--r-m); padding: 10px; }
.tile { overflow: hidden; padding: 0; gap: 0; }
.tile-bar { height: 6px; background: var(--idle); }
.tile-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; flex-grow: 1; }

/* ---------- Bedienelemente */
.btn { height: 48px; padding: 0 16px; border-radius: var(--r-m); border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--fault); border-color: var(--fault); }
.btn.big { height: 64px; font-size: 18px; width: 100%; }
.btn.huge { height: 96px; font-size: 24px; width: 100%; }
.btn.sm { height: 40px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
.icon-btn { width: 48px; padding: 0; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field input, .field select, .field textarea, input.in, select.in, textarea.in {
  height: 48px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--raised); width: 100%; min-width: 0;
}
.field textarea, textarea.in { height: auto; padding: 10px 12px; resize: vertical; }
input.in.sm, select.in.sm { height: 40px; font-size: 14px; padding: 0 8px; }
input[type=color].in { padding: 2px; width: 56px; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; font: 700 12px/16px var(--font); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.s-run { --c: var(--run); --cs: var(--run-soft); }
.s-setup { --c: var(--setup); --cs: var(--setup-soft); }
.s-wait { --c: var(--wait); --cs: var(--wait-soft); }
.s-fault { --c: var(--fault); --cs: var(--fault-soft); }
.s-idle { --c: var(--idle); --cs: var(--idle-soft); }
.pill[class*="s-"] { background: var(--cs); color: var(--c); }
.tile-bar[class*="s-"] { background: var(--c); }
.dot { width: 8px; height: 8px; border-radius: 999px; background: currentColor; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

.chip { min-height: 48px; padding: 6px 14px; border-radius: var(--r-m); border: 1px solid var(--line-strong); background: var(--raised); font-weight: 700; font-size: 15px; cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.seg button { height: 56px; border-radius: var(--r-m); border: 2px solid var(--c, var(--line-strong)); background: var(--cs, var(--raised)); color: var(--c, var(--ink)); font-weight: 700; cursor: pointer; }
.seg button.on { background: var(--c); color: #fff; }
.dark .seg button.on { color: var(--surface); }

.bar { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.bar > div { height: 100%; border-radius: 999px; background: var(--run); }
.bar.accent > div { background: var(--accent); }
.bar.warn > div { background: var(--wait); }
.swatch { width: 20px; height: 20px; border-radius: var(--r-s); border: 1px solid var(--line-strong); flex: none; display: inline-block; vertical-align: middle; }
.swatch.lg { width: 28px; height: 28px; }

.alert { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-radius: var(--r-l); background: var(--wait-soft); border: 1px solid var(--wait); }
.alert .t { font-size: 18px; line-height: 24px; font-weight: 700; color: var(--wait); }
.alert.fault { background: var(--fault-soft); border-color: var(--fault); }
.alert.fault .t { color: var(--fault); }
.note { padding: 12px; border-radius: var(--r-m); background: var(--accent-soft); font-size: 14px; line-height: 20px; }
.note b { color: var(--accent); }

.table { display: grid; gap: 6px 12px; align-items: center; font-size: 14px; line-height: 20px; }
.scroll-x { overflow-x: auto; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-m); background: var(--sunken); font-size: 14px; }
.list-row.ok { background: var(--run-soft); }
.list-row.ok .num { color: var(--run); }
.list-row.warn { background: var(--wait-soft); color: var(--wait); font-weight: 700; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.step { background: var(--sunken); border-radius: var(--r-m); padding: 10px; display: flex; flex-direction: column; gap: 6px; border: 1px solid transparent; }
.step.on { background: var(--accent-soft); border-color: var(--accent); }
.route { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.route span { display: inline-flex; align-items: center; height: 34px; padding: 0 10px; border-radius: var(--r-m); background: var(--sunken); font-size: 14px; }
.route span.p { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.route span.d { background: var(--run-soft); color: var(--run); font-weight: 700; }
.route i { color: var(--muted); font-style: normal; }
.sizes { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 6px; }
.sizes > div { background: var(--sunken); border-radius: var(--r-s); padding: 6px; text-align: center; }
.sizes input { width: 100%; height: 40px; text-align: center; border: 1px solid var(--line-strong); border-radius: var(--r-s); background: var(--raised); font-family: var(--mono); }
.empty { padding: 24px; border-radius: var(--r-l); border: 2px dashed var(--line); text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0)); transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 12px 18px; border-radius: var(--r-m); font-weight: 700; z-index: 50; box-shadow: 0 4px 20px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
.offline { position: fixed; top: env(safe-area-inset-top, 0); left: 0; right: 0; background: var(--fault); color: #fff; text-align: center; font-weight: 700; padding: 6px; z-index: 60; font-size: 14px; }

/* Handy-Stationen */
.station-head { display: flex; flex-direction: column; gap: 2px; }
.counter { display: flex; align-items: baseline; gap: 8px; }
.counter .n { font: 700 72px/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.press-ring { width: 240px; height: 240px; max-width: 100%; aspect-ratio: 1; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; }
.press-ring > div { width: 80%; height: 80%; border-radius: 50%; background: var(--raised); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.press-ring .t { font: 700 56px/1 var(--mono); }
.big-choice { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r-l); border: 1px solid var(--line); background: var(--raised); text-decoration: none; color: inherit; box-shadow: var(--shadow); min-height: 80px; }
.big-choice:hover { border-color: var(--accent); }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r-m); border: 2px solid var(--line); background: var(--raised); text-align: left; width: 100%; cursor: pointer; font-size: 16px; line-height: 22px; }
.check .box { width: 26px; height: 26px; border-radius: var(--r-s); border: 2px solid var(--line-strong); flex: none; display: grid; place-items: center; color: var(--on-accent); }
.check.on { border-color: var(--accent); background: var(--accent-soft); }
.check.on .box { background: var(--accent); border-color: var(--accent); }

/* Motive */
.motif { aspect-ratio: 1; width: 100%; border-radius: var(--r-m); background: var(--sunken); display: grid; place-items: center; overflow: hidden; position: relative; }
.motif img { width: 100%; height: 100%; object-fit: contain; }
.motif.sm { width: 64px; height: 64px; flex: none; }

/* Login */
.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 380px; }

.timeline-row { display: grid; grid-template-columns: 52px auto minmax(0, 1fr) auto; gap: 10px; align-items: start; font-size: 14px; line-height: 20px; }
@media (max-width: 560px) { .timeline-row { grid-template-columns: 46px minmax(0, 1fr) auto; } .timeline-row .pill { grid-column: 2; justify-self: start; } .timeline-row .txt { grid-column: 2 / 4; } }
button.big-choice { width: 100%; text-align: left; font: inherit; cursor: pointer; }
