/* Hogar — design tokens and components.
   Direction: Rams-like restraint; powdered blush/mint accents with a function
   (blush = pending/urgent, mint = done/active); Plus Jakarta Sans for UI, Fragment
   Mono for numbers and labels, Gambarino for display titles. */
:root {
  --ink: #0F2626;
  --ink-2: #3F504F;
  --ink-3: #5E6E6D;
  --paper: #FBF7F6;
  --surface: #FFFFFF;
  --surface-2: #F3EEED;
  --line: #ECE3E1;
  --line-strong: #0F2626;
  --dash: #C9BDBA;
  --blush: #F3E4E2;
  --mint: #DBEFE1;
  --pos: #1F7A4D;
  --neg: #B3372B;
  --on-ink: #FBF7F6;
  --ink-panel: #0F2626;
  --ink-panel-fg: #FBF7F6;
  --ink-panel-muted: rgba(251, 247, 246, .68);
  --ink-panel-line: rgba(251, 247, 246, .14);
  --nav-bg: #0F2626;
  --nav-fg: #FBF7F6;
  --nav-active-bg: #DBEFE1;
  --nav-active-fg: #0F2626;
  --unpaid: #E5DAD7;
  --shadow: 0 1px 2px rgba(15,38,38,.04), 0 12px 32px -16px rgba(15,38,38,.16);
  --font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Fragment Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-serif: 'Gambarino', Georgia, serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #E9EFED;
  --ink-2: #B4C2C0;
  --ink-3: #8D9C9A;
  --paper: #0D1716;
  --surface: #13201F;
  --surface-2: #1A2928;
  --line: #233331;
  --line-strong: #E9EFED;
  --dash: #3A4B49;
  --blush: #3A2D2C;
  --mint: #22382C;
  --pos: #74C99A;
  --neg: #F0907F;
  --on-ink: #0D1716;
  --ink-panel: #1C2E2D;
  --ink-panel-fg: #E9EFED;
  --ink-panel-muted: rgba(233, 239, 237, .66);
  --ink-panel-line: rgba(233, 239, 237, .12);
  --nav-bg: #E9EFED;
  --nav-fg: #0D1716;
  --nav-active-bg: #22382C;
  --nav-active-fg: #E9EFED;
  --unpaid: #2C3B3A;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px -16px rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-ui); font-size: 15px; line-height: 1.5; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .35; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--pos); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 400; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--ink-3); }
.hint { font-size: 13px; color: var(--ink-3); margin: 2px 0 0; }
.serif-title { font-family: var(--font-serif); font-weight: 400; font-size: 34px; line-height: 1.05; margin: 0; }
.display { font-family: var(--font-serif); font-weight: 400; font-size: clamp(40px, 6vw, 64px); line-height: 1.02; margin: 10px 0 0; letter-spacing: -.01em; }
.display-sm { font-family: var(--font-serif); font-weight: 400; font-size: clamp(34px, 5vw, 48px); line-height: 1; margin: 0 6px; }
.lead { margin: 12px 0 0; font-size: 18px; color: var(--ink-2); max-width: 760px; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 40px; }
.app { padding: 24px 0 200px; min-height: 100vh; }
.sync { font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); min-height: 16px; padding: 8px 4px 0; }

/* Nav */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--nav-bg); color: var(--nav-fg); border-radius: 16px; padding: 8px 8px 8px 20px; }
.nav-left { display: flex; align-items: center; gap: 28px; }
.wordmark { font-family: var(--font-serif); font-size: 28px; line-height: 1; text-decoration: none; color: inherit; }
.nav-links { display: flex; gap: 4px; }
.nav-link { text-decoration: none; padding: 8px 14px; border-radius: 10px; min-height: 40px; display: inline-flex; align-items: center; }
.nav-link[aria-current="page"] { background: var(--nav-active-bg); color: var(--nav-active-fg); font-weight: 500; }
.nav-right { display: flex; align-items: center; gap: 6px; }
.nav-btn { border: 0; background: transparent; border-radius: 10px; min-height: 40px; min-width: 40px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; }
.nav-btn:hover { background: rgba(127,127,127,.18); }
.seg { display: inline-flex; border-radius: 10px; padding: 3px; gap: 2px; }
.seg-nav { border: 1px solid rgba(127,127,127,.35); font-family: var(--font-mono); font-size: 12px; }
.seg-nav button { border: 0; background: transparent; border-radius: 7px; padding: 0 10px; min-height: 32px; }
.seg-nav button[aria-pressed="true"] { background: var(--nav-fg); color: var(--nav-bg); }

/* Controls */
.seg-box { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; }
.seg-box button { border: 0; background: transparent; color: var(--ink-2); border-radius: 9px; padding: 0 14px; min-height: 40px; }
.seg-box button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.seg-soft button[aria-pressed="true"] { background: var(--blush); color: var(--ink); font-weight: 500; }
.btn { border: 0; border-radius: 12px; padding: 0 20px; min-height: 48px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-weight: 400; }
.btn-dashed { background: transparent; border: 1px dashed var(--dash); color: var(--ink); font-weight: 400; }
.btn-text { background: transparent; border: 0; color: var(--ink-2); padding: 10px 0; min-height: 44px; }
.btn-text:hover { color: var(--ink); }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 10px; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-btn-box { width: 44px; height: 44px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; }
.field { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 0 14px; min-height: 46px; }
.field:focus { outline: none; border-color: var(--ink); }

.pill { border-radius: 99px; padding: 0 14px; min-height: 40px; font-size: 13px; white-space: nowrap; border: 1px solid transparent; }
.pill-outline { border-color: var(--dash); background: var(--surface); color: var(--ink); }
.pill-outline:hover { border-color: var(--ink); }
.pill-done { border-color: var(--mint); background: var(--mint); color: var(--ink); }
.pill-ink { background: var(--ink); color: var(--on-ink); }
.pill-light { background: var(--ink-panel-fg); color: var(--ink-panel); }
.pill-soft { background: var(--surface-2); color: var(--ink); }
.pill-lg { min-height: 48px; padding: 0 18px; font-size: 14px; font-weight: 500; }

.badge { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; border-radius: 6px; padding: 3px 8px; white-space: nowrap; display: inline-block; vertical-align: middle; }
.badge-mint { background: var(--mint); color: var(--ink); }
.badge-blush { background: var(--blush); color: var(--ink); }
.badge-soft { background: var(--surface-2); color: var(--ink-2); }
.badge-light { background: var(--ink-panel-line); color: var(--ink-panel-fg); }
.chip { display: inline-flex; align-items: center; border-radius: 8px; padding: 4px 10px; font-size: 13px; background: var(--surface-2); }
.chip-mint { background: var(--mint); }
.tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; }

.money-field { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 0 12px; min-height: 48px; min-width: 150px; }
.money-field span { font-family: var(--font-mono); color: var(--ink-3); }
.money-field input { border: 0; outline: none; background: transparent; width: 100%; text-align: right; font-family: var(--font-mono); font-size: 17px; min-width: 0; }
.money-field:focus-within { border-color: var(--ink); }
.money-field.is-estimated { border-style: dashed; border-color: var(--dash); background: var(--paper); }
.money-field.on-dark { background: transparent; border-color: var(--ink-panel-line); }
.money-field.on-dark.is-estimated { border-color: rgba(251,247,246,.38); }
:root[data-theme="dark"] .money-field.on-dark.is-estimated { border-color: rgba(233,239,237,.32); }
.money-field.on-dark span { color: var(--ink-panel-muted); }
.money-field.on-dark input { color: var(--ink-panel-fg); }
.money-field.on-dark:focus-within { border-color: var(--ink-panel-fg); }

/* Ledger: entradas / salidas / disponible */
.ledger { margin: 12px 0 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 16px; }
.ledger > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ledger dt { font-family: var(--font-ui); }
.ledger dd { margin: 0; text-align: right; }
.ledger .ledger-total { border-bottom: 0; border-top: 1px solid var(--line-strong); margin-top: -1px; padding-top: 12px; }
.ledger .ledger-total dt { font-weight: 500; }
.ledger .ledger-total dd { font-size: 28px; letter-spacing: -.02em; }

/* Today */
.today-head { margin-top: 48px; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 48px; margin-top: 40px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-lg { display: flex; flex-direction: column; gap: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.plain-list { list-style: none; margin: 8px 0 0; padding: 0; }
.week-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; min-height: 56px; border-bottom: 1px solid var(--line); }
.week-row:has(> :nth-child(2):last-child) { grid-template-columns: minmax(0, 1fr) auto; }

.urgent { background: var(--ink-panel); color: var(--ink-panel-fg); border-radius: 24px; padding: 8px; display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 8px; }
.urgent-date .badge { align-self: flex-start; }
.urgent-date { padding: 20px 8px 20px 18px; display: flex; flex-direction: column; }
.urgent-day { font-family: var(--font-serif); font-size: 104px; line-height: .85; margin-top: 18px; }
.urgent-when { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; margin-top: 10px; }
.urgent-count { margin: auto 0 0; padding-top: 18px; font-size: 14px; font-weight: 400; color: var(--ink-panel-muted); }
.urgent-count .num { color: var(--ink-panel-fg); display: block; font-size: 18px; }
.urgent-list { list-style: none; margin: 0; padding: 0; border-radius: 18px; background: rgba(255,255,255,.04); }
.urgent-item { padding: 14px 18px; border-bottom: 1px solid var(--ink-panel-line); }
.urgent-item:last-child { border-bottom: 0; }
.urgent-name { font-size: 17px; font-weight: 500; }
.urgent-meta { font-size: 13px; color: var(--ink-panel-muted); }
.urgent-card { display: grid; grid-template-columns: minmax(170px, 1fr) 150px auto; gap: 10px; align-items: center; }
.urgent-card .money-field { min-width: 0; }
.urgent-more { padding: 4px 18px; }
.urgent-more .btn-text { color: var(--ink-panel-muted); }
.urgent-more .btn-text:hover { color: var(--ink-panel-fg); }
.urgent-bill { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; }
.urgent-bill .urgent-name { font-size: 15px; }
.urgent .pill-light:hover { opacity: .9; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px 22px; }
.panel-head { display: flex; justify-content: space-between; gap: 16px; }
.panel-title { margin: 0; font-size: 18px; font-weight: 500; }
.panel-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.confirm-row { display: grid; grid-template-columns: minmax(0, 1fr) 180px auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--surface-2); }

/* Month */
.month-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 40px; flex-wrap: wrap; }
.month-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.month-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.template-note { margin: 12px 0 0; color: var(--ink-2); max-width: 640px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 64px; align-items: end; margin-top: 40px; }
.hero-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: clamp(44px, 7vw, 80px); line-height: 1; letter-spacing: -.04em; margin-top: 14px; }
.hero-text { margin: 16px 0 0; font-size: 18px; color: var(--ink-2); }
.hero-text .num { color: var(--ink); }

.block { margin-top: 64px; }
.block-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line-strong); padding-bottom: 14px; gap: 12px; }
.block-title { display: flex; align-items: center; gap: 14px; }
.block-total { font-size: 22px; }
.sign-dot { width: 36px; height: 36px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 18px; flex: none; }
.sign-in { background: var(--mint); }
.sign-out { background: var(--blush); }
.block-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

.dist { margin-top: 24px; }
.dist-bar { display: flex; gap: 3px; height: 26px; }
.dist-seg { min-width: 6px; background: var(--unpaid); border-radius: 6px; overflow: hidden; display: block; }
.dist-seg > span { display: block; height: 100%; background: var(--ink); }
.dist-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.dist-key { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; }
.key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.key-paid { background: var(--ink); }
.key-unpaid { background: var(--unpaid); margin-left: 10px; }

.track { height: 10px; background: var(--unpaid); border-radius: 99px; overflow: hidden; display: block; }
.track > span { display: block; height: 100%; border-radius: 99px; background: var(--ink); }
.track-thin { height: 6px; }

.groups { margin-top: 8px; }
.group { border-bottom: 1px solid var(--line); scroll-margin-top: 24px; }
.group-head { width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr) 180px 130px 130px; gap: 16px; align-items: center; min-height: 64px; border: 0; background: transparent; text-align: left; padding: 0; }
.group-chevron { color: var(--ink-3); display: inline-flex; transition: transform .15s; }
.group-head[aria-expanded="true"] .group-chevron { transform: rotate(90deg); }
.group-name { font-weight: 500; font-size: 17px; }
.group-status { font-size: 13px; color: var(--ink-3); text-align: right; }
.group-total { text-align: right; font-size: 16px; }

.lines { list-style: none; margin: 0 0 10px; padding: 0; }
.block > .lines { margin-top: 4px; }
.group .lines { padding-left: 44px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 110px 150px 200px; gap: 12px; align-items: center; min-height: 54px; border-top: 1px solid var(--surface-2); }
.block > .lines .line { border-top: 0; border-bottom: 1px solid var(--line); }
.line.is-paid .cell { color: var(--ink-3); }
.line.is-computed { color: var(--ink-3); font-size: 14px; }
.line-add { padding: 2px 0; }
.name-wrap { display: flex; align-items: center; gap: 4px; min-width: 0; }
.name-wrap.is-child { padding-left: 28px; }
.expand { width: 28px; height: 28px; border: 0; background: transparent; color: var(--ink-3); border-radius: 6px; transition: transform .15s; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.expand[aria-expanded="true"] { transform: rotate(90deg); }
.expand-spacer { width: 0; flex: none; }
.name-wrap.is-child .expand-spacer, .is-computed .expand-spacer { width: 0; }
.amount-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.amount-wrap .cell-num { width: 132px; flex: none; }
.sign { font-family: var(--font-mono); }
.line-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.row-actions { display: inline-flex; gap: 0; opacity: .5; }
.line:hover .row-actions, .row-actions:focus-within { opacity: 1; }
.cell { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 10px 8px; min-height: 44px; min-width: 0; }
.cell:hover { border-color: var(--line); background: var(--surface); }
.cell:focus { border-color: var(--ink); background: var(--surface); outline: none; }
.cell-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.cell-num.is-estimated { border: 1px dashed var(--dash); }
.cell-select { appearance: none; -webkit-appearance: none; color: var(--ink-3); font-size: 13px; cursor: pointer; }
.readonly-amount { display: block; padding: 10px 8px; text-align: right; }

/* Activity */
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-top: 48px; border-bottom: 1px solid var(--line-strong); padding-bottom: 16px; flex-wrap: wrap; }
.page-title { font-family: var(--font-serif); font-weight: 400; font-size: clamp(44px, 6vw, 64px); line-height: 1; margin: 8px 0 0; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-top: 20px; }
.filter-group { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.card-list { list-style: none; margin: 16px 0 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.day-group { margin-top: 36px; }
.day-head { display: flex; justify-content: space-between; padding-bottom: 8px; }
.tx-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto 120px 44px; gap: 14px; align-items: center; padding: 10px 8px 10px 14px; border-bottom: 1px solid var(--surface-2); }
.tx-row:last-child { border-bottom: 0; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; background: var(--surface-2); }
.avatar-r { background: var(--blush); }
.avatar-b { background: var(--mint); }
.tx-desc { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { font-size: 13px; color: var(--ink-3); }
.empty { padding: 20px 16px; color: var(--ink-3); }

/* Goals */
.goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 32px; }
.goal { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.goal-icon { font-size: 22px; }
.goal-name { font-weight: 500; font-size: 17px; }

/* Floating chat */
.chat-dock { position: fixed; left: 0; right: 0; bottom: 24px; display: flex; justify-content: center; padding: 0 24px; pointer-events: none; z-index: 30; }
.chat-inner { width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 8px; pointer-events: auto; }
.chat-reply { align-self: flex-start; max-width: 100%; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow); }
.chat-form { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 7px 7px 7px 18px; box-shadow: 0 16px 40px -16px rgba(15,38,38,.35); }
.chat-form:focus-within { border-color: var(--ink); }
.chat-form input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; min-height: 44px; }
.chat-form input::placeholder { color: var(--ink-3); }
.chat-who { background: var(--surface-2); border: 0; }
.chat-who button { min-height: 34px; padding: 0 10px; font-family: var(--font-mono); font-size: 12px; }
.chat-who button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15,38,38,.12); }
.chat-send { width: 44px; height: 44px; border: 0; background: var(--ink); color: var(--on-ink); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* Dialog */
dialog { border: 0; padding: 0; border-radius: 20px; background: var(--paper); color: var(--ink); width: min(480px, calc(100vw - 32px)); box-shadow: 0 24px 64px -24px rgba(0,0,0,.4); }
dialog::backdrop { background: rgba(15,38,38,.35); }
.dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.input { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 0 14px; min-height: 48px; font-size: 16px; width: 100%; }
.input:focus { outline: none; border-color: var(--ink); }
.amount-field { display: flex; align-items: baseline; gap: 4px; border-bottom: 2px solid var(--ink); padding-bottom: 4px; }
.amount-field span { font-family: var(--font-mono); font-size: 32px; color: var(--ink-3); }
.amount-input { border: 0; outline: none; background: transparent; font-family: var(--font-mono); font-size: 44px; letter-spacing: -.03em; width: 100%; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 0 14px; min-height: 44px; }
.chip-btn[aria-pressed="true"] { border-color: var(--ink); background: var(--mint); font-weight: 500; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--on-ink); padding: 12px 18px; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.tabbar { display: none; }

@media (max-width: 900px) {
  .today-grid, .hero { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .app { padding: 12px 0 200px; }
  .nav { padding: 6px 6px 6px 14px; }
  .nav-links { display: none; }
  .today-head { margin-top: 24px; }
  .lead { font-size: 16px; }
  .urgent { grid-template-columns: 1fr; }
  .urgent-date { padding: 16px 16px 4px; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
  .urgent-day { font-size: 64px; margin-top: 0; order: -1; }
  .urgent-count { margin: 0; padding-top: 0; width: 100%; }
  .urgent-count .num { display: inline; }
  .urgent-bill { grid-template-columns: minmax(0, 1fr) auto; }
  .urgent-bill .num { grid-column: 1; grid-row: 2; font-size: 13px; }
  .urgent-bill .pill { grid-column: 2; grid-row: 1 / span 2; }
  .urgent-card { grid-template-columns: minmax(0, 1fr) auto; }
  .urgent-card > div:first-child { grid-column: 1 / -1; }
  .confirm-row { grid-template-columns: 1fr auto; }
  .confirm-row > div:first-child { grid-column: 1 / -1; }
  .month-head { margin-top: 24px; }
  .month-tools { width: 100%; }
  .month-tools .field { flex: 1; }
  .block { margin-top: 48px; }
  .serif-title { font-size: 28px; }
  .group-head { grid-template-columns: 22px minmax(0, 1fr) auto; row-gap: 4px; padding: 10px 0; }
  .group-head .track { grid-column: 2 / -1; grid-row: 2; }
  .group-status { display: none; }
  .group .lines { padding-left: 0; }
  .line { grid-template-columns: minmax(0, 1fr) 110px; row-gap: 0; padding: 4px 0; }
  .line .type-cell { display: none; }
  .line-actions { grid-column: 1 / -1; justify-content: flex-start; padding-bottom: 6px; }
  .dist-key { margin-left: 0; }
  .tx-row { grid-template-columns: 40px minmax(0, 1fr) auto 40px; }
  .tx-row .tx-cat, .tx-row .tx-source { display: none; }
  .filters .field { width: 100%; }
  .tabbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); z-index: 20; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; text-decoration: none; color: var(--ink-3); font-size: 12px; }
  .tabbar a[aria-current="page"] { color: var(--ink); font-weight: 500; }
  .chat-dock { bottom: calc(74px + env(safe-area-inset-bottom)); padding: 0 12px; }
  .chat-form { padding-left: 14px; }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 92vh; }
  .form-row { grid-template-columns: 1fr; }
}

/* ── Sign in + account ─────────────────────────────────────── */
.login { min-height: 100vh; display: flex; flex-direction: column; padding: 20px 16px 40px; max-width: 440px; margin: 0 auto; }
.login-top { display: flex; justify-content: space-between; align-items: center; }
.login-top .seg-nav button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.login-card { margin: auto 0; padding: 48px 0; display: flex; flex-direction: column; }
.login-title { font-family: var(--font-serif); font-weight: 400; font-size: clamp(40px, 9vw, 56px); line-height: 1; margin: 0; letter-spacing: -.01em; }
.login-lead { color: var(--ink-2); font-size: 17px; margin: 16px 0 32px; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form .btn { margin-top: 8px; }
.login-code { font-family: var(--font-mono); font-size: 28px; letter-spacing: .35em; min-height: 64px; text-align: center; }
.login-error { color: var(--neg); margin: 4px 0 0; font-size: 14px; }
.login-note { color: var(--pos); margin: 4px 0 0; font-size: 14px; }
.login-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.account-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 24px; margin-top: 32px; align-items: start; }
.account .login-note, .account .login-error { margin-top: 16px; }
.account-form { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.inline-form { display: flex; gap: 8px; }
.inline-form .field { flex: 1; min-width: 0; }
.hint { font-size: 13px; margin: 2px 0 0; }
.people { list-style: none; margin: 8px 0 0; padding: 0; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.person > div { flex: 1; min-width: 0; }
.person-email { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.person .badge { background: var(--blush); color: var(--ink); }
@media (max-width: 760px) {
  .account-grid { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
