/* MAX OS — near-black, brushed chrome, burgundy. Thumb-first. One easing, one duration scale. */
:root {
  --bg: #070708; --s1: #0e0e10; --s2: #141417; --s3: #1b1b1f; --line: rgba(255,255,255,.07); --line2: rgba(255,255,255,.12);
  --tx: #ecebef; --tx2: #aeadb5; --tx3: #8a8993;
  --bur: #8e1c30; --bur2: #c43a52; --bur3: #e9798b; --burA: rgba(196,58,82,.16);
  --ok: #7fc8a9; --warn: #e2b36b;
  --chrome: linear-gradient(180deg, #fbfbfd 0%, #c9c9d0 38%, #85858f 52%, #d8d8de 70%, #f4f4f7 100%);
  --r1: 10px; --r2: 16px; --r3: 22px;
  --e: cubic-bezier(.2,.75,.15,1); --d1: 160ms; --d2: 260ms; --d3: 420ms;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --disp: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--tx); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
body::before { /* grain */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 100; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body::after { /* burgundy light from above */
  content: ""; position: fixed; left: 50%; top: -30vh; width: 140vw; height: 70vh; transform: translateX(-50%); pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side, rgba(142,28,48,.28), rgba(142,28,48,0)); filter: blur(10px);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--bur2); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* shell */
#app { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: calc(var(--sat) + 56px) 16px calc(var(--sab) + 96px); }
.top { position: fixed; z-index: 20; top: 0; left: 0; right: 0; padding: calc(var(--sat) + 10px) 16px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(180deg, rgba(7,7,8,.92), rgba(7,7,8,.72)); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); border-bottom: 1px solid var(--line); }
.top .brand { font: 700 13px/1 var(--disp); letter-spacing: .22em; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cd { font: 600 12px/1 var(--mono); color: var(--tx2); display: flex; gap: 8px; align-items: baseline; font-variant-numeric: tabular-nums; }
.cd b { font: 700 15px/1 var(--disp); color: var(--tx); letter-spacing: -.01em; }
.cd .ph { color: var(--bur3); letter-spacing: .08em; }
.tabs { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 8px calc(var(--sab) + 6px);
  background: rgba(10,10,12,.86); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); border-top: 1px solid var(--line); }
.tabs a { display: grid; justify-items: center; gap: 3px; padding: 8px 0 4px; font-size: 10.5px; letter-spacing: .02em; color: var(--tx3); transition: color var(--d1) var(--e); min-height: 48px; }
.tabs a svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.tabs a[aria-current="page"] { color: var(--tx); }
.tabs a[aria-current="page"] svg { stroke: var(--bur3); }

/* type */
h1 { font: 700 30px/1.05 var(--disp); letter-spacing: -.028em; margin: 18px 0 4px; }
h2 { font: 650 13px/1.2 var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--tx3); margin: 28px 0 10px; }
h3 { font: 650 17px/1.25 var(--disp); letter-spacing: -.01em; margin: 0; }
.sub { color: var(--tx2); margin: 0 0 8px; }
.chrome { background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.num { font-family: var(--disp); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--tx2); } .dim { color: var(--tx3); } .accent { color: var(--bur3); }

/* surfaces */
.card { position: relative; background: linear-gradient(180deg, var(--s2), var(--s1)); border: 1px solid var(--line); border-radius: var(--r2); padding: 16px; }
.card + .card { margin-top: 10px; }
.card.hero { padding: 20px 18px; border-radius: var(--r3); overflow: hidden; }
.card.hero::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(255,255,255,.28), rgba(255,255,255,.04) 30%, rgba(196,58,82,.35) 70%, rgba(255,255,255,.08));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.sb { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--s3); border: 1px solid var(--line); font-size: 12px; color: var(--tx2); }
.pill.b { background: var(--burA); border-color: rgba(196,58,82,.35); color: var(--bur3); }
.kpi .v { font: 700 26px/1 var(--disp); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 11.5px; color: var(--tx3); letter-spacing: .06em; text-transform: uppercase; margin-top: 6px; }

/* progress */
.bar { height: 6px; border-radius: 99px; background: var(--s3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--bur), var(--bur2)); transform-origin: left; transition: width var(--d3) var(--e); }
.ring { --p: 0; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--bur2) calc(var(--p) * 1%), var(--s3) 0); }
.ring > span { width: 52px; height: 52px; border-radius: 50%; background: var(--s1); display: grid; place-items: center; font: 700 15px/1 var(--disp); font-variant-numeric: tabular-nums; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line2); background: var(--s3); color: var(--tx); font-weight: 600; transition: transform var(--d1) var(--e), background var(--d1) var(--e); }
.btn:active { transform: scale(.97); }
.btn.p { background: linear-gradient(180deg, var(--bur2), var(--bur)); border-color: rgba(255,255,255,.14); box-shadow: 0 8px 24px -10px rgba(196,58,82,.6), inset 0 1px 0 rgba(255,255,255,.18); }
.btn.g { background: transparent; }
.btn.s { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.w { width: 100%; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--s2); border: 1px solid var(--line); gap: 2px; }
.seg button { border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; color: var(--tx2); font-size: 13px; font-weight: 600; min-height: 36px; }
.seg button[aria-pressed="true"] { background: var(--s3); color: var(--tx); box-shadow: inset 0 0 0 1px var(--line2); }
.field { display: grid; gap: 6px; }
.field label { font-size: 12px; color: var(--tx3); letter-spacing: .04em; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line2); background: var(--s1); outline: none; transition: border-color var(--d1) var(--e); }
input:focus, select:focus, textarea:focus { border-color: var(--bur2); }
textarea { min-height: 88px; resize: vertical; }
.chk { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.chk:last-child { border-bottom: 0; }
.chk .box { flex: 0 0 24px; height: 24px; border-radius: 8px; border: 1.5px solid var(--line2); display: grid; place-items: center; transition: all var(--d1) var(--e); }
.chk[aria-checked="true"] .box { background: var(--bur2); border-color: var(--bur2); }
.chk[aria-checked="true"] .box::after { content: ""; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.chk[aria-checked="true"] .t { color: var(--tx2); }

/* timeline of blocks */
.blocks { position: relative; }
.blk { position: relative; display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); }
.blk .tm { font: 600 12.5px/1.1 var(--mono); color: var(--tx3); text-align: right; font-variant-numeric: tabular-nums; }
.blk .tt { font-weight: 600; } .blk .dt { font-size: 12.5px; color: var(--tx3); margin-top: 2px; }
.blk.now { background: linear-gradient(90deg, var(--burA), transparent 70%); border-radius: 12px; }
.blk.now .tm { color: var(--bur3); }
.blk.past .tt { color: var(--tx2); }
.dot { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line2); display: grid; place-items: center; background: transparent; }
.dot[data-s="done"] { background: var(--bur2); border-color: var(--bur2); }
.dot[data-s="done"]::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px,-1px); }
.dot[data-s="partial"] { background: conic-gradient(var(--bur2) 50%, transparent 0); border-color: var(--bur2); }
.dot[data-s="missed"] { border-color: var(--tx3); } .dot[data-s="missed"]::after { content: "–"; color: var(--tx3); font-weight: 700; }
.dot[data-s="skipped"]::after { content: "·"; color: var(--tx3); font-weight: 700; }
.tag { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--tx3); }
.tag.ascension { color: var(--bur3); } .tag.money { color: #d9d9e0; } .tag.life { color: var(--tx2); } .tag.school { color: var(--warn); }

/* sheet + toast */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.5); opacity: 0; transition: opacity var(--d2) var(--e); }
.scrim.on { opacity: 1; }
.sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: 86dvh; overflow: auto; background: var(--s1); border: 1px solid var(--line2); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 10px 16px calc(var(--sab) + 18px); transform: translateY(100%); transition: transform var(--d3) var(--e); }
.sheet.on { transform: none; }
.sheet .grab { width: 36px; height: 4px; border-radius: 4px; background: var(--line2); margin: 0 auto 12px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: calc(var(--sab) + 84px); transform: translate(-50%, 20px); opacity: 0; background: var(--s3); border: 1px solid var(--line2); padding: 10px 14px; border-radius: 12px; font-size: 13.5px; transition: all var(--d2) var(--e); pointer-events: none; max-width: 90vw; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* list + table */
.list > * { padding: 12px 0; border-bottom: 1px solid var(--line); } .list > *:last-child { border-bottom: 0; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; } table.t td, table.t th { padding: 9px 4px; border-bottom: 1px solid var(--line); text-align: left; } table.t th { color: var(--tx3); font-weight: 600; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; } table.t td.r, table.t th.r { text-align: right; }
.empty { padding: 22px; text-align: center; color: var(--tx3); border: 1px dashed var(--line2); border-radius: var(--r2); }
.more { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.more a { display: grid; gap: 6px; padding: 16px; border-radius: var(--r2); background: var(--s2); border: 1px solid var(--line); }
.more a b { font-family: var(--disp); font-size: 16px; } .more a span { font-size: 12.5px; color: var(--tx3); }

/* collapsible cards */
details.fold > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; min-height: 28px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; width: 8px; height: 8px; border-right: 1.5px solid var(--tx3); border-bottom: 1.5px solid var(--tx3); transform: rotate(45deg); transition: transform var(--d2) var(--e); margin-left: 10px; }
details.fold[open] > summary::after { transform: rotate(-135deg); }
details.fold[open] > summary { margin-bottom: 8px; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.chips > * { width: 100%; }
.tier-A { background: var(--burA); border-color: rgba(196,58,82,.45); color: var(--bur3); } .tier-B { background: transparent; border-color: var(--line2); color: var(--tx); } .tier-watch { background: transparent; border-style: dashed; color: var(--tx3); }
.seg button[aria-pressed="true"].fill, .seg[data-seg] button[aria-pressed="true"] { background: var(--bur2); color: #fff; box-shadow: none; }

/* motion: enter */
.in { animation: in var(--d3) var(--e) both; } .in2 { animation: in var(--d3) var(--e) 60ms both; } .in3 { animation: in var(--d3) var(--e) 120ms both; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (min-width: 700px) { #app { padding-top: calc(var(--sat) + 72px); } h1 { font-size: 36px; } }
