/* Lifeboard UI. Tokens live in tokens.css. No inline styles anywhere: every visual decision is a class. */
@import url("/css/tokens.css");

/* ============================ base ============================ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); font: 400 .9375rem/1.5 var(--font-ui); font-feature-settings: "cv11" 1; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2 { font-family: var(--font-display); font-weight: 500; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 1.75rem; line-height: 1.2; }
h2 { font-size: 1.25rem; line-height: 1.3; }
h3 { font-size: 1rem; line-height: 1.375; font-weight: 600; }
p { text-wrap: pretty; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-hover); }
button { font: inherit; color: inherit; }
img, svg { max-width: 100%; }
code { font: .85em var(--font-mono); background: var(--sunken); padding: .1em .35em; border-radius: var(--r-xs); }
.muted { color: var(--ink-2); }
.small { font-size: .8125rem; line-height: 1.4; }
.split > *, .cols-2 > *, .cols-3 > *, .stack > * { min-width: 0; }
.fig, .figure-xl, .figure-l, .figure { white-space: nowrap; }
.stats-hero { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: end; }
.fig { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1, "cv11" 1; text-align: right; }
.break { overflow-wrap: anywhere; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
.skip { position: absolute; left: -999rem; top: 0; z-index: 200; padding: .6rem 1rem; background: var(--brand); color: var(--on-brand); border-radius: 0 0 var(--r-sm) 0; }
.skip:focus { left: 0; }
body.is-locked { overflow: hidden; }

/* ============================ shell ============================ */
.app { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--sidebar); display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-4) var(--sp-3); background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.topbar, .tabbar { display: none; }
.content { margin-left: var(--sidebar); min-height: 100vh; }
.page { width: 100%; max-width: calc(var(--content-max) + 2 * var(--sp-6)); margin: 0 auto; padding: var(--sp-6) var(--sp-6) var(--sp-8); }

.brand { display: inline-flex; align-items: center; gap: .6rem; padding: var(--sp-1) var(--sp-2); color: var(--ink); text-decoration: none; font: 600 1.2rem/1 var(--font-display); }
.brand:hover { color: var(--ink); }
.brand-mark { width: 1.7rem; height: 1.7rem; flex: none; color: var(--brand); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.more-link { margin-top: var(--sp-3); }
.side-search { display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-height: 2.5rem; padding: 0 var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--paper); color: var(--ink-2); cursor: pointer; text-align: left; }
.side-search:hover { border-color: var(--ink-2); }
.side-search span { flex: 1; }
.kbd { font: 600 .72rem/1 var(--font-ui); padding: .2rem .4rem; border: 1px solid var(--line-strong); border-radius: var(--r-xs); color: var(--ink-2); background: var(--surface); }
.side-nav { display: flex; flex-direction: column; gap: var(--sp-4); flex: 1; }
.nav-group { display: grid; gap: 2px; }
.nav-group-label { padding: 0 var(--sp-3); margin-bottom: var(--sp-1); font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
.nav-link { position: relative; display: flex; align-items: center; gap: .7rem; min-height: 2.5rem; padding: 0 var(--sp-3); border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-weight: 520; }
.nav-link:hover { background: var(--sunken); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 620; }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: .5rem; bottom: .5rem; width: 3px; border-radius: 3px; background: var(--brand); }
.nav-icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.badge { margin-left: auto; min-width: 1.4rem; padding: .05rem .45rem; border-radius: var(--r-pill); background: var(--signal-soft); color: var(--signal-ink); font-size: .75rem; font-weight: 650; text-align: center; }
.side-foot { display: grid; gap: var(--sp-2); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.profile-btn { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: var(--sp-2); border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; text-align: left; }
.profile-btn:hover { background: var(--sunken); }
.avatar { display: grid; place-items: center; width: 2rem; height: 2rem; flex: none; border-radius: 50%; background: var(--brand); color: var(--on-brand); font-weight: 650; font-size: .85rem; }
.profile-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 560; }

/* ============================ page structure ============================ */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-3) var(--sp-4); padding-bottom: var(--sp-4); margin-bottom: var(--sp-5); position: relative; }
.page-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.page-title { flex: 1 1 14rem; min-width: 0; }
.page-title h1 { font-size: 1.875rem; }
.page-sub { margin-top: var(--sp-1); color: var(--ink-2); }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.section-switch { display: none; }
.section { margin-bottom: var(--sp-6); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.section-head h2 { font-size: 1.125rem; }
.section-head .count { color: var(--ink-2); font-weight: 400; font-family: var(--font-ui); font-size: .9rem; }
.stack { display: grid; gap: var(--sp-4); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.split { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--sp-6); align-items: start; }
.cols-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-6); align-items: start; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-6); align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--sp-4) var(--sp-5); }
.panel > * + * { margin-top: var(--sp-3); }
.panel > .section-head:first-child { margin-top: calc(var(--sp-1) * -1); }

/* ============================ rows ============================ */
.rows { display: block; }
.row { position: relative; display: flex; align-items: center; gap: var(--sp-3); min-height: 3.25rem; padding: var(--sp-2) var(--sp-2); border-top: 1px solid var(--line); border-radius: 0; }
.rows > .row:first-child { border-top-color: transparent; }
.row.is-link { cursor: pointer; }
.row.is-link:hover { background: color-mix(in srgb, var(--sunken) 55%, transparent); border-radius: var(--r-sm); }
.row-lead { display: grid; place-items: center; flex: none; min-width: 2.75rem; min-height: 2.75rem; margin: calc(var(--sp-2) * -1) 0 calc(var(--sp-2) * -1) calc(var(--sp-2) * -1); }
.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-title { font-weight: 540; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-title.wrap { white-space: normal; }
.row-title button, .row-title a { all: unset; cursor: pointer; display: block; overflow: hidden; text-overflow: ellipsis; white-space: inherit; }
.row-title button:focus-visible, .row-title a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-xs); }
.row-sub { color: var(--ink-2); font-size: .8125rem; line-height: 1.35; display: flex; flex-wrap: wrap; gap: .1rem .6rem; align-items: center; }
.row-meta { flex: none; color: var(--ink-2); font-size: .875rem; text-align: right; }
.row-actions { flex: none; display: flex; gap: var(--sp-1); }
.row.is-done .row-title { color: var(--ink-2); text-decoration: line-through; text-decoration-thickness: 1px; }
.row.is-done { opacity: .72; }
.row.is-flash { animation: flash 700ms var(--ease-out); }
@keyframes flash { from { background: var(--brand-soft); } to { background: transparent; } }
.dot { display: inline-block; width: .5rem; height: .5rem; flex: none; border-radius: 50%; background: var(--signal); }
.group-head { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-4) 0 var(--sp-1); font-size: .875rem; font-weight: 640; color: var(--ink-2); }
.group-head.is-signal { color: var(--signal); }
.group-head:first-child { margin-top: 0; }

/* ============================ controls ============================ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.5rem; min-width: 2.5rem; padding: 0 var(--sp-4); border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-weight: 600; font-size: .9rem; line-height: 1; text-decoration: none; cursor: pointer; transition: background-color var(--t-micro) var(--ease-out), border-color var(--t-micro) var(--ease-out), transform var(--t-micro) var(--ease-out); }
.btn:hover { background: var(--sunken); color: var(--ink); }
.btn:active { transform: scale(.985); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover, .btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-brand); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--brand); }
.btn-quiet:hover { background: var(--brand-soft); color: var(--brand-ink); }
.btn-danger { border-color: transparent; background: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: var(--surface); }
.btn-danger-solid:hover { background: var(--danger); filter: brightness(.92); color: var(--surface); }
.btn-sm { min-height: 2.25rem; padding: 0 var(--sp-3); font-size: .84rem; }
.btn-icon { padding: 0; width: 2.5rem; border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-icon:hover { color: var(--ink); }
.btn[aria-busy="true"] { position: relative; color: transparent; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid var(--on-brand); border-right-color: transparent; animation: spin 700ms linear infinite; }
.btn:not(.btn-primary)[aria-busy="true"]::after { border-color: var(--ink); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.chip { display: inline-flex; align-items: center; gap: .3rem; min-height: 1.5rem; padding: 0 .6rem; border-radius: var(--r-pill); background: var(--sunken); color: var(--ink); font-size: .78rem; font-weight: 560; white-space: nowrap; border: 0; }
button.chip { cursor: pointer; }
button.chip:hover { filter: brightness(.96); }
.chip-brand { background: var(--brand-soft); color: var(--brand-ink); }
.chip-signal { background: var(--signal-soft); color: var(--signal-ink); }
.chip-ok { background: var(--success-soft); color: var(--success); }
.chip-warn { background: var(--warning-soft); color: var(--warning); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip .icon { width: .9rem; height: .9rem; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-pill); background: var(--sunken); max-width: 100%; overflow-x: auto; }
.seg button, .seg a { display: inline-flex; align-items: center; justify-content: center; min-height: 2.25rem; padding: 0 var(--sp-4); border: 0; border-radius: var(--r-pill); background: transparent; color: var(--ink-2); font-weight: 580; font-size: .875rem; text-decoration: none; white-space: nowrap; cursor: pointer; }
.seg button[aria-pressed="true"], .seg button[aria-checked="true"], .seg button[aria-selected="true"], .seg a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.seg button:hover:not([aria-pressed="true"]):not([aria-checked="true"]) { color: var(--ink); }

.field { display: grid; gap: var(--sp-1); margin-bottom: var(--sp-4); }
.field-label { font-size: .84rem; font-weight: 620; }
.field-hint { font-size: .8125rem; color: var(--ink-2); }
.field-error { display: flex; gap: .35rem; align-items: flex-start; color: var(--danger); font-size: .84rem; font-weight: 560; }
.field-error:empty { display: none; }
.form-error { color: var(--danger); font-weight: 560; font-size: .875rem; min-height: 1.2em; }
.form-error:empty { min-height: 0; }
input, select, textarea { width: 100%; max-width: 100%; min-height: 2.75rem; padding: .55rem .8rem; border: 1px solid var(--line-strong); border-radius: var(--r-xs); background: var(--surface); color: var(--ink); font: inherit; font-size: .9375rem; transition: border-color var(--t-micro), box-shadow var(--t-micro); }
textarea { min-height: 5.5rem; resize: vertical; }
select { appearance: none; padding-right: 2.2rem; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 1.15rem) 52%, calc(100% - .8rem) 52%; background-size: .35rem .35rem; background-repeat: no-repeat; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--ink-2) 80%, transparent); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--brand); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
input[type="checkbox"], input[type="radio"] { appearance: none; width: 1.375rem; height: 1.375rem; min-height: 0; padding: 0; margin: 0; flex: none; border: 1.5px solid var(--line-strong); border-radius: var(--r-xs); background: var(--surface); display: inline-grid; place-content: center; cursor: pointer; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::after { content: ""; width: .7rem; height: .4rem; border-left: 2.5px solid var(--on-brand); border-bottom: 2.5px solid var(--on-brand); transform: rotate(-48deg) scale(0); transform-origin: center; margin-top: -2px; transition: transform var(--t-micro) var(--ease-out); }
input[type="checkbox"]:checked { background: var(--brand); border-color: var(--brand); }
input[type="checkbox"]:checked::after { transform: rotate(-48deg) scale(1); }
input[type="radio"]:checked { border-color: var(--brand); box-shadow: inset 0 0 0 4px var(--surface); background: var(--brand); }
input[type="checkbox"]:disabled { opacity: .4; cursor: not-allowed; }
.check-hit { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; cursor: pointer; }
.check-label { display: flex; align-items: center; gap: var(--sp-3); min-height: 2.75rem; font-weight: 500; cursor: pointer; }
.toggle { appearance: none; width: 2.75rem !important; height: 1.6rem !important; border-radius: var(--r-pill) !important; background: var(--sunken); border: 1.5px solid var(--line-strong); position: relative; flex: none; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--ink-2); transition: transform var(--t-micro) var(--ease-out), background var(--t-micro); transform: none; border: 0; margin: 0; }
.toggle:checked { background: var(--brand); border-color: var(--brand); }
.toggle:checked::after { transform: translateX(1.1rem); background: var(--on-brand); border: 0; }
.field > .seg { display: flex; width: 100%; } .field > .seg button { flex: 1 1 auto; padding: 0 var(--sp-2); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0 var(--sp-4); }
.money-input { position: relative; }
.money-input > span { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.money-input input { padding-left: 1.9rem; font-variant-numeric: tabular-nums; }
.money-big input { min-height: 3.5rem; font-size: 1.75rem; font-weight: 600; letter-spacing: -.02em; }
.stepper { display: inline-flex; align-items: center; gap: var(--sp-2); }
.stepper input { width: 4.5rem; text-align: center; font-variant-numeric: tabular-nums; }
.range { display: flex; align-items: center; gap: var(--sp-3); }
input[type="range"] { appearance: auto; accent-color: var(--brand); min-height: 2.75rem; padding: 0; border: 0; background: transparent; }

progress, meter { appearance: none; width: 100%; height: .45rem; border: 0; border-radius: var(--r-pill); background: var(--line); overflow: hidden; display: block; }
progress::-webkit-progress-bar, meter::-webkit-meter-bar { background: var(--line); border-radius: var(--r-pill); }
progress::-webkit-progress-value, meter::-webkit-meter-optimum-value { background: var(--brand); border-radius: var(--r-pill); transition: width var(--t-std) var(--ease-out); }
progress::-moz-progress-bar, meter::-moz-meter-bar { background: var(--brand); border-radius: var(--r-pill); }
.bar-line { display: flex; align-items: center; gap: var(--sp-3); }
.bar-line progress { flex: 1; }

/* ============================ feedback ============================ */
#toasts { position: fixed; left: calc(var(--sidebar) + var(--sp-5)); bottom: var(--sp-5); z-index: 120; display: grid; gap: var(--sp-2); max-width: min(26rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: var(--sp-3); padding: .75rem 1rem; border-radius: var(--r-sm); background: var(--ink); color: var(--paper); box-shadow: var(--shadow-float); font-size: .9rem; font-weight: 520; pointer-events: auto; animation: toast-in var(--t-std) var(--ease-out); }
.toast.err { background: var(--danger); color: var(--surface); }
.toast .btn { min-height: 2rem; padding: 0 .7rem; border-color: color-mix(in srgb, currentColor 40%, transparent); background: transparent; color: inherit; font-size: .84rem; }
.toast .btn:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.toast-text { flex: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); border: 1px solid var(--line); border-left: 3px solid var(--signal); border-radius: var(--r-sm); background: var(--signal-soft); color: var(--signal-ink); }
.banner p { flex: 1 1 16rem; }
.banner.is-info { border-left-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.banner.is-ok { border-left-color: var(--success); background: var(--success-soft); color: var(--success); }
.skeleton { display: block; height: 1rem; border-radius: var(--r-xs); background: linear-gradient(90deg, var(--sunken) 25%, color-mix(in srgb, var(--sunken) 60%, var(--surface)) 50%, var(--sunken) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton-row { height: 3.25rem; margin: .25rem 0; border-radius: var(--r-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }
.empty { display: grid; justify-items: center; gap: var(--sp-2); padding: var(--sp-7) var(--sp-4); text-align: center; color: var(--ink-2); }
.empty .icon { width: 2.5rem; height: 2.5rem; color: var(--line-strong); stroke-width: 1.4; }
.empty p { max-width: 28rem; }
.empty strong { color: var(--ink); font-family: var(--font-display); font-weight: 500; font-size: 1.1rem; }
.empty-inline { padding: var(--sp-4) var(--sp-2); color: var(--ink-2); }

/* ============================ overlays ============================ */
dialog { padding: 0; border: 0; color: var(--ink); background: var(--raised); box-shadow: var(--shadow-float); }
dialog::backdrop { background: var(--scrim); animation: fade var(--t-std) var(--ease-out); }
@keyframes fade { from { opacity: 0; } }
dialog.modal { width: min(30rem, calc(100vw - 2rem)); border-radius: var(--r-md); padding: var(--sp-5); animation: pop var(--t-std) var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
dialog.modal h2 { margin-bottom: var(--sp-2); font-size: 1.2rem; }
dialog.modal p { color: var(--ink-2); margin-bottom: var(--sp-4); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--sp-2); }
dialog.sheet { position: fixed; margin: 0; max-width: none; max-height: none; display: flex; flex-direction: column; }
dialog.sheet[open] { display: flex; }
.sheet-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; font-size: 1.25rem; }
.sheet-body { flex: 1; overflow-y: auto; padding: var(--sp-5); overscroll-behavior: contain; }
.sheet-foot { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--line); background: var(--raised); }
.sheet-foot .spacer { flex: 1; }
.sheet-grab { display: none; }
@media (min-width: 900px) {
  dialog.sheet { inset: 0 0 0 auto; width: min(30rem, 100vw); height: 100vh; border-radius: var(--r-md) 0 0 var(--r-md); border-left: 1px solid var(--line); animation: drawer-in var(--t-sheet) var(--ease-out); }
  dialog.sheet.is-wide { width: min(40rem, 100vw); }
  dialog.palette { inset: 12vh auto auto 50%; transform: translateX(-50%); width: min(40rem, calc(100vw - 2rem)); height: auto; max-height: 70vh; border-radius: var(--r-md); border: 1px solid var(--line); animation: pop var(--t-std) var(--ease-out); }
}
@keyframes drawer-in { from { transform: translateX(2rem); opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(3rem); opacity: 0; } }
.menu { position: fixed; z-index: 150; min-width: 12rem; max-width: 18rem; padding: var(--sp-1); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--raised); box-shadow: var(--shadow-float); animation: pop var(--t-micro) var(--ease-out); }
.menu-item { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 2.5rem; padding: 0 var(--sp-3); border: 0; border-radius: var(--r-xs); background: none; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer; font-size: .9rem; }
.menu-item:hover, .menu-item:focus-visible { background: var(--sunken); outline-offset: -2px; }
.menu-item[aria-checked="true"] { font-weight: 640; color: var(--brand-ink); }
.menu-item.is-danger { color: var(--danger); }
.menu-item .icon { color: var(--ink-2); }
.menu-sep { height: 1px; margin: var(--sp-1) 0; background: var(--line); }
.menu-label { padding: var(--sp-2) var(--sp-3) var(--sp-1); font-size: .78rem; font-weight: 600; color: var(--ink-2); }

/* ============================ data ============================ */
.figure-xl { font: 600 2.5rem/1.05 var(--font-ui); letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.figure-l { font: 600 1.5rem/1.2 var(--font-ui); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.figure { font-variant-numeric: tabular-nums; font-weight: 520; }
.cur { font-size: .8em; color: var(--ink-2); font-weight: 500; margin-right: .08em; }
.stat { display: grid; gap: 2px; align-content: start; }
h2.stat-label { font-family: var(--font-ui); font-size: .8125rem; font-weight: 450; letter-spacing: 0; }
.stat-label { color: var(--ink-2); font-size: .8125rem; }
.stat-note { color: var(--ink-2); font-size: .8125rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--sp-4) var(--sp-5); }
.delta { font-size: .84rem; font-weight: 600; color: var(--ink-2); }
.delta.up { color: var(--success); } .delta.down { color: var(--danger); }
.spark { display: block; width: 100%; height: 3.25rem; color: var(--brand); }
.spark path.line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark path.area { fill: currentColor; opacity: .12; stroke: none; }
.spark circle { fill: currentColor; }
.split-bar { display: flex; height: .6rem; border-radius: var(--r-pill); overflow: hidden; background: var(--sunken); gap: 2px; }
.split-bar > span { display: block; min-width: 2px; flex: 1 1 0; }
.split-bar .assets { background: var(--s-income); } .split-bar .debts { background: var(--s-spend); }
.legend { display: flex; flex-wrap: wrap; gap: .25rem var(--sp-4); font-size: .8125rem; color: var(--ink-2); }
.legend .assets-key { background: var(--s-income); } .legend .debts-key { background: var(--s-spend); }
.seg-mobile { display: none; }
.legend i { display: inline-block; width: .6rem; height: .6rem; border-radius: 2px; margin-right: .35rem; }
.cat-row { display: grid; grid-template-columns: minmax(5rem, 9rem) 1fr auto; gap: var(--sp-3); align-items: center; padding: .35rem 0; font-size: .9rem; }
.chart-box { position: relative; height: 15rem; }
.chart-summary { font-size: .9rem; margin-bottom: var(--sp-2); }
details.table-alt { margin-top: var(--sp-2); }
details.table-alt summary { cursor: pointer; color: var(--brand); font-size: .84rem; font-weight: 600; min-height: 2rem; display: flex; align-items: center; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table caption { text-align: left; padding-bottom: var(--sp-2); color: var(--ink-2); font-size: .84rem; }
.table th, .table td { padding: .6rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { position: sticky; top: 0; background: var(--paper); font-size: .8125rem; font-weight: 620; color: var(--ink-2); white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--sunken) 55%, transparent); }
.table tr.is-link { cursor: pointer; }

dialog.palette .sheet-head { display: none; }
dialog.palette .sheet-body { padding: 0; }
dialog.palette .search-input input { min-height: 3.25rem; }
dialog.palette .filters, dialog.palette #search-results, dialog.palette .more-link { padding: 0 var(--sp-3); }
#search-results { padding-bottom: var(--sp-3); }
.qr { width: 11rem; height: 11rem; display: block; border-radius: var(--r-sm); border: 1px solid var(--line); }
.qr-wrap { margin: var(--sp-3) 0; }
.settings-nav .nav-link { color: var(--ink-2); }
.ov-summary { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); list-style: none; cursor: default; margin-bottom: var(--sp-2); }
.ov-summary::-webkit-details-marker { display: none; }
.ov-summary h2 { font-size: 1.125rem; }
.ov-headline { color: var(--ink-2); font-size: .9rem; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-body > * + * { margin-top: var(--sp-3); }
@media (min-width: 900px) { .ov-headline { display: none; } }
@media (max-width: 899px) { .ov { border-top: 1px solid var(--line); } .ov-summary { cursor: pointer; min-height: 3rem; align-items: center; margin-bottom: 0; } .ov-summary::after { content: ""; width: .5rem; height: .5rem; margin-left: var(--sp-2); border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); flex: none; } .ov[open] > .ov-summary::after { transform: rotate(-135deg); } .ov-body { padding-bottom: var(--sp-3); } .cols-3 { gap: 0; } }
/* habits: heat strip + check-in */
.habit-row .row-lead { min-width: 3.25rem; }
.habit-check { width: 1.75rem; height: 1.75rem; border-radius: 50%; }
.habit-check::after { width: .85rem; height: .5rem; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; width: max-content; }
.heat-cell { width: 1.1rem; height: 1.1rem; min-height: 0; padding: 0; border: 1px solid var(--line-strong); border-radius: 4px; background: transparent; cursor: pointer; }
.heat-cell[data-state="done"] { background: var(--brand); border-color: var(--brand); }
.heat-cell[data-state="off"] { border-style: dashed; border-color: var(--line); cursor: default; }
.heat-cell.is-today { outline: 2px solid var(--signal); outline-offset: 1px; }
.heat-scroll { overflow-x: auto; padding: 4px; }
.date-stepper { display: inline-flex; align-items: center; gap: var(--sp-1); }
.date-stepper .label { min-width: 9rem; text-align: center; font-weight: 600; }

/* capture + search */
.capture-bar { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; padding: var(--sp-2); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); margin-bottom: var(--sp-5); }
.capture-bar input { flex: 1 1 14rem; border: 0; background: transparent; min-height: 2.5rem; }
.capture-bar input:focus-visible { outline: none; }
.capture-bar:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--brand); }
.type-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.type-chips button { min-height: 2.5rem; padding: 0 var(--sp-4); border-radius: var(--r-pill); border: 1px solid var(--line-strong); background: var(--surface); font-weight: 580; cursor: pointer; }
.type-chips button[aria-checked="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); }
.search-input { display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-4); border-bottom: 1px solid var(--line); }
.search-input input { border: 0; background: transparent; min-height: 3.5rem; font-size: 1.05rem; }
.search-input input:focus-visible { outline: none; }
.result { display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 3rem; padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--r-sm); background: none; text-align: left; cursor: pointer; text-decoration: none; color: var(--ink); }
.result:hover, .result[aria-selected="true"] { background: var(--brand-soft); }
.result-type { margin-left: auto; font-size: .78rem; color: var(--ink-2); }
.filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-4); }
.filters select, .filters input { width: auto; min-height: 2.5rem; padding-top: .35rem; padding-bottom: .35rem; font-size: .875rem; }
.filters .grow { flex: 1 1 12rem; }
.filters input[type="checkbox"] { width: 1.375rem; min-height: 0; padding: 0; }
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--line); margin-bottom: var(--sp-5); overflow-x: auto; }
.tabs [role="tab"] { min-height: 2.75rem; padding: 0 var(--sp-4); border: 0; border-bottom: 2px solid transparent; background: none; font-weight: 580; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tabs [role="tab"][aria-selected="true"] { color: var(--brand-ink); border-bottom-color: var(--brand); }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); align-items: start; }
.lane { padding: var(--sp-3); border-radius: var(--r-md); background: var(--sunken); min-height: 12rem; }
.lane.is-over { outline: 2px dashed var(--brand); }
.lane .section-head { padding: 0 var(--sp-1); }
.card-row { margin-bottom: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.card-row[draggable="true"] { cursor: grab; }
.goal-card { display: grid; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; text-align: left; width: 100%; }
.goal-card:hover { border-color: var(--line-strong); }
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: var(--sp-4); }
.steps { counter-reset: step; display: grid; gap: var(--sp-3); }
.steps li { counter-increment: step; display: flex; gap: var(--sp-3); }
.steps li::before { content: counter(step); flex: none; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); font-weight: 650; font-size: .85rem; }
.copy-line { display: flex; gap: var(--sp-2); align-items: center; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); }
.copy-line code { flex: 1; background: none; padding: 0; overflow-wrap: anywhere; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.settings-nav { display: grid; gap: 2px; }
.settings-layout { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: var(--sp-6); align-items: start; }
.settings-body { max-width: 40rem; }
.md { max-width: 44rem; line-height: 1.65; }
.md h1, .md h2, .md h3 { margin: 1.6em 0 .5em; } .md h1:first-child { margin-top: 0; }
.md ul { list-style: disc; padding-left: 1.3em; margin: .5em 0; } .md ol { list-style: decimal; padding-left: 1.4em; margin: .5em 0; }
.md li { margin: .25em 0; } .md p { margin: .6em 0; }
.md table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: .9rem; } .md th, .md td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.getting-started { margin-bottom: var(--sp-5); }

/* ============================ auth ============================ */
body.auth-body { min-height: 100svh; display: grid; grid-template-columns: minmax(20rem, 1fr) minmax(24rem, 1fr); background: var(--paper); }
.auth-story { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: var(--sp-6); padding: clamp(2rem, 5vw, 4.5rem); background: #0e2a29; color: #eef3ef; overflow: hidden; }
.auth-story .brand { color: #fff; align-self: flex-start; } .auth-story .brand-mark { color: #7fd8d1; }
.auth-story h2 { font-size: clamp(2rem, 3.6vw, 3.2rem); line-height: 1.08; max-width: 14ch; color: #fff; font-weight: 450; }
.auth-story p { max-width: 36ch; margin-top: var(--sp-3); color: #b9cfca; font-size: 1.02rem; }
.auth-preview { width: min(100%, 24rem); border-top: 1px solid rgb(255 255 255 / .2); }
.auth-preview li { display: flex; align-items: center; gap: var(--sp-3); padding: .8rem 0; border-bottom: 1px solid rgb(255 255 255 / .12); color: #cfe0dc; font-size: .9rem; }
.auth-preview b { color: #fff; font-weight: 600; min-width: 5rem; }
.auth-preview .dot { background: #ff9c66; }
.auth-preview .tick { width: 1rem; height: 1rem; border-radius: 50%; border: 1.5px solid #7fd8d1; background: #7fd8d1; flex: none; }
.auth-preview .tick.off { background: none; }
.auth-main { display: grid; place-items: center; padding: var(--sp-6) var(--sp-5); }
.auth-card { width: min(100%, 25rem); }
.auth-card h1 { font-size: 2rem; margin-bottom: var(--sp-2); }
.auth-card > p { margin: var(--sp-2) 0; color: var(--ink-2); }
.auth-card form { margin-top: var(--sp-5); }
.auth-card .btn-primary { width: 100%; min-height: 3rem; margin-top: var(--sp-2); }
.auth-card input:not([type="checkbox"]) { min-height: 3rem; }
.auth-card .check-label { align-items: flex-start; font-weight: 450; font-size: .875rem; }
.password-control { position: relative; }
.password-control input { padding-right: 4.5rem; }
.password-toggle { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); min-height: 2.5rem; padding: 0 .7rem; border: 0; border-radius: var(--r-xs); background: none; color: var(--brand); font-weight: 650; font-size: .84rem; cursor: pointer; }
.password-toggle:hover { background: var(--brand-soft); }
.auth-links { display: grid; gap: var(--sp-2); margin-top: var(--sp-5); font-size: .9rem; }
body.auth-page { display: flex; justify-content: center; align-items: flex-start; min-height: 100vh; padding: 10vh 1rem 2rem; }
.card.consent { width: min(100%, 30rem); padding: var(--sp-6); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.card.consent h1 { font-size: 1.5rem; margin-bottom: var(--sp-3); }
.card.consent .brand { margin-bottom: var(--sp-4); padding: 0; }
.client-name { color: var(--brand); }
.scope-list { margin: var(--sp-3) 0 var(--sp-4); } .scope-list li { padding: var(--sp-3) 0; border-top: 1px solid var(--line); }
.scope-list label { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem var(--sp-3); font-weight: 620; cursor: pointer; }
.scope-list .block { display: block; flex-basis: 100%; font-weight: 400; color: var(--ink-2); font-size: .875rem; padding-left: 2.1rem; }
fieldset { margin: 0; padding: 0; border: 0; } legend { padding: 0; font-weight: 650; }
.card.consent .actions, .actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }

/* ============================ responsive ============================ */
@media (max-width: 1199px) and (min-width: 900px) {
  :root { --sidebar: var(--rail); }
  .sidebar { align-items: center; padding-inline: var(--sp-2); }
  .brand span, .side-search span, .nav-link span, .profile-name, .new-btn .label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .side-search .kbd, .nav-group-label, .nav-link .badge { display: none; }
  .side-search, .new-btn { width: 2.75rem; padding: 0; justify-content: center; }
  .nav-link { justify-content: center; padding: 0; width: 2.75rem; }
  .nav-link[aria-current="page"]::before { left: -.3rem; }
  .nav-group + .nav-group { padding-top: var(--sp-3); border-top: 1px solid var(--line); }
  .nav-link .dot { position: absolute; top: .55rem; right: .55rem; }
  #toasts { left: calc(var(--rail) + var(--sp-4)); }
}
@media (max-width: 1099px) { .split, .cols-3 { grid-template-columns: minmax(0, 1fr); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 899px) {
  :root { --sidebar: 0rem; }
  .sidebar { display: none; }
  .content { margin-left: 0; padding-top: var(--topbar-h); padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .topbar { position: fixed; z-index: 40; inset: 0 0 auto 0; display: flex; align-items: center; gap: var(--sp-1); height: var(--topbar-h); padding: 0 var(--sp-3) 0 var(--sp-4); background: color-mix(in srgb, var(--paper) 94%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
  .topbar .brand { flex: 1; padding: 0; font-size: 1.15rem; }
  .topbar .btn-icon { width: 2.75rem; height: 2.75rem; position: relative; }
  .topbar .badge-dot { position: absolute; top: .55rem; right: .55rem; width: .6rem; height: .6rem; border-radius: 50%; background: var(--signal); border: 2px solid var(--paper); }
  .tabbar { position: fixed; z-index: 40; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line); }
  .tab { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: var(--tabbar-h); border: 0; background: none; color: var(--ink-2); text-decoration: none; font-size: .72rem; font-weight: 600; cursor: pointer; }
  .tab .icon { width: 1.5rem; height: 1.5rem; }
  .tab[aria-current="page"] { color: var(--brand-ink); }
  .tab[aria-current="page"] .icon { fill: var(--brand-soft); }
  .tab-capture { align-self: start; margin-top: -1.1rem; }
  .tab-capture .fab { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--brand); color: var(--on-brand); box-shadow: 0 4px 14px rgb(11 99 96 / .35); }
  .tab-capture .fab .icon { width: 1.6rem; height: 1.6rem; stroke-width: 2.25; }
  .tab-capture { color: var(--ink); }
  .page { padding: var(--sp-4) var(--sp-4) var(--sp-6); }
  .page-head { margin-bottom: var(--sp-4); }
  .page-title h1 { font-size: 1.625rem; }
  .section-switch { display: flex; margin-bottom: var(--sp-4); width: 100%; }
  .section-switch .seg { width: 100%; } .section-switch .seg a { flex: 1; padding: 0 var(--sp-2); font-size: .8125rem; }
  .row { flex-wrap: wrap; } .row-main { flex-basis: 8rem; } .habit-row, .row.card-row { flex-wrap: nowrap; }
  #toasts { left: var(--sp-4); right: var(--sp-4); bottom: calc(var(--tabbar-h) + var(--sp-4) + env(safe-area-inset-bottom)); max-width: none; }
  dialog.sheet { inset: auto 0 0 0; width: 100%; max-height: 92dvh; height: auto; border-radius: var(--r-lg) var(--r-lg) 0 0; animation: sheet-in var(--t-sheet) var(--ease-out); }
  dialog.sheet.is-full { inset: 0; max-height: none; height: 100dvh; border-radius: 0; }
  dialog.sheet .sheet-grab { display: block; width: 2.5rem; height: 4px; margin: .5rem auto 0; border-radius: 4px; background: var(--line-strong); }
  .sheet-foot { padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom)); }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .capture-bar { display: none; }
  .banner.is-info { flex-wrap: nowrap; } .banner.is-info p { flex: 1 1 0; }
  .split > [data-testid="home-habits"] { order: -1; }
  .view-toggle { display: none; }
  .seg-mobile { display: block; margin-bottom: var(--sp-3); } .seg-mobile .seg { display: flex; width: 100%; } .seg-mobile .seg button { flex: 1; }
  .board { display: block; }
  .board .lane { margin-bottom: var(--sp-3); }
  .settings-layout { grid-template-columns: 1fr; }
  .btn-sm { min-height: 2.5rem; }
  input, select, textarea { font-size: 1rem; min-height: 3rem; }
  .btn { min-height: 2.75rem; }
  .row { min-height: 3.5rem; }
  body.auth-body { grid-template-columns: 1fr; }
  .auth-story { padding: var(--sp-5); min-height: 0; gap: var(--sp-4); } .auth-story h2 { font-size: 1.75rem; } .auth-preview, .auth-story p { display: none; }
  .auth-main { align-items: start; padding: var(--sp-5) var(--sp-4) var(--sp-7); }
}
@media (max-width: 480px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .stats-hero { grid-template-columns: minmax(0, 1fr); } .cat-row { grid-template-columns: minmax(4rem, 7rem) 1fr auto; } .figure-xl { font-size: 2.125rem; } .cols-3 { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; } .skeleton { animation: none; } }
@media print { .sidebar, .topbar, .tabbar { display: none; } .content { margin: 0; } }
