/* Palette comes from the house: marine-layer fog, deep pool teal, lemon from the backyard tree,
   bougainvillea for anything that needs a nudge. Lemon is spent in one place: the focus screen. */
:root {
  --bg: #E8EEEC; --paper: #F7FAF8; --ink: #10262B; --muted: #55706E; --line: #CBD8D4;
  --teal: #0D4B52; --on-teal: #F2FAF8; --accent-text: #0D4B52;
  --lemon: #F4CF3F; --on-lemon: #251E00; --berry: #A92F60; --good: #2E7D5B;
  --tone-a: #CFE6E3; --tone-b: #E5E3D4; --tone-c: #EBDAE1; --tone-d: #D8E6CB; --tone-e: #D9E1E5;
  --head: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C181B; --paper: #132327; --ink: #E5EEEB; --muted: #94AEAB; --line: #26393D;
    --teal: #1B6A72; --on-teal: #F2FAF8; --accent-text: #F4D250;
    --berry: #EE76A3; --good: #5CC196;
    --tone-a: #17363B; --tone-b: #2E2F26; --tone-c: #35262E; --tone-d: #243A1D; --tone-e: #212F37;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--body); }
body.locked { overflow: hidden; }
h1, h2, h3 { font-family: var(--head); letter-spacing: -0.02em; margin: 0; }
p { margin: 0 0 10px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.pad { padding: 0 2px; }

#app { max-width: 640px; margin: 0 auto; padding: 0 18px calc(104px + var(--safe-b)); }
.page { padding-bottom: 12px; }
.head { padding-top: calc(30px + var(--safe-t)); padding-bottom: 6px; }
.head h1 { font-size: clamp(2.1rem, 9.5vw, 2.8rem); font-weight: 800; line-height: 1.02; letter-spacing: -0.035em; }
.sub { color: var(--muted); font-size: 1.05rem; margin-top: 4px; }
.stats { color: var(--muted); font-size: .92rem; margin-top: 8px; }
.sec { font-size: 1.2rem; font-weight: 800; margin: 30px 0 6px; }
.sec-note { font-family: var(--body); font-weight: 600; color: var(--muted); font-size: .9rem; margin-left: 6px; letter-spacing: 0; }
.label { font-size: .86rem; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.block { margin: 20px 0; }
.empty { color: var(--muted); padding: 16px 2px; }

/* week dots */
.week { display: flex; gap: 9px; margin-top: 16px; }
.dot { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line); }
.dot.on { background: var(--teal); border-color: var(--teal); }
.dot.now { outline: 2px solid var(--accent-text); outline-offset: 2px; }

/* chips + buttons */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { flex: none; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper); font-weight: 600; }
.chip.on { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1.5px solid transparent; font-weight: 700; text-align: center; }
.btn-primary { background: var(--teal); color: var(--on-teal); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-quiet { background: transparent; color: var(--muted); width: 100%; min-height: 44px; margin-top: 4px; }
.btn-danger { background: transparent; border-color: var(--berry); color: var(--berry); margin-top: 12px; }
.btn-big { width: 100%; min-height: 58px; font-size: 1.08rem; border-radius: 16px; margin: 6px 0 4px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.btn-row .btn { flex: 1 1 auto; }
.file { cursor: pointer; }
.btn-dark { background: var(--on-lemon); color: var(--lemon); }
.btn-ghost-dark { background: transparent; color: var(--on-lemon); border-color: rgba(37, 30, 0, .35); width: 100%; min-height: 52px; border-radius: 16px; }

/* task rows: lines, not cards */
.list { margin-top: 4px; }
.list.tight .row { padding: 10px 2px; }
.row { display: flex; align-items: center; gap: 14px; padding: 13px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row-main { flex: 1; min-width: 0; }
.row-text { font-weight: 600; line-height: 1.3; }
.row-meta { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.row-meta.hot { color: var(--berry); }
.is-done .row-text { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.check { position: relative; flex: none; width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--teal); background: transparent; color: var(--on-teal); display: grid; place-items: center; padding: 0; transition: background .12s; }
.check::after { content: ""; position: absolute; inset: -10px; }
.check.ghost { border-color: var(--line); display: block; }
.is-done .check { background: var(--teal); }
.check.big { width: 46px; height: 46px; font-size: 22px; border-color: var(--line); }
.mission.is-done .check.big { background: var(--lemon); border-color: var(--lemon); color: var(--on-lemon); }
.avatar { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--tone-a); display: grid; place-items: center; font-size: 16px; }
.avatar.big { width: 40px; height: 40px; font-size: 20px; }
details.more > summary, details.acc > summary { list-style: none; cursor: pointer; font-weight: 700; padding: 15px 0; color: var(--accent-text); display: flex; justify-content: space-between; }
details > summary::-webkit-details-marker { display: none; }
details.more > summary::after, details.acc > summary::after { content: "+"; font-size: 1.3rem; line-height: 1; }
details[open] > summary::after { content: "\2212"; }
.more { border-top: 1px solid var(--line); margin-top: 18px; }

.kids-card { display: block; width: 100%; text-align: left; margin-top: 28px; padding: 16px 18px; border: 0; border-radius: 18px; background: var(--tone-a); color: var(--ink); }
.kids-title { display: block; font-family: var(--head); font-weight: 800; font-size: 1.1rem; margin-bottom: 8px; }
.kid-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.kid-pill { font-weight: 600; font-size: .92rem; }

.fab { position: fixed; right: 18px; bottom: calc(86px + var(--safe-b)); width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--lemon); color: var(--on-lemon); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .22); z-index: 20; }

/* tabs */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--paper); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
#tabs button { position: relative; display: grid; justify-items: center; gap: 2px; padding: 9px 0 8px; background: none; border: 0; color: var(--muted); font-size: .72rem; font-weight: 600; min-height: 58px; }
#tabs button.on { color: var(--accent-text); }
#tabs button.on::before { content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--lemon); }

/* rooms */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.tile { display: flex; flex-direction: column; text-align: left; gap: 1px; padding: 14px; min-height: 148px; border: 0; border-radius: 18px; background: var(--tone); color: var(--ink); }
.tile-top { position: relative; width: 46px; height: 46px; margin-bottom: 8px; }
.tile-emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; }
.tile-name { font-family: var(--head); font-weight: 800; font-size: 1.05rem; line-height: 1.15; margin-bottom: 4px; }
.tile-meta { font-size: .8rem; color: color-mix(in srgb, var(--ink) 72%, transparent); }
.tone-a { --tone: var(--tone-a); } .tone-b { --tone: var(--tone-b); } .tone-c { --tone: var(--tone-c); } .tone-d { --tone: var(--tone-d); } .tone-e { --tone: var(--tone-e); }
.ring { display: block; }
.ring-bg { fill: none; stroke: color-mix(in srgb, var(--ink) 14%, transparent); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--teal); stroke-width: 4; stroke-linecap: round; }
@media (prefers-color-scheme: dark) { .ring-fg { stroke: var(--lemon); } }

.gantt { position: relative; padding: 4px 0 8px; font-size: .74rem; }
.g-months { position: relative; height: 18px; margin-left: 8.4rem; color: var(--muted); }
.g-months span { position: absolute; transform: translateX(2px); }
.g-row { display: grid; grid-template-columns: 8.4rem 1fr; align-items: center; height: 21px; }
.g-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 6px; }
.g-track { position: relative; height: 100%; border-left: 1px solid var(--line); }
.g-bar { position: absolute; top: 5px; height: 11px; border-radius: 6px; background: var(--tone); box-shadow: inset 0 0 0 1.5px var(--teal); overflow: hidden; }
.g-fill { display: block; height: 100%; background: var(--teal); }
.g-today { position: absolute; top: 18px; bottom: 0; width: 2px; background: var(--berry); }

.room-bar { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: calc(10px + var(--safe-t)) 10px 6px; }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 10px 0 4px; border: 0; background: none; font-weight: 700; color: var(--accent-text); }
.overlay { position: fixed; inset: 0; z-index: 30; overflow-y: auto; background: var(--bg); }
.room-page { max-width: 640px; margin: 0 auto; padding: 0 18px calc(60px + var(--safe-b)); }
.room-page .head { padding-top: 6px; }
.room-emoji { font-size: 2.4rem; line-height: 1; margin-bottom: 8px; }
.goal { margin-top: 18px; padding: 18px; border-radius: 18px; background: var(--paper); border: 1.5px solid var(--line); }
.goal-label { font-size: .86rem; color: var(--muted); font-weight: 600; }
.goal-title { font-size: 1.45rem; font-weight: 800; margin: 2px 0 12px; line-height: 1.15; }
.goal-prog { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.goal-prog strong { font-family: var(--head); font-size: 1.5rem; }
.acc { border-top: 1px solid var(--line); margin-top: 14px; }
.acc-body { padding-bottom: 14px; }
.acc-body h3 { font-size: .95rem; margin: 14px 0 4px; }
.acc-body ul { margin: 0; padding-left: 20px; }
.acc-body li { margin: 3px 0; }
.pri { margin: 20px 0 6px; padding-left: 14px; border-left: 3px solid var(--teal); }
@media (prefers-color-scheme: dark) { .pri { border-left-color: var(--lemon); } }
.pri-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.pri-title { font-family: var(--head); font-weight: 800; font-size: 1.05rem; }
.pri-done { color: var(--muted); font-size: .86rem; margin: 2px 0 8px; }
.pri-count { flex: none; font-weight: 700; color: var(--muted); font-size: .9rem; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--teal); border-radius: 3px; }
@media (prefers-color-scheme: dark) { .bar span { background: var(--lemon); } }
.notes { width: 100%; padding: 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); resize: vertical; }

/* forms */
.field { display: grid; gap: 6px; margin: 12px 0; }
.field > span { font-size: .86rem; color: var(--muted); font-weight: 600; }
.field.inline { margin-top: 4px; }
input, select, textarea { min-height: 48px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); padding: 0 12px; width: 100%; }
textarea { padding: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.members .member { display: grid; grid-template-columns: 3.4rem 1fr 6.4rem; gap: 8px; margin-bottom: 10px; }
.members .member input[type=date] { grid-column: 2 / 4; }
.emoji-in { text-align: center; padding: 0; font-size: 1.3rem; }
.switch { display: flex; gap: 12px; align-items: center; margin: 14px 0; min-height: 44px; font-weight: 600; }
.switch input { width: 26px; height: 26px; min-height: 0; accent-color: var(--teal); }
.callout, .tip { padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--lemon) 26%, var(--paper)); border-left: 4px solid var(--lemon); margin: 12px 0; font-size: .95rem; }
.sync-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 6px; }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.sync-status.online .sync-dot { background: var(--good); }
.sync-status.error .sync-dot { background: var(--berry); }
.sync-status.connecting .sync-dot { background: var(--lemon); }

/* family */
.kid { margin-top: 26px; }
.kid-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.kid-head h3 { font-size: 1.3rem; font-weight: 800; }
.kid-emoji { font-size: 2rem; }
.stars { margin-left: auto; display: flex; gap: 5px; }
.star { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.star.on { background: var(--lemon); }

/* sheet */
#sheet { position: fixed; inset: 0; z-index: 40; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 20, 22, .5); }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-width: 640px; margin: 0 auto; max-height: 90vh; overflow-y: auto; background: var(--paper); border-radius: 22px 22px 0 0; padding: 10px 20px calc(24px + var(--safe-b)); outline: none; animation: up .2s ease-out; }
.sheet-grab { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet-room { color: var(--muted); font-weight: 600; font-size: .9rem; }
.sheet-title { font-size: 1.45rem; font-weight: 800; line-height: 1.18; margin: 2px 0 6px; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }

/* focus: the one loud moment */
#focus { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: var(--lemon); color: var(--on-lemon); }
#focus :focus-visible { outline-color: var(--on-lemon); }
.focus-inner { min-height: 100%; max-width: 640px; margin: 0 auto; padding: calc(22px + var(--safe-t)) 24px calc(26px + var(--safe-b)); display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.focus-x { align-self: flex-end; background: none; border: 0; font-weight: 700; padding: 10px 4px; margin-bottom: auto; color: inherit; }
.focus-count { font-weight: 700; opacity: .75; }
.focus-text { font-family: var(--head); font-size: clamp(1.9rem, 8.6vw, 3.1rem); line-height: 1.07; font-weight: 800; letter-spacing: -0.035em; }
.focus-tip { font-size: 1.05rem; max-width: 34ch; margin: 0; }
.focus-timer { font-family: var(--head); font-size: 3.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; margin-top: 10px; }
.focus-est { opacity: .75; margin-top: -10px; }
.focus-inner.end { justify-content: center; }
.focus-inner .btn-big { margin-top: 12px; }

/* toast */
#toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); z-index: 60; width: max-content; transform: translateX(-50%) translateY(10px); opacity: 0; display: flex; align-items: center; gap: 14px; max-width: min(92vw, 520px); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 600; transition: opacity .18s, transform .18s; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast[hidden] { display: none; }
#toast button { background: none; border: 0; color: var(--lemon); font-weight: 800; padding: 6px 4px; }
@media (prefers-color-scheme: dark) { #toast { background: #E5EEEB; color: #10262B; } #toast button { color: #8A5F00; } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media (min-width: 700px) { #tabs { left: 50%; right: auto; width: 640px; transform: translateX(-50%); border-radius: 18px 18px 0 0; border: 1px solid var(--line); border-bottom: 0; } }
