/* =========================================================
   AURUM WEALTH — ACCOUNT, PORTFOLIO, PLANNING, AND HISTORY
   Extends the existing design tokens without replacing them.
   ========================================================= */

textarea { width: 100%; padding: 12px; border: 1px solid var(--line-strong); border-radius: 11px; outline: 0; resize: vertical; background: var(--bg-elevated); color: var(--text); font: inherit; line-height: 1.5; }
textarea:focus-visible { box-shadow: var(--focus); }
.wealth-guest [data-panel="home"],.wealth-guest [data-panel="portfolio"],.wealth-guest [data-panel="planning"],.wealth-guest [data-panel="timeline"] { display: none !important; }
.button-danger { border-color: rgba(240,108,117,.34); background: var(--red-soft); color: var(--red); }
.value-positive { color: var(--green) !important; }
.value-negative { color: var(--red) !important; }
.heading-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.heading-actions .button { min-height: 44px; }
.wealth-tab svg, .account-trigger svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

/* Header account */
.account-trigger { display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 4px 11px 4px 5px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text-soft); text-align: left; transition: border-color .2s var(--ease), background-color .2s var(--ease); }
.account-trigger:hover { border-color: var(--line-strong); background: var(--surface-2); }
.account-trigger > svg { width: 16px; height: 16px; color: var(--muted); }
.account-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border: 1px solid rgba(216,173,88,.32); border-radius: 11px; background: linear-gradient(145deg, var(--gold-soft), var(--surface-3)); color: var(--gold-bright); font-size: .72rem; font-weight: 850; }
.account-avatar.large { width: 50px; height: 50px; border-radius: 15px; font-size: .9rem; }
.account-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.account-trigger-copy strong, .account-trigger-copy small { display: block; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-trigger-copy strong { font-size: .72rem; }
.account-trigger-copy small { margin-top: 2px; color: var(--muted); font-size: .57rem; }

/* Guest and authenticated home */
.wealth-guest-state { max-width: 970px; margin: 14px auto 42px; padding: clamp(28px,6vw,72px); border: 1px solid var(--line); border-radius: 28px; background: radial-gradient(circle at 85% 5%, rgba(216,173,88,.12), transparent 35%), linear-gradient(145deg, var(--surface), var(--bg-elevated)); box-shadow: var(--shadow-lg); text-align: center; }
.wealth-guest-state h1 { max-width: 760px; margin: 15px auto 12px; font-size: clamp(2rem,5vw,4rem); letter-spacing: -.055em; line-height: 1.02; }
.wealth-guest-state > p { max-width: 720px; margin: 0 auto; color: var(--muted); font-size: .93rem; line-height: 1.7; }
.wealth-guest-orb { display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 20px; border: 1px solid rgba(216,173,88,.3); border-radius: 21px; background: var(--gold-soft); color: var(--gold); }
.wealth-guest-orb svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.wealth-guest-actions { display: flex; justify-content: center; gap: 10px; margin-top: 28px; }
.privacy-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-top: 38px; text-align: left; }
.privacy-grid > div { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.privacy-grid strong, .privacy-grid span { display: block; }
.privacy-grid strong { font-size: .77rem; }
.privacy-grid span { margin-top: 6px; color: var(--muted); font-size: .66rem; line-height: 1.55; }
.migration-banner { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; padding: 17px 19px; border: 1px solid rgba(216,173,88,.28); border-radius: 16px; background: var(--gold-soft); }
.migration-banner strong, .migration-banner p { display: block; }
.migration-banner strong { margin-top: 5px; font-size: .85rem; }
.migration-banner p { margin: 4px 0 0; color: var(--muted); font-size: .67rem; }
.migration-banner > div:last-child { display: flex; gap: 8px; flex: 0 0 auto; }
.net-worth-hero { display: grid; grid-template-columns: minmax(300px,1.15fr) minmax(0,1.85fr); gap: 14px; }
.net-worth-primary { min-height: 222px; padding: 25px; border-color: rgba(216,173,88,.28); background: radial-gradient(circle at 90% 15%, rgba(216,173,88,.14), transparent 42%), linear-gradient(145deg, var(--surface), var(--bg-elevated)); }
.net-worth-primary > span, .net-worth-primary > small, .hero-change small { display: block; color: var(--muted); }
.net-worth-primary > span { font-size: .72rem; font-weight: 760; text-transform: uppercase; letter-spacing: .08em; }
.net-worth-primary > button { display: block; max-width: 100%; min-height: 54px; margin: 16px 0 4px; padding: 0; border: 0; background: none; text-align: left; }
.net-worth-primary > button strong { display: block; overflow-wrap: anywhere; color: var(--gold-bright); font-size: clamp(1.55rem,3.4vw,2.55rem); font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.net-worth-primary > small { font-size: .63rem; }
.hero-change { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.hero-change span { display: block; font-size: .83rem; font-weight: 780; }
.hero-change small { margin-top: 3px; font-size: .6rem; }
.wealth-kpi-grid, .portfolio-summary-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.wealth-kpi { min-width: 0; padding: 18px; }
.wealth-kpi span, .wealth-kpi small { display: block; color: var(--muted); }
.wealth-kpi span { font-size: .65rem; }
.wealth-kpi strong { display: block; margin: 10px 0 4px; overflow-wrap: anywhere; font-size: .96rem; font-variant-numeric: tabular-nums; }
.wealth-kpi small { font-size: .59rem; }
.wealth-dashboard-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-top: 14px; }
.wealth-chart-card, .wealth-insight-card { min-width: 0; padding: 21px; }
.wealth-insight-card > h2 { margin: 5px 0 15px; font-size: 1rem; }
.insight-list > div { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 44px; border-bottom: 1px solid var(--line); }
.insight-list > div:last-child { border-bottom: 0; }
.insight-list span { color: var(--muted); font-size: .68rem; }
.insight-list strong { max-width: 62%; font-size: .74rem; text-align: right; }

/* Charts */
.chart-stage { display: grid; place-items: center; min-height: 220px; margin-top: 12px; }
.chart-stage.compact { min-height: 190px; }
.chart-stage.large { min-height: 300px; }
.chart-empty { display: grid; place-items: center; width: 100%; min-height: 150px; padding: 20px; border: 1px dashed var(--line-strong); border-radius: 14px; color: var(--muted); font-size: .7rem; text-align: center; }
.donut-chart { width: min(230px,100%); overflow: visible; }
.donut-segment { cursor: pointer; transition: opacity .2s var(--ease), stroke-width .2s var(--ease); }
.donut-segment:hover, .donut-segment:focus-visible { opacity: .82; stroke-width: 18; outline: none; }
.donut-chart text { fill: var(--muted); font-size: 7px; font-family: var(--font); }
.donut-chart .donut-total { fill: var(--text); font-size: 10px; font-weight: 800; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px; }
.chart-legend > span { display: inline-flex; align-items: center; gap: 5px; min-height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; font-size: .59rem; }
.chart-legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--legend-color,var(--gold)); }
.chart-legend b { font-weight: 720; }
.chart-legend small { color: var(--muted); }
.line-chart { width: 100%; height: auto; overflow: visible; }
.chart-grid line { stroke: var(--line); stroke-width: 1; }
.chart-grid text, .axis-label { fill: var(--muted); font-size: 9px; font-family: var(--mono); }
.line-area { fill: rgba(216,173,88,.09); }
.net-worth-line { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.line-point { fill: var(--surface); stroke: var(--gold-bright); stroke-width: 2; cursor: pointer; }
.line-point:hover, .line-point:focus-visible { r: 6px; outline: none; }
.flow-baseline { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 4; }
.flow-bar { opacity: .72; cursor: pointer; transition: opacity .18s var(--ease); }
.flow-bar.market { fill: var(--green); }
.flow-bar.capital { fill: var(--blue); }
.flow-bar.is-negative { fill: var(--red); }
.flow-bar:hover, .flow-bar:focus-visible { opacity: 1; outline: none; }
.flow-label { fill: var(--muted); font-family: var(--mono); font-size: 7px; letter-spacing: .08em; }
.legend-dot.net { --legend-color: var(--gold); }.legend-dot.market { --legend-color: var(--green); }.legend-dot.capital { --legend-color: var(--blue); }

/* Portfolio */
.auth-required-inline { display: flex; align-items: center; gap: 16px; padding: 20px; border: 1px dashed var(--line-strong); border-radius: 17px; background: var(--surface); }
.auth-required-inline > svg { flex: 0 0 auto; width: 32px; height: 32px; fill: none; stroke: var(--gold); stroke-width: 1.5; }
.auth-required-inline > div { min-width: 0; flex: 1; }
.auth-required-inline strong { font-size: .87rem; }
.auth-required-inline p { margin: 4px 0 0; color: var(--muted); font-size: .69rem; }
.portfolio-summary-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
.portfolio-main-grid { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(300px,.7fr); gap: 14px; margin-top: 14px; }
.asset-register-card, .journal-card { padding: 21px; }
.asset-basket-card { margin-top: 14px; padding: 20px; border-color: rgba(216,173,88,.24); background: radial-gradient(circle at 96% 0,rgba(216,173,88,.1),transparent 36%),var(--surface); }
.asset-basket-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.asset-basket-head h2 { margin: 5px 0 4px; font-size: 1rem; }
.asset-basket-head p { max-width: 650px; margin: 0; color: var(--muted); font-size: .67rem; line-height: 1.55; }
.asset-basket-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex: 0 0 auto; }
.asset-basket-actions .button { min-height: 44px; }
.asset-basket-metrics { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 9px; margin-top: 16px; }
.asset-basket-metrics > div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.asset-basket-metrics span,.asset-basket-metrics strong { display: block; }
.asset-basket-metrics span { color: var(--muted); font-size: .57rem; }
.asset-basket-metrics strong { margin-top: 6px; overflow-wrap: anywhere; font-size: .72rem; font-variant-numeric: tabular-nums; }
.portfolio-side-stack { display: grid; align-content: start; gap: 14px; }
.portfolio-empty { display: grid; justify-items: center; padding: 50px 20px; text-align: center; }
.portfolio-empty[hidden] { display: none; }
.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-2); color: var(--gold); }
.empty-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; }
.portfolio-empty strong { font-size: .92rem; }
.portfolio-empty p { margin: 6px 0 18px; color: var(--muted); font-size: .69rem; }
.asset-list { display: grid; gap: 10px; margin-top: 15px; }
.asset-row { display: grid; grid-template-columns: minmax(170px,1.5fr) repeat(4,minmax(105px,1fr)); gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.asset-row > div { min-width: 0; }
.asset-row > div:not(.asset-row-head):not(.asset-row-actions) span { display: block; color: var(--muted); font-size: .56rem; }
.asset-row > div:not(.asset-row-head):not(.asset-row-actions) strong { display: block; margin-top: 4px; overflow-wrap: anywhere; font-size: .67rem; font-variant-numeric: tabular-nums; }
.asset-row-head { display: flex; align-items: center; gap: 10px; }
.asset-select-control { display: grid; place-items: center; flex: 0 0 44px; width: 44px; min-height: 44px; margin: 0; cursor: pointer; }
.asset-select-control input { width: 20px; height: 20px; margin: 0; accent-color: var(--gold); cursor: pointer; }
.asset-row-head strong, .asset-row-head small { display: block; }
.asset-row-head strong { font-size: .78rem; }
.asset-row-head small { margin-top: 3px; color: var(--muted); font-size: .55rem; }
.asset-row-head .asset-specification { max-width: 440px; margin-top: 6px; color: var(--text-soft); line-height: 1.45; }
.asset-type-mark { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; background: var(--gold-soft); color: var(--gold); font-size: .63rem; font-weight: 850; }
.asset-row-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; padding-top: 7px; border-top: 1px solid var(--line); }
.text-button.danger { color: var(--red); }

/* Asset-specific forms and selected-asset reporting */
.asset-detail-fields { min-width: 0; margin: 2px 0 0; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.asset-detail-fields legend { display: inline-flex; align-items: center; gap: 7px; padding: 0 7px; color: var(--text-soft); font-size: .72rem; font-weight: 780; }
.asset-detail-fields legend svg { width: 17px; height: 17px; fill: none; stroke: var(--gold); stroke-width: 1.7; }
.asset-detail-fields .form-grid:first-of-type { margin-top: 9px; }
.asset-detail-fields .form-grid { margin-top: 12px; }
.service-status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.service-status-row span { color: var(--muted); font-size: .62rem; }
.service-status-row strong { font-size: .64rem; text-align: right; }
.account-service-note { margin: 12px 0; padding: 11px 12px; border: 1px solid rgba(240,174,70,.28); border-radius: 11px; background: rgba(240,174,70,.08); }
.account-service-note strong,.account-service-note span { display: block; }
.account-service-note strong { color: var(--gold-bright); font-size: .7rem; }
.account-service-note span { margin-top: 4px; color: var(--muted); font-size: .61rem; line-height: 1.5; }
.report-modal-card { width: min(980px,100%); }
.report-title-row p { margin: 5px 0 0; color: var(--muted); font-size: .61rem; }
.report-brand { display: none; align-items: center; gap: 12px; margin: 8px 0 18px; }
.report-brand img { width: 56px; height: 56px; object-fit: contain; }
.report-brand strong,.report-brand span { display: block; }
.report-brand strong { color: #082b63; font-size: 1rem; letter-spacing: .08em; }
.report-brand span { margin-top: 3px; color: #475569; font-size: .65rem; }
.asset-report-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; margin: 16px 0; }
.asset-report-summary > div { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.asset-report-summary span,.asset-report-summary strong { display: block; }
.asset-report-summary span { color: var(--muted); font-size: .57rem; }
.asset-report-summary strong { margin-top: 6px; overflow-wrap: anywhere; font-size: .75rem; font-variant-numeric: tabular-nums; }
.asset-report-table { display: grid; gap: 9px; }
.asset-report-row { display: grid; grid-template-columns: minmax(180px,1.4fr) repeat(4,minmax(105px,1fr)); align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.asset-report-row > div { min-width: 0; }
.asset-report-row > div:not(.report-asset-name) span,.asset-report-row small { display: block; color: var(--muted); font-size: .55rem; }
.asset-report-row > div:not(.report-asset-name) strong { display: block; margin-top: 4px; overflow-wrap: anywhere; font-size: .67rem; }
.report-asset-name { display: flex; align-items: center; gap: 10px; }
.report-asset-name strong,.report-asset-name small { display: block; }
.report-asset-name strong { font-size: .76rem; }
.report-asset-name small { margin-top: 3px; line-height: 1.4; }
.report-privacy-note { margin: 15px 0 0; padding: 11px 12px; border-left: 2px solid var(--gold); background: var(--gold-soft); color: var(--muted); font-size: .6rem; line-height: 1.55; }
.allocation-cards { display: grid; gap: 7px; margin-top: 12px; }
.allocation-cards > div { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.allocation-cards span { color: var(--muted); font-size: .63rem; }
.allocation-cards strong { font-size: .7rem; }
.allocation-cards small { grid-column: 1 / -1; color: var(--muted); font-size: .55rem; }
.concentration-card { padding: 20px; }
.concentration-card h2 { margin: 5px 0 14px; font-size: 1rem; }
.concentration-card > small { display: block; margin-top: 13px; color: var(--muted); font-size: .6rem; line-height: 1.5; }
.warning-list { display: grid; gap: 8px; }
.warning-list > p { color: var(--muted); font-size: .68rem; }
.concentration-warning { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.concentration-warning strong { grid-row: 1 / 3; align-self: center; min-width: 54px; font-size: .85rem; }
.concentration-warning span { font-size: .69rem; font-weight: 750; }
.concentration-warning small { color: var(--muted); font-size: .56rem; }
.concentration-warning.high, .concentration-warning.very-high { border-color: rgba(240,108,117,.23); background: var(--red-soft); }
.journal-card { margin-top: 14px; }
.journal-summary { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 9px; margin-top: 16px; }
.journal-summary > div { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.journal-summary span, .journal-summary strong { display: block; }
.journal-summary span { color: var(--muted); font-size: .6rem; }
.journal-summary strong { margin-top: 5px; font-size: .75rem; }
.journal-list { display: grid; gap: 8px; margin-top: 14px; }
.journal-list > article { display: grid; grid-template-columns: minmax(170px,1.4fr) repeat(3,minmax(110px,1fr)) auto; align-items: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line); }
.journal-list strong, .journal-list small, .journal-list span { display: block; }
.journal-list > article > div > span { color: var(--muted); font-size: .56rem; }
.journal-list > article > div > strong { margin-top: 3px; font-size: .68rem; }
.journal-list small { margin-top: 3px; color: var(--muted); font-size: .56rem; }

/* Planning */
.planning-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.planning-card, .rebalancing-card { padding: 22px; }
.planning-results { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-top: 15px; }
.planning-results > div { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.planning-results span, .planning-results strong { display: block; }
.planning-results span { color: var(--muted); font-size: .6rem; }
.planning-results strong { margin-top: 5px; font-size: .77rem; }
.target-mode { display: flex; }
.target-mode .segment { flex: 1; }
.planner-rows { display: grid; gap: 8px; margin-top: 16px; }
.planner-row { display: grid; grid-template-columns: minmax(130px,1fr) 105px minmax(105px,.8fr) minmax(105px,.8fr); align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.planner-row strong, .planner-row small, .planner-row span { display: block; }
.planner-row > div:first-child strong { font-size: .7rem; }
.planner-row > div:first-child small, .planner-row > div:not(:first-child) span { margin-top: 3px; color: var(--muted); font-size: .53rem; }
.planner-row > div:not(:first-child) strong { margin-top: 3px; font-size: .64rem; }
.planner-row label { margin: 0; }
.planner-row label > span { margin-bottom: 4px; font-size: .53rem; }
.planner-row .input-shell { min-height: 40px; }
.allocation-total { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin-top: 13px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.allocation-total span { color: var(--muted); font-size: .62rem; }
.allocation-total strong { font-size: .75rem; }
.allocation-total small { grid-column: 1 / -1; color: var(--muted); font-size: .55rem; }
.allocation-total.is-valid { border-color: rgba(78,210,154,.3); background: var(--green-soft); }
.allocation-total.is-invalid { border-color: rgba(240,108,117,.24); background: var(--red-soft); }
.rebalancing-card { margin-top: 14px; }
.rebalance-controls { display: grid; grid-template-columns: auto minmax(220px,.6fr) auto; align-items: end; gap: 12px; margin-top: 18px; }
.target-allocation-editor { margin-top: 18px; }
.target-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.target-editor-head strong, .target-editor-head small { display: block; }
.target-editor-head strong { font-size: .78rem; }
.target-editor-head small { margin-top: 3px; color: var(--muted); font-size: .58rem; }
.target-editor-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; margin-top: 12px; }
.target-editor-grid label { margin: 0; }
.target-editor-grid label > span { display: block; margin-bottom: 5px; font-size: .59rem; }
.rebalance-results { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; margin-top: 17px; }
.rebalance-action { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.rebalance-action span, .rebalance-action strong, .rebalance-action b, .rebalance-action small { display: block; }
.rebalance-action span { color: var(--muted); font-size: .58rem; }
.rebalance-action strong { margin-top: 7px; font-size: .62rem; letter-spacing: .08em; }
.rebalance-action b { margin-top: 4px; font-size: .76rem; }
.rebalance-action small { margin-top: 4px; color: var(--muted); font-size: .54rem; }
.rebalance-action.buy, .rebalance-action.add { border-color: rgba(78,210,154,.26); background: var(--green-soft); }
.rebalance-action.sell { border-color: rgba(240,108,117,.24); background: var(--red-soft); }
.calculation-disclaimer { margin: 14px 0 0; color: var(--muted); font-size: .61rem; }

/* History and timeline */
.history-card, .timeline-card { padding: 22px; }
.history-head, .timeline-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.history-head h2, .timeline-toolbar h2 { margin: 5px 0 0; font-size: 1.05rem; }
.history-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; margin-top: 17px; }
.history-metrics > div { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.history-metrics span, .history-metrics strong { display: block; }
.history-metrics span { color: var(--muted); font-size: .58rem; }
.history-metrics strong { margin-top: 4px; font-size: .75rem; }
.timeline-card { margin-top: 14px; }
.timeline-filters { display: grid; grid-template-columns: minmax(180px,1.4fr) minmax(130px,.8fr) 140px 140px; gap: 8px; }
.timeline-filters input, .timeline-filters select { min-height: 44px; }
.timeline-empty { padding: 32px 16px; color: var(--muted); text-align: center; }
.timeline-empty strong { color: var(--text-soft); font-size: .81rem; }
.timeline-empty p { margin: 5px 0 0; font-size: .65rem; }
.timeline-list { margin-top: 18px; }
.timeline-event { display: grid; grid-template-columns: 66px 18px minmax(0,1fr); gap: 10px; min-height: 98px; }
.timeline-date { text-align: right; }
.timeline-date strong, .timeline-date span { display: block; }
.timeline-date strong { font-size: 1.05rem; }
.timeline-date span { color: var(--muted); font-size: .54rem; }
.timeline-rail { position: relative; display: flex; justify-content: center; }
.timeline-rail::before { content: ""; position: absolute; top: 17px; bottom: 0; width: 1px; background: var(--line-strong); }
.timeline-rail span { position: relative; z-index: 1; width: 9px; height: 9px; margin-top: 7px; border: 2px solid var(--surface); border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.timeline-event-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.event-category { color: var(--gold); font-size: .53rem; font-weight: 800; letter-spacing: .08em; }
.timeline-event-card h3 { margin: 4px 0 0; font-size: .76rem; }
.timeline-event-card p { margin: 5px 0 0; color: var(--muted); font-size: .61rem; }
.timeline-event-card > strong { flex: 0 0 auto; font-size: .69rem; }
.mini-timeline { margin-top: 12px; }
.mini-timeline > div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; min-height: 45px; border-bottom: 1px solid var(--line); }
.mini-timeline > div:last-child { border-bottom: 0; }
.event-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.mini-timeline strong, .mini-timeline small { display: block; }
.mini-timeline strong { font-size: .68rem; }
.mini-timeline small { margin-top: 2px; color: var(--muted); font-size: .54rem; }
.mini-timeline b { font-size: .63rem; }

/* Account drawer */
.account-drawer-backdrop { position: fixed; z-index: 510; inset: 0; background: rgba(1,5,12,.64); backdrop-filter: blur(5px); }
.account-drawer { position: fixed; z-index: 520; top: 0; right: 0; width: min(430px,100vw); height: 100dvh; padding: 18px 18px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; border-left: 1px solid var(--line-strong); background: var(--bg-elevated); box-shadow: -24px 0 70px rgba(0,0,0,.42); transform: translateX(105%); transition: transform .25s var(--ease); }
.account-drawer.is-open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.drawer-head > div { display: flex; align-items: center; gap: 11px; }
.drawer-head strong, .drawer-head small { display: block; }
.drawer-head strong { font-size: .84rem; }
.drawer-head small { margin-top: 3px; color: var(--muted); font-size: .62rem; }
#drawer-guest { padding: 24px 0; }
#drawer-guest p { color: var(--muted); font-size: .73rem; line-height: 1.6; }
#drawer-guest .button { width: 100%; margin-top: 8px; }
.account-status-row { display: flex; align-items: center; gap: 9px; padding: 15px 0; color: var(--muted); font-size: .63rem; }
.profile-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-bottom: 14px; }
.profile-meta > div { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.profile-meta span, .profile-meta strong { display: block; }
.profile-meta span { color: var(--muted); font-size: .55rem; }
.profile-meta strong { margin-top: 4px; font-size: .62rem; }
.account-nav { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-bottom: 14px; }
.account-nav button { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--text-soft); font-size: .66rem; font-weight: 720; text-align: left; }
.account-nav svg { width: 17px; height: 17px; fill: none; stroke: var(--gold); }
.account-section { margin-top: 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.account-section summary { min-height: 48px; padding: 15px; font-size: .72rem; font-weight: 780; }
.account-section[open] summary { border-bottom: 1px solid var(--line); }
.account-section > form, .account-section > div, .account-section > p, .account-section > button { margin-inline: 14px; }
.account-section > form, .account-section > div { padding-bottom: 14px; }
.account-section > p { color: var(--muted); font-size: .64rem; }
.check-row { display: flex; align-items: flex-start; width: 100%; min-width: 0; gap: 10px; margin: 0; color: var(--text-soft); font-size: .72rem; line-height: 1.45; }
.check-row input[type="checkbox"] { flex: 0 0 22px; width: 22px; min-width: 22px; height: 22px; min-height: 22px; margin: 0; padding: 0; }
.check-row span { flex: 1 1 auto; min-width: 0; padding-top: 1px; overflow-wrap: anywhere; }
.asset-capital-check { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.security-summary { display: grid; grid-template-columns: 1fr auto; gap: 9px; padding-top: 14px; font-size: .66rem; }
.security-summary span { color: var(--muted); }
.security-actions, .export-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; }
.account-mini-title { display: block; margin: 9px 0; color: var(--muted); font-size: .58rem; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.security-subform + .security-subform { padding-top: 14px; border-top: 1px solid var(--line); }
.device-list { display: grid; gap: 7px; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.device-row strong, .device-row small { display: block; }
.device-row strong { font-size: .63rem; }
.device-row small { margin-top: 3px; color: var(--muted); font-size: .53rem; }
.device-row > div:last-child { display: flex; gap: 4px; }
.export-actions .button, .export-actions select { flex: 1 1 150px; }
.drawer-logout { width: 100%; margin-top: 16px; }
.snapshot-action { display: grid; grid-template-columns: minmax(170px,220px) auto; align-items: end; gap: 8px; }
.snapshot-action > label { grid-column: 1 / -1; color: var(--muted); font-size: .62rem; font-weight: 680; }
.snapshot-action .input-shell input { min-height: 44px; }

/* Modals and authentication */
.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; z-index: 600; inset: 0; display: grid; place-items: center; padding: max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left)); overflow-y: auto; background: rgba(1,5,12,.72); backdrop-filter: blur(9px); opacity: 0; transition: opacity .18s var(--ease); }
.modal-backdrop.is-open { opacity: 1; }
.modal-card { position: relative; width: min(620px,100%); max-height: calc(100dvh - 32px); padding: 24px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 21px; background: var(--bg-elevated); box-shadow: 0 28px 90px rgba(0,0,0,.55); transform: translateY(10px) scale(.99); transition: transform .2s var(--ease); }
.modal-backdrop.is-open .modal-card { transform: none; }
.form-modal { width: min(760px,100%); }
.compact-modal { width: min(430px,100%); text-align: center; }
.compact-modal > p { color: var(--muted); font-size: .7rem; line-height: 1.6; }
.modal-close { position: absolute; z-index: 1; top: 16px; right: 16px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-head h2 { margin: 5px 0 0; font-size: 1.1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 8px; }
.modal-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 13px; border: 1px solid rgba(216,173,88,.28); border-radius: 18px; background: var(--gold-soft); color: var(--gold); }
.modal-icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; }
.auth-card { width: min(590px,100%); }
.auth-brand { display: flex; align-items: center; gap: 11px; padding-right: 48px; }
.auth-brand > div:last-child span, .auth-brand > div:last-child strong { display: block; }
.auth-brand span { color: var(--muted); font-size: .59rem; text-transform: uppercase; letter-spacing: .08em; }
.auth-brand strong { margin-top: 3px; font-size: .83rem; letter-spacing: .08em; }
.auth-tabs { display: flex; margin: 22px 0; }
.auth-tabs .segment { flex: 1; }
.auth-view h2 { margin: 0; font-size: 1.55rem; }
.auth-view > p { margin: 6px 0 0; color: var(--muted); font-size: .7rem; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: .6rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.google-button, .passkey-login-button { width: 100%; margin-top: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); }
.google-mark { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: #fff; color: #4285f4; font-size: .82rem; font-weight: 900; }
.guest-link { display: block; min-height: 44px; margin: 16px auto -8px; border: 0; background: none; color: var(--muted); font-size: .62rem; }
.auth-mfa-view { text-align: center; }
.auth-mfa-view .settings-fields { max-width: 390px; margin-inline: auto; text-align: left; }
.mfa-shield { display: grid; place-items: center; width: 56px; height: 56px; margin: 2px auto 14px; border: 1px solid rgba(216,173,88,.32); border-radius: 18px; background: var(--gold-soft); color: var(--gold); }
.mfa-shield svg { width: 27px; height: 27px; }
.otp-input { width: 100%; min-height: 54px; letter-spacing: .38em; font-family: var(--mono); font-size: 1.2rem; font-weight: 800; text-align: center; }
.totp-modal-card { width: min(720px,100%); }
.totp-intro { max-width: 600px; color: var(--muted); font-size: .72rem; line-height: 1.65; }
.totp-setup-grid { display: grid; grid-template-columns: minmax(220px,280px) 1fr; align-items: center; gap: 20px; margin: 20px 0; }
.totp-qr-frame { overflow: hidden; padding: 11px; border: 1px solid rgba(216,173,88,.35); border-radius: 18px; background: #fff; box-shadow: var(--shadow-sm); }
.totp-qr-frame img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
.totp-manual { min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.totp-manual span, .totp-manual small { display: block; color: var(--muted); font-size: .62rem; }
.totp-manual p { margin: 5px 0 12px; color: var(--text-soft); font-size: .72rem; }
.totp-manual code { display: block; overflow-wrap: anywhere; color: var(--gold-bright); font-size: .76rem; font-weight: 800; letter-spacing: .09em; line-height: 1.6; }
.totp-manual .text-button { margin: 9px 0; }
.recovery-success, .security-callout { display: flex; align-items: flex-start; gap: 12px; margin: 18px 0; padding: 15px; border: 1px solid rgba(78,210,154,.25); border-radius: 14px; background: var(--green-soft); }
.recovery-success svg { flex: 0 0 auto; color: var(--green); }
.recovery-success strong, .recovery-success span { display: block; }
.recovery-success span, .security-callout p { margin: 4px 0 0; color: var(--muted); font-size: .67rem; line-height: 1.55; }
.recovery-code-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.recovery-code-grid code { padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-size: .72rem; font-weight: 750; letter-spacing: .08em; text-align: center; }
.security-callout { display: block; border-color: rgba(216,173,88,.25); background: var(--gold-soft); }
.danger-zone { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

/* Responsive wealth layout */
@media (max-width: 1180px) {
  .portfolio-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .portfolio-main-grid { grid-template-columns: 1fr; }
  .portfolio-side-stack { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .asset-row { grid-template-columns: minmax(170px,1.3fr) repeat(3,minmax(105px,1fr)); }
  .asset-basket-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .asset-report-row { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .report-asset-name { grid-column: 1 / -1; }
  .target-editor-grid, .rebalance-results { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 900px) {
  .net-worth-hero { grid-template-columns: 1fr; }
  .wealth-dashboard-grid { grid-template-columns: 1fr; }
  .planning-grid { grid-template-columns: 1fr; }
  .asset-row { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .asset-row-head { grid-column: 1 / -1; }
  .timeline-toolbar { flex-direction: column; }
  .timeline-filters { width: 100%; grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 760px) {
  .privacy-grid, .portfolio-side-stack { grid-template-columns: 1fr; }
  .migration-banner { align-items: stretch; flex-direction: column; }
  .migration-banner > div:last-child { justify-content: flex-end; }
  .journal-summary, .history-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .journal-list > article { grid-template-columns: repeat(2,minmax(0,1fr)); border: 1px solid var(--line); border-radius: 12px; }
  .journal-list > article > div:first-child { grid-column: 1 / -1; }
  .asset-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .asset-basket-head { flex-direction: column; }
  .asset-basket-actions { width: 100%; justify-content: stretch; }
  .asset-basket-actions .button { flex: 1; }
  .asset-basket-metrics,.asset-report-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .asset-report-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .rebalance-controls { grid-template-columns: 1fr; align-items: stretch; }
  .target-editor-grid, .rebalance-results { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .planner-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .planner-row > div:first-child { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .tab-nav .tab-button:not([data-mobile-primary]) { display: none; }
  .tab-nav .tab-button[data-mobile-primary] { display: flex; flex: 1 1 20%; min-width: 0; }
  .account-trigger { width: 42px; min-height: 42px; padding: 3px; border: 0; background: transparent; }
  .account-trigger-copy, .account-trigger > svg { display: none; }
  .account-avatar { width: 38px; height: 38px; border-radius: 12px; }
  .wealth-guest-state { margin-top: 0; padding: 29px 18px; border-radius: 20px; }
  .wealth-guest-state h1 { font-size: 2rem; }
  .wealth-guest-state > p { font-size: .79rem; }
  .wealth-guest-actions { align-items: stretch; flex-direction: column; }
  .privacy-grid { margin-top: 25px; }
  .heading-actions { width: 100%; justify-content: stretch; }
  .heading-actions .button { flex: 1; }
  .snapshot-action { width: 100%; grid-template-columns: 1fr; }
  .snapshot-action > label { grid-column: 1; }
  .snapshot-action .button { width: 100%; }
  .net-worth-primary { min-height: 205px; padding: 20px; }
  .wealth-kpi-grid, .portfolio-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .wealth-chart-card, .wealth-insight-card, .asset-register-card, .journal-card, .planning-card, .rebalancing-card, .history-card, .timeline-card { padding: 18px; }
  .auth-required-inline { align-items: flex-start; flex-wrap: wrap; }
  .auth-required-inline .button { width: 100%; }
  .asset-row { padding: 13px; }
  .timeline-filters { grid-template-columns: 1fr; }
  .history-head { align-items: stretch; flex-direction: column; }
  .history-head .segmented { width: 100%; }
  .history-head .segment { flex: 1; min-width: 44px; padding-inline: 7px; }
  .timeline-event { grid-template-columns: 45px 12px minmax(0,1fr); gap: 7px; }
  .timeline-event-card { align-items: stretch; flex-direction: column; }
  .modal-backdrop { place-items: end center; padding: 0; }
  .modal-card { width: 100%; max-height: min(92dvh,900px); padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 22px 22px 0 0; transform: translateY(28px); }
  .modal-actions { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); margin-inline: -16px; padding: 11px 16px calc(11px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg-elevated); }
  .modal-actions .button { flex: 1; }
  .asset-capital-check { align-items: flex-start; font-size: .78rem; }
  .account-drawer { padding-inline: 14px; }
  .totp-setup-grid { grid-template-columns: 1fr; }
  .totp-qr-frame { width: min(280px,100%); margin-inline: auto; }
}

@media (max-width: 520px) {
  .wealth-kpi-grid, .portfolio-summary-grid { grid-template-columns: 1fr; }
  .wealth-kpi { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 3px 12px; align-items: center; }
  .wealth-kpi strong { grid-column: 2; grid-row: 1 / 3; margin: 0; text-align: right; }
  .wealth-kpi small { grid-column: 1; }
  .asset-row { grid-template-columns: 1fr; }
  .asset-row-head, .asset-row-actions { grid-column: 1; }
  .asset-row-actions { display: grid; grid-template-columns: repeat(3,1fr); }
  .asset-basket-card { padding: 16px; }
  .asset-basket-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .asset-basket-actions .button { grid-column: 1 / -1; }
  .asset-basket-metrics,.asset-report-summary,.asset-report-row { grid-template-columns: 1fr; }
  .report-asset-name { grid-column: 1; }
  .planning-results, .journal-summary, .history-metrics, .target-editor-grid, .rebalance-results { grid-template-columns: 1fr; }
  .planner-row { grid-template-columns: 1fr; }
  .planner-row > div:first-child { grid-column: 1; }
  .target-editor-head { align-items: stretch; flex-direction: column; }
  .account-nav { grid-template-columns: 1fr; }
  .auth-view .form-grid, .form-modal .form-grid { grid-template-columns: 1fr; }
  .migration-banner > div:last-child { display: grid; }
  .recovery-code-grid { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .header-actions .account-trigger { margin-right: -2px; }
  .wealth-guest-state h1 { font-size: 1.75rem; }
  .net-worth-primary > button strong { font-size: 1.35rem; }
  .tab-nav .tab-button[data-mobile-primary] { font-size: .56rem; }
}

@media (max-width: 950px) and (max-height: 520px) {
  .tab-nav .tab-button:not([data-mobile-primary]) { display: none; }
  .tab-nav .tab-button[data-mobile-primary] { display: flex; flex: 1 1 20%; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .account-drawer, .modal-backdrop, .modal-card, .donut-segment, .flow-bar { transition: none !important; }
}

@media print {
  body.printing-asset-report { padding: 0 !important; background: #fff !important; color: #111827 !important; }
  body.printing-asset-report > *:not(#asset-report-modal) { display: none !important; }
  body.printing-asset-report #asset-report-modal { position: static !important; display: block !important; padding: 0 !important; overflow: visible !important; background: #fff !important; opacity: 1 !important; }
  body.printing-asset-report .report-modal-card { width: 100% !important; max-height: none !important; padding: 12mm !important; overflow: visible !important; border: 0 !important; border-radius: 0 !important; background: #fff !important; color: #111827 !important; box-shadow: none !important; transform: none !important; }
  body.printing-asset-report .report-title-row .icon-button,body.printing-asset-report .report-actions { display: none !important; }
  body.printing-asset-report .report-brand { display: flex; }
  body.printing-asset-report .asset-report-summary > div,body.printing-asset-report .asset-report-row { break-inside: avoid; border-color: #d7dee8 !important; background: #fff !important; }
  body.printing-asset-report .asset-report-summary span,body.printing-asset-report .asset-report-row span,body.printing-asset-report .asset-report-row small,body.printing-asset-report .report-title-row p,body.printing-asset-report .report-privacy-note { color: #475569 !important; }
  body.printing-asset-report .asset-type-mark { border: 1px solid #d5ad58; background: #fff7df !important; color: #7b570e !important; }
  body.printing-asset-report .report-privacy-note { border-color: #d5ad58 !important; background: #fffaf0 !important; }
}
