:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-soft: #fbfbfd;
  --ink: #1d1d1f;
  --muted: #67676d;
  --line: #dcdce1;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --positive: #16835d;
  --negative: #9a5317;
  --danger: #b42318;
  --warning: #a45b00;
  --hero: #102641;
  --shadow: 0 22px 70px rgba(0, 0, 0, .08);
  --radius: 28px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent); outline-offset: 3px; }
[hidden] { display: none !important; }
.visually-hidden { position: fixed; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }
.skip-link { position: fixed; z-index: 100; left: 16px; top: -60px; padding: 10px 14px; border-radius: 12px; background: var(--ink); color: #fff; transition: top .2s; }
.skip-link:focus { top: 16px; }
.desktop-only-screen { display: none; min-height: 100svh; padding: 32px; background: var(--surface); }
.desktop-only-content { width: min(100%, 560px); margin: auto; }
.desktop-only-content img { margin-bottom: 32px; border-radius: 18px; object-fit: cover; }
.desktop-only-content h1 { margin: 0; font-size: clamp(2.8rem, 7vw, 5rem); line-height: 1.04; }
.desktop-only-content > p:last-child { max-width: 48ch; margin: 22px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.6; }

.login-screen { min-height: 100svh; display: grid; grid-template-columns: minmax(320px, 600px) 1fr; background: var(--surface); }
.login-panel { display: flex; flex-direction: column; justify-content: center; width: min(100%, 490px); margin: auto; padding: 56px; }
.login-logo { border-radius: 22px; object-fit: cover; box-shadow: 0 8px 28px rgba(0,0,0,.12); margin-bottom: 34px; }
.eyebrow { margin: 0 0 10px; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .13em; }
.login-panel h1 { margin: 0; font-size: clamp(3rem, 4vw, 4.1rem); line-height: 1.04; }
.login-copy { max-width: 370px; margin: 26px 0 34px; color: var(--muted); font-size: 1.08rem; line-height: 1.55; }
.login-form { display: grid; gap: 10px; }
.login-form > label, .form-grid label { color: var(--muted); font-size: .82rem; font-weight: 600; }
.password-field { position: relative; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 13px 14px; transition: border-color .18s, box-shadow .18s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(0,113,227,.12); }
textarea { min-height: 92px; resize: vertical; }
.password-field input { padding-right: 50px; }
.form-error { min-height: 18px; margin: 0; color: var(--danger); font-size: .88rem; line-height: 1.45; }
.login-footnote { margin: 24px 0 0; color: var(--muted); font-size: .78rem; }
.login-art { position: relative; overflow: hidden; margin: 16px; min-height: calc(100svh - 32px); border-radius: 32px; background: repeating-linear-gradient(to bottom, transparent 0, transparent 73px, rgba(255,255,255,.08) 74px), var(--hero); }
.login-quote { position: absolute; left: clamp(30px, 6vw, 90px); bottom: clamp(34px, 7vw, 100px); color: #fff; display: grid; gap: 8px; }
.login-quote span, .login-quote small { color: #c9d9ec; font-size: .9rem; }
.login-quote strong { font-size: clamp(2rem, 4vw, 4.6rem); line-height: 1.06; }
.login-quote small { margin-top: 16px; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 11px 19px; border: 0; border-radius: 999px; font-weight: 650; transition: transform .18s var(--ease), background .18s, opacity .18s; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: scale(.98); }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-hover); }
.button.secondary { background: #e8e8ed; color: var(--ink); }
.button.danger { background: #fff0ed; color: var(--danger); }
.button:disabled { cursor: wait; opacity: .62; transform: none; }
.button.wide { width: 100%; }
.button.compact { min-height: 40px; padding: 9px 16px; font-size: .9rem; }
.button svg { width: 17px; height: 17px; }
.icon-button, .hero-icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #efeff1; }
.icon-button.inside { position: absolute; right: 4px; top: 4px; width: 38px; height: 38px; background: transparent; }
.icon-button svg, .hero-icon-button svg { width: 19px; height: 19px; }
.text-button { padding: 7px 0; border: 0; background: transparent; color: var(--accent); font-size: .88rem; font-weight: 600; }
.text-button svg { width: 16px; height: 16px; vertical-align: middle; }

.app-shell { min-height: 100svh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; display: flex; flex-direction: column; width: 244px; padding: 24px 16px; background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 28px; }
.brand img { border-radius: 11px; object-fit: cover; }
.brand div { display: grid; gap: 1px; min-width: 0; }
.brand strong { font-size: .98rem; }
.brand span { overflow: hidden; color: var(--muted); font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
.nav-list, .sidebar-foot { display: grid; gap: 5px; }
.sidebar-foot { margin-top: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 13px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 600; text-align: left; }
.nav-item svg { width: 20px; height: 20px; }
.nav-item:hover { background: rgba(0,0,0,.04); color: var(--ink); }
.nav-item.active { background: var(--hero); color: #fff; }
.main-content { margin-left: 244px; min-height: 100svh; padding: 0 clamp(24px, 4vw, 64px) 80px; overflow: hidden; }
.main-content > .page, .topbar { max-width: 1520px; margin-left: auto; margin-right: auto; }
.topbar { position: sticky; top: 0; z-index: 12; display: grid; grid-template-columns: 1fr auto; align-items: center; min-height: 82px; background: var(--bg); border-bottom: 1px solid var(--line); }
.period-control, .top-actions { display: flex; align-items: center; gap: 10px; }
.date-navigation { display: flex; align-items: center; gap: 4px; min-width: 0; }
.date-navigation .date-step { flex: 0 0 36px; width: 36px; height: 36px; background: transparent; }
.date-navigation .date-step:hover { background: var(--surface); }
.period-control { grid-column: 1; }
.top-actions { grid-column: 2; justify-self: end; }
.segmented { display: flex; padding: 3px; border-radius: 999px; background: #e8e8ed; }
.segmented button { min-height: 34px; padding: 6px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: .8rem; font-weight: 650; }
.segmented button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.09); }
.date-button { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .84rem; font-weight: 600; }
.date-button svg { width: 17px; height: 17px; color: var(--muted); }
.sync-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .78rem; }
.sync-state i { width: 7px; height: 7px; border-radius: 50%; background: #30a46c; box-shadow: 0 0 0 4px rgba(48,164,108,.12); }
.sync-state.saving i { background: #d18b00; animation: pulse 1s infinite; }
.sync-state.error i { background: var(--negative); }
@keyframes pulse { 50% { opacity: .35; } }

.page { display: none; animation: page-in .36s var(--ease); }
.page.active { display: block; }
@keyframes page-in { from { opacity: 0; transform: translateY(7px); } }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 32px; padding: clamp(32px, 5vw, 64px) 0 28px; }
.page-heading h1 { margin: 0; font-size: clamp(2.5rem, 5vw, 5.25rem); line-height: 1.04; }
.page-intro { max-width: 310px; margin: 0 0 6px; color: var(--muted); line-height: 1.55; }
.compact-heading { padding-top: clamp(28px, 4vw, 50px); }

.balance-hero { position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(240px, .7fr); align-items: center; gap: 40px; min-height: 310px; padding: clamp(30px, 5vw, 58px); border-radius: 28px; background: var(--hero); color: #fff; }
.balance-main { align-self: center; }
.balance-label-row { display: flex; align-items: center; gap: 8px; color: #d6e2f0; font-size: .94rem; }
.hero-icon-button { width: 38px; height: 38px; background: rgba(255,255,255,.1); color: #fff; }
.balance-value { display: block; margin: 20px 0 12px; font-size: clamp(2.65rem, 5.5vw, 5.7rem); line-height: 1; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.balance-caption { color: #c7d5e5; font-size: .84rem; }
.flow-summary { display: grid; border-top: 1px solid rgba(255,255,255,.25); }
.flow-summary div { display: flex; justify-content: space-between; align-items: baseline; min-width: 0; gap: 14px; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.25); }
.flow-summary span, .flow-summary strong { display: block; }
.flow-summary span { color: #c7d5e5; font-size: .82rem; }
.flow-summary strong { font-size: 1.05rem; text-align: right; font-variant-numeric: tabular-nums; }
.balance-hero .positive { color: #95e2bd; }
.balance-hero .negative { color: #ffd19d; }
.hero-glow { display: none; }

.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 26px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--line); }
.metric { min-width: 0; padding: 22px 24px; background: var(--surface); }
.metric span { display: block; margin-bottom: 8px; color: var(--muted); font-size: .76rem; }
.metric strong { display: block; font-size: clamp(1.25rem, 2.2vw, 2rem); line-height: 1.15; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.metric small { display: block; margin-top: 7px; color: var(--muted); font-size: .7rem; }
.section-links { display: flex; justify-content: flex-end; gap: 22px; margin: -10px 0 18px; }
.dashboard-grid, .analysis-grid, .business-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .75fr); gap: 22px; }
.business-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; padding: clamp(22px, 3vw, 34px); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.panel h2 { margin: 0; font-size: clamp(1.25rem, 2.2vw, 1.8rem); }
.chart-period { margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.chart-total { display: grid; gap: 5px; text-align: right; white-space: nowrap; }
.chart-total small { color: var(--muted); font-size: .75rem; }
.chart-select { display: flex; align-items: center; gap: 10px; width: max-content; max-width: 100%; margin-top: 22px; color: var(--muted); font-size: .82rem; }
.chart-select select { width: auto; min-width: 160px; padding: 9px 34px 9px 12px; }
.legend { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: .75rem; }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.chart { min-height: 235px; margin-top: 28px; overflow: hidden; }
.chart.tall { min-height: 310px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart svg text { fill: var(--muted); }
.chart-empty, .empty-state { display: grid; place-items: center; min-height: 190px; padding: 28px; color: var(--muted); text-align: center; }
.chart-empty strong, .empty-state strong { color: var(--ink); }
.empty-state p { margin: 8px auto 18px; max-width: 28ch; line-height: 1.45; }
.activity-list, .simple-list { margin-top: 22px; }
.activity-item, .simple-row { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child, .simple-row:last-child { border-bottom: 0; }
.activity-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: #eef5ff; color: var(--accent); }
.activity-icon svg { width: 18px; height: 18px; }
.activity-copy { min-width: 0; }
.activity-copy strong, .activity-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-copy strong { font-size: .88rem; }
.activity-copy span, .simple-row span { margin-top: 3px; color: var(--muted); font-size: .8rem; }
.activity-amount { font-size: .83rem; font-weight: 650; white-space: nowrap; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }

.daily-summary { padding: clamp(24px, 4vw, 36px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.daily-summary-head, .section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.daily-summary-head h2, .section-heading h2 { margin: 0; font-size: clamp(1.35rem, 2vw, 1.75rem); }
.daily-summary-head > strong { font-size: clamp(1.8rem, 3vw, 2.7rem); font-variant-numeric: tabular-nums; }
.harvest-progress { height: 8px; margin: 24px 0 18px; overflow: hidden; border-radius: 999px; background: var(--line); }
.harvest-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .25s var(--ease); }
.harvest-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; max-width: 580px; }
.harvest-values div { display: grid; gap: 5px; }
.harvest-values span { color: var(--muted); font-size: .82rem; }
.harvest-values strong { font-size: 1.25rem; }
.daily-summary .button { margin-top: 28px; }
.daily-list-section { margin-top: 34px; }
.section-heading > span { color: var(--muted); font-size: .84rem; }
.daily-list { margin-top: 16px; overflow: hidden; border-radius: 22px; background: var(--surface); }
.daily-sale-row { display: grid; grid-template-columns: 40px minmax(0,1fr) auto 18px; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 12px 22px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.daily-sale-row:last-child { border-bottom: 0; }
.daily-sale-row:hover, .payment-sale-row:hover { background: var(--surface-soft); }
.daily-sale-row > svg, .payment-sale-row svg { width: 18px; height: 18px; color: var(--muted); }
.daily-sale-copy { display: grid; min-width: 0; gap: 4px; }
.daily-sale-copy small { overflow: hidden; color: var(--muted); font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.daily-sale-row > strong { white-space: nowrap; font-size: .9rem; }

.payments-summary { display: grid; gap: 9px; padding: 28px 32px; border-radius: var(--radius); background: var(--hero); color: #fff; }
.payments-summary span, .payments-summary small { color: #c7d5e5; }
.payments-summary strong { font-size: clamp(2rem, 4vw, 3.7rem); line-height: 1.1; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.payments-tools { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 26px 0 14px; }
.payments-tools .search-field { width: min(100%, 340px); }
.payments-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.payment-account { min-width: 0; padding: 22px 24px 6px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.payment-account-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.payment-account-head h2 { margin: 0 0 4px; font-size: 1.1rem; }
.payment-account-head div > span, .payment-account > p { color: var(--muted); font-size: .82rem; }
.payment-account > p { margin: 14px 0 18px; }
.status-badge { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; background: #fff2e4; color: var(--negative); font-size: .72rem; font-weight: 700; }
.status-badge.paid { background: #e6f5ed; color: var(--positive); }
.payment-sales { border-top: 1px solid var(--line); }
.payment-sale-row { display: grid; grid-template-columns: minmax(0,1fr) auto 18px; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 9px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.payment-sale-row:last-child { border-bottom: 0; }
.payment-sale-row span { overflow: hidden; color: var(--muted); font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.payment-sale-row strong { font-size: .82rem; white-space: nowrap; }
.payments-list > .empty-state { grid-column: 1 / -1; border-radius: 22px; background: var(--surface); }

.record-tools { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(170px, 240px); gap: 12px; margin-bottom: 20px; }
.result-count { margin: 0 0 10px; color: var(--muted); font-size: .82rem; }
.search-field { position: relative; }
.search-field svg { position: absolute; left: 14px; top: 14px; width: 18px; height: 18px; color: var(--muted); }
.search-field input { padding-left: 42px; }
.record-list { overflow: hidden; border-radius: 22px; background: var(--surface); }
.record-row { display: grid; grid-template-columns: 44px minmax(0,1.3fr) minmax(130px,.7fr) minmax(130px,.7fr) 24px; align-items: center; gap: 15px; width: 100%; padding: 17px 20px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.record-row:last-child { border-bottom: 0; }
.record-row:hover { background: var(--surface-soft); }
.record-main, .record-detail { min-width: 0; }
.record-main strong, .record-main span, .record-detail strong, .record-detail span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-main strong, .record-detail strong { font-size: .88rem; }
.record-main span, .record-detail span { margin-top: 4px; color: var(--muted); font-size: .8rem; }
.record-date { color: var(--muted); font-size: .78rem; }
.chevron { color: #aaaab0; }
.chevron svg { width: 18px; height: 18px; }

.analysis-metrics { margin-top: 0; }
.wide-panel { min-height: 410px; }
.insight-panel { background: #e8f2ff; }
.insight-panel h2 { margin-bottom: 30px; }
.insight-line { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 17px 0; border-bottom: 1px solid rgba(0,0,0,.1); }
.insight-line:last-child { border: 0; }
.insight-line span { color: var(--muted); font-size: .82rem; }
.insight-line strong { font-size: 1rem; }
.business-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 22px; }
.business-card { min-height: 180px; padding: 28px; border-radius: 26px; background: var(--surface); }
.business-card.featured { background: #152b24; color: #fff; }
.business-card span { display: block; color: var(--muted); font-size: .8rem; }
.business-card.featured span { color: rgba(255,255,255,.58); }
.business-card strong { display: block; margin: 24px 0 7px; font-size: clamp(1.7rem, 3vw, 2.7rem); overflow-wrap: anywhere; }
.business-card small { color: var(--muted); }
.business-card.featured small { color: rgba(255,255,255,.5); }

.modal { width: min(680px, calc(100% - 32px)); max-height: min(86svh, 850px); padding: 0; border: 0; border-radius: 28px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); overflow: auto; }
.modal::backdrop { background: rgba(0,0,0,.34); backdrop-filter: blur(10px); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 28px 30px 20px; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(18px); }
.modal-head h2 { margin: 0; font-size: 1.75rem; }
.type-groups { display: grid; gap: 20px; padding: 6px 30px 32px; }
.type-groups h3 { margin: 0 0 10px; color: var(--muted); font-size: .82rem; }
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.type-button { display: flex; align-items: center; gap: 13px; min-height: 72px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); font-weight: 650; text-align: left; }
.type-button:hover { border-color: #b8b8bf; background: var(--surface-soft); }
.type-button span:first-child { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px; background: #eef5ff; color: var(--accent); }
.type-button svg { width: 18px; height: 18px; }
.type-button > svg { margin-left: auto; color: var(--muted); }
.type-copy { display: grid; min-width: 0; gap: 3px; }
.type-copy small { color: var(--muted); font-size: .76rem; font-weight: 400; }
.entry-form, .settings-form { padding: 0 30px 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; padding: 4px 30px 8px; }
.form-grid label { display: grid; gap: 7px; }
.form-grid .full { grid-column: 1 / -1; }
.form-extra { margin-top: 4px; border-top: 1px solid var(--line); }
.form-extra summary { padding: 16px 0; color: var(--accent); cursor: pointer; font-size: .9rem; font-weight: 650; }
.form-extra .extra-grid { padding: 2px 0 10px; }
.sale-paid-field label, .sale-payment-date label { display: grid; gap: 7px; }
.modal-subtitle { margin: 8px 0 0; color: var(--muted); font-size: .86rem; }
.daily-form-body, .payment-form-body { display: grid; gap: 16px; padding: 8px 30px 24px; }
.field-label { display: grid; gap: 7px; color: var(--muted); font-size: .84rem; font-weight: 600; }
.field-hint { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.daily-form-body .section-heading h3 { margin: 8px 0 0; font-size: 1.05rem; }
.allocation-row { margin: 0 0 12px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; }
.allocation-head { display: flex; justify-content: space-between; align-items: center; }
.allocation-row .form-grid { padding: 10px 0 0; }
.daily-form-body > .text-button { justify-self: start; display: inline-flex; align-items: center; gap: 6px; }
.daily-remainder { margin: 0; font-weight: 700; }
.payment-total { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; }
.payment-total span { color: var(--muted); }
.payment-total strong { font-size: 1.3rem; }
.payment-form-body #payment-fields { display: grid; gap: 16px; }
.payment-form-body #payment-unpriced { margin: 0; line-height: 1.45; }
.entry-error, .settings-error { margin: 0 30px 10px; }
.settings-copy { margin: 0 30px 16px; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.settings-secondary { margin: 18px 30px 0; padding-top: 20px; border-top: 1px solid var(--line); }
.settings-secondary h3 { margin: 0 0 6px; font-size: 1rem; }
.settings-secondary h3:not(:first-child) { margin-top: 24px; }
.settings-secondary p { margin: 0 0 12px; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.delete-confirmation { margin: 20px 30px 0; padding: 16px; border: 1px solid var(--danger); border-radius: 16px; background: #fff8f6; }
.delete-confirmation p { margin: 5px 0 15px; color: var(--muted); font-size: .86rem; }
.delete-confirmation div { display: flex; gap: 8px; }
.modal-actions { position: sticky; bottom: 0; z-index: 1; display: flex; justify-content: flex-end; gap: 10px; padding: 20px 30px 30px; background: var(--surface); border-top: 1px solid var(--line); }
.modal-actions .danger { margin-right: auto; }
.small-modal { width: min(580px, calc(100% - 32px)); }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 26px; transform: translate(-50%, 24px); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px; background: rgba(29,29,31,.94); color: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.22); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease); font-size: .84rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1050px) {
  .sidebar { width: 210px; }
  .main-content { margin-left: 210px; }
  .balance-value { font-size: clamp(2.5rem, 4.1vw, 4.2rem); }
  .dashboard-grid, .analysis-grid { grid-template-columns: 1fr; }
  .payments-list { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1023px) {
  .desktop-only-screen { display: flex; }
  .login-screen, .app-shell, .skip-link, .modal, .toast { display: none !important; }
}

html.handheld-device .desktop-only-screen { display: flex; }
html.handheld-device .login-screen, html.handheld-device .app-shell,
html.handheld-device .skip-link, html.handheld-device .modal,
html.handheld-device .toast { display: none !important; }

@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --bg: #111113; --surface: #1d1d20; --surface-soft: #252527; --ink: #f5f5f7; --muted: #acacb5; --line: #38383a; --hero: #102641; --positive: #6ad6a7; --negative: #f2b97f; --danger: #ff988e; --shadow: 0 22px 70px rgba(0,0,0,.45); }
  .sidebar { background: var(--surface); }
  .segmented, .button.secondary, .icon-button { background: #2c2c2e; }
  .segmented button.active { background: #48484a; }
  .insight-panel { background: #17263a; }
  .activity-icon, .type-button span:first-child { background: #172b45; }
  .button.danger, .delete-confirmation { background: #3b2322; }
  .status-badge { background: #3d2a19; }
  .status-badge.paid { background: #1c382c; }
}

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

@media (prefers-reduced-transparency: reduce) {
  .sidebar, .topbar, .modal-head { backdrop-filter: none; background: var(--surface); }
}

@media (prefers-contrast: more) {
  :root { --line: #777; --muted: #505057; }
  .balance-label-row, .balance-caption, .flow-summary span { color: #fff; }
  .modal { border: 2px solid var(--ink); }
}

@media (prefers-color-scheme: dark) and (prefers-contrast: more) {
  :root { --line: #aaa; --muted: #d0d0d6; }
}
