:root {
  color-scheme: light;
  --ink: #151827;
  --ink-soft: #34384b;
  --muted: #73778a;
  --muted-2: #9ca0b2;
  --paper: #f5f6fb;
  --surface: #ffffff;
  --surface-soft: #f0f1f7;
  --line: #e4e6ef;
  --line-strong: #b7bac8;
  --accent: #ff6b57;
  --accent-dark: #b9343f;
  --dark: #171b2d;
  --warning: #a65f00;
  --warning-soft: #fff5df;
  --info: #096da8;
  --info-soft: #e7f5ff;
  --danger: #a53a39;
  --success: #277a72;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-dialog: 0 28px 90px rgba(23, 27, 45, .22);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { touch-action: manipulation; }
html { background: var(--paper); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid #5b61ff;
  outline-offset: 3px;
}

.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.skip-link { position: fixed; top: -70px; left: 16px; z-index: 200; padding: 12px 16px; border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 700; }
.skip-link:focus { top: 16px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 214px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; z-index: 20; height: 100vh; padding: 30px 16px 22px; background: var(--dark); color: #f8faf7; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 46px; color: inherit; text-decoration: none; font-size: 22px; font-weight: 790; letter-spacing: -.025em; }
.brand img { border-radius: 10px; }
.main-nav { display: grid; gap: 8px; }
.nav-item { min-height: 50px; display: flex; align-items: center; gap: 13px; width: 100%; padding: 0 14px; border: 0; border-radius: 12px; background: transparent; color: #eef1ed; font-size: 16px; text-align: left; cursor: pointer; position: relative; }
.nav-item .ph { font-size: 23px; color: #dce1dc; }
.nav-item:hover { background: #242942; }
.nav-item.active { background: #2b3049; color: #fff; font-weight: 720; }
.nav-item.active::before { content: ""; position: absolute; inset: 9px auto 9px -4px; width: 4px; border-radius: 99px; background: var(--accent); }
.nav-item.active .ph { color: var(--accent); }
.sidebar-settings { margin-top: auto; }
.mobile-settings { display: none; }
body:not(.is-authenticated) .app-shell { grid-template-columns: 1fr; }
body:not(.is-authenticated) .sidebar { display: none; }

.main { min-width: 0; }
.app-content { min-height: 100vh; padding: 38px clamp(28px, 4vw, 58px) 70px; }
.demo-banner { max-width: 1240px; min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 auto 24px; padding: 10px 12px 10px 16px; border: 1px solid #d9d8ff; border-radius: 14px; background: #f0f0ff; }
.demo-banner > div { display: flex; align-items: center; gap: 12px; }
.demo-banner > div > .ph { font-size: 24px; color: var(--accent-dark); }
.demo-banner span { display: grid; gap: 2px; }
.demo-banner small { color: var(--muted); }
.page-header { min-height: 94px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin: 0 auto 28px; max-width: 1240px; }
.page-header-leading { min-width: 0; display: grid; gap: 10px; }
.back-button { width: max-content; min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 0 9px 0 4px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 760; cursor: pointer; }
.back-button:hover { background: var(--surface-soft); color: var(--ink); }
.back-button .ph { font-size: 18px; }
.eyebrow, .auth-kicker { margin: 0 0 7px; color: var(--muted); font-size: 11px; line-height: 1.2; letter-spacing: .16em; font-weight: 760; }
.page-header h1 { margin: 0; font-size: clamp(30px, 3vw, 40px); line-height: 1.05; letter-spacing: -.045em; }
.page-header h1:focus { outline: none; }
.page-subtitle { margin: 8px 0 0; color: var(--muted); font-size: 15px; }
.header-actions { display: flex; gap: 10px; align-items: center; }
.primary-button, .secondary-button, .quiet-button, .text-button, .icon-control, .field-icon { border: 0; cursor: pointer; }
.primary-button, .secondary-button { min-height: 48px; border-radius: 12px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; font-weight: 750; }
.primary-button { background: var(--accent); color: var(--ink); }
.primary-button:hover { background: #f45b4b; }
.primary-button:disabled,
.primary-button:disabled:hover {
  border: 1px solid var(--line);
  background: #e7e9e2;
  color: #6e756f;
  cursor: not-allowed;
}
.secondary-button { border: 1px solid var(--line); background: var(--surface); }
.secondary-button:hover { border-color: var(--line-strong); background: #fbfbf8; }
.full-button { width: 100%; }
.quick-add { position: relative; }
.quick-add-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 240px; padding: 8px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 18px 50px rgba(12, 17, 13, .14); }
.quick-add-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.quick-add-menu button:hover { background: var(--surface-soft); }
.quick-add-menu .ph { font-size: 24px; }
.quick-add-menu span { display: grid; gap: 2px; }
.quick-add-menu small { color: var(--muted); }

.view-root { max-width: 1240px; margin: 0 auto; }
.today-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(290px, .9fr); gap: 28px; align-items: start; }
.today-primary { min-width: 0; }
.lifecycle-guide { position: relative; display: grid; grid-template-columns: minmax(190px, .75fr) minmax(300px, 1.25fr); align-items: center; gap: 18px; margin-bottom: 16px; padding: 16px 58px 16px 18px; border: 1px solid #ddd9ff; border-radius: 16px; background: #f4f2ff; }
.lifecycle-guide-copy h2 { margin: 0; font-size: 17px; }
.lifecycle-guide-copy > p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.lifecycle-guide-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin: 0; padding: 0; list-style: none; }
.lifecycle-guide-steps li { min-width: 0; min-height: 54px; display: flex; align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.78); }
.lifecycle-guide-steps .ph { flex: 0 0 auto; font-size: 20px; }
.lifecycle-guide-steps .pending .ph { color: var(--warning); }
.lifecycle-guide-steps .estimated .ph { color: var(--info); }
.lifecycle-guide-steps .exact .ph { color: var(--success); }
.lifecycle-guide-steps span { min-width: 0; display: grid; gap: 2px; }
.lifecycle-guide-steps strong, .lifecycle-guide-steps small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lifecycle-guide-steps strong { font-size: 11px; }
.lifecycle-guide-steps small { color: var(--muted); font-size: 9px; }
.lifecycle-guide-dismiss { position: absolute; top: 8px; right: 8px; }
.attention-panel { margin-bottom: 16px; overflow: hidden; border: 1px solid #ead9ba; border-radius: 16px; background: #fffdf8; }
.attention-panel > header { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 17px; border-bottom: 1px solid #eee2cb; }
.attention-panel > header h2 { margin: 0; font-size: 17px; }
.attention-panel > header > span { min-width: 28px; height: 28px; display: grid; place-items: center; border-radius: 999px; background: var(--warning-soft); color: #764600; font-size: 12px; font-weight: 780; }
.attention-list { display: grid; }
.attention-item { min-height: 66px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 10px 13px; border-top: 1px solid #eee7d9; }
.attention-item:first-child { border-top: 0; }
.attention-item > .ph { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-size: 20px; }
.attention-item.overdue > .ph { background: #fff0ed; color: var(--danger); }
.attention-item.pending > .ph { background: var(--warning-soft); color: var(--warning); }
.attention-item.anomaly > .ph { background: var(--info-soft); color: var(--info); }
.attention-item > div { min-width: 0; }
.attention-item strong, .attention-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attention-item strong { font-size: 13px; }
.attention-item small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.outlook-hero { min-height: 168px; display: grid; grid-template-columns: .95fr 1px 1.15fr; align-items: center; gap: 34px; padding: 30px 36px; border-radius: 18px; background: var(--dark); color: #fff; }
.outlook-label { display: flex; align-items: center; gap: 7px; margin: 0 0 12px; color: #bfc6bf; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.outlook-total { font-size: clamp(31px, 3.2vw, 43px); line-height: 1; letter-spacing: -.04em; }
.outlook-total.has-range { font-size: clamp(28px, 2.75vw, 38px); }
.outlook-total.multi-currency { display: block; max-width: 420px; font-size: clamp(24px, 2.4vw, 32px); line-height: 1.22; }
.outlook-note { display: block; margin-top: 10px; color: #aeb6af; font-size: 14px; }
.hero-divider { height: 90px; background: #3a423b; }
.hero-insight { display: grid; grid-template-columns: 54px 1fr; gap: 18px; align-items: center; }
.hero-insight-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: #202820; color: var(--accent); font-size: 28px; }
.hero-insight strong { display: block; font-size: 18px; line-height: 1.25; }
.hero-insight p { margin: 6px 0 0; color: #bfc6bf; font-size: 14px; line-height: 1.5; }

.agenda { margin-top: 24px; }
.agenda-group + .agenda-group { margin-top: 5px; }
.agenda-group-title { margin: 0; padding: 10px 6px 7px; font-size: 15px; }
.payment-row { min-height: 91px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(135px, auto) auto; align-items: center; gap: 14px; padding: 16px 6px; border-bottom: 1px solid var(--line); }
.payment-main { min-width: 0; display: flex; align-items: center; gap: 16px; }
.payment-icon { flex: 0 0 auto; width: 50px; height: 50px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); font-size: 25px; }
.payment-icon.bill { color: var(--info); background: var(--info-soft); border-color: #d5eafa; }
.payment-title { min-width: 0; }
.payment-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.payment-title small { display: block; margin-top: 5px; color: var(--muted); font-size: 13px; }
.type-text { color: var(--muted); }
.amount-cell { text-align: right; }
.amount-cell strong { display: block; font-size: 16px; }
.amount-cell small { display: block; margin-top: 5px; color: var(--muted); }
.amount-cell.pending strong { color: var(--warning); }
.amount-cell.estimated strong { color: var(--info); }
.lifecycle-badge { display: inline-flex; align-items: center; margin-left: 7px; padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 760; letter-spacing: .02em; }
.lifecycle-badge.pending { color: #835000; background: var(--warning-soft); }
.lifecycle-badge.estimated { color: #075f95; background: var(--info-soft); }
.lifecycle-badge.exact { color: var(--success); background: #eaf5e9; }
.row-actions { display: flex; align-items: center; gap: 5px; }
.row-action { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 690; font-size: 12px; cursor: pointer; }
.row-action.primary-inline { border-color: var(--accent); background: var(--accent); }
.row-action:hover { border-color: var(--line-strong); }
.overflow { position: relative; }
.icon-control { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 10px; background: transparent; font-size: 21px; }
.icon-control:hover { background: var(--surface-soft); }
.overflow-menu { position: absolute; right: 0; top: calc(100% + 5px); z-index: 30; min-width: 150px; padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: 0 14px 34px rgba(12, 17, 13, .14); }
.overflow-menu button { width: 100%; min-height: 44px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.overflow-menu button:hover { background: var(--surface-soft); }
.overflow-menu .danger { color: var(--danger); }
.payment-row.is-paid { opacity: .55; }
.payment-row.is-paid .payment-title strong { text-decoration: line-through; }
.payment-row.is-overdue { border-left: 3px solid var(--danger); padding-left: 12px; background: #fff9f8; }
.amount-cell.overdue small { color: var(--danger); font-weight: 720; }

.side-panel { border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.74); overflow: hidden; }
.side-column { min-width: 0; }
.mini-calendar { padding: 24px; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.side-head h2 { margin: 0; font-size: 17px; }
.text-button { display: inline-flex; align-items: center; gap: 6px; padding: 7px; border-radius: 8px; background: transparent; color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.text-button:hover { background: var(--surface-soft); }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 24px; }
.week-day { min-width: 0; display: grid; justify-items: center; gap: 8px; padding: 4px 0; color: var(--muted); font-size: 11px; }
.week-day b { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); font-size: 14px; }
.week-day.today b { background: var(--dark); color: #fff; }
.event-dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.event-dot.fixed { background: var(--accent); }
.event-dot.bill { background: var(--info); }
.side-upcoming { border-top: 1px solid var(--line); }
.side-payment { display: grid; grid-template-columns: 48px 1fr; gap: 10px; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.side-payment time { color: var(--muted); font-size: 12px; }
.side-payment strong { display: block; font-size: 14px; }
.side-payment small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 13px; padding: 17px 22px 20px; color: var(--muted); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.legend .variable { background: var(--info); }
.legend .estimate { background: transparent; border: 1px dashed #7b5dc5; }
.privacy-note { display: flex; align-items: center; gap: 7px; margin: 16px 7px 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.privacy-note .ph { font-size: 16px; }
.calm-note { margin-top: 18px; display: flex; align-items: center; gap: 14px; padding: 18px 20px; border: 1px solid #ddd9ff; border-radius: 15px; background: #f7f7ff; }
.calm-note .ph { flex: 0 0 auto; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #eef0ff; color: #5b61ff; font-size: 22px; }
.calm-note div { min-width: 0; }
.calm-note strong { display: block; font-size: 14px; }
.calm-note p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.calm-note button { margin-left: auto; }

.empty-state { padding: 70px 20px; text-align: center; }
.empty-icon { width: 72px; height: 72px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; background: #eef0ff; color: #5b61ff; font-size: 34px; }
.empty-state h2 { margin: 0; font-size: 23px; }
.empty-state p { max-width: 430px; margin: 9px auto 22px; color: var(--muted); line-height: 1.55; }
.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.empty-actions .quiet-button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); }

.calendar-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .75fr); gap: 26px; }
.calendar-panel, .plan-panel { border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.calendar-toolbar h2 { margin: 0; font-size: 20px; text-transform: capitalize; }
.toolbar-actions { display: flex; gap: 7px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekday { padding: 12px 8px; border-bottom: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 12px; font-weight: 700; }
.calendar-day { min-height: 112px; padding: 9px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; }
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day.outside { color: #747c75; background: #f8f8f4; }
.calendar-day.selected { box-shadow: inset 0 0 0 2px #5b61ff; background: #f7f7ff; }
.day-number { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; font-size: 13px; }
.calendar-day.today .day-number { background: var(--dark); color: #fff; }
.day-events { display: grid; gap: 4px; margin-top: 7px; }
.day-event { overflow: hidden; padding: 4px 6px; border-radius: 6px; background: #eef4dc; color: #34451e; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.day-event.bill { background: var(--info-soft); color: #075e90; }
.day-event-more { color: var(--muted); font-size: 10px; font-weight: 720; }
.selected-day { padding: 24px; }
.selected-day h2 { margin: 0; font-size: 20px; text-transform: capitalize; }
.selected-day-list { margin-top: 18px; }
.selected-day-item { padding: 14px 0; border-top: 1px solid var(--line); }
.selected-day-item strong { display: block; }
.selected-day-item small { display: block; margin-top: 5px; color: var(--muted); }

.plan-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); gap: 26px; }
.plan-panel { padding: 26px; }
.plan-panel h2 { margin: 0; font-size: 20px; }
.plan-intro { margin: 7px 0 24px; color: var(--muted); }
.month-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); align-items: start; gap: 18px; padding: 15px 0; border-top: 1px solid var(--line); }
.month-row:first-of-type { border-top: 0; }
.month-row time { text-transform: capitalize; }
.plan-bar { height: 8px; border-radius: 99px; background: #eceee7; overflow: hidden; }
.plan-bar span { display: block; height: 100%; border-radius: inherit; background: #82a438; }
.bar-w-0 { width: 0; } .bar-w-5 { width: 5%; } .bar-w-10 { width: 10%; } .bar-w-15 { width: 15%; } .bar-w-20 { width: 20%; }
.bar-w-25 { width: 25%; } .bar-w-30 { width: 30%; } .bar-w-35 { width: 35%; } .bar-w-40 { width: 40%; } .bar-w-45 { width: 45%; }
.bar-w-50 { width: 50%; } .bar-w-55 { width: 55%; } .bar-w-60 { width: 60%; } .bar-w-65 { width: 65%; } .bar-w-70 { width: 70%; }
.bar-w-75 { width: 75%; } .bar-w-80 { width: 80%; } .bar-w-85 { width: 85%; } .bar-w-90 { width: 90%; } .bar-w-95 { width: 95%; } .bar-w-100 { width: 100%; }
.month-currency-list { display: grid; gap: 9px; }
.month-currency-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(140px, auto); align-items: center; gap: 14px; }
.month-currency-row strong { text-align: right; font-size: 13px; }
.insight-list { display: grid; gap: 18px; margin-top: 24px; }
.insight { display: grid; grid-template-columns: 42px 1fr; gap: 12px; }
.insight .ph { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-soft); font-size: 21px; }
.insight strong { display: block; font-size: 14px; }
.insight p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.cashflow-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-bottom: 22px; overflow: hidden; border-radius: 18px; background: #39423b; color: #fff; }
.cashflow-hero.single { grid-template-columns: 1fr; }
.cashflow-hero > div { min-height: 142px; display: grid; align-content: center; gap: 8px; padding: 26px 30px; background: var(--dark); }
.cashflow-hero .eyebrow { color: #aeb6af; }
.cashflow-hero strong { font-size: clamp(28px, 3vw, 40px); letter-spacing: -.04em; }
.cashflow-hero strong.up { color: #ffd58a; }
.cashflow-hero strong.down { color: var(--accent); }
.cashflow-hero strong.neutral { color: #fff; }
.cashflow-hero span { color: #bfc6bf; font-size: 13px; line-height: 1.45; }
.scenario-buttons { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0; }
.scenario-button { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 720; }
.scenario-button.active { border-color: #5b61ff; background: #eef0ff; color: #4249b8; }
.scenario-total { display: block; font-size: 30px; letter-spacing: -.035em; }
.scenario-note { display: block; margin-top: 6px; color: var(--muted); }
.insight-list.compact { margin-top: 24px; }
.bill-intelligence { margin: 24px 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 15px; }
.section-heading h2 { margin: 0; font-size: 24px; }
.section-heading > p { max-width: 430px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.bill-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.bill-intelligence-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.bill-intelligence-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.bill-intelligence-card h3 { margin: 0; font-size: 17px; }
.anomaly-badge, .stable-badge, .insufficient-badge { display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px; border-radius: 999px; font-size: 10px; font-weight: 760; white-space: nowrap; }
.anomaly-badge { color: #8a4c00; background: var(--warning-soft); }
.stable-badge { color: var(--success); background: #eaf5e9; }
.insufficient-badge { color: var(--muted); background: var(--surface-soft); }
.trend-chart { height: 142px; display: flex; align-items: end; gap: 9px; margin-top: 18px; padding: 14px 4px 0; border-bottom: 1px solid var(--line); }
.trend-column { flex: 1; height: 100%; display: grid; grid-template-rows: 1fr auto; align-items: end; gap: 7px; text-align: center; }
.trend-column span { display: block; width: min(28px, 72%); min-height: 8px; margin: auto auto 0; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, #ff9b8d, #ff6b57); }
.bar-h-0 { height: 0; } .bar-h-5 { height: 5%; } .bar-h-10 { height: 10%; } .bar-h-15 { height: 15%; } .bar-h-20 { height: 20%; }
.bar-h-25 { height: 25%; } .bar-h-30 { height: 30%; } .bar-h-35 { height: 35%; } .bar-h-40 { height: 40%; } .bar-h-45 { height: 45%; }
.bar-h-50 { height: 50%; } .bar-h-55 { height: 55%; } .bar-h-60 { height: 60%; } .bar-h-65 { height: 65%; } .bar-h-70 { height: 70%; }
.bar-h-75 { height: 75%; } .bar-h-80 { height: 80%; } .bar-h-85 { height: 85%; } .bar-h-90 { height: 90%; } .bar-h-95 { height: 95%; } .bar-h-100 { height: 100%; }
.trend-column small { color: var(--muted); font-size: 10px; }
.bill-intelligence-card footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 12px; }
.bill-intelligence-card footer small { color: var(--muted); }
.forecast-source { display: flex; align-items: flex-start; gap: 6px; margin: 12px 0 0; padding-top: 11px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.45; }
.forecast-source .ph { flex: 0 0 auto; margin-top: 1px; color: var(--info); font-size: 14px; }
.plan-evidence-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 26px; }
.forecast-provenance .plan-intro { margin-bottom: 18px; line-height: 1.55; }
.provenance-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.provenance-counts > div { padding: 12px; border-radius: 11px; background: var(--surface-soft); }
.provenance-counts dt { color: var(--muted); font-size: 10px; font-weight: 720; }
.provenance-counts dd { margin: 3px 0 0; font-size: 21px; font-weight: 780; }
.comparison-status { display: grid; grid-template-columns: 34px 1fr; align-items: start; gap: 10px; margin-top: 16px; padding: 12px; border-radius: 11px; background: var(--info-soft); }
.comparison-status > .ph { width: 34px; height: 34px; display: grid; place-items: center; color: var(--info); font-size: 18px; }
.comparison-status strong { display: block; font-size: 12px; }
.comparison-status p { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.plan-outlook { margin-top: 24px; padding: 0; }
.plan-outlook > summary { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 19px 25px; cursor: pointer; list-style: none; }
.plan-outlook > summary::-webkit-details-marker { display: none; }
.plan-outlook > summary > span { min-width: 0; display: grid; gap: 4px; }
.plan-outlook > summary .eyebrow { display: block; margin: 0; }
.plan-outlook > summary strong { font-size: 18px; }
.plan-outlook > summary small { color: var(--muted); font-size: 11px; }
.plan-outlook > summary > .ph { flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-soft); font-size: 19px; transition: transform .2s ease; }
.plan-outlook[open] > summary { border-bottom: 1px solid var(--line); }
.plan-outlook[open] > summary > .ph { transform: rotate(180deg); }
.plan-outlook-body { padding: 4px 25px 20px; }

.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); align-items: center; gap: clamp(40px, 8vw, 120px); padding: clamp(34px, 7vw, 100px); }
.auth-copy { max-width: 600px; }
.auth-kicker { color: #5b61ff; }
.auth-copy h1 { max-width: 540px; margin: 0; font-size: clamp(42px, 5.8vw, 72px); line-height: .99; letter-spacing: -.055em; }
.auth-copy > p { max-width: 520px; margin: 22px 0; color: var(--muted); font-size: 18px; line-height: 1.6; }
.trust-list { display: grid; gap: 12px; margin: 30px 0 0; padding: 0; list-style: none; color: var(--ink-soft); }
.trust-list li { display: flex; align-items: center; gap: 10px; }
.trust-list .ph { color: var(--success); font-size: 21px; }
.auth-card { max-width: 440px; padding: 30px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.auth-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 26px; font-size: 18px; }
.auth-card > label { display: block; margin-bottom: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 720; }
.password-field { position: relative; }
.password-field input { width: 100%; min-height: 50px; padding: 0 48px 0 13px; border: 1px solid var(--line-strong); border-radius: 11px; background: #fbfbf8; }
.field-icon { position: absolute; right: 4px; top: 4px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 9px; background: transparent; font-size: 21px; }
.auth-card .primary-button { margin-top: 8px; }
.auth-card > small { display: block; margin-top: 14px; color: var(--muted); text-align: center; }

dialog { padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-dialog); }
dialog::backdrop { background: rgba(8, 12, 9, .62); }
.sheet-dialog { width: min(680px, calc(100% - 28px)); max-height: calc(100vh - 30px); overflow: auto; }
.payment-form, .settings-sheet, .import-form { padding: 26px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.dialog-head h2 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.type-selector, .amount-mode { margin: 0 0 20px; padding: 0; border: 0; }
.type-selector legend, .amount-mode legend { margin-bottom: 9px; color: var(--ink-soft); font-size: 13px; font-weight: 720; }
.type-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-selector legend { grid-column: 1 / -1; }
.type-selector input, .amount-mode input { position: absolute; opacity: 0; pointer-events: none; }
.type-selector label > span { min-height: 82px; display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; column-gap: 9px; align-content: center; padding: 13px; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.type-selector .ph { grid-row: 1 / 3; align-self: center; font-size: 24px; }
.type-selector b { font-size: 14px; }
.type-selector small { margin-top: 3px; color: var(--muted); }
.type-selector input:checked + span { border-color: #5b61ff; box-shadow: inset 0 0 0 1px #5b61ff; background: #f5f5ff; }
.type-selector input:focus-visible + span, .amount-mode input:focus-visible + span { outline: 3px solid #5b61ff; outline-offset: 3px; }
.amount-mode { display: flex; flex-wrap: wrap; gap: 8px; }
.amount-mode legend { width: 100%; }
.amount-mode label > span { display: block; min-height: 40px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13px; }
.amount-mode input:checked + span { border-color: #5b61ff; background: #eef0ff; color: #4249b8; font-weight: 700; }
.compact-dialog { width: min(530px, calc(100% - 28px)); }
.lifecycle-steps { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 7px; margin-bottom: 20px; }
.lifecycle-steps > span { min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 7px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); font-size: 10px; font-weight: 700; }
.lifecycle-steps > span .ph { font-size: 18px; }
.lifecycle-steps > span.active { border-color: #5b61ff; background: #eef0ff; color: #4249b8; }
.lifecycle-steps > .ph { color: var(--muted-2); }
.lifecycle-mode { margin-top: 20px; }
.form-row, .advanced-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row + .form-row { margin-top: 14px; }
.field { display: grid; gap: 7px; color: var(--ink-soft); font-size: 13px; font-weight: 680; }
.field input, .field select, .field textarea { width: 100%; min-height: 46px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; background: var(--surface); color: var(--ink); }
.field textarea { resize: vertical; }
.field small { color: var(--muted); font-size: 11px; font-weight: 450; }
.money-field { display: grid; grid-template-columns: auto 1fr; align-items: center; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.money-field > span { padding-left: 12px; color: var(--muted); }
.money-field input { border: 0; }
.field.is-disabled { opacity: .55; }
.field [aria-invalid="true"], .money-field:has([aria-invalid="true"]) { border-color: var(--danger); }
.advanced-fields { margin-top: 20px; border-top: 1px solid var(--line); }
.advanced-fields summary { padding: 16px 0 5px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; color: var(--ink-soft); font-size: 13px; font-weight: 700; list-style: none; }
.advanced-fields[open] summary .ph { transform: rotate(180deg); }
.advanced-grid { margin-top: 12px; }
.field-wide { grid-column: 1 / -1; }
.check-label { display: flex; align-items: center; gap: 9px; color: var(--ink-soft); font-size: 13px; }
.check-label input { width: 18px; height: 18px; }
.field-error { min-height: 19px; margin: 10px 0 0; color: var(--danger); font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.quiet-button { min-height: 46px; padding: 0 15px; border-radius: 10px; background: transparent; font-weight: 700; }
.quiet-button:hover { background: var(--surface-soft); }

.settings-dialog { width: min(560px, calc(100% - 28px)); }
.settings-list { border-top: 1px solid var(--line); }
.settings-row { width: 100%; min-height: 76px; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 12px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.settings-link { color: inherit; text-decoration: none; }
.settings-row:hover { background: #fbfbf8; }
.settings-row > .ph:first-child { font-size: 23px; }
.settings-row span { display: grid; gap: 4px; }
.settings-row small { color: var(--muted); }
.settings-row > b { color: var(--muted); font-size: 13px; }
.manage-payments-list { display: grid; margin: 18px 0; border-top: 1px solid var(--line); }
.manage-payment { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.manage-payment > div:first-child { min-width: 0; }
.manage-payment strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.manage-payment small { display: block; margin-top: 4px; color: var(--muted); }
.manage-payment > div:last-child { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
.danger-control { color: var(--danger); }
.data-actions { display: grid; gap: 12px; margin-top: 18px; }
.data-actions > .settings-row { border-top: 1px solid var(--line); }
.file-picker { position: relative; min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: 11px; background: var(--surface-soft); cursor: pointer; }
.file-picker:focus-within { outline: 3px solid #5b61ff; outline-offset: 3px; }
.file-picker > span { position: relative; z-index: 2; display: flex; align-items: center; gap: 9px; pointer-events: none; }
.file-picker .ph { font-size: 21px; }
.file-picker input { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.backup-status { min-height: 22px; margin: 0; color: var(--muted); }
.backup-status.is-error { color: var(--danger); }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; padding-top: 20px; border-top: 1px solid #edc8c5; }
.danger-zone div { display: grid; gap: 4px; }
.danger-zone small { color: var(--muted); }
.danger-button { flex: 0 0 auto; border: 1px solid #dca7a3; color: var(--danger); }
.danger-button:hover { background: #fff2f1; }
.connection-details { margin-top: 18px; color: var(--muted); font-size: 13px; }
.connection-details summary { cursor: pointer; }
.connection-details > div { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding: 13px; border-radius: 10px; background: var(--surface-soft); }
.import-help { display: flex; gap: 13px; margin-bottom: 18px; padding: 14px; border-radius: 12px; background: var(--surface-soft); }
.import-help > .ph { font-size: 26px; }
.import-help p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.candidate-section { padding: 0 26px 26px; }
.candidate-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 0 8px; border-top: 1px solid var(--line); }
.candidate-head h3 { margin: 0; }
.candidate { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.candidate small { display: block; margin-top: 4px; color: var(--muted); }
.candidate-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.candidate-actions button { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; }
.candidate-actions button[aria-pressed="true"] { border-color: #5b61ff; background: #eef0ff; }
.candidate-status { color: var(--success); font-weight: 700; font-size: 12px; }
.duplicate-badge { width: max-content; display: inline-flex; align-items: center; gap: 4px; margin-top: 7px; padding: 4px 7px; border-radius: 999px; color: #805000; background: var(--warning-soft); font-size: 10px; font-weight: 740; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 300; max-width: min(380px, calc(100% - 32px)); padding: 13px 16px; border-radius: 11px; background: var(--dark); color: #fff; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media (forced-colors: active) {
  .nav-item.active::before, .event-dot, .plan-bar span, .trend-column span { forced-color-adjust: none; background: Highlight; }
  .calendar-day.selected, .type-selector input:checked + span, .amount-mode input:checked + span { outline: 2px solid Highlight; }
}

/* iOS refresh: warm canvas, navy ink and coral action language. */
body {
  background:
    radial-gradient(circle at 88% -8%, rgba(255, 107, 87, .14), transparent 34%),
    var(--paper);
}

.sidebar { background: var(--dark); }
.nav-item:hover { background: #242942; }
.nav-item.active { background: #2b3049; }
.nav-item.active::before { background: var(--accent); }
.nav-item.active .ph { color: var(--accent); }
.primary-button { background: var(--accent); color: #fff; box-shadow: 0 8px 18px rgba(255, 107, 87, .22); }
.primary-button:hover { background: #f45b4b; }
.secondary-button { border-color: var(--line); background: rgba(255, 255, 255, .86); }
.secondary-button:hover { border-color: #b3b7ff; background: #f7f7ff; }
.quick-add-menu, .overflow-menu { box-shadow: 0 18px 50px rgba(23, 27, 45, .14); }
.demo-banner { border-color: #d9d8ff; background: #f0f0ff; }
.demo-banner > div > .ph { color: #5b61ff; }
.lifecycle-guide { border-color: #ddd9ff; background: #f4f2ff; }
.attention-panel { border-color: #f0d6d3; background: #fffafa; }
.attention-panel > header { border-bottom-color: #f4e4e2; }
.outlook-hero { background: linear-gradient(135deg, #171b2d 0%, #272d4a 65%, #42345a 100%); box-shadow: 0 18px 36px rgba(23, 27, 45, .18); }
.hero-divider { background: #454b6a; }
.hero-insight-icon { background: #353b5c; color: #ff9b8d; }
.payment-row { border-bottom-color: var(--line); }
.payment-icon.bill { color: #5b61ff; background: #eef0ff; border-color: #d9dcff; }
.lifecycle-badge.exact { color: #277a72; background: #e3f5f2; }
.row-action.primary-inline { border-color: var(--accent); background: var(--accent); color: #fff; }
.payment-row.is-overdue { background: #fff7f6; }
.week-day.today b, .calendar-day.today .day-number { background: var(--dark); }
.event-dot.fixed, .legend i { background: var(--accent); }
.calendar-day.selected { box-shadow: inset 0 0 0 2px #5b61ff; background: #f7f7ff; }
.day-event { background: #ffe9e5; color: #9d3d38; }
.day-event.bill { background: #eef0ff; color: #4e55c8; }
.plan-bar span { background: linear-gradient(90deg, #5b61ff, #9188ff); }
.cashflow-hero { background: #282d48; }
.cashflow-hero strong.down { color: #ff9b8d; }
.scenario-button.active { border-color: #5b61ff; background: #eef0ff; color: #4249b8; }
.trend-column span { background: linear-gradient(180deg, #ff9b8d, #ff6b57); }
.forecast-source .ph { color: #5b61ff; }
.comparison-status { background: #eef0ff; }
.comparison-status > .ph { color: #5b61ff; }
.plan-outlook > summary > .ph { background: #eef0ff; color: #5b61ff; }
.auth-kicker { color: #5b61ff; }
.auth-card { box-shadow: 0 20px 60px rgba(23, 27, 45, .08); }
.trust-list .ph { color: #277a72; }
.field-icon:hover, .icon-control:hover { background: var(--surface-soft); }
dialog::backdrop { background: rgba(13, 16, 31, .68); }
.type-selector input:checked + span { border-color: #5b61ff; background: #f5f5ff; box-shadow: inset 0 0 0 1px #5b61ff; }
.amount-mode input:checked + span, .lifecycle-steps > span.active { border-color: #5b61ff; background: #eef0ff; color: #4249b8; }
.type-selector input:focus-visible + span, .amount-mode input:focus-visible + span, .file-picker:focus-within { outline-color: #5b61ff; }
.file-picker { background: #f4f4fb; }
.candidate-actions button[aria-pressed="true"] { border-color: #5b61ff; background: #eef0ff; }
.candidate-status { color: #277a72; }
.toast { background: var(--dark); }
