:root {
  color-scheme: light;
  --bg: #EEF1EC; --surface: #F8F9F6; --ink: #1E2824; --muted: #5E6B65; --line: #D5DBD5;
  --moss: #3F6650; --moss-2: #7FA08B; --moss-3: #B9CDBF; --moss-0: #DDE5DF;
  --sun: #C98F1E; --danger: #A8443A; --on-moss: #F8F9F6;
  --round: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #151B19; --surface: #1D2522; --ink: #E6ECE8; --muted: #97A49E; --line: #2D3833;
    --moss: #8DBB9C; --moss-2: #5E8A6E; --moss-3: #3E5E4B; --moss-0: #26302C;
    --sun: #E7C064; --danger: #E08378; --on-moss: #102018;
  }
}
*, *::before, *::after { box-sizing: inherit; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--sans); -webkit-tap-highlight-color: transparent; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--bg); z-index: 10; }
#view { max-width: 560px; margin: 0 auto; padding: 18px 18px calc(96px + env(safe-area-inset-bottom, 0px)); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }

h1 { font: 700 30px/1.15 var(--round); letter-spacing: -0.01em; margin: 6px 0 2px; }
h2 { font: 650 19px/1.3 var(--round); margin: 30px 0 10px; }
.sub { color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Week strip */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 20px 0 8px; }
.day { display: grid; justify-items: center; gap: 6px; padding: 8px 0; border-radius: 14px; font-size: 13px; color: var(--muted); }
.day i { width: 22px; height: 22px; margin: 3px; border-radius: 50%; display: block; }
.day i.rest { background: var(--moss-0); transform: scale(.45); }
.day i.plan { border: 2px solid var(--moss-2); }
.day i.missed { border: 2px dashed var(--line); }
.day.is-today { background: var(--surface); color: var(--ink); font-weight: 600; }
.weeknote { display: flex; gap: 22px; flex-wrap: wrap; color: var(--muted); font-size: 15px; }
.weeknote span { display: inline-flex; align-items: center; gap: 6px; }
.weeknote .link { padding: 0; }

/* Rows */
.list { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .meta { color: var(--muted); font-size: 14px; }
.check { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--moss-2); display: grid; place-items: center; }
.done .check { background: var(--moss); border-color: var(--moss); }
.done .check::after { content: ""; width: 10px; height: 6px; border: solid var(--on-moss); border-width: 0 0 2.5px 2.5px; transform: translateY(-1px) rotate(-45deg); }
.done .title { color: var(--muted); }
.go { color: var(--moss); font-weight: 600; font-size: 15px; }

.banner { display: block; width: 100%; text-align: left; margin-top: 18px; background: var(--moss); color: var(--on-moss); border: 0; border-radius: 16px; padding: 14px 16px; }
.banner b { display: block; font: 650 17px var(--round); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 10px 16px; font-weight: 550; }
.btn.primary { background: var(--moss); border-color: var(--moss); color: var(--on-moss); }
.btn.wide { width: 100%; padding: 15px; font-size: 17px; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .45; }
.link { background: none; border: 0; color: var(--moss); padding: 8px 0; font-weight: 550; }
.link.danger { color: var(--danger); }

/* Heatmap */
.heatwrap { overflow-x: auto; margin: 0 -4px; }
.heatmap { width: 100%; min-width: 320px; display: block; }
.heatmap text { font: 10px var(--sans); fill: var(--muted); }
.hm-0 { fill: var(--line); }
.hm-1 { fill: var(--moss-3); }
.hm-2 { fill: var(--moss-2); }
.hm-3 { fill: var(--moss); }
.hm-today { stroke: var(--sun); stroke-width: 2; }
circle.hm-0.hm-today { fill: none; }
.hm-sel { stroke: var(--ink); stroke-width: 2; }
.stats { display: flex; gap: 24px; margin: 12px 0 0; }
.stats b { display: block; font: 700 24px var(--round); font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 14px; }
.dayinfo { margin-top: 10px; background: var(--surface); border-radius: 14px; padding: 12px 14px; font-size: 15px; }

/* Session */
.top { display: flex; justify-content: space-between; align-items: center; }
.progress { height: 6px; background: var(--moss-0); border-radius: 3px; overflow: hidden; margin: 14px 0 18px; }
.progress div { height: 100%; background: var(--moss); transition: width .25s; }
.move { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 6px 8px 6px 14px; }
.move .tap { flex: 1; display: flex; align-items: center; gap: 14px; background: none; border: 0; text-align: left; padding: 10px 0; min-width: 0; }
.timerbtn { flex: none; border: 0; background: var(--moss-0); color: var(--moss); border-radius: 12px; padding: 10px 12px; font-weight: 650; font-variant-numeric: tabular-nums; }
.done .timerbtn { opacity: .55; }
.footer { margin-top: 24px; display: grid; gap: 6px; justify-items: center; }

/* Timer overlay */
#timer { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: grid; place-items: center; text-align: center; padding: env(safe-area-inset-top, 0px) 24px env(safe-area-inset-bottom, 0px); }
#timer[hidden] { display: none; }
.t-name { font: 650 22px var(--round); margin: 0 0 4px; }
.t-side { color: var(--muted); margin: 0 0 18px; min-height: 1.4em; }
.t-ring { position: relative; width: min(72vw, 300px); aspect-ratio: 1; margin: 0 auto; }
.t-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.t-ring circle { fill: none; stroke-width: 10; }
.t-ring .bg { stroke: var(--moss-0); }
.t-ring .fg { stroke: var(--moss); stroke-linecap: round; transition: stroke-dashoffset .2s linear; }
.t-ring.switch .fg { stroke: var(--sun); }
.t-num { position: absolute; inset: 0; display: grid; place-items: center; font: 700 64px var(--round); font-variant-numeric: tabular-nums; }
.t-actions { display: flex; gap: 10px; justify-content: center; margin-top: 28px; }

/* Forms */
label.field { display: grid; gap: 6px; margin: 14px 0; font-size: 14px; color: var(--muted); }
input[type=text], input[type=url], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; color: var(--ink); font-size: 16px; }
textarea { min-height: 80px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 12px; font-size: 15px; }
.chip.on { background: var(--moss); border-color: var(--moss); color: var(--on-moss); }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.scale .chip { padding: 10px 2px; font-size: 12.5px; line-height: 1.2; border-radius: 14px; text-align: center; }
.mvedit { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: grid; gap: 8px; }
.mvedit .opts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mvedit select { width: auto; }
.mvedit input[type=number] { width: 78px; }
.mvedit .tools { display: flex; gap: 4px; margin-left: auto; }
.icon { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; min-width: 38px; height: 38px; }
.inline { display: flex; align-items: center; gap: 6px; font-size: 15px; }

/* Log */
.month { font: 600 15px var(--round); color: var(--muted); margin: 22px 0 8px; }
.note { display: block; font-style: italic; color: var(--muted); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.chart { width: 100%; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .effort { stroke: var(--sun); fill: none; stroke-width: 2.5; }
.chart .body { stroke: var(--moss); fill: none; stroke-width: 2.5; }
.chart .d-effort { fill: var(--sun); }
.chart .d-body { fill: var(--moss); }
.legend { display: flex; gap: 16px; font-size: 14px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

/* Settings */
.status { font-size: 14px; color: var(--muted); }
.status.err { color: var(--danger); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px 16px 14px; }

/* Tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); }
.tabs[hidden] { display: none; }
.tabs button { background: none; border: 0; padding: 10px 0; color: var(--muted); font-weight: 550; font-size: 13.5px; min-width: 0; border-radius: 12px; }
.tabs button.on { color: var(--moss); background: var(--moss-0); }

/* Sheet */
#sheet { position: fixed; inset: 0; z-index: 25; background: rgb(0 0 0 / .35); display: flex; align-items: flex-end; }
#sheet[hidden] { display: none; }
.sheet { width: 100%; max-width: 560px; margin: 0 auto; max-height: 90%; overflow-y: auto; background: var(--bg); border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); }
.sheet h2 { margin-top: 4px; }

#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; z-index: 40; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 15px; max-width: 90vw; pointer-events: none; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; padding: 16px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* v2: two people */
.pic { flex: none; display: inline-block; vertical-align: middle; overflow: visible; }
h1.hello { display: flex; align-items: center; gap: 10px; }
.hero { display: grid; gap: 4px; width: 100%; text-align: left; margin-top: 18px; background: var(--moss); color: var(--on-moss); border: 0; border-radius: 20px; padding: 20px 20px 18px; }
.hero-label { font: 700 24px/1.15 var(--round); }
.hero-sub { font-size: 15px; opacity: .9; }
.simplebtn { margin-top: 10px; }
.notecard, .together { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.notecard { margin-top: 14px; border-color: var(--sun); }
.notecard .grow, .together .grow { flex: 1; min-width: 0; }
.nc-from { font-weight: 650; }
.nc-text { font-size: 17px; margin-top: 2px; overflow-wrap: anywhere; }
.nc-sug { margin-top: 6px; color: var(--muted); }
.notecard .actions, .together .actions { margin-top: 10px; }
.row.split { padding: 8px 10px 8px 16px; }
.plain { background: none; border: 0; text-align: left; padding: 6px 0; }
.logrow { margin-bottom: 8px; align-items: flex-start; }
.weeknav { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 10px; }
.weeknav b { font: 650 17px var(--round); }
.icon:disabled { opacity: .35; }
.chip.person { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px 6px 8px; }
.plan { display: grid; gap: 6px; margin-top: 8px; }
.pday { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.pday.is-today { border-color: var(--moss-2); }
.pd-name { width: 38px; flex: none; display: grid; line-height: 1.2; padding-top: 5px; }
.pd-name small { color: var(--muted); }
.pd-body { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 34px; }
.pchip { display: inline-flex; align-items: center; gap: 4px; background: var(--moss-0); color: var(--ink); border-radius: 999px; padding: 6px 6px 6px 12px; font-size: 15px; }
.pchip.done { background: var(--moss); color: var(--on-moss); }
.pchip button { border: 0; background: none; color: inherit; opacity: .6; padding: 0 6px; font-size: 13px; }
.pchip:not(:has(button)) { padding-right: 12px; }
.padd { border: 1px dashed var(--moss-2); background: none; color: var(--moss); border-radius: 999px; padding: 6px 12px; font-size: 15px; }
.cal-h, .cal-g { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-h span { text-align: center; color: var(--muted); font-size: 13px; padding-bottom: 4px; }
.cd { position: relative; aspect-ratio: 1; border: 0; background: var(--surface); border-radius: 12px; display: grid; place-items: center; padding: 0; }
.cd small { position: absolute; top: 3px; left: 6px; font-size: 11px; color: var(--muted); }
.cd .pic { margin-top: 8px; }
.cd.is-today { box-shadow: inset 0 0 0 2px var(--sun); }
.cd.sel { box-shadow: inset 0 0 0 2px var(--ink); }
.cd.future { background: none; }
.dl { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.stats { flex-wrap: wrap; gap: 14px; }
.stats > div { flex: 1; min-width: 92px; display: grid; justify-items: start; gap: 2px; }
.stats b { font-size: 22px; }
.stats span { font-size: 13px; line-height: 1.3; }
.who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 4px; }
.whobtn { display: grid; justify-items: center; gap: 4px; padding: 18px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.clock { font: 700 72px/1 var(--round); font-variant-numeric: tabular-nums; text-align: center; margin: 34px 0 6px; letter-spacing: -0.02em; }
.sheet .chips { margin-top: -4px; }
.lead { margin: 18px 0 -10px; color: var(--muted); }
