:root {
  --bg: #000; --card: #141416; --card2: #1c1c1f; --key: #232327; --line: rgba(255,255,255,.07);
  --text: #f5f5f7; --dim: #8d8d93; --faint: #55555b;
  --blue: #2e9eff; --blue-soft: rgba(46,158,255,.14);
  --green: #34c77b; --green-soft: rgba(52,199,123,.12);
  --amber: #ffb340; --amber-soft: rgba(255,179,64,.16);
  --red: #ff5a5f; --red-soft: rgba(255,90,95,.18);
}
* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent }
html, body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased }
body { min-height: 100vh; padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 110px); -webkit-user-select: none; user-select: none; overscroll-behavior-y: none }
button { font: inherit; color: inherit }
input { -webkit-user-select: text; user-select: text }

/* Boot and lock */
body.boot #app, body.boot .tabs, body.boot #lock { display: none }
#lock { display: none }
body.locked #lock { display: flex; flex-direction: column; align-items: center; padding-top: 10vh }
body.locked #app, body.locked .tabs { display: none }
.lockmark img { width: 72px; height: 72px; border-radius: 18px }
#lock h2 { font-size: 22px; font-weight: 700; margin: 14px 0 26px }
.dots { display: flex; gap: 18px; margin-bottom: 36px }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--dim) }
.dots i.on { background: var(--text); border-color: var(--text) }
.dots.shake { animation: shake .4s }
@keyframes shake { 20%, 60% { transform: translateX(-10px) } 40%, 80% { transform: translateX(10px) } }
.lockpad { width: 100%; max-width: 300px; gap: 14px !important }
.lockpad button { height: 70px !important; border-radius: 50% !important; width: 70px; justify-self: center; font-size: 28px !important }

/* Pages */
.page { display: none }
.page.on { display: block }
.top { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px }
.date { font-size: 13px; color: var(--dim); font-weight: 500; letter-spacing: .02em; text-transform: uppercase }
h1 { font-size: 32px; font-weight: 700; letter-spacing: -.02em; margin: 2px 0 0 }
#page-data h1, #page-misc h1 { margin-bottom: 14px }
.none { text-align: center; color: var(--dim); padding: 24px 0; font-size: 15px }
.hint { font-size: 13px; color: var(--dim); margin-top: 8px; line-height: 1.4 }
.ring { width: 44px; height: 44px; position: relative }
.ring svg { transform: rotate(-90deg) }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 600 }
.round { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; display: grid; place-items: center; cursor: pointer }

/* Home cards */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 26px }
.stat { background: var(--card); border-radius: 22px; padding: 14px; cursor: pointer; transition: transform .2s cubic-bezier(.2,.8,.2,1), background .2s; touch-action: manipulation }
.stat:active { background: var(--card2) }
.stat.hold, .task.hold { transform: scale(.96) }
.stat .lbl { font-size: 12px; color: var(--dim); font-weight: 500; display: flex; justify-content: space-between; gap: 4px }
.stat .val { font-size: 32px; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums }
.stat .val small { font-size: 14px; color: var(--faint); font-weight: 500; letter-spacing: 0 }
.stat .sub { font-size: 12px; color: var(--dim); margin-top: 2px; font-variant-numeric: tabular-nums }
.bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.07); margin-top: 12px; overflow: hidden }
.bar i { display: block; height: 100%; border-radius: 3px; transition: width .5s cubic-bezier(.2,.8,.2,1) }

/* Task rows */
.sec { display: flex; justify-content: space-between; align-items: baseline; margin: 0 4px 10px }
.sec h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em }
.sec span { font-size: 13px; color: var(--dim) }
.list { display: flex; flex-direction: column; gap: 8px }
.task { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid transparent; border-radius: 18px; padding: 14px; cursor: pointer; transition: transform .15s, background .3s, border-color .3s; touch-action: manipulation }
.task.late { background: var(--amber-soft); border-color: rgba(255,179,64,.35) }
.task.over { background: var(--red-soft); border-color: rgba(255,90,95,.45) }
.task.done { background: var(--green-soft) }
.task.skipped { opacity: .55 }
.check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--faint); flex: none; display: grid; place-items: center; transition: all .2s }
.task.late .check { border-color: var(--amber) }
.task.over .check { border-color: var(--red) }
.task.done .check { background: var(--green); border-color: var(--green) }
.check svg { opacity: 0; transition: opacity .2s }
.task.done .check svg { opacity: 1 }
.tname { flex: 1; font-size: 16px; font-weight: 500; overflow-wrap: anywhere }
.task.done .tname, .task.skipped .tname { color: var(--dim); text-decoration: line-through; text-decoration-color: var(--faint) }
.when { font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; text-align: right; line-height: 1.25 }
.when em { display: block; font-style: normal; font-size: 11px; font-weight: 600 }
.task.late .when { color: var(--amber) }
.task.over .when { color: var(--red) }
.prog { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font-size: 12px; font-weight: 600; color: var(--dim); font-variant-numeric: tabular-nums; vertical-align: 1px }
.prog svg { transition: transform .2s }
.prog.open svg { transform: rotate(90deg) }
.tree { margin: 6px 0 0 22px; padding-left: 12px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 6px }
.sub { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; padding: 8px 8px 8px 12px; cursor: pointer; font-size: 15px }
.sub .check { width: 22px; height: 22px }
.sub span { flex: 1; overflow-wrap: anywhere }
.sub.done .check { background: var(--green); border-color: var(--green) }
.sub.done .check svg { opacity: 1 }
.sub.done span { color: var(--dim); text-decoration: line-through; text-decoration-color: var(--faint) }
.sub .x { border: 0; background: transparent; color: var(--faint); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; cursor: pointer }
.addsub { display: flex; gap: 6px }
.addsub input { flex: 1; min-width: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--text); font: inherit; font-size: 16px; padding: 9px 12px; outline: none }
.addsub input:focus { border-color: var(--blue) }
.addsub button { width: 42px; border: 0; border-radius: 14px; background: var(--blue-soft); color: var(--blue); font-size: 20px; cursor: pointer }
.fold { margin-top: 22px }
.fold summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; margin: 0 4px 10px; font-size: 15px; font-weight: 600; color: var(--dim) }
.fold summary::-webkit-details-marker { display: none }
.fold summary svg { transition: transform .2s }
.fold[open] summary svg { transform: rotate(90deg) }

/* Tasks tab */
.trowcard { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 18px; padding: 14px 16px; cursor: pointer; color: var(--faint) }
.trowcard > div { flex: 1 }
.trowcard .tname { color: var(--text) }
.trowcard.paused .tname { color: var(--dim) }
.tsum { font-size: 13px; color: var(--dim); margin-top: 3px }
.tag { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 8px; background: var(--card2); color: var(--dim) }

/* Sheets */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 10 }
.scrim.show { opacity: 1; pointer-events: auto }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow-y: auto; background: #18181b; border-radius: 28px 28px 0 0; padding: 10px 16px calc(env(safe-area-inset-bottom) + 18px); transform: translateY(105%); transition: transform .35s cubic-bezier(.2,.9,.2,1); z-index: 11 }
.sheet.show { transform: none }
.grab { width: 38px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.18); margin: 0 auto 14px }
.shead { display: flex; justify-content: space-between; align-items: baseline; margin: 0 4px 4px; gap: 8px }
.shead h3 { font-size: 17px; font-weight: 600 }
.shead span { font-size: 13px; color: var(--dim) }
.display { text-align: center; font-size: 56px; font-weight: 700; letter-spacing: -.03em; margin: 18px 0 4px; font-variant-numeric: tabular-nums; min-height: 68px }
.display small { font-size: 20px; color: var(--faint); font-weight: 500; letter-spacing: 0 }
.display.empty { color: var(--faint) }
.warn { text-align: center; font-size: 14px; color: var(--amber); min-height: 20px; margin-bottom: 12px }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px }
.pad button { height: 58px; border: 0; border-radius: 16px; background: var(--key); font-size: 24px; font-weight: 500; cursor: pointer; transition: background .1s, transform .1s; touch-action: manipulation }
.pad button:active { background: #333338; transform: scale(.96) }
.pad button.ghost { background: transparent }
.go { margin-top: 12px; width: 100%; height: 54px; border: 0; border-radius: 18px; background: var(--blue); color: #fff; font-size: 17px; font-weight: 600; cursor: pointer; transition: opacity .2s, transform .1s }
.go:active { transform: scale(.98) }
.go.off, .go:disabled { opacity: .35 }
.entries { margin: 10px 0 4px; display: flex; flex-direction: column }
.ent { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--line) }
.ent:last-child { border-bottom: 0 }
.ent b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; flex: 1 }
.ent span { font-size: 14px; color: var(--dim); font-variant-numeric: tabular-nums }
.ent button { border: 0; background: var(--red-soft); color: var(--red); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: grid; place-items: center }
.menu { display: flex; flex-direction: column; gap: 8px; margin-top: 12px }
.menu button { border: 0; background: var(--key); border-radius: 16px; padding: 16px; text-align: left; font-size: 16px; font-weight: 500; cursor: pointer; display: flex; justify-content: space-between }
.menu button span { color: var(--dim); font-size: 14px; font-weight: 400 }

/* Forms */
.field { width: 100%; background: var(--key); border: 1px solid transparent; border-radius: 14px; color: var(--text); font: inherit; font-size: 17px; padding: 13px 14px; outline: none; margin-top: 10px }
.field:focus { border-color: var(--blue) }
.field.small { width: auto; font-size: 16px; padding: 9px 12px; margin: 0; color-scheme: dark }
.field.bad { border-color: var(--red) }
.flabel { font-size: 12px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin: 18px 4px 8px }
.chips { display: flex; flex-wrap: wrap; gap: 6px }
.chips button { border: 1px solid var(--line); background: var(--key); border-radius: 12px; padding: 9px 13px; font-size: 14px; font-weight: 500; cursor: pointer }
.chips button.on { background: var(--blue-soft); border-color: rgba(46,158,255,.5); color: var(--blue) }
.chips.days { margin-top: 10px; justify-content: space-between }
.chips.days button { width: 42px; height: 42px; padding: 0; border-radius: 50% }
.stepper { display: flex; align-items: center; justify-content: space-between; background: var(--key); border-radius: 14px; padding: 6px; margin-top: 10px }
.stepper button { width: 44px; height: 40px; border: 0; border-radius: 10px; background: var(--card2); font-size: 22px; cursor: pointer }
.row2 { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding: 0 4px; font-size: 15px; color: var(--dim) }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px }
.pair button { height: 48px; border: 0; border-radius: 14px; background: var(--key); font-size: 15px; font-weight: 600; cursor: pointer }
.pair button.danger { color: var(--red); background: var(--red-soft) }
.setrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px }
.setrow:last-of-type { border-bottom: 0 }
.setrow span { flex: 1 }
.setrow input { width: 110px; text-align: right }
.setrow em { font-style: normal; font-size: 12px; color: var(--faint); width: 52px }

/* Data */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--card); border-radius: 12px; padding: 3px; position: sticky; top: calc(env(safe-area-inset-top) + 6px); z-index: 4; margin-bottom: 18px }
.seg button { border: 0; background: transparent; color: var(--dim); font-size: 14px; font-weight: 600; padding: 8px 0; border-radius: 9px; cursor: pointer; transition: all .2s }
.seg button.on { background: #2c2c30; color: var(--text) }
.range { font-size: 13px; color: var(--dim); text-align: center; margin: -8px 0 16px }
.card { background: var(--card); border-radius: 22px; padding: 16px; margin-bottom: 12px }
.chead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px }
.chead h2 { font-size: 13px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .04em }
.chead span { font-size: 12px; color: var(--faint) }
.big { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; flex-wrap: wrap }
.big b { font-size: 34px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums }
.big small { font-size: 15px; color: var(--faint); font-weight: 500 }
.delta { font-size: 13px; font-weight: 600; padding: 3px 8px; border-radius: 8px; font-variant-numeric: tabular-nums }
.delta:empty { display: none }
.up { background: var(--green-soft); color: var(--green) }
.down { background: var(--red-soft); color: var(--red) }
.flat { background: var(--card2); color: var(--dim) }
svg.chart { display: block; width: 100%; margin-top: 12px; overflow: visible }
svg text { font-family: inherit }
.minis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px }
.mini { background: var(--card2); border-radius: 14px; padding: 10px }
.mini span { display: block; font-size: 11px; color: var(--dim); font-weight: 500 }
.mini b { display: block; font-size: 17px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--dim); margin-top: 8px; align-items: center }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px }
.insights { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px }
.insights:empty { display: none }
.ins { background: var(--card); border-radius: 18px; padding: 14px }
.ins span { font-size: 11px; color: var(--dim); font-weight: 600; text-transform: uppercase; letter-spacing: .04em }
.ins b { display: block; font-size: 17px; font-weight: 700; margin-top: 6px; overflow-wrap: anywhere }
.ins p { font-size: 12px; color: var(--dim); margin-top: 2px }
.heat { display: grid; gap: 3px; margin-top: 12px }
.heat i { aspect-ratio: 1; border-radius: 4px; display: block }
.heat .hl { font-size: 10px; color: var(--faint); text-align: center }
.trow { display: grid; grid-template-columns: 1fr 54px 70px 40px; gap: 8px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px }
.trow:last-child { border-bottom: 0 }
.trow.h { font-size: 11px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding-top: 12px }
.trow.h [data-s] { cursor: pointer }
.trow.h .on { color: var(--blue) }
.trow .n { font-weight: 500; overflow-wrap: anywhere }
.trow .r { text-align: right; font-variant-numeric: tabular-nums; color: var(--dim) }
.pbar { height: 4px; border-radius: 2px; background: rgba(255,255,255,.07); margin-top: 5px; overflow: hidden }
.pbar i { display: block; height: 100%; border-radius: 2px }

/* Tab bar and toast */
.tabs { position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 10px); height: 64px; border-radius: 24px; background: rgba(28,28,31,.72); backdrop-filter: blur(24px) saturate(1.6); -webkit-backdrop-filter: blur(24px) saturate(1.6); border: 1px solid var(--line); display: flex; justify-content: space-around; align-items: center; z-index: 5 }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 600; color: var(--faint); cursor: pointer; padding: 6px 14px }
.tab.on { color: var(--blue) }
.tab svg { width: 24px; height: 24px }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 88px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #2a2a2e; border-radius: 16px; padding: 10px 10px 10px 16px; display: flex; align-items: center; gap: 14px; font-size: 14px; transition: all .25s cubic-bezier(.2,.8,.2,1); white-space: nowrap; z-index: 12; min-height: 44px }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto }
.toast button { border: 0; background: var(--blue-soft); color: var(--blue); font-weight: 600; border-radius: 10px; padding: 6px 12px; cursor: pointer }
