:root {
  --brand: #a70e47;
  --brand-2: #8c3aca;
  --orange: #f97c10;
  --yellow: #f7cd00;
  --cyan: #44c7db;
  --ink: #17111c;
  --muted: #6b5e75;
  --hairline: #e6dfec;
  --surface: #fff;
  --canvas: #f7f4fa;
  --dark-surface: #241b2c;
  --rail: 72px;
  --sidebar: 240px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --display: "Bricolage Grotesque", "Anek Bangla", sans-serif;
  --body: "Hanken Grotesk", "Anek Bangla", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
/* Stops iOS inflating text when a phone is turned sideways. */
html { min-height: 100%; background: var(--canvas); -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
/* iOS Safari zooms the whole page when a focused field is under 16px. */
input, select, textarea { font-size: max(16px, 1em); }
button, a { -webkit-tap-highlight-color: transparent; }
/* No 300ms double-tap-zoom delay on the things people tap. */
button, a, label, summary, input[type="checkbox"], input[type="radio"] { touch-action: manipulation; }
/* The tap highlight is off, so every control needs its own press state or
   taps feel dead on a phone. */
button:active, .btn-vitrine:active, .app-card a:active { opacity: .82; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-2); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--cyan) 80%, white); outline-offset: 3px; }
.skip-link {
  position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 0 14px;
  display: inline-flex; align-items: center; min-height: 44px;
  background: var(--ink); color: white; border-radius: 10px; transform: translateY(-150%);
}
.skip-link:focus { transform: none; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.025em; }
.eyebrow, .mono-label, .meta, .chip, .stat-label, kbd {
  font-family: var(--mono); font-size: .68rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}
.eyebrow { display: block; color: var(--muted); margin-bottom: 5px; }
.page-wrap { width: min(100%, 1280px); margin-inline: auto; padding: 20px 20px 120px; }
/* viewport-fit=cover lets the header slide under a notch, so pay the inset back. */
.page-header { padding: calc(26px + var(--safe-top)) 20px 48px; color: white; }
.page-header .header-inner { width: min(100%, 1240px); margin: 0 auto; }
.page-header h1 { margin: 4px 0 2px; font-size: clamp(1.75rem, 4vw, 2.4rem); }
.page-header p { margin: 0; color: rgba(255,255,255,.72); }
.header-dashboard { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.header-tasks { background: var(--brand-2); }
.header-plan { background: var(--orange); color: var(--ink); }
.header-expenses { background: var(--cyan); color: var(--ink); }
.header-review { background: linear-gradient(135deg, var(--brand-2), var(--brand)); }
.header-settings { background: var(--ink); }
.header-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.header-actions > div { min-width: 0; }
.app-shell main { min-height: 100vh; }
.desktop-sidebar, .tablet-rail { display: none; }

.offline-banner {
  position: fixed; inset: 0 0 auto; z-index: 120;
  min-height: 28px; padding: 5px 18px; background: var(--orange); color: var(--ink);
  align-items: center; justify-content: space-between; font-family: var(--mono);
  font-size: .64rem; letter-spacing: .08em; text-transform: uppercase;
}
.offline-banner:not([hidden]) { display: flex; }
.status-blip { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); animation: blip 1.4s infinite; }
body:has(.offline-banner:not([hidden])) .app-shell { padding-top: 28px; }

.desktop-sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 80; width: var(--sidebar);
  padding: 22px 16px; background: var(--ink); color: white; flex-direction: column; gap: 8px;
}
.brand-lockup { display: flex; align-items: center; gap: 10px; padding: 0 6px 16px; color: white; font: 700 1.2rem var(--display); }
.brand-lockup:hover { color: white; }
.brand-mark, .avatar {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px;
  border-radius: 12px; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white; font: 800 1rem var(--display);
}
.quick-add-primary {
  min-height: 46px; border: 0; border-radius: 13px; background: var(--brand); color: white;
  display: flex; align-items: center; gap: 10px; padding: 0 14px; font-weight: 600; cursor: pointer;
}
.quick-add-primary:hover { background: var(--brand-2); }
.nav-links { display: flex; flex-direction: column; gap: 4px; }
.nav-links a {
  position: relative; min-height: 44px; border-radius: 12px; display: flex; align-items: center;
  gap: 11px; padding: 0 12px; color: rgba(255,255,255,.7); font-weight: 600;
}
.nav-links a:hover, .nav-links a.active { color: white; background: rgba(255,255,255,.09); }
.nav-spine { width: 6px; height: 22px; flex: none; border-radius: 999px; background: var(--nav-color); }
.nav-icon { display: none; }
.sidebar-account {
  margin-top: auto; padding: 14px 7px 0; border-top: 1px solid rgba(255,255,255,.1);
  display: flex; gap: 10px; align-items: center; min-width: 0;
}
.sidebar-account .avatar { width: 34px; height: 34px; background: var(--yellow); color: var(--ink); font-size: .75rem; }
.sidebar-account span:last-child { display: flex; flex-direction: column; min-width: 0; }
.sidebar-account b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-account small { color: #9a90a3; font: 600 .55rem var(--mono); text-transform: uppercase; letter-spacing: .06em; }

.tablet-rail {
  position: fixed; inset: 0 auto 0 0; z-index: 80; width: var(--rail); padding: 16px 10px;
  background: var(--ink); flex-direction: column; align-items: center; gap: 8px;
}
.rail-add {
  width: 48px; height: 48px; border: 0; border-radius: 16px; background: var(--brand);
  color: white; font-size: 1.7rem; line-height: 1; cursor: pointer; margin-bottom: 6px;
}
.nav-links-rail a { width: 52px; height: 52px; padding: 0; justify-content: center; flex-direction: column; gap: 3px; }
.nav-links-rail .nav-spine, .nav-links-rail .nav-label { display: none; }
.nav-links-rail .nav-icon { display: block; }

.mobile-tabbar {
  position: fixed; z-index: 90; inset: auto 0 0; height: calc(76px + var(--safe-bottom));
  padding: 9px 4px var(--safe-bottom); background: rgba(255,255,255,.96);
  border-top: 1px solid var(--hairline); backdrop-filter: blur(14px);
  /* Six links around a fixed centre lane that belongs to the FAB. */
  display: grid; grid-template-columns: repeat(3, 1fr) 74px repeat(3, 1fr); align-items: start;
}
.mobile-tabbar a {
  min-height: 48px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 5px; color: var(--muted); min-width: 0;
}
/* The FAB is absolutely positioned, so it never takes a grid cell. Without
   this the fourth link would auto-place into the centre lane and sit under it. */
.mobile-tabbar a:nth-of-type(4) { grid-column: 5; }
.mobile-tabbar a.active { color: var(--brand); }
.mobile-tabbar small {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 600 .62rem var(--mono); text-transform: uppercase; letter-spacing: .02em;
}
.mobile-tabbar a:active { opacity: .6; }
.mobile-fab:active { transform: translateX(-50%) scale(.94); }
.mobile-fab {
  position: absolute; left: 50%; bottom: calc(37px + var(--safe-bottom)); transform: translateX(-50%);
  width: 60px; height: 60px; border: 0; border-radius: 22px; background: var(--brand); color: white;
  box-shadow: 0 9px 24px rgba(167,14,71,.36); font-size: 2rem; line-height: 1; cursor: pointer;
}
.nav-glyph, .nav-icon { width: 18px; height: 18px; position: relative; color: currentColor; }
.grid-glyph::before { content: ""; position: absolute; inset: 2px; background: currentColor; border-radius: 3px; box-shadow: 10px 0 currentColor; width: 6px; height: 6px; }
.grid-glyph::after { content: ""; position: absolute; left: 2px; top: 12px; background: currentColor; border-radius: 3px; box-shadow: 10px 0 currentColor; width: 6px; height: 6px; }
.list-glyph::before { content:""; position:absolute; left:2px; top:3px; width:14px; height:2px; background:currentColor; border-radius:2px; box-shadow:0 5px currentColor,0 10px currentColor; }
.bars-glyph::before { content:""; position:absolute; left:2px; bottom:2px; width:4px; height:9px; background:currentColor; border-radius:2px; box-shadow:6px -5px currentColor,12px 2px currentColor; }
.dot-glyph::before { content:"৳"; position:absolute; inset:0; display:grid; place-items:center; border:2px solid currentColor; border-radius:50%; font:bold .7rem var(--mono); }
.focus-glyph::before { content:""; position:absolute; inset:2px; border:2px solid currentColor; border-radius:50%; }
.focus-glyph::after { content:""; position:absolute; inset:7px; background:currentColor; border-radius:50%; }
.chart-glyph::before { content:""; position:absolute; inset:2px; border:2px solid currentColor; border-top-color:transparent; border-radius:50%; transform:rotate(-35deg); }
.settings-glyph::before { content:"✦"; position:absolute; inset:0; display:grid; place-items:center; font-size:1.1rem; }
.note-glyph::before { content:""; position:absolute; left:3px; top:2px; width:12px; height:14px; border:2px solid currentColor; border-radius:3px; }
.note-glyph::after { content:""; position:absolute; left:6px; top:6px; width:6px; height:2px; background:currentColor; box-shadow:0 4px currentColor; }

.hero-overlap { margin-top: 0; position: relative; }
.app-card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: 18px;
  min-width: 0; overflow: hidden;
}
.app-card-body { padding: 16px; }
.stage-card { display: flex; }
.stage-spine { width: 4px; background: var(--spine, var(--brand-2)); flex: none; }
.card-title-row { display: flex; gap: 12px; justify-content: space-between; align-items: start; }
.card-title-row > * { min-width: 0; }
.card-title-row h2, .card-title-row h3 { margin: 0; }
.card-title-row p { margin: 3px 0 0; color: var(--muted); }
.dashboard-grid { display: grid; gap: 12px; }
.primary-grid { display: grid; gap: 12px; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi {
  padding: 14px; background: white; border: 1px solid var(--hairline); border-radius: 16px; min-width: 0;
}
.kpi strong {
  display: block; margin-top: 3px; font: 800 clamp(1.65rem, 6vw, 2.4rem)/1 var(--display);
  letter-spacing: -.035em; font-variant-numeric: tabular-nums;
}
.kpi small { display: block; margin-top: 7px; color: var(--muted); }
.cycle-card { padding: 17px; }
.cycle-orb {
  width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center;
  background: #f8e2ea; color: var(--brand); font-size: 1.2rem; flex: none;
}
.cycle-status { display: flex; align-items: center; gap: 13px; }
.cycle-status .copy { flex: 1; min-width: 0; }
.cycle-status .copy b { display: block; font-size: 1.05rem; }
.cycle-status .copy small { color: var(--muted); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn-vitrine {
  min-height: 44px; border-radius: 12px; border: 1px solid transparent; padding: 0 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600; cursor: pointer;
}
.btn-primary-v { background: var(--brand); color: white; }
.btn-primary-v:hover { background: var(--brand-2); color: white; }
.btn-dark-v { background: var(--ink); color: white; }
.btn-dark-v:hover { background: var(--brand-2); color: white; }
.btn-ghost-v { background: transparent; border-color: var(--hairline); color: var(--ink); }
.btn-ghost-v:hover { border-color: var(--brand-2); color: var(--brand-2); }
.btn-danger-v { background: #f8e2ea; color: var(--brand); }
.btn-cyan-v { background: var(--cyan); color: var(--ink); }
.btn-orange-v { background: var(--orange); color: var(--ink); }
.btn-block { width: 100%; }
.task-now { padding: 18px; }
.task-now .project { color: var(--brand); }
.task-now h2 { margin: 5px 0 2px; font-size: clamp(1.45rem, 4vw, 2rem); }
.task-now p { color: var(--muted); }
.progress-track { height: 7px; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.progress-track > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.next-preview {
  display: flex; gap: 10px; align-items: center; padding: 12px; margin-top: 12px;
  background: var(--canvas); border-radius: 12px;
}
.next-preview .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.next-preview span:nth-child(2) { flex: 1; min-width: 0; }
.next-preview small { color: var(--muted); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 22px 0 10px; }
.section-title h2 { font-size: 1.25rem; margin: 0; }
.section-title a {
  font: 600 .65rem var(--mono); letter-spacing: .07em; text-transform: uppercase;
  /* Padding + negative margin buys a 44px thumb target without moving anything. */
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; margin: -14px -4px;
}

.capture-card { padding: 17px; scroll-margin-top: 30px; }
.capture-card h2 { margin-bottom: 4px; font-size: 1.3rem; }
.capture-card > p { color: var(--muted); margin-bottom: 13px; }
.capture-input, .form-control {
  width: 100%; border: 1px solid var(--hairline); border-radius: 12px; background: white;
  color: var(--ink); min-height: 46px; padding: 10px 13px;
}
textarea.form-control { min-height: 96px; resize: vertical; }
.form-control:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(140,58,202,.12); }
.form-grid { display: grid; gap: 15px; }
.form-field label, .form-grid label:not(.form-check-label) {
  display: block; margin-bottom: 6px; color: var(--muted); font: 600 .74rem var(--mono);
  text-transform: uppercase; letter-spacing: .06em;
}
.form-field .helptext, .form-grid .helptext { display: block; color: var(--muted); font-size: .82rem; margin-top: 4px; }
.errorlist { margin: 4px 0 0; padding-left: 18px; color: var(--brand); font-size: .85rem; }
.capture-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.capture-actions small { color: var(--muted); flex: 1; }
.ai-pill, .status-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px;
  background: #f1e6fa; color: var(--brand-2); font: 600 .62rem var(--mono);
  letter-spacing: .06em; text-transform: uppercase;
}
.ai-pill.local { background: #fdf0df; color: var(--ink); }
.item-list { display: flex; flex-direction: column; gap: 8px; }
.task-row { display: flex; background: white; border: 1px solid var(--hairline); border-radius: 14px; overflow: hidden; }
.task-row-content { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 12px 14px; }
.task-row-copy { flex: 1; min-width: 0; }
.task-row-copy b { display: block; overflow-wrap: anywhere; }
.task-row-copy small { color: var(--muted); }
.task-check {
  width: 22px; height: 22px; border: 1.5px solid var(--hairline); border-radius: 7px;
  background: white; flex: none;
}
.status-chip { background: var(--canvas); color: var(--muted); white-space: nowrap; }
.status-in_progress { background: #f8e2ea; color: var(--brand); }
.status-blocked { background: #fdf0df; color: #9a4100; }
.status-needs_review { background: #f1e6fa; color: var(--brand-2); }
.status-completed { background: #e4f7fa; color: #126879; }
.urgent-list .task-row-content { padding-block: 11px; }

.filter-chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chips a, .filter-chips button {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 999px; background: rgba(255,255,255,.12); color: white; font-weight: 600;
}
.filter-chips a:active { transform: scale(.96); }
.filter-chips a.active { background: white; color: var(--ink); border-color: white; }
/* The default chips are drawn for the coloured page header; this variant is
   for chips sitting on the light page background. */
.filter-chips-light a, .filter-chips-light button { border-color: var(--hairline); background: white; color: var(--muted); }
.filter-chips-light a:hover { color: var(--ink); }
.filter-chips-light a.active { background: var(--ink); color: white; border-color: var(--ink); }
.list-toolbar { display: flex; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.list-toolbar p { margin: 0; color: var(--muted); }
.task-list-grid { display: grid; gap: 8px; }
.task-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.task-card-actions button, .task-card-actions a {
  min-height: 36px; padding: 0 11px; border-radius: 10px; border: 1px solid var(--hairline);
  background: white; color: var(--ink); display: inline-flex; align-items: center; font-size: .84rem; font-weight: 600;
}
.task-card-actions .start { background: var(--ink); border-color: var(--ink); color: white; }
.empty-state { padding: 36px 20px; text-align: center; }
.empty-state .empty-art {
  width: 96px; height: 96px; border-radius: 28px; margin: 0 auto 18px;
  background: linear-gradient(135deg, #e4f7fa 0 25%, #fef8db 25% 50%, #fdf0df 50% 75%, #f1e6fa 75%);
}
.empty-state h2 { margin-bottom: 5px; }
.empty-state p { color: var(--muted); max-width: 42ch; margin-inline: auto; }

.timeline { position: relative; display: flex; flex-direction: column; gap: 8px; }
.timeline-item { display: grid; grid-template-columns: 66px 1fr; gap: 10px; align-items: start; }
.timeline-time { padding-top: 14px; text-align: right; font: 600 .68rem var(--mono); color: var(--muted); }
.timeline-card { display: flex; min-width: 0; background: white; border: 1px solid var(--hairline); border-radius: 15px; overflow: hidden; }
.timeline-card .body { flex: 1; min-width: 0; padding: 13px 14px; }
.timeline-card h3 { font-family: var(--body); font-size: .98rem; margin: 0; overflow-wrap: anywhere; }
.timeline-card p { margin: 3px 0 0; color: var(--muted); font-size: .87rem; }
.timeline-card.break { background: #fef8db; border-color: #f3df7e; }
.plan-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 16px;
}
.plan-summary div { padding: 12px; border: 1px solid var(--hairline); border-radius: 13px; background: white; }
.plan-summary strong { display: block; font: 800 1.25rem var(--display); }
.plan-summary small { color: var(--muted); font-size: .74rem; }

.focus-page { min-height: 100vh; padding: max(24px, env(safe-area-inset-top)) 20px 120px; background: var(--ink); color: white; }
.focus-inner { width: min(100%, 780px); margin: 0 auto; }
.focus-top { display: flex; justify-content: space-between; align-items: center; }
.focus-top a {
  color: rgba(255,255,255,.7);
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; margin-right: -10px;
}
.focus-timer { margin: clamp(50px, 12vh, 110px) 0 28px; text-align: center; }
.focus-timer .timer-ring {
  width: min(72vw, 300px); aspect-ratio: 1; border-radius: 50%; margin: 0 auto;
  display: grid; place-items: center; background: conic-gradient(var(--brand) var(--progress, 24%), #34283d 0);
  position: relative;
}
.timer-ring::before { content:""; position:absolute; inset:12px; border-radius:50%; background:var(--ink); }
.timer-ring strong { position: relative; font: 800 clamp(3rem, 14vw, 6rem)/1 var(--display); letter-spacing: -.05em; }
.focus-timer h1 { margin: 26px 0 6px; font-size: clamp(1.8rem, 6vw, 3rem); }
.focus-timer p { color: rgba(255,255,255,.58); }
.focus-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.focus-actions .complete { grid-column: 1 / -1; background: var(--brand); color: white; }
.focus-actions button { min-height: 54px; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; background: var(--dark-surface); color: white; font-weight: 600; }

.expense-totals { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.money-value { font: 800 clamp(1.65rem, 6vw, 2.4rem)/1 var(--display); font-variant-numeric: tabular-nums; }
.money-code { font: 600 .66rem var(--mono); color: var(--muted); }
.category-bar { margin-top: 8px; height: 8px; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.category-bar span { display: block; height: 100%; background: var(--cyan); border-radius: inherit; }
.expense-row .amount { font: 600 .88rem var(--mono); text-align: right; white-space: nowrap; }
.expense-row .currency { font-size: .62rem; color: var(--muted); }

.review-hero { padding: 18px; background: white; border: 1px solid var(--hairline); border-radius: 18px; }
.review-score { display: flex; align-items: center; gap: 16px; }
.score-donut {
  width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--brand) var(--score), var(--hairline) 0);
}
.score-donut::before { content:""; width:66px; height:66px; border-radius:50%; background:white; }
.score-donut strong { position:absolute; font:800 1.3rem var(--display); }
.insight-card { padding: 16px; }
.insight-card h3 { font-size: 1.05rem; margin-bottom: 4px; }
.insight-card p { color: var(--muted); margin: 0; }

.settings-sections { display: grid; gap: 12px; }
.settings-card { padding: 18px; }
.settings-card h2 { font-size: 1.2rem; margin-bottom: 14px; }
.settings-card .form-grid { grid-template-columns: 1fr; }
.form-check { display: flex; align-items: center; gap: 9px; }
.form-check input { width: 20px; height: 20px; }
.form-check label { margin: 0 !important; font-family: var(--body) !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--ink) !important; }
.model-picker-field { grid-column: 1 / -1; }
.model-picker-meta { display: grid; gap: 7px; margin-top: 7px; color: var(--muted); }
.model-picker-meta code { overflow-wrap: anywhere; color: var(--ink); }
.text-button {
  width: max-content; max-width: 100%; border: 0; background: transparent;
  color: var(--brand); font-weight: 700; text-align: left; cursor: pointer;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; margin-inline: -4px;
}
.text-button:hover { color: var(--brand-2); }
.text-button:disabled { color: var(--muted); cursor: wait; }
.model-label {
  max-width: 62%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: .7rem;
}

/* Phone first: a full-bleed bottom sheet. The grip stays put and only the
   list scrolls, so the title never slides away under a thumb. */
.quick-add-dialog {
  width: 100%; max-width: 100%; margin: auto 0 0;
  max-height: 88vh; max-height: 88dvh;
  padding: 8px 14px calc(14px + var(--safe-bottom)); border: 0; border-radius: 24px 24px 0 0;
  background: white; color: var(--ink);
  overflow: hidden;
  box-shadow: 0 -20px 54px rgba(23,17,28,.3);
}
.quick-add-dialog::backdrop { background: rgba(23,17,28,.5); backdrop-filter: blur(2px); }
/* display lives on [open] only. Setting it on the element itself overrides the
   browser's `dialog:not([open]) { display: none }` and leaves a closed sheet
   sitting in the page. */
.quick-add-dialog[open] {
  display: flex; flex-direction: column;
  animation: sheet-up .28s cubic-bezier(.22,1,.36,1);
}
.sheet-grip { flex: none; touch-action: none; cursor: grab; }
.sheet-grip:active { cursor: grabbing; }
.sheet-handle { width: 44px; height: 5px; margin: 4px auto 12px; border-radius: 999px; background: var(--hairline); }
.sheet-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet-title h2 { margin: 0; }
.icon-btn {
  width: 42px; height: 42px; border: 1px solid var(--hairline); background: white; border-radius: 12px;
  color: var(--muted); font-size: 1.4rem; cursor: pointer;
}
.quick-add-list {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding-bottom: 2px;
}
.quick-add-list a {
  min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--hairline); border-radius: 15px; color: var(--ink);
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.quick-add-list a:hover { border-color: var(--brand-2); background: var(--canvas); }
.quick-add-list a:active { transform: scale(.985); background: var(--canvas); }
.quick-add-list a.is-featured { border-color: var(--brand-2); background: #faf6fe; }
/* Keyboard hints are noise on a touch screen. */
.quick-add-list kbd { display: none; }
.quick-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; font-weight: 800; }
.quick-icon.cyan { background: #e4f7fa; color: #126879; }
.quick-icon.orange { background: #fdf0df; color: #9a4100; }
.quick-icon.purple { background: #f1e6fa; color: var(--brand-2); }
.quick-icon.magenta { background: #f8e2ea; color: var(--brand); }
.quick-icon.teal { background: #dff5f2; color: #0d7d70; }
.quick-add-list a > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.quick-add-list small { color: var(--muted); }
.quick-add-list kbd { color: var(--muted); background: var(--canvas); border: 1px solid var(--hairline); padding: 3px 6px; border-radius: 6px; }

.toast-stack { position: fixed; z-index: 150; top: 16px; right: 16px; left: 16px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.app-toast {
  width: min(100%, 460px); margin-left: auto; min-height: 48px; padding: 10px 12px 10px 15px;
  border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: var(--ink); color: white;
  box-shadow: 0 16px 36px rgba(23,17,28,.22); display: flex; gap: 10px; align-items: center; pointer-events: auto;
}
.app-toast span { flex: 1; }
.app-toast button { width: 32px; height: 32px; border: 0; border-radius: 9px; background: rgba(255,255,255,.1); color: white; }
.app-toast.error { background: #5c1731; }
.app-toast.success { border-left: 4px solid var(--cyan); }

.confirm-grid { display: grid; gap: 12px; }
.proposal-card { padding: 15px; }
.proposal-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.proposal-head input { width: 21px; height: 21px; }
.proposal-head h3 { flex: 1; margin: 0; font-size: 1rem; }
.proposal-fields { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.proposal-fields + .proposal-fields { margin-top: 10px; }
.proposal-fields .wide { grid-column: 1 / -1; }
.kind-switch { display: inline-flex; gap: 4px; padding: 3px; margin-bottom: 12px; border: 1px solid var(--hairline); border-radius: 11px; background: var(--canvas); }
.kind-switch button {
  min-height: 32px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font-size: .82rem; font-weight: 700; cursor: pointer;
}
.kind-switch button:hover { color: var(--ink); }
.kind-switch button.is-active { background: white; color: var(--ink); box-shadow: 0 1px 3px rgba(23,17,28,.14); }
.proposal-card.is-converted { border-color: var(--brand-2); box-shadow: inset 3px 0 0 var(--brand-2); }
.convert-note { margin-left: 8px; color: var(--brand-2); font-size: .78rem; font-weight: 700; }
.source-quote { padding: 14px; border-radius: 13px; background: var(--canvas); border-left: 4px solid var(--brand-2); color: var(--muted); }

form.is-busy { opacity: .72; }
form.is-busy button[type="submit"] { cursor: progress; }
.inline-check {
  display: inline-flex; align-items: center; gap: 9px; min-height: 44px;
  color: var(--muted); font-size: .86rem; cursor: pointer;
}
.inline-check input { width: 24px; height: 24px; flex: none; accent-color: var(--brand); }
.note-list { display: grid; gap: 10px; }
.note-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px 15px; }
.note-check { display: flex; }
/* The visible box stays 24px; the button itself is a 44px thumb target. */
.note-check button {
  position: relative; width: 44px; height: 44px; margin: -10px 0 -10px -12px; padding: 0;
  flex: none; cursor: pointer; border: 0; background: none; display: grid; place-items: center;
}
.note-check button::before {
  content: ""; width: 24px; height: 24px; border: 2px solid var(--hairline);
  border-radius: 8px; background: white; transition: background .12s ease, border-color .12s ease;
}
.note-check button[aria-checked="true"]::before { border-color: var(--brand); background: var(--brand); }
.note-check button[aria-checked="true"]::after {
  content: "✓"; position: absolute; color: white; font-size: .85rem; font-weight: 800; line-height: 1;
}
.note-check button:active::before { transform: scale(.9); }
.note-body { flex: 1; min-width: 0; }
.note-body p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 7px; }
.note-card.is-done .note-body p { color: var(--muted); text-decoration: line-through; }
.link-btn {
  border: 0; background: none; color: var(--muted); font: inherit; font-size: .8rem; cursor: pointer;
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; margin: -13px -6px;
}
.link-btn:hover { color: var(--ink); text-decoration: underline; }
.link-btn.danger:hover { color: var(--brand); }

.auth-shell {
  min-height: 100vh; min-height: 100dvh; padding: clamp(14px, 3vh, 28px) 20px;
  background: var(--ink); display: flex; align-items: center; justify-content: center;
}
.auth-shell > main {
  width: 100%; margin-block: auto; display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: min(100%, 460px); margin: auto; border-radius: 24px; background: white; overflow: hidden;
  box-shadow: 0 30px 70px rgba(0,0,0,.35);
}
.login-art { height: 145px; display: flex; align-items: stretch; position: relative; }
.login-art i { flex: 1; }
.login-art i:nth-child(1) { background: var(--cyan); }
.login-art i:nth-child(2) { background: var(--yellow); }
.login-art i:nth-child(3) { background: var(--orange); }
.login-art i:nth-child(4) { background: var(--brand-2); }
.login-art i:nth-child(5) { background: var(--brand); }
.login-art::after { content:"V"; position:absolute; inset:0; display:grid; place-items:center; color:white; text-shadow:0 3px 18px rgba(0,0,0,.3); font:800 4rem var(--display); }
.login-body { padding: 24px; }
.login-body h1 { font-size: 2rem; margin-bottom: 4px; }
.login-body > p { color: var(--muted); }
.login-body .form-row { margin-top: 14px; }
.login-body label { display:block; margin-bottom:6px; color:var(--muted); font:600 .66rem var(--mono); text-transform:uppercase; letter-spacing:.07em; }
.login-body input { width:100%; min-height:50px; border:1px solid var(--hairline); border-radius:12px; padding:0 13px; }
.offline-page { min-height:100vh; display:grid; place-items:center; padding:20px; text-align:center; background:var(--ink); color:white; }
.offline-page .empty-art { margin-inline:auto; }
.offline-page p { color:rgba(255,255,255,.6); }

.skeleton { position: relative; overflow: hidden; background: #eeeaf1; border-radius: 10px; color: transparent; }
.skeleton::after {
  content:""; position:absolute; inset:0; transform:translateX(-100%);
  background:linear-gradient(90deg,transparent,rgba(255,255,255,.65),transparent); animation:shimmer 1.3s infinite;
}

@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes blip { 50% { opacity: .3; } }
@keyframes shimmer { to { transform: translateX(100%); } }

@media (min-width: 600px) {
  body { font-size: 16px; }
  .primary-grid { grid-template-columns: 1.15fr .85fr; align-items: start; }
  .task-list-grid, .confirm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .expense-totals { grid-template-columns: repeat(4, 1fr); }
  .form-grid.two-columns, .settings-card .form-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .tablet-rail { display: flex; }
  .app-shell { margin-left: var(--rail); }
  .mobile-tabbar { display: none; }
  .page-wrap { padding: 24px 28px 50px; }
  .page-header { padding: 28px 28px 50px; }
  /* Pointer sizes get a centred card instead of a sheet. */
  .quick-add-dialog {
    width: min(calc(100% - 40px), 470px); margin: auto; border-radius: 24px;
    padding: 18px 20px 20px; max-height: min(86vh, 700px); box-shadow: 0 30px 70px rgba(23,17,28,.3);
  }
  .quick-add-dialog[open] { animation: sheet-pop .2s ease-out; }
  .quick-add-dialog .sheet-handle { display: none; }
  .quick-add-dialog .sheet-grip { touch-action: auto; cursor: default; }
  .quick-add-list kbd { display: inline-block; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); align-items: start; }
  .dashboard-main { min-width: 0; }
  .dashboard-main .primary-grid { grid-template-columns: 1fr; }
  .dashboard-side { min-width: 0; position: sticky; top: 20px; }
  .timeline-item { grid-template-columns: 90px 1fr; }
  .plan-page-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .6fr); gap: 18px; align-items: start; }
  .plan-page-grid aside { position: sticky; top: 20px; }
  .focus-actions { grid-template-columns: repeat(3, 1fr); }
  .focus-actions .complete { grid-column: auto; }
}

@media (min-width: 1024px) {
  .tablet-rail { display: none; }
  .desktop-sidebar { display: flex; }
  .app-shell { margin-left: var(--sidebar); }
  .page-wrap { padding-inline: 32px; }
  .page-header { padding-inline: 32px; }
  .dashboard-main .primary-grid { grid-template-columns: 1.15fr .85fr; }
  .task-list-grid { grid-template-columns: repeat(2, minmax(320px, 1fr)); }
  .settings-sections { grid-template-columns: 1.2fr .8fr; align-items: start; }
  .settings-sections .sticky { position: sticky; top: 20px; }
  body:has(.offline-banner:not([hidden])) .desktop-sidebar { top: 28px; }
}

@media (min-width: 1280px) {
  .task-list-grid { grid-template-columns: repeat(3, minmax(300px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
