/* Dienste – Web-App
   Fahrzeugweiß, Leuchtrot (RAL 3024) und Geldgrün. Einziger Hingucker: das Melder-Display oben. */

@font-face { font-family: "Barlow"; src: url("/fonts/barlow-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("/fonts/barlow-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "VT323"; src: url("/fonts/vt323-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --paper: #F5F7F6;
  --surface: #FFFFFF;
  --ink: #1B2126;
  --muted: #5F6A73;
  --line: #DCE1E4;
  --red: #E2361C;
  --red-ink: #B52610;
  --green: #14714A;
  --green-soft: #E2F1E8;
  --star: #C98A00;
  --lcd: #B4C09C;
  --lcd-ink: #1C2815;
  --lcd-dim: #6F7D5C;
  --asb: #2C4E86;
  --drk: #E2361C;
  --juh: #14714A;

  --f-xs: 0.8125rem;   /* 13 */
  --f-s: 0.9375rem;    /* 15 */
  --f-m: 1.0625rem;    /* 17 */
  --f-l: 1.375rem;     /* 22 */
  --f-xl: 2rem;        /* 32 */

  --gap: 16px;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12171A;
    --surface: #1A2024;
    --ink: #E8ECEE;
    --muted: #9AA5AD;
    --line: #2B3338;
    --red: #FF5636;
    --red-ink: #FF7A5E;
    --green: #47C489;
    --green-soft: #173528;
    --star: #F2B533;
    --lcd: #93A27E;
    --lcd-ink: #141D0E;
    --lcd-dim: #52603F;
    --asb: #7FA3E0;
    --drk: #FF5636;
    --juh: #47C489;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--f-m)/1.4 "Barlow", system-ui, sans-serif;
  min-height: 100dvh;
  padding-top: var(--safe-t);
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

/* Heckwarnmarkierung: rot-weiße Schrägstreifen wie am RTW-Heck */
.chevron {
  position: sticky; top: 0; z-index: 30;
  height: 7px;
  background: repeating-linear-gradient(-45deg, var(--red) 0 10px, #FFFFFF 10px 20px);
}

/* ---------------------------------------------------------------- Kopf */
.top {
  position: sticky; top: 7px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px var(--gap) 8px;
  background: var(--paper);
}
.top h1 { margin: 0; font-size: var(--f-xl); font-weight: 700; letter-spacing: -0.01em; }
.icon-btn {
  display: grid; place-items: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer;
}
.icon-btn.spin svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.banner {
  margin: 0 var(--gap) 8px; padding: 8px 12px;
  border-left: 4px solid var(--red);
  background: var(--surface);
  font-size: var(--f-s);
}

main { padding: 0 var(--gap) calc(var(--tabs-h) + var(--safe-b) + 24px); }
.view { max-width: 640px; margin: 0 auto; }

/* ---------------------------------------------------------------- Melder-Display */
.pager {
  position: relative;
  margin: 4px 0 18px;
  padding: 14px 16px 12px;
  border-radius: 14px;
  background: #2A2F33;
  box-shadow: inset 0 0 0 2px #3B4247;
}
.pager-screen {
  display: block; width: 100%;
  padding: 10px 12px 8px;
  border: 0; border-radius: 6px;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.035) 0 1px, transparent 1px 3px),
    var(--lcd);
  color: var(--lcd-ink);
  font-family: "VT323", ui-monospace, monospace;
  text-align: left;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.35);
  cursor: pointer;
}
.pager-row { display: flex; justify-content: space-between; gap: 12px; font-size: 1.35rem; line-height: 1.15; }
.pager-big { font-size: 2.6rem; line-height: 1; margin: 4px 0 2px; }
.pager-dim { color: var(--lcd-dim); }
.pager-foot { display: flex; justify-content: space-between; margin-top: 8px; color: #C3CAD0; font-size: var(--f-xs); }
.pager-led { width: 9px; height: 9px; border-radius: 50%; background: #3A1712; display: inline-block; margin-right: 6px; vertical-align: 1px; }
.pager.alarm .pager-led { background: #FF4122; box-shadow: 0 0 8px #FF4122; }
.pager-type { overflow: hidden; white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .pager.fresh .pager-type { animation: type 0.9s steps(28, end) both; }
  .pager.fresh.alarm .pager-led { animation: blink 0.5s steps(1) 4; }
}
@keyframes type { from { max-width: 0; } to { max-width: 100%; } }
@keyframes blink { 50% { opacity: 0.15; } }

/* ---------------------------------------------------------------- Filter */
.filter { display: flex; gap: 6px; margin: 0 0 6px; overflow-x: auto; scrollbar-width: none; }
.filter button {
  flex: none; min-height: 36px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 18px;
  background: transparent; font-size: var(--f-s); font-weight: 600; cursor: pointer;
}
.filter button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------------------------------------------------------------- Dienstliste */
.day { margin-top: 14px; }
.day-head {
  position: sticky; top: calc(7px + 62px); z-index: 5;
  display: flex; align-items: baseline; gap: 8px;
  margin: 0; padding: 6px 0;
  background: var(--paper);
  font-size: var(--f-s); font-weight: 600; color: var(--muted);
}
.day-head strong { color: var(--ink); font-size: var(--f-m); }
.duty {
  display: grid; grid-template-columns: 64px 1fr auto; column-gap: 12px; row-gap: 2px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.duty:first-of-type { border-top: 0; }
.duty-code { grid-row: span 3; font-size: var(--f-l); font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; }
.duty-code small { display: block; margin-top: 4px; font-size: var(--f-xs); font-weight: 600; }
.src-asb { color: var(--asb); }
.src-drk { color: var(--drk); }
.src-juh { color: var(--juh); }
.duty-time { font-weight: 600; }
.duty-place, .duty-crew { grid-column: 2 / 4; font-size: var(--f-s); color: var(--muted); }
.duty-crew b { color: var(--ink); font-weight: 600; }
.duty-money { align-self: start; text-align: right; }
.duty.running { background: linear-gradient(90deg, var(--green-soft), transparent 70%); }
.tag-running { font-size: var(--f-xs); font-weight: 600; color: var(--green); }

.money {
  display: inline-block; padding: 3px 8px; border-radius: 6px;
  background: var(--green-soft); color: var(--green);
  font-weight: 700; font-size: var(--f-s); white-space: nowrap;
}
.star { color: var(--star); }

/* Bonus-Dienste aus dem Kanal */
.bonus-text { grid-column: 2 / 4; margin: 4px 0 0; font-size: var(--f-s); color: var(--ink); overflow-wrap: anywhere; }
.bonus-actions { grid-column: 2 / 4; display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.duty.taken .duty-code, .duty.taken .duty-time, .duty.taken .bonus-text { text-decoration: line-through; color: var(--muted); }
.tag-taken { font-size: var(--f-xs); font-weight: 700; color: var(--red-ink); }

.empty { padding: 28px 0; color: var(--muted); }
.empty b { color: var(--ink); }

/* ---------------------------------------------------------------- Knöpfe, Formulare */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px;
  border: 0; border-radius: 10px;
  font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn-red { background: var(--red); color: #FFFFFF; }
.btn-quiet { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: var(--f-s); }
.btn:disabled { opacity: 0.55; cursor: default; }
.field { display: flex; gap: 8px; }
.field input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 12px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface);
}
.form-error { margin: 8px 0 0; color: var(--red-ink); font-size: var(--f-s); }
.form-error:empty { display: none; }
.hint { font-size: var(--f-s); color: var(--muted); }

/* ---------------------------------------------------------------- Kalender */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.cal-head h2 { margin: 0; font-size: var(--f-l); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-wd { text-align: center; font-size: var(--f-xs); font-weight: 600; color: var(--muted); padding-bottom: 2px; }
.cal-day {
  position: relative; aspect-ratio: 1 / 1.08;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding-top: 7px; border: 0; border-radius: 10px;
  background: var(--surface); font-weight: 600; cursor: pointer;
}
.cal-day.out { background: transparent; color: var(--muted); font-weight: 400; }
.cal-day.past { color: var(--muted); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--ink); }
.cal-day.wish::after { content: "★"; position: absolute; top: 2px; right: 5px; font-size: 0.75rem; color: var(--star); }
.dots { display: flex; gap: 3px; margin-top: auto; margin-bottom: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot.asb { background: var(--asb); }
.dot.drk { background: var(--drk); }
.dot.juh { background: var(--juh); }
.legend { display: flex; gap: 14px; margin-top: 12px; font-size: var(--f-xs); color: var(--muted); flex-wrap: wrap; }
.legend .dot { display: inline-block; margin-right: 5px; }

/* ---------------------------------------------------------------- Konten */
.acc { padding: 18px 0 20px; border-top: 1px solid var(--line); }
.acc:first-of-type { border-top: 0; }
.acc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.acc-head h2 { margin: 0; font-size: var(--f-l); }
.acc-num { font-size: var(--f-xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.acc-sub { margin: 4px 0 0; font-size: var(--f-s); color: var(--muted); }
.chart { width: 100%; height: auto; margin: 14px 0 6px; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.chart .past { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .plan { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-dasharray: 1 5; stroke-linecap: round; }
.chart .proj { fill: none; stroke: var(--red); stroke-width: 2; stroke-dasharray: 6 5; }
.chart .now { fill: var(--ink); }
.chart .end { fill: var(--red); }
.chart text { fill: var(--muted); font-size: 11px; font-family: "Barlow", sans-serif; }
.chart text.endlabel { fill: var(--red-ink); font-weight: 700; font-size: 12px; }
.facts { margin: 10px 0 0; font-size: var(--f-s); }
.fact { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; padding: 3px 0; }
.fact span { color: var(--muted); }
.fact b { font-weight: 600; margin-left: auto; text-align: right; }
.deltas { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: var(--f-xs); color: var(--muted); }
.deltas span b { color: var(--ink); font-weight: 600; }
.deltas .neg b { color: var(--red-ink); }
.deltas .pos b { color: var(--green); }
.total { margin: 0 0 6px; font-size: var(--f-s); color: var(--muted); }
.total b { color: var(--ink); font-size: var(--f-l); }

/* ---------------------------------------------------------------- Mehr */
.block { padding: 16px 0 18px; border-top: 1px solid var(--line); }
.block:first-child { border-top: 0; padding-top: 4px; }
.block h2 { margin: 0 0 8px; font-size: var(--f-m); }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; font-size: var(--f-s); }
.rows li + li { border-top: 1px solid var(--line); }
.rows .muted { color: var(--muted); }
.warn { color: var(--red-ink); }
.ok { color: var(--green); }
.seg { display: flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; min-height: 40px; border: 0; background: transparent; font-size: var(--f-s); font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 1.5px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.x-btn { min-width: 36px; min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 1.1rem; cursor: pointer; }

.who-result { margin-top: 12px; }
.who-group { margin-top: 10px; }
.who-group h3 { margin: 0 0 4px; font-size: var(--f-s); color: var(--muted); font-weight: 600; }
.who-row { display: grid; grid-template-columns: 56px 1fr; gap: 10px; padding: 6px 0; font-size: var(--f-s); }
.who-row b { font-size: var(--f-m); }

/* ---------------------------------------------------------------- Tabs unten */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 0.75rem; font-weight: 600;
}
.tabs svg { width: 26px; height: 26px; }
.tabs a[aria-current="page"] { color: var(--red); }

/* ---------------------------------------------------------------- Tag-Blatt */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(10, 14, 16, 0.45); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 85dvh; overflow-y: auto;
  padding: 8px var(--gap) calc(24px + var(--safe-b));
  border-radius: 18px 18px 0 0;
  background: var(--paper);
}
@media (prefers-reduced-motion: no-preference) {
  .sheet:not([hidden]) .sheet-panel { animation: up 0.22s ease-out; }
}
@keyframes up { from { transform: translateY(40px); opacity: 0.4; } }
.sheet-grip { width: 40px; height: 5px; margin: 0 auto 12px; border-radius: 3px; background: var(--line); }
.sheet-panel h2 { margin: 0 0 6px; font-size: var(--f-l); }
.sheet-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }

/* ---------------------------------------------------------------- Anmeldung */
.login { max-width: 380px; margin: 0 auto; padding: 48px var(--gap) 32px; text-align: center; }
.login-icon { border-radius: 22px; box-shadow: 0 6px 24px rgba(11, 55, 42, 0.35); }
.login h1 { margin: 18px 0 6px; font-size: var(--f-xl); }
.login p { color: var(--muted); }
.login form { margin-top: 26px; text-align: left; }
.login label { display: block; font-weight: 600; margin-bottom: 6px; }
.login input {
  width: 100%; min-height: 56px; padding: 0 14px; margin-bottom: 12px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface);
  font-family: "VT323", ui-monospace, monospace; font-size: 2rem; letter-spacing: 0.2em; text-align: center;
}
.login .btn-red { width: 100%; }
.install { margin-top: 28px; font-size: var(--f-s); color: var(--muted); }
