.history-page { color: var(--ink); }
.history-page select, .history-page button { font: inherit; }
.history-skip-link { position: fixed; top: 10px; left: 10px; z-index: 1000; padding: 9px 12px; border-radius: 7px; background: var(--ink); color: #fff; transform: translateY(-150%); }
.history-skip-link:focus { transform: translateY(0); }
.history-workspace { width: min(100%, 1500px); margin: 0 auto; padding: 26px 34px 64px; }
.history-intro { margin-bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.history-intro h1 { margin: 0; font-family: 'Montserrat', sans-serif; font-size: clamp(26px, 2.4vw, 34px); line-height: 1.15; letter-spacing: -.03em; }
.history-intro p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.history-actions { display: flex; align-items: end; gap: 9px; }
.history-range { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.history-range select, .history-button { min-height: 38px; border: 1px solid var(--line); border-radius: var(--control-radius); background: var(--surface); color: var(--ink); font-size: 12px; }
.history-range select { min-width: 122px; padding: 0 32px 0 11px; }
.history-button { padding: 0 13px; display: inline-flex; align-items: center; gap: 7px; font-weight: 650; }
.history-button:hover { border-color: var(--line-strong); background: var(--surface-muted); }
.history-button:disabled { cursor: wait; opacity: .56; }
.history-report-button { border-color: #2d6a4f; background: #2d6a4f; color: #fff; }
.history-report-button:hover { border-color: #245840; background: #245840; }
.history-button:focus-visible, .history-range select:focus-visible, .history-metric-switch button:focus-visible { outline: 3px solid rgba(45,106,79,.18); outline-offset: 2px; }
.history-summary { margin-bottom: 14px; display: grid; grid-template-columns: 1.35fr repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.history-summary article { min-width: 0; min-height: 112px; padding: 20px 22px; border-left: 1px solid var(--line); }
.history-summary article:first-child { border-left: 0; }
.history-summary span { display: block; color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .025em; }
.history-summary strong { display: block; margin: 10px 0 4px; font-family: 'Montserrat', sans-serif; font-size: clamp(21px, 2vw, 28px); letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.history-summary p { margin: 0; color: var(--muted); font-size: 11px; }
.history-summary-lead { background: #203a48; color: #fff; }
.history-summary-lead.is-negative { background: #51383b; }
.history-summary-lead span, .history-summary-lead p { color: rgba(255,255,255,.62); }
.history-overview-grid { margin-bottom: 14px; display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: stretch; }
.history-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.history-chart-card, .history-ledger { min-width: 0; padding: 22px; }
.history-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.history-card-header h2, .history-insight-card h2 { margin: 0; font-family: 'Montserrat', sans-serif; font-size: 17px; line-height: 1.3; letter-spacing: -.02em; }
.history-card-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.history-metric-switch { padding: 3px; display: flex; gap: 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-muted); }
.history-metric-switch button { min-height: 31px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 11px; white-space: nowrap; }
.history-metric-switch button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20,34,58,.1); font-weight: 700; }
.history-legend { min-height: 20px; margin-top: 17px; display: flex; gap: 16px; color: var(--muted); font-size: 11px; }
.history-legend span { display: inline-flex; align-items: center; gap: 6px; }
.history-legend i { width: 8px; height: 8px; border-radius: 50%; }
.history-chart-shell { width: 100%; min-height: 280px; margin-top: 3px; }
.history-chart-shell svg { width: 100%; height: 280px; display: block; overflow: visible; }
.history-grid-line { stroke: #e6ebe8; stroke-width: 1; }
.history-zero-line { stroke: #8b9691; stroke-width: 1.25; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.history-axis-label { fill: #78827e; font-size: 10px; font-family: 'Open Sans', sans-serif; }
.history-line { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.history-dot { stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.history-insight-card { padding: 22px; background: #f0f4f2; }
.history-insight-card > header { display: flex; align-items: center; gap: 9px; }
.history-insight-card > header i { color: var(--green); font-size: 18px; }
.history-insight-card dl { margin: 20px 0 0; }
.history-insight-card dl div { padding: 14px 0; border-top: 1px solid #d7dfdb; }
.history-insight-card dt { color: var(--muted); font-size: 11px; }
.history-insight-card dd { margin: 5px 0 0; color: var(--ink); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.history-sync-note { margin: 18px 0 0; padding-top: 18px; display: flex; gap: 9px; border-top: 1px solid #d7dfdb; color: var(--muted); font-size: 10px; line-height: 1.5; }
.history-sync-note > i { margin-top: 2px; color: var(--green); font-size: 15px; }
.history-sync-note span, .history-sync-note strong { display: block; }
.history-sync-note strong { margin-bottom: 2px; color: var(--ink); font-size: 11px; }
.history-ledger { padding-bottom: 8px; }
.history-read-only { min-height: 30px; padding: 0 9px; display: inline-flex; align-items: center; gap: 6px; border-radius: 7px; background: var(--surface-muted); color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.history-table-wrap { margin-top: 18px; overflow-x: auto; }
.history-table-wrap table { width: 100%; border-collapse: collapse; font-size: 12px; }
.history-table-wrap th { padding: 10px 12px; border-bottom: 1px solid var(--line-strong); color: var(--muted); font-size: 10px; font-weight: 700; text-align: right; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.history-table-wrap th:first-child, .history-table-wrap th:last-child { text-align: left; }
.history-table-wrap td { padding: 14px 12px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.history-table-wrap td:first-child, .history-table-wrap td:last-child { text-align: left; }
.history-table-wrap tbody tr:last-child td { border-bottom: 0; }
.history-table-wrap tbody tr:hover { background: #fafbf9; }
.history-month { font-weight: 700; }
.history-saved.positive { color: var(--green); font-weight: 700; }
.history-saved.negative { color: var(--red); font-weight: 700; }
.history-net-worth { font-weight: 750; }
.history-net-worth.negative { color: var(--red); }
.history-activity { min-width: 210px; max-width: 310px; color: var(--muted); white-space: normal !important; line-height: 1.45; }
.history-loading { padding: 36px !important; color: var(--muted); text-align: center !important; }
.history-status { margin: 12px 0 0; color: var(--red); font-size: 12px; }
.history-report-dialog { width: min(760px, calc(100vw - 32px)); max-width: none; padding: 0; border: 1px solid #cfd8d3; border-radius: 16px; background: #f8faf8; color: #14223a; box-shadow: 0 24px 64px rgba(20,34,58,.24); }
.history-report-dialog::backdrop { background: rgba(20,34,58,.56); }
.history-report-shell { min-height: min(620px, calc(100dvh - 48px)); padding: 18px; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 12px; }
.history-report-header { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.history-report-header > div { min-width: 0; display: grid; gap: 2px; }
.history-report-header strong { font-family: 'Montserrat', sans-serif; font-size: 14px; }
.history-report-header span { color: #68736e; font-size: 10.5px; }
.history-report-close { width: 36px; height: 36px; flex: 0 0 auto; padding: 0; border: 1px solid #d7dfdb; border-radius: 8px; background: #fff; color: #68736e; cursor: pointer; }
.history-report-close:hover { border-color: #aebbb4; color: #14223a; }
.history-report-close:focus-visible, .history-report-nav:focus-visible { outline: 3px solid rgba(45,106,79,.24); outline-offset: 2px; }
.history-report-progress { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.history-report-progress span { height: 3px; border-radius: 2px; background: #d9e0dc; }
.history-report-progress span.is-complete { background: #2d6a4f; }
.history-report-slide { min-height: 430px; padding: clamp(34px, 7vw, 68px); border-radius: 12px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(190px, .7fr); align-items: end; gap: clamp(28px, 6vw, 68px); }
.history-report-slide[data-tone="navy"] { background: #203a48; color: #fff; }
.history-report-slide[data-tone="green"] { background: #285c47; color: #fff; }
.history-report-slide[data-tone="sand"] { background: #eee8d9; color: #20302b; }
.history-report-slide-copy { min-width: 0; }
.history-report-icon { width: 42px; height: 42px; margin-bottom: 28px; border: 1px solid currentColor; border-radius: 10px; display: grid; place-items: center; opacity: .82; }
.history-report-icon i { font-size: 20px; }
.history-report-eyebrow { margin: 0 0 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; opacity: .7; }
.history-report-slide h2 { max-width: 18ch; margin: 0; font-family: 'Montserrat', sans-serif; font-size: clamp(23px, 4vw, 38px); line-height: 1.08; text-wrap: balance; }
.history-report-metric { display: block; margin-top: 28px; font-family: 'Montserrat', sans-serif; font-size: clamp(38px, 7vw, 70px); line-height: .95; font-variant-numeric: tabular-nums; }
.history-report-metric-label { display: block; margin-top: 8px; font-size: 11px; opacity: .7; }
.history-report-body { max-width: 52ch; margin: 22px 0 0; font-size: 13px; line-height: 1.6; text-wrap: pretty; opacity: .82; }
.history-report-facts { margin: 0; align-self: end; }
.history-report-facts div { padding: 15px 0; border-top: 1px solid currentColor; }
.history-report-facts dt { font-size: 10px; opacity: .62; }
.history-report-facts dd { margin: 5px 0 0; font-size: 13px; font-weight: 700; line-height: 1.4; font-variant-numeric: tabular-nums; }
.history-report-footer { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.history-report-footer > span { color: #68736e; font-size: 11px; font-variant-numeric: tabular-nums; }
.history-report-footer > div { display: flex; gap: 7px; }
.history-report-nav { min-height: 38px; padding: 0 12px; border: 1px solid #d7dfdb; border-radius: 8px; background: #fff; color: #20302b; display: inline-flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; cursor: pointer; }
.history-report-nav:hover { border-color: #aebbb4; background: #f2f5f3; }
.history-report-nav:disabled { cursor: default; opacity: .42; }
.history-report-next { border-color: #2d6a4f; background: #2d6a4f; color: #fff; }
.history-report-next:hover { border-color: #245840; background: #245840; }
.history-toast { position: fixed; right: 22px; bottom: 22px; z-index: 400; padding: 10px 13px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: 150ms ease; }
.history-toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 1120px) { .history-overview-grid { grid-template-columns: 1fr; } .history-insight-card dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (max-width: 880px) { .history-workspace { padding-inline: 22px; } .history-summary { grid-template-columns: repeat(2, 1fr); } .history-summary article:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); } .history-summary article:nth-child(4) { border-top: 1px solid var(--line); } .history-card-header { flex-direction: column; } }
@media (max-width: 680px) { .history-workspace { padding: 22px 15px 48px; } .history-intro { align-items: flex-start; flex-direction: column; } .history-actions { width: 100%; flex-wrap: wrap; } .history-range { flex: 1 1 100%; } .history-range select { width: 100%; } .history-actions .history-button { flex: 1; justify-content: center; } .history-summary { grid-template-columns: 1fr; } .history-summary article { min-height: 94px; border-left: 0; border-top: 1px solid var(--line); } .history-summary article:first-child { border-top: 0; } .history-insight-card dl { grid-template-columns: 1fr; gap: 0; } .history-metric-switch { width: 100%; overflow-x: auto; } .history-metric-switch button { flex: 1; } .history-chart-card, .history-ledger { padding: 18px; } .history-report-shell { min-height: calc(100dvh - 20px); padding: 12px; } .history-report-slide { min-height: 0; padding: 28px 24px; grid-template-columns: 1fr; align-items: start; gap: 24px; overflow-y: auto; } .history-report-icon { margin-bottom: 22px; } .history-report-facts { align-self: auto; } .history-report-footer { align-items: flex-end; } .history-report-nav { min-width: 40px; padding-inline: 10px; } }
@media (prefers-reduced-motion: reduce) { .history-toast { transition: none; } }
