/* Life OS V32 — app.css
   Identity: navy ground, warm orange for the one thing to do, teal for what is
   scheduled/settled. Surfaces are opaque. Everything scales with rem so browser
   zoom and the in-app text size both work. */
:root {
  --bg: #0B1220; --surf: #141C2C; --surf-2: #1B2538; --surf-3: #223050; --line: #26324A; --line-2: #33425F;
  --txt: #F1F5FB; --dim: #A3B2C9; --faint: #6C7E9A;
  --orange: #FF8A3D; --orange-ink: #1A0D04; --orange-soft: rgba(255, 138, 61, .14);
  --teal: #35D6C4; --teal-ink: #04201C; --teal-soft: rgba(53, 214, 196, .14);
  --rose: #FF6B85; --rose-soft: rgba(255, 107, 133, .14); --gold: #F7C948; --gold-soft: rgba(247, 201, 72, .14); --blue: #6FAAFF; --violet: #B49BFF;
  --r: 14px; --r-s: 9px; --r-l: 20px; --tap: 46px; --gap: 14px; --wrap: 980px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; --display: 'Space Grotesk', var(--font);
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --fs: 16px;
}
html[data-theme="day"] {
  --bg: #F2F5FA; --surf: #FFFFFF; --surf-2: #EAEFF7; --surf-3: #DCE4F0; --line: #D6DEEA; --line-2: #BFCAD9;
  --txt: #0E1626; --dim: #4A5872; --faint: #74829A;
  --orange: #C9560A; --orange-ink: #FFFFFF; --orange-soft: rgba(201, 86, 10, .12);
  --teal: #0E8478; --teal-ink: #FFFFFF; --teal-soft: rgba(14, 132, 120, .12);
  --rose: #B8284A; --rose-soft: rgba(184, 40, 74, .12); --gold: #8A5F00; --gold-soft: rgba(138, 95, 0, .12); --blue: #1C5BBE; --violet: #6746D6;
  --shadow: 0 10px 30px rgba(20, 30, 60, .14);
}
html[data-text="large"] { --fs: 19px; }
html[data-text="xl"] { --fs: 22px; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--txt); font-family: var(--font); line-height: 1.5; min-height: 100vh; -webkit-font-smoothing: antialiased; }
html[data-motion="off"] *, html[data-motion="off"] *::before, html[data-motion="off"] *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: var(--teal); }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; } h2 { font-size: 1.15rem; font-weight: 600; } h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
.dim { color: var(--dim); } .faint { color: var(--faint); } .small { font-size: .85rem; } .num { font-variant-numeric: tabular-nums; }
.stack > * + * { margin-top: var(--gap); }

/* ---------- app frame ---------- */
#app { display: grid; grid-template-rows: auto 1fr; min-height: 100vh; }
#top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
#top .in { max-width: var(--wrap); margin: 0 auto; padding: 8px 14px; display: flex; align-items: center; gap: 8px; min-height: 56px; }
#top .brand { font-family: var(--display); font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--txt); }
#top .brand .mark { width: 22px; height: 22px; display: inline-block; }
#top .sp { flex: 1; }
#view { max-width: var(--wrap); margin: 0 auto; padding: 14px 14px calc(96px + env(safe-area-inset-bottom)); width: 100%; }
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surf); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#tabs .row { display: grid; grid-template-columns: repeat(5, 1fr); max-width: 640px; margin: 0 auto; }
#tabs button { appearance: none; background: none; border: 0; color: var(--dim); font: inherit; font-size: .72rem; padding: 8px 0 6px; min-height: 58px; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
#tabs button .ic { width: 22px; height: 22px; }
#tabs button[aria-current="page"] { color: var(--orange); }
#tabs button.add .ic { width: 44px; height: 44px; border-radius: 50%; background: var(--orange); color: var(--orange-ink); display: grid; place-items: center; margin-top: -18px; box-shadow: var(--shadow); }
#side { display: none; }
@media (min-width: 900px) {
  #app { grid-template-columns: 240px 1fr; grid-template-rows: auto 1fr; }
  #top { grid-column: 1 / -1; }
  #side { display: block; border-right: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 56px; height: calc(100vh - 56px); overflow: auto; }
  #side button, #side a { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; color: var(--dim); font: inherit; padding: 10px 12px; border-radius: var(--r-s); min-height: 44px; cursor: pointer; text-decoration: none; }
  #side button[aria-current="page"] { background: var(--surf-2); color: var(--txt); font-weight: 600; }
  #side .ic { width: 20px; height: 20px; }
  #side h3 { font-size: .75rem; color: var(--faint); font-weight: 600; margin: 16px 12px 6px; font-family: var(--font); }
  #tabs { display: none; }
  #view { padding-bottom: 40px; }
}

/* ---------- surfaces ---------- */
.card { background: var(--surf); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.card.hero { border-color: var(--orange); background: linear-gradient(180deg, var(--orange-soft), transparent 60%), var(--surf); }
.card.teal { border-color: var(--teal); }
.card.warn { border-color: var(--rose); background: linear-gradient(180deg, var(--rose-soft), transparent 70%), var(--surf); }
.card.quiet { background: var(--surf-2); border-color: transparent; }
.eyebrow { font-size: .78rem; color: var(--faint); margin-bottom: 4px; }
.h-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 8px; }
.h-row h2 { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
@media (max-width: 599px) { .grid2 { grid-template-columns: 1fr; } }
.cols { display: grid; gap: var(--gap); }
@media (min-width: 900px) { .cols.two { grid-template-columns: 3fr 2fr; align-items: start; } }

/* ---------- buttons ---------- */
.btn { appearance: none; border: 1px solid var(--line-2); background: var(--surf-2); color: var(--txt); font: inherit; font-weight: 600; border-radius: 12px; padding: 0 16px; min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transition: transform .12s var(--ease), background .15s; }
.btn:active { transform: scale(.98); }
.btn.pri { background: var(--orange); color: var(--orange-ink); border-color: transparent; }
.btn.teal { background: var(--teal); color: var(--teal-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--rose); border-color: var(--rose); background: transparent; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .88rem; border-radius: 10px; }
.btn.link { background: none; border: 0; color: var(--teal); padding: 0 6px; min-height: 44px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btnrow.col { flex-direction: column; } .btnrow.col .btn { width: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { appearance: none; border: 1px solid var(--line-2); background: var(--surf); color: var(--dim); font: inherit; font-size: .88rem; border-radius: 999px; padding: 0 12px; min-height: 40px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"], .chip.on { background: var(--teal-soft); border-color: var(--teal); color: var(--txt); font-weight: 600; }
.chip.orange[aria-pressed="true"] { background: var(--orange-soft); border-color: var(--orange); }
.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surf-3); color: var(--dim); vertical-align: middle; }
.pill.orange { background: var(--orange-soft); color: var(--orange); } .pill.teal { background: var(--teal-soft); color: var(--teal); } .pill.rose { background: var(--rose-soft); color: var(--rose); } .pill.gold { background: var(--gold-soft); color: var(--gold); }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }

/* ---------- rows / lists ---------- */
.row { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 8px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .body { flex: 1; min-width: 0; }
.row .ttl { font-weight: 600; overflow-wrap: anywhere; }
.row .meta { font-size: .85rem; color: var(--dim); overflow-wrap: anywhere; }
.row.done .ttl { text-decoration: line-through; color: var(--faint); }
.row.tappable { cursor: pointer; }
.row .open { appearance: none; background: none; border: 0; color: var(--faint); min-width: 44px; min-height: 44px; cursor: pointer; display: grid; place-items: center; border-radius: 10px; }
.tick { appearance: none; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surf); cursor: pointer; flex: 0 0 auto; position: relative; margin: 0 2px; }
.tick::after { content: ''; position: absolute; inset: -6px; }
.tick.on { background: var(--teal); border-color: var(--teal); }
.tick.on::before { content: ''; position: absolute; left: 12px; top: 6px; width: 8px; height: 15px; border: solid var(--teal-ink); border-width: 0 3px 3px 0; transform: rotate(45deg); }
.tile { display: block; background: var(--surf); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; text-decoration: none; color: inherit; cursor: pointer; min-height: 74px; font: inherit; text-align: left; width: 100%; }
.tile .ic { width: 22px; height: 22px; color: var(--teal); margin-bottom: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.empty { color: var(--dim); padding: 14px 0; }
.empty b { color: var(--txt); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .92rem; }
.kv dt { color: var(--faint); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.bar { height: 8px; background: var(--surf-3); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--teal); }
.note { border-left: 3px solid var(--line-2); padding: 6px 12px; color: var(--dim); font-size: .92rem; }
.note.rose { border-color: var(--rose); } .note.gold { border-color: var(--gold); } .note.teal { border-color: var(--teal); }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { color: var(--faint); font-weight: 600; }
.tbl td.num, .tbl th.num { text-align: right; }
pre.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; white-space: pre-wrap; background: var(--surf-2); padding: 10px; border-radius: var(--r-s); overflow: auto; }
.day-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day-strip button { appearance: none; border: 1px solid var(--line); background: var(--surf); color: var(--dim); border-radius: 10px; min-height: 52px; font: inherit; font-size: .8rem; cursor: pointer; }
.day-strip button[aria-pressed="true"] { border-color: var(--orange); color: var(--txt); background: var(--orange-soft); }
.day-strip b { display: block; font-size: 1rem; color: var(--txt); }
.agenda-item { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); min-height: 46px; align-items: center; }
.agenda-item .t { color: var(--teal); font-weight: 600; font-variant-numeric: tabular-nums; font-size: .9rem; }
.agenda-item.allday .t { color: var(--faint); }
.agenda-item.deadline .t { color: var(--orange); }
.agenda-item.ctx { opacity: .65; }
.timer { text-align: center; padding: 20px 0; }
.timer .big { font-family: var(--display); font-size: 3.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sparkrow { display: flex; align-items: flex-end; gap: 3px; height: 70px; }
.sparkrow i { flex: 1; background: var(--teal); border-radius: 3px 3px 0 0; min-height: 3px; }
.sparkrow i.miss { background: var(--surf-3); height: 3px !important; }
.sparkrow i[title] { cursor: help; }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--faint); margin-right: 6px; }
.status-dot.ok { background: var(--teal); } .status-dot.warn { background: var(--gold); } .status-dot.bad { background: var(--rose); }

/* ---------- forms ---------- */
.f { display: block; width: 100%; font: inherit; color: var(--txt); background: var(--surf-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; min-height: var(--tap); }
textarea.f { min-height: 96px; resize: vertical; }
select.f { appearance: none; }
.frow { margin-bottom: 12px; }
.frow label, .frow .fl { display: block; font-size: .85rem; color: var(--dim); margin-bottom: 4px; }
.frow .hint { font-size: .8rem; color: var(--faint); margin-top: 4px; }
.frow .err { font-size: .85rem; color: var(--rose); margin-top: 4px; }
.f[aria-invalid="true"] { border-color: var(--rose); }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset { border: 0; padding: 0; margin: 0 0 12px; } legend { font-size: .85rem; color: var(--dim); margin-bottom: 6px; padding: 0; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); padding: 6px 0; border-bottom: 1px solid var(--line); }
.switch input { width: 24px; height: 24px; accent-color: var(--teal); }

/* ---------- sheet / dialog ---------- */
#scrim { position: fixed; inset: 0; background: rgba(2, 6, 16, .6); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
#scrim.on { opacity: 1; pointer-events: auto; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surf); border-radius: var(--r-l) var(--r-l) 0 0; border-top: 1px solid var(--line-2); max-height: 92vh; overflow: auto; transform: translateY(105%); transition: transform .25s var(--ease); padding: 12px 16px calc(20px + env(safe-area-inset-bottom)); box-shadow: var(--shadow); }
#sheet.on { transform: none; }
#sheet .grab { width: 40px; height: 4px; background: var(--line-2); border-radius: 2px; margin: 0 auto 12px; }
#sheet h3 { font-size: 1.15rem; margin-bottom: 4px; }
#sheet .sub { color: var(--dim); font-size: .9rem; margin-bottom: 14px; }
@media (min-width: 720px) { #sheet { left: 50%; right: auto; width: 560px; transform: translate(-50%, 105%); bottom: 24px; border-radius: var(--r-l); border: 1px solid var(--line-2); } #sheet.on { transform: translate(-50%, 0); } }
body.has-sheet #view, body.has-sheet #top, body.has-sheet #tabs, body.has-sheet #side { filter: none; }
#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--txt); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .2s; z-index: 50; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translateX(-50%); }
@media (min-width: 900px) { #toast { bottom: 24px; } }
#banner { max-width: var(--wrap); margin: 10px auto 0; padding: 0 14px; }
.banner { display: flex; align-items: center; gap: 10px; background: var(--surf-2); border: 1px solid var(--line-2); border-radius: var(--r); padding: 10px 12px; }
.banner.rose { border-color: var(--rose); } .banner.teal { border-color: var(--teal); }
.banner .body { flex: 1; min-width: 0; font-size: .92rem; }

/* ---------- search ---------- */
#search { position: fixed; inset: 0; z-index: 45; background: rgba(2, 6, 16, .7); display: none; padding: 8vh 12px 0; }
#search.on { display: block; }
#searchBox { max-width: 600px; margin: 0 auto; background: var(--surf); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; }
#searchBox input { width: 100%; font: inherit; font-size: 1.1rem; padding: 16px; border: 0; background: transparent; color: var(--txt); border-bottom: 1px solid var(--line); }
#searchList { max-height: 60vh; overflow: auto; }
#searchList button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; color: var(--txt); font: inherit; padding: 10px 16px; min-height: var(--tap); cursor: pointer; border-bottom: 1px solid var(--line); }
#searchList button[aria-selected="true"], #searchList button:hover { background: var(--surf-2); }
#searchList .k { font-size: .75rem; color: var(--faint); min-width: 74px; }
#searchList .s { font-size: .82rem; color: var(--dim); }
.demo-flag { position: fixed; top: 60px; right: 10px; z-index: 30; background: var(--gold); color: #1a1400; font-weight: 700; font-size: .75rem; padding: 4px 10px; border-radius: 999px; }
@media print { #top, #tabs, #side, #scrim, #sheet, #toast { display: none !important; } body { background: #fff; color: #000; } .card { border-color: #999; } }
