:root {
  --bg: #0e1116;
  --bg2: #161b22;
  --card: #1b212b;
  --card2: #222b38;
  --line: #2a3340;
  --txt: #e7edf5;
  --muted: #93a1b3;
  --accent: #4f9dff;
  --accent2: #2f6fd0;
  --good: #45c98a;
  --warn: #ffb24d;
  --danger: #ff6b6b;
  --pill: #2a3340;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(0,0,0,.35);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--txt); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 16px; line-height: 1.4;
  padding-bottom: env(safe-area-inset-bottom);
  overscroll-behavior-y: none;
}
a { color: var(--accent); }

/* ---- Topbar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, rgba(14,17,22,.96), rgba(14,17,22,.82));
  backdrop-filter: blur(8px);
  padding: calc(env(safe-area-inset-top) + 14px) 18px 12px;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: .2px; }
.topbar .date { color: var(--muted); font-size: 13px; margin-top: 2px; }
.progress-wrap { margin-top: 12px; }
.progress-bar { height: 8px; background: var(--bg2); border-radius: 999px; overflow: hidden; }
.progress-bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--good)); transition: width .35s ease; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---- Layout ---- */
.wrap { max-width: 640px; margin: 0 auto; padding: 16px 14px 96px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin: 22px 4px 8px; }

/* ---- Cards / Fenster ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow); }
.card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; padding: 14px 16px 8px; }
.card-head .ttl { font-weight: 640; font-size: 16px; }
.card-head .sub { color: var(--muted); font-size: 12px; }
.card-head .time { color: var(--accent); font-size: 13px; font-variant-numeric: tabular-nums; }
.badge-now { background: var(--accent); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 8px; vertical-align: middle; }

/* ---- Items ---- */
.item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); cursor: pointer; user-select: none; }
.item:first-of-type { border-top: 1px solid var(--line); }
.item .box { flex: 0 0 24px; width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; transition: .15s; }
.item.done .box { background: var(--good); border-color: var(--good); }
.item .box svg { width: 14px; height: 14px; opacity: 0; transform: scale(.6); transition: .15s; }
.item.done .box svg { opacity: 1; transform: scale(1); }
.item .meta { flex: 1; min-width: 0; }
.item .nm { font-weight: 520; }
.item.done .nm { color: var(--muted); text-decoration: line-through; }
.item .dt { color: var(--muted); font-size: 12.5px; }
.tag { font-size: 10.5px; color: var(--warn); border: 1px solid var(--warn); border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.opt { font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.due-note { padding: 10px 16px; border-top: 1px dashed var(--line); color: var(--warn); font-size: 13px; }

/* ---- Periodisch ---- */
.per { padding: 14px 16px; border-top: 1px solid var(--line); }
.per:first-child { border-top: none; }
.per .row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.per .nm { font-weight: 580; }
.per .det { color: var(--muted); font-size: 12.5px; }
.per .due-pill { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--pill); color: var(--muted); white-space: nowrap; }
.per .due-pill.due { background: var(--warn); color: #2a1c00; font-weight: 600; }
.per .note { color: var(--muted); font-size: 12px; margin-top: 6px; }
.per .controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.per .controls input[type=date], .per .controls select { background: var(--bg2); color: var(--txt); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 14px; }

/* ---- Buttons ---- */
.btn { appearance: none; border: 1px solid var(--line); background: var(--card2); color: var(--txt); border-radius: 10px; padding: 9px 14px; font-size: 14px; font-weight: 560; cursor: pointer; transition: .12s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.good { background: var(--good); border-color: var(--good); color: #06311e; }

/* ---- PRN ---- */
.prn { padding: 12px 16px; border-top: 1px solid var(--line); }
.prn:first-child { border-top: none; }
.prn .row1 { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.prn .nm { font-weight: 560; }
.prn .det { color: var(--muted); font-size: 12.5px; }
.prn .warn { margin-top: 8px; background: rgba(255,107,107,.12); border: 1px solid var(--danger); color: #ffd0d0; border-radius: 10px; padding: 8px 10px; font-size: 12.5px; }
.prn .note { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---- Vitals ---- */
.vitals-form { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 14px 16px; }
.vitals-form input { background: var(--bg2); color: var(--txt); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 15px; text-align: center; }
.vitals-form .full { grid-column: 1 / -1; }
.vlog { padding: 10px 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; }
.vlog .when { color: var(--muted); font-size: 12px; }

/* ---- Hints / Microcopy ---- */
.hints { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.hints li { color: var(--muted); font-size: 13px; margin: 6px 0; padding-left: 4px; }
.hints .disc { color: var(--txt); }
.excluded { margin-top: 10px; font-size: 12.5px; color: var(--danger); background: rgba(255,107,107,.08); border: 1px solid rgba(255,107,107,.35); border-radius: 10px; padding: 8px 10px; }

/* ---- Push-Banner ---- */
.push-banner { display: flex; align-items: center; gap: 10px; background: var(--card2); border: 1px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.push-banner .t { flex: 1; font-size: 13.5px; }
.push-banner .t b { display: block; }
.push-banner .t span { color: var(--muted); font-size: 12px; }

/* ---- Tabbar ---- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: rgba(22,27,34,.96); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { flex: 1; background: none; border: none; color: var(--muted); padding: 10px 0 12px; font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.tabbar button.active { color: var(--accent); }
.tabbar button svg { width: 22px; height: 22px; }

/* ---- Modal / Toast ---- */
.toast { position: fixed; left: 50%; bottom: 78px; transform: translateX(-50%) translateY(20px); background: #fff; color: #111; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 560; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Settings rows ---- */
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-top: 1px solid var(--line); gap: 12px; }
.set-row:first-child { border-top: none; }
.set-row label { font-size: 14.5px; }
.set-row .hint { color: var(--muted); font-size: 12px; }
.set-row input[type=time] { background: var(--bg2); color: var(--txt); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 15px; }
.set-row input[type=password] { background: var(--bg2); color: var(--txt); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 15px; width: 150px; }

.view { display: none; }
.view.active { display: block; }

/* Switch */
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .2s; }
.switch .sl:before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .sl { background: var(--good); }
.switch input:checked + .sl:before { transform: translateX(20px); }
