/* Home – Bausteine aus den Vorlagen a.html (Handy) und mac.html (Mac). Farben nur aus tokens.css. */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
:root {
  --fs: 17px; --fs-sub: 13px; --zeile: 52px; --karte: 20px; --pad-y: 10px; --pad-x: 16px; --check: 26px;
  --h1: 34px; --h2: 20px; --haken-einzug: 54px; --zeit: 50px; --bar: 4px;
}
html[data-layout="mac"] {
  --fs: 14px; --fs-sub: 12px; --zeile: 44px; --karte: 14px; --pad-y: 8px; --pad-x: 14px; --check: 22px;
  --h1: 30px; --h2: 17px; --haken-einzug: 50px; --zeit: 46px; --bar: 3px;
}
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: var(--fs)/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--c-fokus); outline-offset: 2px; }

/* Rahmen: Handy = eine Spalte mit Leiste unten, Mac = Seitenleiste links */
.app {
  max-width: 440px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 20px) max(16px, env(safe-area-inset-right, 0px))
           calc(env(safe-area-inset-bottom, 0px) + 104px) max(16px, env(safe-area-inset-left, 0px));
}
html[data-layout="mac"] body { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
html[data-layout="mac"] .app { max-width: none; margin: 0; padding: 34px 40px 60px; min-width: 0; }
html[data-layout="mobil"] .side, html[data-layout="mac"] .tabbar, html[data-route="einrichten"] .tabbar { display: none; }

/* Kopf */
.eyebrow { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--c-termin); }
html[data-layout="mac"] .eyebrow { font-size: 12px; }
h1 { margin: 2px 0 14px; font-size: var(--h1); line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
html[data-layout="mac"] h1 { margin-bottom: 0; }
.lead { margin: -8px 0 16px; color: var(--text-2); font-size: 15px; }
h2 { margin: 26px 4px 8px; font-size: var(--h2); font-weight: 700; letter-spacing: -.01em; }
h2 span { font-size: 13px; font-weight: 500; color: var(--text-2); }
html[data-layout="mac"] h2 { margin: 0 4px 8px; display: flex; justify-content: space-between; align-items: baseline; }
.zurueck { border: 0; background: none; padding: 0 0 8px; color: var(--c-fokus); font-size: var(--fs); }
.head { display: flex; align-items: end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.stack { display: grid; gap: 22px; }
.stack h2 { margin-top: 0; }
.note { margin-top: 18px; color: var(--text-2); }

/* Karten und Zeilen */
.card { background: var(--surface); border-radius: var(--karte); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: var(--zeile); padding: var(--pad-y) var(--pad-x); width: 100%; border: 0; background-color: transparent; text-align: left; }
.row + .row, .wk + .wk {
  background-image: linear-gradient(var(--line), var(--line));
  background-size: calc(100% - var(--haken-einzug)) .5px; background-position: right top; background-repeat: no-repeat;
}
.main { flex: 1; min-width: 0; }
.title { font-size: var(--fs); }
.sub { font-size: var(--fs-sub); color: var(--text-2); margin-top: 1px; }
.sub.schule { color: var(--c-schule); }
.chev { color: var(--text-3); font-size: 22px; line-height: 1; }
.cd { font-size: 15px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
html[data-layout="mac"] .cd { font-size: 13px; }
.cd.bald { color: var(--c-schule); font-weight: 600; }
.leer { padding: 16px; color: var(--text-2); font-size: 15px; }

/* Abhaken */
.check {
  flex: none; width: var(--check); height: var(--check); padding: 0; border-radius: 50%;
  border: 1.6px solid var(--text-3); background: none; color: transparent;
  display: grid; place-items: center; transition: background .15s, border-color .15s;
}
.check svg { width: 55%; height: 55%; }
.done .check, .check[aria-checked="true"] { background: var(--c-erledigt); border-color: var(--c-erledigt); color: var(--auf-farbe); }
.done .title { color: var(--text-2); }

/* Tageszustand */
.state {
  width: 100%; border: 0; text-align: left; display: grid; grid-template-columns: 1fr 1fr auto;
  align-items: center; gap: 12px; padding: 14px 16px;
}
.state small { display: block; font-size: 13px; color: var(--text-2); }
.state b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c-erledigt); margin-right: 6px; vertical-align: 2px; }
.dot.warn { background: var(--c-morgen); }
html[data-layout="mac"] .state { width: auto; display: flex; gap: 18px; border-radius: 12px; padding: 7px 14px; }
html[data-layout="mac"] .state small { font-size: 11px; }
html[data-layout="mac"] .state b { font-size: 17px; }
html[data-layout="mac"] .state .chev { display: none; }
.tools { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }

/* Termine */
.time { width: var(--zeit); flex: none; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.time small { display: block; font-weight: 400; color: var(--text-2); font-size: 13px; }
html[data-layout="mac"] .time { font-size: 13px; }
html[data-layout="mac"] .time small { font-size: 12px; }
.bar { width: var(--bar); align-self: stretch; border-radius: 2px; flex: none; }
.bar.schule { background: var(--c-schule); }
.bar.sport { background: var(--c-eishockey); }

/* Spontan-Knöpfe */
.spont { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.spont button {
  border: 0; border-radius: 16px; background: var(--surface); padding: 12px 4px 10px;
  display: grid; justify-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text);
}
.spont svg { width: 26px; height: 26px; color: var(--text-2); }
.spont [aria-pressed="true"] { background: var(--c-erledigt-bg); color: var(--c-erledigt); }
.spont [aria-pressed="true"] svg { color: var(--c-erledigt); }
html[data-layout="mac"] .spont { display: flex; gap: 6px; }
html[data-layout="mac"] .spont button { border-radius: 12px; padding: 0 12px; min-height: 46px; display: flex; align-items: center; gap: 6px; font-size: 13px; }
html[data-layout="mac"] .spont svg { width: 18px; height: 18px; }

/* Woche, Handy: eine Zeile je Tag */
.wk { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 10px 16px; }
.d { text-align: center; font-size: 20px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.d small { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); text-transform: uppercase; }
.wk ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; align-content: center; font-size: 15px; }
.wk li { display: flex; align-items: baseline; gap: 8px; }
.wk li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; transform: translateY(-1px); }
.wk li.schule::before { background: var(--c-schule); }
.wk li.sport::before { background: var(--c-eishockey); }
.wk li span { flex: 1; min-width: 0; }
.wk li time { color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 13px; }
.exam { font-weight: 600; }
.wk li.exam span { font-weight: 600; }

/* Woche, Mac: 7 Spalten */
.week { margin-top: 30px; overflow-x: auto; }
.days { display: grid; grid-template-columns: repeat(7, minmax(128px, 1fr)); gap: 8px; align-items: start; }
.dayh { display: flex; align-items: baseline; gap: 6px; padding: 0 4px 8px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.dayh b { font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.today .dayh b { color: var(--auf-farbe); background: var(--c-termin); border-radius: 999px; min-width: 30px; text-align: center; padding: 0 6px; }
.day { display: grid; gap: 5px; }
.wkitem { position: relative; background: var(--surface); border-radius: 9px; padding: 6px 8px 6px 13px; font-size: 13px; line-height: 1.25; }
.wkitem::before { content: ""; position: absolute; left: 5px; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; }
.wkitem.schule::before { background: var(--c-schule); }
.wkitem.sport::before { background: var(--c-eishockey); }
.wkitem time { display: block; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.free { padding: 6px 4px; font-size: 12px; color: var(--text-3); }

/* Nächstes Spiel */
.game { display: flex; align-items: center; gap: 16px; padding: 14px 16px; }
.game .k { font-size: 13px; font-weight: 600; color: var(--c-eishockey); }
.game .big { text-align: center; font-size: 30px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.game .big small { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); }

/* Mehr */
.ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--auf-farbe); flex: none; }
.ico svg { width: 18px; height: 18px; }
.status { margin: 22px 4px 0; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* Leiste unten: schwebend, Glas */
.tabbar {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  width: min(408px, calc(100% - 24px)); display: flex; padding: 5px; border-radius: 999px;
  background: var(--glass); -webkit-backdrop-filter: blur(24px) saturate(1.8); backdrop-filter: blur(24px) saturate(1.8);
  box-shadow: 0 8px 28px var(--schatten), inset 0 0 0 .5px var(--line);
}
.tabbar button {
  flex: 1; border: 0; background: none; border-radius: 999px; padding: 6px 0 5px;
  display: grid; justify-items: center; gap: 2px; font-size: 10px; font-weight: 600; color: var(--text);
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar [aria-current="page"] { background: var(--fill); }

/* Seitenleiste (Mac) */
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side);
  padding: 44px 10px 16px; border-right: .5px solid var(--line); display: grid; align-content: start; gap: 2px;
}
.side .lbl { margin: 14px 10px 4px; font-size: 11px; font-weight: 600; color: var(--text-2); }
.side button { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; padding: 5px 10px; border-radius: 8px; font-size: 13px; text-align: left; }
.side button:hover { background: var(--fill); }
.side [aria-current="page"] { background: var(--fill); font-weight: 600; }
.sq { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: var(--auf-farbe); flex: none; }
.sq svg { width: 14px; height: 14px; }
.side .status { margin: 18px 10px 0; }

/* Check-in: Blatt über allem (Handy) bzw. Seite (Mac) */
html[data-layout="mobil"] [data-screen="checkin"] {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; background: var(--bg);
  animation: sheet .38s cubic-bezier(.2, .8, .2, 1);
}
@keyframes sheet { from { transform: translateY(100%); } }
.sheetbar {
  position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: var(--bg); font-weight: 600;
}
.sheetbar button { border: 0; background: none; padding: 4px 0; justify-self: start; font-weight: 400; color: var(--text-2); }
.sheet { max-width: 440px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 32px) max(16px, env(safe-area-inset-left, 0px)); }
html[data-layout="mac"] .sheet { max-width: 560px; margin: 0; padding: 0; }
.q { margin: 22px 4px 8px; font-size: 15px; font-weight: 600; color: var(--text-2); }
html[data-layout="mac"] .q { font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 0; border-radius: 999px; padding: 9px 15px; background: var(--surface); font-size: 15px; }
html[data-layout="mac"] .chip { padding: 7px 14px; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.chips input {
  flex: 1 1 140px; min-width: 0; border: 0; border-radius: 999px; padding: 9px 15px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 15px;
}

/* Drehräder */
.wheels { position: relative; display: flex; justify-content: center; align-items: center; gap: 4px; padding: 8px 0; }
.wheels::before {
  content: ""; position: absolute; left: 14px; right: 14px; top: 50%; height: var(--row-h, 40px); transform: translateY(-50%);
  background: var(--fill); border-radius: 10px;
}
.wheel {
  --row: 40px; position: relative; width: 56px; height: calc(var(--row) * 5); overflow-y: scroll;
  scroll-snap-type: y mandatory; padding-block: calc(var(--row) * 2); scrollbar-width: none;
  -webkit-mask-image: linear-gradient(transparent, black 30%, black 70%, transparent);
          mask-image: linear-gradient(transparent, black 30%, black 70%, transparent);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-item { height: var(--row); line-height: var(--row); text-align: right; padding-right: 6px; scroll-snap-align: center; font-size: 22px; font-variant-numeric: tabular-nums; }
.unit { position: relative; width: 52px; font-weight: 600; }
html[data-layout="mac"] .wheels { --row-h: 36px; }
html[data-layout="mac"] .wheel { --row: 36px; width: 52px; }
html[data-layout="mac"] .wheel-item { font-size: 19px; }

/* Gefühl */
.moods { display: grid; grid-template-columns: repeat(5, 1fr); padding: 14px 6px; }
.moods button { border: 0; background: none; padding: 0; display: grid; justify-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.moods svg { width: 44px; height: 44px; padding: 7px; border-radius: 50%; background: var(--fill); color: var(--text-2); }
.moods [aria-checked="true"] { color: var(--text); font-weight: 600; }
.moods [aria-checked="true"] svg { background: var(--text); color: var(--bg); }
textarea, .feld {
  display: block; width: 100%; min-height: 84px; border: 0; padding: 12px 16px; resize: none;
  background: transparent; color: var(--text); font: inherit;
}
.feld { min-height: 0; background: var(--surface); border-radius: 14px; }
.send { width: 100%; margin-top: 24px; border: 0; border-radius: 14px; padding: 15px; background: var(--text); color: var(--bg); font-weight: 600; }
html[data-layout="mac"] .send { width: auto; padding: 10px 22px; border-radius: 10px; }
.fehler { margin: 10px 4px 0; color: var(--c-termin); font-size: 15px; }

/* Nachrichten und Markdown */
.read { max-width: 680px; }
html[data-layout="mobil"] .read { max-width: none; }
.tage { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 16px; }
.md { background: var(--surface); border-radius: var(--karte); padding: 6px 18px 16px; line-height: 1.45; }
.md h1, .md h2, .md h3 { margin: 22px 0 6px; font-size: 18px; letter-spacing: 0; }
.md h1 { font-size: 20px; }
.md p { margin: 8px 0; }
.md ul, .md ol { margin: 8px 0; padding-left: 22px; }
.md li { margin: 4px 0; }
.md a { color: var(--c-fokus); text-decoration: underline; text-underline-offset: 2px; }
.md hr { border: 0; border-top: .5px solid var(--line); margin: 18px 0; }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--fill); padding: 1px 5px; border-radius: 5px; }
.md blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--text-2); }
.md .hinweis { margin: 10px 0; padding: 8px 14px; border-radius: 12px; background: var(--c-hinweis-bg); }
.md .hinweis-warnung { background: var(--c-warnung-bg); }
.md .tabelle { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: .92em; }
.md th, .md td { padding: 5px 10px; border-bottom: .5px solid var(--line); text-align: left; vertical-align: top; }
.md details { margin: 10px 0; }
.md summary { cursor: pointer; font-weight: 600; color: var(--text-2); }
.md .kaestchenliste { list-style: none; padding-left: 0; }
.md .kaestchen { display: flex; gap: 10px; align-items: flex-start; }
.md .kaestchen .check { margin-top: 1px; }
.md .kaestchen.done span { color: var(--text-2); }
.state.kein { grid-template-columns: 1fr auto; }
.tage .chip[aria-pressed="false"] { color: var(--text-2); }
