/* StopMe Eltern-App – flaches Apple-Minimal wie die Desktop-App (kein Verlauf). */
:root {
  --canvas: #F5F5F7; --card: #FFFFFF; --ink: #1D1D1F; --muted: #636369; --hair: #E5E5EA;
  --chip: #EEEEF0; --chip-ink: #1D1D1F;
  --blue: #0A84FF; --blue-ink: #0060DF; --green: #248A3D; --green-bg: #34C759; --red: #D70015; --amber: #B25000; --amber-bg: #FFF4E5;
  --purple: #7C5CE5;
  --radius: 18px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #000000; --card: #1C1C1E; --ink: #F5F5F7; --muted: #98989F; --hair: #2C2C2E;
    --chip: #2C2C2E; --chip-ink: #F5F5F7;
    --blue: #0A84FF; --blue-ink: #409CFF; --green: #30D158; --green-bg: #30D158; --red: #FF453A; --amber: #FFB340; --amber-bg: #2E2416;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #000000; --card: #1C1C1E; --ink: #F5F5F7; --muted: #98989F; --hair: #2C2C2E;
  --chip: #2C2C2E; --chip-ink: #F5F5F7; --blue-ink: #409CFF; --green: #30D158; --green-bg: #30D158; --red: #FF453A;
  --amber: #FFB340; --amber-bg: #2E2416; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--canvas); color: var(--ink); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
  max-width: 560px; margin: 0 auto;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--blue-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; border-radius: 12px; }

/* Kopfzeile */
.top { display: flex; align-items: center; justify-content: space-between; padding: 18px 2px 10px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 22px; letter-spacing: -.02em; }
.glyph { width: 24px; height: 24px; fill: none; stroke: var(--blue); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); background: var(--card); padding: 6px 12px; border-radius: 999px; box-shadow: var(--shadow); max-width: 60%; }
.pill span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.pill.on .dot { background: var(--green-bg); }

main { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 6px 0 12px; }

/* Karten */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.child-head { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--blue); flex: none; }
.child-name { font-weight: 650; font-size: 18px; }
.status { font-size: 14px; color: var(--muted); }
.status.locked { color: var(--red); }
.status.parent { color: var(--purple); }
.status.focus { color: var(--blue-ink); }
.status.break, .status.free { color: var(--green); }

.time { display: flex; align-items: baseline; gap: 8px; margin: 14px 0 6px; }
.time b { font-size: 44px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.time span { color: var(--muted); font-size: 15px; }
.bar { height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 3px; transition: width .4s ease; }
.bar.low i { background: var(--red); }
.meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 6px; gap: 8px; }

/* Anfrage */
.request { margin-top: 14px; background: var(--amber-bg); border-radius: 14px; padding: 14px; }
.request p { margin: 0 0 12px; font-weight: 600; }
.request small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* Schaltflächen */
.btn { min-height: 48px; border: 0; border-radius: 14px; padding: 0 16px; font-weight: 600; background: var(--chip); color: var(--chip-ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s ease, opacity .2s ease, background .2s ease; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.green { background: var(--green-bg); color: #fff; }
.btn.danger { color: var(--red); }
.btn.ghost { background: transparent; color: var(--blue-ink); }
.btn.wide { width: 100%; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.actions .btn { flex-direction: column; gap: 4px; min-height: 64px; font-size: 13px; padding: 6px 4px; }
.actions .btn svg { width: 20px; height: 20px; }

/* Leer-/Begrüßungszustand */
.hero { text-align: center; padding: 36px 20px; }
.hero h1 { font-size: 26px; letter-spacing: -.02em; margin: 14px 0 8px; }
.hero p { color: var(--muted); margin: 0 auto 8px; max-width: 30em; }
.hero ol { text-align: left; color: var(--ink); max-width: 26em; margin: 18px auto 0; padding-left: 1.3em; }
.hero ol li { margin: 6px 0; }
.hero img { width: 76px; height: 76px; border-radius: 18px; }
.note { font-size: 14px; color: var(--muted); text-align: center; margin: 0; }
.banner { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.banner .btn { flex: none; min-height: 40px; }

/* Fußzeile */
.foot { padding: 6px 0 18px; display: flex; flex-direction: column; gap: 10px; }
.legal { font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0 0; }

/* Auswahl-Sheet */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet[hidden] { display: none; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.35); animation: fade .2s ease; }
.sheet-panel { position: relative; width: 100%; max-width: 560px; background: var(--card); border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); animation: up .24s cubic-bezier(.2,.8,.2,1); max-height: 88dvh; overflow: auto; }
.grab { width: 38px; height: 5px; border-radius: 3px; background: var(--hair); margin: 0 auto 10px; }
.sheet h2 { font-size: 19px; margin: 6px 0 14px; }
.sheet h3 { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 8px; }
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chips[data-group="task"] { grid-template-columns: repeat(2, 1fr); }
.chips[data-group="taskMin"] { grid-template-columns: repeat(4, 1fr); }
.sheet h4 { font-size: 13px; font-weight: 500; color: var(--muted); margin: 12px 0 6px; }
.chip { min-height: 44px; padding: 0 8px; border-radius: 12px; border: 0; background: var(--chip); color: var(--chip-ink); font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--blue); color: #fff; }
.list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.list .btn { justify-content: flex-start; min-height: 52px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--canvas); padding: 12px 18px; border-radius: 14px; font-size: 15px; font-weight: 500; max-width: calc(100% - 32px); z-index: 30; box-shadow: 0 8px 30px rgba(0,0,0,.25); animation: up .2s ease; pointer-events: none; }
.toast.err { background: var(--red); color: #fff; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (max-width: 360px) { .time b { font-size: 38px; } .actions .btn { font-size: 12px; } }

/* QR-Scanner */
.scanner { position: fixed; inset: 0; z-index: 40; background: #000; display: flex; align-items: center; justify-content: center; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: relative; width: min(68vw, 300px); aspect-ratio: 1; border-radius: 28px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55); border: 3px solid rgba(255,255,255,.9); }
.scan-top { position: absolute; top: calc(28px + env(safe-area-inset-top)); left: 24px; right: 24px; text-align: center; color: #fff; }
.scan-top h2 { margin: 0 0 6px; font-size: 21px; }
.scan-top p { margin: 0; opacity: .85; font-size: 15px; }
.scan-cancel { position: absolute; bottom: calc(32px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); min-width: 180px; background: rgba(255,255,255,.18); color: #fff; backdrop-filter: blur(12px); }

/* Einstellungen */
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--ink); flex: none; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.top-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; flex: 1; }
.top-right .pill { max-width: none; min-width: 0; }
.set-head { display: flex; align-items: center; gap: 10px; margin: 2px 0 2px; }
.set-head h1 { font-size: 26px; margin: 0; letter-spacing: -.02em; }
.group { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 16px; }
.group-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 18px 4px 8px; }
.group-note { font-size: 13px; color: var(--muted); margin: 8px 4px 0; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 0; border-bottom: 1px solid var(--hair); }
.item:last-child { border-bottom: 0; }
.item label, .item .lbl { flex: 1; min-width: 0; }
.item small { display: block; color: var(--muted); font-size: 13px; }
.switch { width: 51px; height: 31px; border-radius: 16px; border: 0; background: var(--hair); position: relative; flex: none; transition: background .2s ease; padding: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s ease; }
.switch[aria-checked="true"] { background: var(--green-bg); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch::before { content: ""; position: absolute; inset: -7px -10px; }   /* 44px+ Tipp-Fläche */
.stepper { display: inline-flex; align-items: center; background: var(--chip); border-radius: 12px; flex: none; }
.stepper button { width: 44px; height: 44px; border: 0; background: transparent; color: var(--blue-ink); font-size: 22px; line-height: 1; }
.stepper output { min-width: 58px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
input[type="time"], input[type="date"] { font: inherit; color: var(--ink); background: var(--chip); border: 0; border-radius: 10px; padding: 8px 10px; min-height: 44px; }
.seg { display: flex; background: var(--chip); border-radius: 12px; padding: 3px; gap: 2px; width: 100%; }
.seg button { flex: 1; border: 0; background: transparent; min-height: 44px; border-radius: 9px; font-weight: 600; color: var(--muted); font-size: 14px; padding: 0 6px; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 10px 0; }
.week div { text-align: center; font-size: 12px; color: var(--muted); }
.week input { width: 100%; text-align: center; font: inherit; font-weight: 600; background: var(--chip); color: var(--ink); border: 0; border-radius: 10px; min-height: 44px; padding: 0; }
.profiles { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.profiles .chip { flex: none; padding: 0 14px; }
.profiles .chip.add { color: var(--blue-ink); background: transparent; border: 1.5px dashed var(--hair); }
.savebar { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); margin-top: 18px; z-index: 5; }
.savebar .btn { box-shadow: 0 8px 24px rgba(10,132,255,.35); }

/* Live-Aktivität auf der Kind-Karte */
.activity { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 8px 12px; background: var(--chip); border-radius: 12px; font-size: 14px; color: var(--ink); min-height: 40px; }
.act-ic { width: 18px; height: 18px; fill: none; stroke: var(--blue-ink); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.act-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.act-since { color: var(--muted); font-size: 13px; flex: none; }
