/* ---------- Farben ---------- */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --line: #e3e6eb;
  --text: #14161a;
  --muted: #6b7280;
  --accent: #e8531a;
  --accent-ink: #ffffff;
  --accent-soft: #fdece4;
  --ok: #16a34a;
  --ok-soft: #e3f6e9;
  --gold: #b7791f;
  --gold-soft: #fdf3dc;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgb(16 24 40 / .05);
  --radius: 16px;
  --tab-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1013;
    --surface: #171a1f;
    --surface-2: #21252c;
    --line: #2a2f37;
    --text: #eef0f3;
    --muted: #9aa3af;
    --accent: #ff6a2b;
    --accent-ink: #160a04;
    --accent-soft: #2d1b12;
    --ok: #2bd46a;
    --ok-soft: #12291b;
    --gold: #f5c542;
    --gold-soft: #332a12;
    --danger: #f87171;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1013;
  --surface: #171a1f;
  --surface-2: #21252c;
  --line: #2a2f37;
  --text: #eef0f3;
  --muted: #9aa3af;
  --accent: #ff6a2b;
  --accent-ink: #160a04;
  --accent-soft: #2d1b12;
  --ok: #2bd46a;
  --ok-soft: #12291b;
  --gold: #f5c542;
  --gold-soft: #332a12;
  --danger: #f87171;
  --shadow: none;
  color-scheme: dark;
}

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
code { font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.link { color: var(--accent); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.link .i { width: 16px; height: 16px; }

/* ---------- Kopfzeile & Tabs ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  max-width: 720px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px 16px;
  background: var(--bg);
}
@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .topbar { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
}
.topbar h1 { flex: 1; min-width: 0; font-size: 24px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-btn { margin-left: -8px; }
.back-btn .i { width: 26px; height: 26px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 12px; background: transparent; color: var(--text);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn:disabled { opacity: .3; }
.icon-btn .i { width: 22px; height: 22px; }

.sync-btn.s-off, .sync-btn.s-offline { color: var(--muted); }
.sync-btn.s-ok { color: var(--ok); }
.sync-btn.s-pending { color: var(--accent); }
.sync-btn.s-error { color: var(--danger); }
.sync-btn.s-syncing .i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

main {
  max-width: 720px; margin: 0 auto;
  padding: 0 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 28px);
}
body.rest-on main { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 110px); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 720px; margin: 0 auto; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  height: var(--tab-h); font-size: 11px; font-weight: 650; color: var(--muted);
}
.tab .i { width: 24px; height: 24px; }
.tab.active { color: var(--accent); }

/* ---------- Karten & Listen ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px 0; box-shadow: var(--shadow);
}
.card.flush { padding: 0; overflow: hidden; }
.section-label {
  margin: 24px 4px 8px; font-size: 13px; font-weight: 750; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 750; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.eyebrow .i { width: 16px; height: 16px; }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); }
.hint { margin-top: 10px; font-size: 13px; color: var(--muted); }
.pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }

.list-row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 16px; min-height: 60px;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left;
}
.list-row:last-child { border-bottom: 0; }
.list-row:active { background: var(--surface-2); }
.list-row strong { display: block; font-weight: 650; }
.list-row .muted.small { display: block; margin-top: 1px; }
.list-row > .i:first-child { color: var(--muted); }
.list-row .chev { color: var(--muted); width: 18px; height: 18px; }
.sets-text { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.spark { flex: none; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.date-badge {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 12px; background: var(--surface-2); line-height: 1;
}
.date-badge b { font-size: 17px; }
.date-badge span { font-size: 11px; color: var(--muted); font-weight: 650; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px;
  border: 1px solid transparent; border-radius: 13px;
  background: var(--surface-2); color: var(--text);
  font-weight: 700; text-align: center;
  transition: transform .08s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.text { background: none; padding: 0 10px; min-height: 40px; color: var(--accent); }
.btn.text.danger { color: var(--danger); background: none; }
.danger-text { color: var(--danger) !important; }
.btn.block { display: flex; width: 100%; margin-top: 12px; }
.btn.lg { min-height: 54px; font-size: 17px; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 14px; border-radius: 11px; }
.trash-row { gap: 8px; padding-right: 8px; }
.trash-row .icon-btn .i { width: 20px; height: 20px; }

/* ---------- Formulare ---------- */
.field-block { display: block; margin-top: 12px; }
.field-block:first-child { margin-top: 0; }
.label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 650; color: var(--muted); }
.form input:not([type="checkbox"]), .form select, .form textarea,
.notes textarea, .sheet input, .sheet textarea, .bw-card input {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--surface); font-size: 16px; outline: none;
}
textarea { resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { border-color: var(--accent) !important; }
input.invalid { border-color: var(--danger) !important; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two .field-block { margin-top: 0; }
.with-unit { position: relative; display: block; }
.with-unit .unit { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.with-unit input { padding-right: 38px !important; }
.with-unit.sm { width: 110px; }
.row-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--line); }
.row-field:last-of-type { border-bottom: 0; }
.row-field > span:first-child { font-weight: 600; }
.row-field select { width: auto !important; min-width: 120px; }

.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); position: relative; transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .15s; }
.switch:checked { background: var(--ok); border-color: var(--ok); }
.switch:checked::after { transform: translateX(20px); }

.search-wrap { position: relative; margin: 12px 0; }
.search-wrap .i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search {
  width: 100%; min-height: 46px; padding: 10px 12px 10px 42px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 16px; outline: none;
}

.seg { display: flex; gap: 4px; padding: 4px; margin: 12px 0; background: var(--surface-2); border-radius: 13px; }
.card .seg { margin: 0; }
.seg > * {
  flex: 1; display: grid; place-items: center; min-height: 38px; padding: 0 8px;
  border: 0; border-radius: 10px; background: none; font-weight: 650; font-size: 14px; color: var(--muted);
}
.seg > .active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.seg.small > * { font-size: 13px; min-height: 34px; }

/* ---------- Start ---------- */
.hero { padding: 20px; }
.hero h2 { font-size: 26px; font-weight: 800; margin: 4px 0 2px; }
.hero.live { display: block; border-color: var(--accent); }
.welcome { text-align: center; padding: 28px 20px 24px; }
.welcome p { margin-top: 6px; }
.welcome-badge { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 8px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); }
.welcome-badge .i { width: 34px; height: 34px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* Streak */
.streak { padding: 16px 16px 14px; }
.streak-top { display: flex; align-items: center; gap: 12px; }
.flame { width: 54px; height: 54px; flex: none; }
.flame svg { display: block; width: 100%; height: 100%; }
.streak:not(.on) .flame .f-outer { fill: var(--surface-2); }
.streak:not(.on) .flame .f-inner { fill: var(--line); }
.streak.on .flame svg { filter: drop-shadow(0 4px 10px rgb(255 106 43 / .35)); }
.streak.risk .flame { animation: flicker 1.8s ease-in-out infinite; }
@keyframes flicker { 50% { opacity: .6; transform: scale(.95); } }
.streak-num { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.05; }
.streak-num b { font-size: 36px; font-weight: 850; font-variant-numeric: tabular-nums; }
.streak.on .streak-num b { color: var(--accent); }
.streak-num span { font-size: 13px; font-weight: 650; color: var(--muted); }
.streak-best { display: flex; flex-direction: column; align-items: center; padding: 6px 12px; border-radius: 12px; background: var(--surface-2); line-height: 1.15; }
.streak-best span { font-size: 10px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.streak-best b { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.streak-msg { margin-top: 10px; font-size: 14px; }
.streak-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 12px; }
.sw { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sw small { font-size: 11px; font-weight: 650; color: var(--muted); }
.sw.now small { color: var(--text); font-weight: 800; }
.sw-dot { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; }
.sw-dot .i { width: 16px; height: 16px; stroke-width: 3; }
.sw.done .sw-dot { background: var(--accent); color: var(--accent-ink); }
.sw.planned .sw-dot { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.sw.today .sw-dot { border: 2px dashed var(--accent); }
.sw.missed .sw-dot { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.sw.off .sw-dot::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.sw.now.off .sw-dot { border-color: var(--line); }
.streak-line { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 12px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.streak-line .i { width: 18px; height: 18px; fill: currentColor; stroke: none; }

.day-row { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.day-row:last-child { border-bottom: 0; }
.day-row.today { background: var(--accent-soft); }
.day-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.day-info strong { font-size: 17px; }
.day-row .btn { min-height: 40px; padding: 0 16px; }
.mini-btns { display: flex; }

.bw-card .bw-input { display: flex; gap: 10px; margin-top: 10px; }
.bw-card p { margin-top: 4px; }

/* ---------- Training ---------- */
.wk-head { padding: 12px 16px; }
.clock { display: inline-flex; align-items: center; gap: 6px; font-weight: 750; font-size: 18px; font-variant-numeric: tabular-nums; }
.clock .i { color: var(--accent); }
.date-field { display: inline-flex; align-items: center; gap: 8px; }
.date-field input { border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); padding: 6px 8px; min-height: 38px; }
.progress { height: 6px; margin-top: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width .25s ease; }

.ex-card { padding: 14px 12px 8px; }
.ex-card.complete { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.ex-head { display: flex; align-items: flex-start; gap: 8px; padding: 0 4px; }
.ex-head h3 { font-size: 18px; font-weight: 750; line-height: 1.25; }
.ex-head .icon-btn { margin: -8px -6px 0 0; }
.ex-pin { display: flex; gap: 8px; align-items: flex-start; margin: 10px 4px 0; font-size: 14px; color: var(--muted); }
.ex-pin .i { width: 17px; height: 17px; margin-top: 2px; }
.ex-last { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 10px 4px 0; font-size: 14px; }
.ex-last b { font-variant-numeric: tabular-nums; }
.tag {
  font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--surface-2); padding: 2px 7px; border-radius: 6px;
}
.ex-tip { margin: 10px 0 4px; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; }
.tip-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.tip-head .i { width: 17px; height: 17px; color: var(--accent); }
.tip-head b { color: var(--accent); }
.tip-head span { font-weight: 700; font-variant-numeric: tabular-nums; }
.ex-tip ul { margin: 6px 0 0; padding-left: 18px; }
.ex-tip li { margin-top: 2px; }

.sets { margin-top: 6px; }
.set-row {
  position: relative; display: grid; grid-template-columns: 44px 1fr 1fr 52px; gap: 8px; align-items: center;
  padding: 5px 4px; border-radius: 12px; transition: background .15s;
}
.set-head { padding: 4px 4px 0; font-size: 11px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.set-head span:nth-child(2), .set-head span:nth-child(3) { text-align: center; }
.set-no { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.set-no b { font-size: 17px; }
.set-no small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.num {
  width: 100%; min-width: 0; height: 48px; padding: 0 6px;
  border: 1.5px solid transparent; border-radius: 11px; background: var(--surface-2);
  text-align: center; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; outline: none;
}
.num.left { text-align: left; font-size: 16px; font-weight: 600; padding: 10px 12px; height: auto; min-height: 46px; background: var(--surface); border-color: var(--line); }
.num:focus { border-color: var(--accent); background: var(--surface); }
.num::placeholder { color: var(--muted); opacity: .6; font-weight: 500; }
.check {
  display: grid; place-items: center; width: 52px; height: 48px;
  border: 1.5px solid var(--line); border-radius: 11px; background: transparent; color: var(--muted);
}
.check .i { width: 24px; height: 24px; stroke-width: 2.6; }
.set-row.done { background: var(--ok-soft); }
.set-row.done .num { background: transparent; }
.set-row.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.set-no .pr-tag {
  display: inline-flex; align-items: center; gap: 1px; margin-top: 1px;
  padding: 0 4px; border-radius: 5px; background: var(--gold-soft); color: var(--gold);
  font-size: 10px; font-weight: 800;
}
.pr-tag .i { width: 10px; height: 10px; }
.ex-actions { display: flex; gap: 4px; margin-top: 2px; }
.ex-actions .i { width: 18px; height: 18px; }
.ex-note {
  width: 100%; margin: 4px 0 8px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 16px; outline: none;
}
.notes { margin-top: 20px; }

/* ---------- Pausentimer ---------- */
.rest {
  position: fixed; z-index: 25; left: 12px; right: 12px;
  bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 10px);
  max-width: 696px; margin: 0 auto; overflow: hidden;
  border-radius: 16px; background: var(--text); color: var(--bg);
  box-shadow: 0 10px 30px rgb(0 0 0 / .25);
}
.rest-fill { height: 4px; background: color-mix(in srgb, var(--bg) 20%, transparent); }
.rest-fill span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.rest-row { display: flex; align-items: center; gap: 6px; padding: 8px 8px 8px 16px; }
.rest-text { flex: 1; display: flex; flex-direction: column; line-height: 1.15; }
.rest-label { font-size: 12px; font-weight: 700; opacity: .75; text-transform: uppercase; letter-spacing: .05em; }
.rest-time { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rest-btn {
  min-width: 50px; height: 44px; padding: 0 10px; border: 0; border-radius: 11px;
  background: color-mix(in srgb, var(--bg) 16%, transparent); color: inherit; font-weight: 750;
}
.rest.over { background: var(--accent); color: var(--accent-ink); animation: nudge .5s ease 2; }
.rest.over .rest-fill span { background: var(--accent-ink); }
@keyframes nudge { 50% { transform: scale(1.02); } }

/* ---------- Verlauf & Details ---------- */
.stat-row { display: flex; gap: 8px; margin: 6px 0 4px; }
.stat-row > div { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 12px; background: var(--surface-2); }
.stat-row b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-row span { font-size: 12px; color: var(--muted); text-align: center; }
.weeks { display: block; margin-top: 12px; }
.weeks .bar { fill: color-mix(in srgb, var(--accent) 55%, var(--surface-2)); }
.weeks .bar.now { fill: var(--accent); }
.weeks .bar.zero { fill: var(--surface-2); }
.weeks .bar-val { font-size: 10px; font-weight: 700; fill: var(--muted); }

.detail-ex { padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-ex:first-child { padding-top: 0; }
.detail-ex:last-of-type { border-bottom: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: 9px; background: var(--surface-2);
  font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.chip.skip { color: var(--muted); }
.chip.pr { background: var(--gold-soft); color: var(--gold); }
.chip .i { width: 14px; height: 14px; }
.note-text { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: 14px; color: var(--muted); }
.note-text .i { width: 16px; height: 16px; margin-top: 2px; }

/* ---------- Diagramme ---------- */
.chart-wrap { margin-top: 12px; min-height: 120px; }
.chart-tip { font-size: 13px; font-weight: 650; color: var(--muted); min-height: 20px; margin-bottom: 4px; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { font-size: 11px; fill: var(--muted); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .1; }
.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .dot.last { fill: var(--accent); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart-empty { display: grid; place-items: center; height: 140px; color: var(--muted); font-size: 14px; border-radius: 12px; background: var(--surface-2); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; margin: 12px 0; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.tile b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tile .eyebrow { font-size: 11px; }

.bw-add { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.bw-add .field-block { margin: 0; }
.bw-add .btn { grid-column: 1 / -1; }

/* ---------- Pläne ---------- */
.item-card { padding: 12px; }
.item-top { display: flex; align-items: center; gap: 4px; }
.item-no {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none;
  border-radius: 8px; background: var(--surface-2); font-size: 13px; font-weight: 750; color: var(--muted);
}
.item-ex {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  min-height: 44px; padding: 0 8px; border: 0; background: none; text-align: left; font-weight: 700; font-size: 16px;
}
.item-ex span { line-height: 1.25; overflow-wrap: break-word; hyphens: auto; }
.item-ex .i { width: 16px; height: 16px; color: var(--muted); }
.item-top .icon-btn { width: 34px; height: 38px; }
.item-top .icon-btn .i { width: 19px; height: 19px; }
.item-fields { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 10px; margin-top: 8px; }
.item-fields .field-block { margin: 0; }
.item-fields input {
  width: 100%; min-height: 44px; padding: 8px 10px;
  border: 1.5px solid var(--line); border-radius: 11px; background: var(--surface); font-size: 16px; outline: none;
}
.item-fields .num.left { min-height: 44px; padding: 8px 34px 8px 10px; }
.scheme-preview { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.scheme-preview.bad { color: var(--danger); }

/* ---------- Einstellungen ---------- */
.status-line { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 14px; font-weight: 600; }
.status-line::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status-line.s-ok::before { background: var(--ok); }
.status-line.s-pending::before, .status-line.s-syncing::before { background: var(--accent); }
.status-line.s-error::before { background: var(--danger); }
.help { margin-top: 14px; font-size: 14px; }
.help summary { cursor: pointer; font-weight: 700; color: var(--accent); padding: 6px 0; }
.help ol { margin: 8px 0 0; padding-left: 20px; }
.help li { margin-top: 8px; }
.help a { color: var(--accent); text-decoration: underline; word-break: break-all; }
.card p.small + p.small { margin-top: 8px; }

/* ---------- Sheets ---------- */
.sheet-root { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / .45); opacity: 0; transition: opacity .2s; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
  max-height: 86vh; overflow: auto; overscroll-behavior: contain;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 16px);
  border-radius: 22px 22px 0 0; background: var(--surface);
  transform: translateY(100%); transition: transform .22s ease;
}
.sheet-root.open .sheet-backdrop { opacity: 1; }
.sheet-root.open .sheet { transform: none; }
.sheet-grip { width: 40px; height: 5px; margin: 0 auto 12px; border-radius: 99px; background: var(--line); }
.sheet-title { font-size: 19px; font-weight: 800; margin-bottom: 10px; }
.sheet-text { margin-bottom: 14px; }
.sheet-btns { display: flex; gap: 10px; margin-top: 14px; }
.sheet-btns .btn { flex: 1; }
.sheet-list { display: flex; flex-direction: column; }
.sheet-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 0 6px;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font-size: 16px; font-weight: 600;
}
.sheet-item:last-child { border-bottom: 0; }
.sheet-item .i { color: var(--muted); }
.sheet-item.danger, .sheet-item.danger .i { color: var(--danger); }
.sheet-item.accent, .sheet-item.accent .i { color: var(--accent); }
.picker-list { max-height: 50vh; overflow: auto; }
.sheet .search-wrap { margin-top: 0; }

.summary { text-align: center; padding: 6px 0 0; }
.summary h2 { font-size: 22px; font-weight: 800; margin-top: 10px; }
.summary .stat-row { margin-top: 16px; }
.summary-badge { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); }
.summary-badge .i { width: 32px; height: 32px; }
.pr-list { list-style: none; margin: 0; padding: 0; text-align: left; }
.pr-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.pr-list .i { color: var(--gold); margin-top: 1px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 60; left: 16px; right: 16px; top: calc(env(safe-area-inset-top) + 12px);
  max-width: 480px; margin: 0 auto; padding: 12px 16px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-weight: 650; font-size: 15px; text-align: center;
  box-shadow: 0 10px 30px rgb(0 0 0 / .25);
  opacity: 0; transform: translateY(-10px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- Schmale Handys ---------- */
@media (max-width: 380px) {
  .set-row { grid-template-columns: 38px 1fr 1fr 48px; gap: 6px; }
  .check { width: 48px; }
  .item-fields { grid-template-columns: 1fr 1fr; }
  .item-fields .field-block:nth-child(2) { grid-column: 1 / -1; order: -1; }
}
@media (min-width: 380px) and (max-width: 520px) {
  .item-fields { grid-template-columns: 1fr 1fr; }
  .item-fields .field-block:nth-child(2) { grid-column: 1 / -1; order: -1; }
}
