/* HorseTime – Stil. Farben als Tokens; Dunkel per System oder data-theme, „Sonne“ = Hochkontrast. */

:root {
  --scale: 1;
  --brand: #00695c;
  --brand-2: #00897b;
  --on-brand: #fff;
  --bg: #f1f4f3;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --text: #13201d;
  --muted: #586763;
  --line: #d3dcd9;
  --ok: #1b7a3a;
  --early: #a35c00;
  --late: #c62828;
  --ok-bg: #e2f3e7;
  --early-bg: #fff0d4;
  --late-bg: #fde3e3;
  --ahead: #1565c0;
  --accent: #ef6c00;
  --on-accent: #fff;
  --danger: #c62828;
  --track: #e8590c;
  --route: #1565c0;
  --pos: #1a73e8;
  --map-bg: #e8ecea;
  --map-grid: #cfd8d5;
  --focus: #ff9800;
  --bw: 1px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 3px 10px rgba(0, 0, 0, .05);
  --tabbar: min(3.9rem, 84px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --brand: #26a69a; --brand-2: #4db6ac; --on-brand: #04201c;
    --bg: #0c1312; --surface: #151f1d; --surface-2: #1c2826; --text: #e6efec; --muted: #9aaea9; --line: #2b3a37;
    --ok: #4cc472; --early: #f2a93b; --late: #ff6f6f; --ok-bg: #12301f; --early-bg: #3a2a0d; --late-bg: #3d1616;
    --ahead: #64a8ff; --accent: #ff9a3c; --on-accent: #231100; --danger: #ff6f6f;
    --track: #ff8a3d; --route: #64a8ff; --pos: #4f9bff; --map-bg: #1b2422; --map-grid: #2c3a37;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #26a69a; --brand-2: #4db6ac; --on-brand: #04201c;
  --bg: #0c1312; --surface: #151f1d; --surface-2: #1c2826; --text: #e6efec; --muted: #9aaea9; --line: #2b3a37;
  --ok: #4cc472; --early: #f2a93b; --late: #ff6f6f; --ok-bg: #12301f; --early-bg: #3a2a0d; --late-bg: #3d1616;
  --ahead: #64a8ff; --accent: #ff9a3c; --on-accent: #231100; --danger: #ff6f6f;
  --track: #ff8a3d; --route: #64a8ff; --pos: #4f9bff; --map-bg: #1b2422; --map-grid: #2c3a37;
  --shadow: none;
  color-scheme: dark;
}
:root[data-theme="sun"] {
  --brand: #003d33; --brand-2: #00594c; --on-brand: #fff;
  --bg: #fff; --surface: #fff; --surface-2: #fff; --text: #000; --muted: #1a1a1a; --line: #000;
  --ok: #005c1f; --early: #7a3d00; --late: #a30000; --ok-bg: #c8f0d3; --early-bg: #ffe0a8; --late-bg: #ffcccc;
  --ahead: #0b3d91; --accent: #b34700; --danger: #a30000;
  --track: #d40000; --route: #0033cc; --map-grid: #888;
  --bw: 2px; --shadow: none;
}
:root[data-theme="sun"] body { font-weight: 500; }
:root[data-theme="sun"] .v, :root[data-theme="sun"] .clock { font-weight: 900; }

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
html { font-size: calc(100% * var(--scale)); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
a { color: var(--brand); }
[hidden] { display: none !important; }
.ic { width: 1.4em; height: 1.4em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.num, .v, .clock, .delta, table, output { font-variant-numeric: tabular-nums; }

/* ---------- Rahmen ---------- */
.app { min-height: 100dvh; padding-bottom: calc(var(--tabbar) + var(--safe-b)); }
.main { max-width: 1180px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px 16px; }
.view-head { display: flex; align-items: center; gap: .5rem; justify-content: space-between; margin: .25rem 0 .75rem; }

.tabs {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--surface); border-top: var(--bw) solid var(--line);
}
.tabs a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: min(.75rem, 17px); font-weight: 600;
}
.tabs a .ic { width: min(1.5rem, 34px); height: min(1.5rem, 34px); }
.tabs a[aria-current="page"] { color: var(--brand); }
.tabs a[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--brand);
}
.tab-dot { position: absolute; top: 8px; right: calc(50% - 1.2rem); width: 10px; height: 10px; border-radius: 50%; background: var(--late); box-shadow: 0 0 0 2px var(--surface); }

/* Querformat (Handy quer): Navigation als Leiste links */
@media (orientation: landscape) and (max-height: 600px) {
  .app { padding-bottom: 0; padding-left: calc(72px + env(safe-area-inset-left)); }
  .tabs {
    top: 0; right: auto; width: calc(72px + env(safe-area-inset-left)); height: auto;
    grid-template-columns: 1fr; grid-auto-rows: 1fr; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) env(safe-area-inset-left);
    border-top: 0; border-right: var(--bw) solid var(--line);
  }
  .tabs a[aria-current="page"]::before { top: 25%; bottom: 25%; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .main { padding-top: 8px; }
  :root { --tabbar: 0px; --safe-b: 0px; }
}

/* ---------- Karten, Felder, Knöpfe ---------- */
.card {
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; min-width: 0;
}
.form .field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.lbl { font-size: .85rem; font-weight: 650; color: var(--muted); }
.hint { font-size: .82rem; color: var(--muted); margin: 0; }
.hint.bad { color: var(--late); font-weight: 600; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2);
  border: calc(var(--bw) + .5px) solid var(--line); border-radius: 10px; padding: .6rem .75rem; min-height: 3rem; width: 100%;
}
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
input.bad { border-color: var(--late); }
input.computed { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); border-style: dashed; font-weight: 700; }
.inp { display: flex; align-items: center; gap: .5rem; }
.inp input { font-size: 1.35rem; font-weight: 600; text-align: right; flex: 1; min-width: 0; }
.unit { color: var(--muted); font-weight: 600; min-width: 2.6rem; }
.name-input { font-size: 1.25rem; font-weight: 700; background: transparent; border-color: transparent; padding-left: .25rem; }
.name-input:hover { border-color: var(--line); }
.row-head { display: flex; align-items: center; gap: .25rem; margin-bottom: .75rem; }
.time-input { font-size: 2rem; text-align: center; font-weight: 700; }
input[type="range"] { padding: 0; min-height: 2.5rem; accent-color: var(--brand); background: transparent; border: 0; }
output.out { font-size: 1.35rem; font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 3rem; padding: .5rem 1rem; border-radius: 12px; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--text); background: var(--surface-2);
  border: calc(var(--bw) + .5px) solid var(--line); user-select: none; -webkit-user-select: none;
}
.btn:active { transform: translateY(1px); }
a.btn { text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn.accent { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.danger.ghost { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.big { min-height: 4rem; font-size: 1.2rem; border-radius: 16px; }
.btn.wide { width: 100%; justify-content: flex-start; margin-bottom: .5rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.btn-row .btn { flex: 1 1 auto; }
.icon-btn {
  display: inline-grid; place-items: center; width: 2.9rem; height: 2.9rem; flex: none; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--text); border: var(--bw) solid transparent;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); }

.seg { display: flex; border: calc(var(--bw) + .5px) solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.seg button {
  flex: 1; min-height: 2.9rem; padding: .4rem .5rem; font: inherit; font-weight: 650; cursor: pointer;
  color: var(--muted); background: transparent; border: 0; border-left: calc(var(--bw) + .5px) solid var(--line);
}
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  min-height: 2.6rem; min-width: 3rem; padding: .3rem .85rem; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 650; color: var(--text); background: var(--surface-2); border: calc(var(--bw) + .5px) solid var(--line);
}
.chip[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }

.switch { display: flex; align-items: center; gap: .75rem; min-height: 3rem; cursor: pointer; font-weight: 600; }
.switch input { appearance: none; -webkit-appearance: none; width: 3.1rem; height: 1.8rem; min-height: 0; padding: 0; flex: none; border-radius: 999px; position: relative; background: var(--line); border: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: .2rem; left: .2rem; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(1.3rem); }

.prose p { margin: 0 0 .6rem; }
.help summary { cursor: pointer; font-weight: 700; min-height: 2rem; }
.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; }

/* ---------- Plan ---------- */
.phase-bar { display: flex; gap: .5rem; overflow-x: auto; padding: 2px 2px .75rem; scrollbar-width: none; }
.phase-bar .chip { flex: none; }
.phase-bar .chip.add { display: inline-flex; align-items: center; gap: .25rem; }
.plan-grid, .calc-grid, .settings-grid { display: grid; gap: 0 1rem; }
@media (min-width: 860px) {
  .plan-grid { grid-template-columns: minmax(320px, 5fr) 6fr; align-items: start; }
  .calc-grid, .settings-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: .75rem; margin: 0 0 .75rem; }
.kv div { min-width: 0; }
.kv dt { font-size: .8rem; font-weight: 650; color: var(--muted); }
.kv dd { margin: 0; font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kv dd small { font-size: .8rem; font-weight: 600; color: var(--muted); }
.kv .em dd { color: var(--brand); }
.result .sub { color: var(--muted); font-size: .9rem; margin: 0 0 .5rem; }
.result .timeline { margin-top: .25rem; }

table.splits { width: 100%; border-collapse: collapse; font-size: 1.05rem; }
.splits th { text-align: right; font-size: .78rem; color: var(--muted); font-weight: 700; padding: .35rem .5rem; border-bottom: calc(var(--bw) + 1px) solid var(--line); }
.splits th:first-child, .splits td:first-child { text-align: left; }
.splits td { text-align: right; padding: .5rem; border-bottom: var(--bw) solid var(--line); }
.splits td.tgt { font-weight: 800; font-size: 1.2rem; color: var(--brand); }
.splits tr.fin td { font-weight: 800; border-bottom: 0; }
.splits td .dl { font-weight: 700; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.table-head h2 { margin: 0; }

/* ---------- Zeitleiste ---------- */
.timeline { width: 100%; min-height: 4.6rem; }
.tl { display: block; overflow: visible; }
.tl text { font-size: .75rem; fill: var(--muted); font-weight: 600; }
.tl .tl-strong { fill: var(--text); font-weight: 800; }
.tl .tl-target-label { fill: var(--brand); font-weight: 800; }
.tl-bg { fill: var(--surface-2); stroke: var(--line); stroke-width: 1; }
.tl-ok { fill: color-mix(in srgb, var(--ok) 35%, transparent); }
.tl-late { fill: color-mix(in srgb, var(--late) 22%, transparent); }
.tl-elapsed { fill: color-mix(in srgb, var(--text) 14%, transparent); }
.tl-tick { stroke: var(--muted); stroke-width: 1.5; }
.tl-target { stroke: var(--brand); stroke-width: 3; }
.tl-now { stroke: var(--text); stroke-width: 3; }
.tl-now-head { fill: var(--text); }
.tl-ahead { fill: var(--ahead); stroke: var(--surface); stroke-width: 1.5; }
.tl-behind { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.tl-onplan { fill: var(--ok); stroke: var(--surface); stroke-width: 1.5; }
.tl-proj { stroke: var(--surface); stroke-width: 2; }
.tl-proj.tl-ok { fill: var(--ok); }
.tl-proj.tl-early { fill: var(--early); }
.tl-proj.tl-late { fill: var(--late); }

/* ---------- Live ---------- */
.view[data-view="live"] { margin: -4px -4px 0; }
.live { display: flex; flex-direction: column; gap: .75rem; }
.live-info { container-type: inline-size; display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.live-head { display: flex; align-items: center; gap: .35rem; }
.live-head select { flex: 1; min-width: 7rem; font-weight: 700; min-height: 2.9rem; }
.live-head .gps-badge { margin-right: auto; }
@media (max-width: 360px) { #liveFull { display: none; } }
.gps-badge {
  flex: none; min-height: 2.9rem; padding: 0 .7rem; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: .85rem; font-weight: 750; border: calc(var(--bw) + .5px) solid var(--line); background: var(--surface); color: var(--muted);
}
.gps-badge::before { content: ""; display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; margin-right: .4rem; background: currentColor; vertical-align: middle; }
.gps-badge[data-gps="ok"] { color: var(--ok); border-color: currentColor; }
.gps-badge[data-gps="weak"], .gps-badge[data-gps="wait"] { color: var(--early); border-color: currentColor; }
.gps-badge[data-gps="denied"], .gps-badge[data-gps="error"], .gps-badge[data-gps="unsupported"] { color: var(--late); border-color: currentColor; }
.gps-badge[data-gps="wait"]::before { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

.clock-card {
  text-align: center; padding: .5rem .75rem .75rem; border-radius: var(--radius);
  background: var(--surface); border: var(--bw) solid var(--line);
}
.clock-card[data-status="ok"] { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.clock-card[data-status="early"] { background: var(--early-bg); border-color: color-mix(in srgb, var(--early) 50%, transparent); }
.clock-card[data-status="late"] { background: var(--late-bg); border-color: color-mix(in srgb, var(--late) 50%, transparent); }
.clock { font-size: min(6.5rem, 21cqi); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.delta { font-size: min(1.9rem, 8.5cqi); font-weight: 800; }
.clock-card[data-status="ok"] .delta { color: var(--ok); }
.clock-card[data-status="early"] .delta { color: var(--early); }
.clock-card[data-status="late"] .delta { color: var(--late); }
.win-line { color: var(--muted); font-size: .9rem; font-weight: 600; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.tile {
  container-type: inline-size; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: 12px; padding: .5rem .7rem .55rem;
}
.tile.wide { grid-column: span 2; }
.tile .k { font-size: .78rem; font-weight: 700; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .v { font-size: min(2.2rem, 21cqi); font-weight: 800; line-height: 1.15; white-space: nowrap; }
.tile.wide .v { font-size: min(2.2rem, 11cqi); }
.tile .u { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile[data-status="ok"] .v { color: var(--ok); }
.tile[data-status="early"] .v { color: var(--early); }
.tile[data-status="late"] .v { color: var(--late); }
.tile .bar { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: .35rem; overflow: hidden; }
.tile .bar i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .3s; }

.split-log { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.split-log li { display: flex; justify-content: space-between; gap: .5rem; padding: .45rem .7rem; border-radius: 10px; background: var(--surface); border: var(--bw) solid var(--line); font-weight: 650; }
.split-log .dl { font-weight: 800; }
.dl.ahead { color: var(--ahead); }
.dl.behind { color: var(--accent); }
.dl.onplan { color: var(--ok); }

.result-card { border-radius: var(--radius); padding: 1rem; border: calc(var(--bw) + 1px) solid var(--line); background: var(--surface); }
.result-card[data-kind="ok"] { background: var(--ok-bg); border-color: var(--ok); }
.result-card[data-kind="early"] { background: var(--early-bg); border-color: var(--early); }
.result-card[data-kind="late"] { background: var(--late-bg); border-color: var(--late); }
.result-card .verdict { font-size: 1.5rem; font-weight: 800; margin: 0 0 .5rem; }

.live-map { height: max(240px, 42vh); border-radius: var(--radius); }
.live-ctl {
  position: sticky; z-index: 5; bottom: calc(var(--tabbar) + var(--safe-b)); display: flex; gap: .6rem;
  padding: .6rem 0 .7rem; background: linear-gradient(to top, var(--bg) 80%, transparent);
}
.live-ctl .btn { flex: 1; }
.live-ctl #btnMarker { flex: 1.6; }
.btn.hold { position: relative; overflow: hidden; }
.btn.hold::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .35); transform: scaleX(0); transform-origin: left; }
.btn.hold.holding::after { transform: scaleX(1); transition: transform var(--hold, 800ms) linear; }

@media (orientation: landscape) and (min-width: 640px) {
  .view[data-view="live"] { margin: 0; }
  .live {
    display: grid; grid-template-columns: minmax(300px, 44%) 1fr; grid-template-rows: 1fr auto; gap: 0 .75rem;
    height: calc(100dvh - var(--tabbar) - var(--safe-b) - 24px);
  }
  .live-info { grid-column: 1; grid-row: 1; overflow-y: auto; padding-right: 2px; }
  .live-ctl { grid-column: 1; grid-row: 2; position: static; background: none; padding-bottom: 0; }
  .live-map { grid-column: 2; grid-row: 1 / span 2; height: auto; }
  .live.nomap { grid-template-columns: 1fr; }
  .clock { font-size: min(6.5rem, 21cqi, 17dvh); }
  .delta { font-size: min(1.9rem, 8.5cqi, 7dvh); }
  .live-info { gap: .5rem; }
}
.live.nomap .live-map { display: none; }

/* ---------- Karte ---------- */
.tmap { position: relative; overflow: hidden; background: var(--map-bg); border: var(--bw) solid var(--line); }
.tmap-canvas { display: block; touch-action: none; cursor: grab; }
.tmap-canvas:active { cursor: grabbing; }
.map-ctl { position: absolute; top: .6rem; right: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.map-ctl button {
  display: grid; place-items: center; width: 2.9rem; height: 2.9rem; border-radius: 12px; cursor: pointer;
  background: var(--surface); color: var(--text); border: var(--bw) solid var(--line); box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.map-ctl button[aria-pressed="true"] { background: var(--pos); color: #fff; border-color: var(--pos); }
.map-attr {
  position: absolute; right: 0; bottom: 0; max-width: 80%; padding: 1px 6px; font-size: 11px; line-height: 1.5;
  background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--text); border-top-left-radius: 6px;
}
.map-attr a { color: inherit; }

/* ---------- Verlauf ---------- */
.run-list { display: grid; gap: .6rem; }
@media (min-width: 860px) { .run-list { grid-template-columns: 1fr 1fr; } }
.run-item {
  display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; text-align: left; width: 100%; cursor: pointer;
  font: inherit; color: var(--text); background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--radius); padding: .8rem 1rem;
}
.run-item .t { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.run-item .meta { color: var(--muted); font-size: .85rem; font-weight: 600; }
.pill { justify-self: end; align-self: start; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 800; background: var(--surface-2); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.early { background: var(--early-bg); color: var(--early); }
.pill.late { background: var(--late-bg); color: var(--late); }
.rd-map { height: 45vh; min-height: 240px; border-radius: var(--radius); margin: .75rem 0; }

/* ---------- Dialoge, Toast ---------- */
.dlg {
  border: var(--bw) solid var(--line); border-radius: 18px; padding: 1.1rem; width: min(26rem, calc(100% - 24px));
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
}
.dlg::backdrop { background: rgba(0, 0, 0, .5); }
.dlg-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.dlg .chips { margin-top: .6rem; }
.menu-group { margin-bottom: .75rem; }
.btn-row.adjust .btn { min-width: 0; flex: 1; padding: .5rem; }
.sheet { width: min(56rem, 100%); max-width: 100%; max-height: 100dvh; padding: 0; }
@media (max-width: 640px) { .sheet { width: 100%; height: 100dvh; margin: 0; border-radius: 0; border: 0; } }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .6rem .6rem 1rem; background: var(--surface); border-bottom: var(--bw) solid var(--line); }
.sheet-head h2 { margin: 0; }
.sheet-body { padding: 1rem; }

.toast {
  position: fixed; z-index: 50; left: 50%; bottom: calc(var(--tabbar) + var(--safe-b) + 5.5rem); transform: translate(-50%, 1rem);
  display: flex; align-items: center; gap: .75rem; max-width: calc(100% - 32px); padding: .7rem .7rem .7rem 1.1rem; border-radius: 14px;
  background: #1d2725; color: #fff; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { font: inherit; font-weight: 800; color: #ffcc80; background: none; border: 0; padding: .4rem .6rem; cursor: pointer; text-transform: uppercase; }

/* ---------- Druck: nur Phase + Zwischenzeiten ---------- */
@media print {
  :root { --scale: 1.1; }
  body { background: #fff; color: #000; }
  .tabs, .view-head .icon-btn, .phase-bar, #phaseForm, .help, .table-head button, .toast { display: none !important; }
  .app { padding: 0; }
  .card { border: 1px solid #000; box-shadow: none; break-inside: avoid; }
  .plan-grid { display: block; }
  .view:not([data-view="plan"]) { display: none !important; }
  .splits td.tgt { color: #000; }
}
