/* calculator.css
   Owner: calculator/dashboard-specific composition (dashboard shell, metric
   cards, advisor panel, decision calculator). Kept as one contiguous block
   from the original "Dashboard redesign layer" section so its source-order
   overrides of shared components.css rules (equal specificity, later wins)
   are preserved now that they live in separate files. */

.dashboard-body {
    min-height: 100dvh;
    overflow-x: hidden;
    background:
        linear-gradient(180deg, var(--surface-tint-nav), var(--page-background-strong)),
        var(--dash-bg);
    color: var(--dash-heading);
    font-family: var(--font-sans);
    letter-spacing: 0;
    line-height: 1.5;
    background-image: none;
}

.advisor-panel,
.dashboard-header,
.dashboard-card,
.metric-card {
    background-image: linear-gradient(180deg, var(--surface-tint-panel), var(--surface-strong));
}

.dashboard-card,
.metric-card {
    contain: layout paint;
}

.dashboard-body .noise {
    opacity: 0.018;
    mix-blend-mode: multiply;
}

[data-theme="dark"].dashboard-body .noise {
    mix-blend-mode: screen;
}

.dashboard-shell {
    position: relative;
    z-index: 3;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 340px;
    gap: 16px;
    width: 100%;
    min-height: 100dvh;
    padding: 16px;
}

.advisor-panel {
    position: sticky;
    top: 16px;
    height: calc(100dvh - 32px);
    overflow: hidden;
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    box-shadow: var(--dash-shadow);
}

.dashboard-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 6px 18px;
    color: var(--dash-heading);
}

.dashboard-logo {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--dash-primary);
    color: var(--surface-solid);
    font-size: 16px;
    font-weight: 800;
}

.dashboard-brand strong,
.dashboard-brand small {
    display: block;
}

.dashboard-brand strong {
    font-size: 17px;
    line-height: 1;
    letter-spacing: -0.025em;
}

.dashboard-brand small {
    margin-top: 3px;
    color: var(--dash-muted);
    font-size: 11px;
    font-weight: 600;
}

.dashboard-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 2px;
}

.dashboard-nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 44px;
    padding: 9px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--dash-muted);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.dashboard-nav-link span {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 6px;
    background: var(--dash-hover);
    color: var(--dash-subtle);
    font-size: 10px;
    font-weight: 800;
}

.dashboard-nav-link:hover,
.dashboard-nav-link:focus-visible {
    background: var(--dash-hover);
    color: var(--dash-heading);
    transform: translateY(-1px);
    outline: none;
}

.dashboard-nav-link.active,
.dashboard-nav-link.active-mode {
    background: var(--dash-primary-soft);
    color: var(--dash-primary) !important;
}

.dashboard-nav-link.active span,
.dashboard-nav-link.active-mode span {
    background: var(--dash-primary);
    color: var(--surface-solid);
}

.theme-toggle {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 9px 10px;
    border-radius: 8px;
    border: 0;
    background: transparent;
    color: var(--dash-muted);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
}

.theme-toggle {
    justify-content: space-between;
    width: 100%;
    background: var(--dash-hover);
    cursor: pointer;
}

.theme-toggle .sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun {
    display: inline;
}

[data-theme="dark"] .theme-toggle .moon {
    display: none;
}

.dashboard-main {
    display: grid;
    gap: 20px;
    width: min(100%, 860px);
    max-width: 860px;
    margin: 0 auto;
    padding: 4px 0 40px;
}

.dashboard-header,
.dashboard-card,
.metric-card {
    background: var(--dash-surface);
    border: 1px solid var(--dash-border);
    border-radius: var(--dash-radius);
    box-shadow: var(--dash-shadow);
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px;
}

.dashboard-header h1 {
    max-width: 620px;
    margin-top: 5px;
    color: var(--dash-heading);
    font-size: 22px;
    font-weight: 800;
    line-height: 1.18;
    letter-spacing: -0.025em;
    text-wrap: balance;
    font-family: var(--font-display);
}

.dashboard-header p {
    max-width: 58ch;
    margin-top: 7px;
    color: var(--dash-muted);
    font-size: 13px;
}

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.date-selector,
.export-button,
.dashboard-body .button-primary,
.dashboard-body .button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--dash-border);
    font-size: 12px;
    font-weight: 700;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.date-selector,
.dashboard-body .button-secondary {
    background: var(--dash-surface);
    color: var(--dash-heading);
}

.export-button,
.dashboard-body .button-primary {
    background: var(--dash-primary);
    border-color: var(--dash-primary);
    color: var(--surface-solid);
}

.date-selector:hover,
.export-button:hover,
.dashboard-body .button-primary:hover,
.dashboard-body .button-secondary:hover,
.advisor-option:hover,
.resources-table a:hover {
    transform: translateY(-1px);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.metric-card {
    min-width: 0;
    position: relative;
    padding: 20px;
    animation: fadeInUp 0.5s ease-out both;
}

.metric-card:nth-child(2) {
    animation-delay: 0.05s;
}

.metric-card:nth-child(3) {
    animation-delay: 0.1s;
}

.metric-card-header,
.dashboard-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.metric-card-header > span:first-child {
    max-width: 100%;
    padding-right: 44px;
    color: var(--dash-muted);
    font-size: 12px;
    font-weight: 600;
}

.metric-icon {
    display: grid;
    place-items: center;
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
}

.metric-icon-primary {
    background: var(--dash-primary-soft);
    color: var(--dash-primary);
}

.metric-icon-secondary {
    background: var(--dash-secondary-soft);
    color: var(--dash-secondary);
}

.metric-icon-muted {
    background: var(--dash-hover);
    color: var(--dash-muted);
}

.metric-value {
    display: block;
    max-width: 100%;
    margin-top: 16px;
    color: var(--dash-heading);
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.035em;
    overflow-wrap: anywhere;
}

.metric-value-sm {
    font-size: 24px;
}

.trend-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: max-content;
    margin-top: 12px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.trend-positive {
    background: var(--status-success-background);
    color: var(--dash-primary);
}

.trend-neutral {
    background: var(--dash-hover);
    color: var(--dash-muted);
}

.trend-warning {
    background: var(--dash-secondary-soft);
    color: var(--dash-secondary);
}

.trend-danger {
    background: var(--status-danger-background);
    color: var(--dash-danger);
}

.dashboard-card {
    padding: 20px;
    animation: fadeInUp 0.5s ease-out both;
}

.dashboard-card h2,
.dashboard-card h3 {
    color: var(--dash-heading);
    font-weight: 800;
    letter-spacing: -0.025em;
}

.dashboard-card h2 {
    font-size: 18px;
}

.dashboard-card h3 {
    font-size: 16px;
}

.section-kicker {
    color: var(--dash-subtle);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.currency-group,
.segmented-control {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border-radius: 10px;
    background: var(--dash-hover);
}

.currency-btn {
    display: grid;
    place-items: center;
    width: 44px;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--dash-muted);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.currency-btn.bg-emerald-500,
.currency-btn.text-white {
    background: var(--dash-primary);
    color: var(--surface-solid);
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 18px 0 20px;
}

.preset-button {
    width: 100%;
    min-height: 82px;
    padding: 12px;
    border: 1px solid var(--dash-border);
    border-radius: 8px;
    background: var(--dash-surface);
    color: var(--dash-heading);
    text-align: left;
    cursor: pointer;
    box-shadow: none;
}

.preset-button strong {
    display: block;
    font-size: 12px;
    font-weight: 700;
}

.preset-button span {
    display: block;
    margin-top: 5px;
    color: var(--dash-muted);
    font-size: 11px;
    line-height: 1.35;
}

.preset-button:hover,
.preset-button:focus-visible {
    border-color: var(--dash-primary);
    background: var(--dash-primary-soft);
    outline: none;
}

.dashboard-form {
    display: grid;
    gap: 16px;
}

.dashboard-form.hidden,
.hidden {
    display: none !important;
}

.text-slate-400 {
    color: var(--dash-muted);
}

.text-emerald-400,
.text-emerald-500 {
    color: var(--dash-primary);
}

.font-bold {
    font-weight: 700;
}

.shadow-inner {
    box-shadow: inset 0 1px 2px var(--input-inner-shadow);
}

.px-6 {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.full-span {
    grid-column: 1 / -1;
}

.dashboard-form label {
    display: block;
    margin-bottom: 7px;
    color: var(--dash-muted);
    font-size: 12px;
    font-weight: 700;
}

.input-field {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--dash-border);
    border-radius: 8px;
    background: var(--dash-surface);
    color: var(--dash-heading);
    font-size: 14px;
    font-weight: 650;
    box-shadow: none;
}

.input-field:focus,
.currency-btn:focus-visible,
.mode-btn:focus-visible,
.advanced-toggle:focus-visible,
.date-selector:focus-visible,
.export-button:focus-visible,
.dashboard-body .button-primary:focus-visible,
.dashboard-body .button-secondary:focus-visible,
.theme-toggle:focus-visible,
.advisor-option:focus-visible,
.resources-table a:focus-visible {
    outline: 3px solid var(--dashboard-focus-outline);
    outline-offset: 2px;
    border-color: var(--dash-primary);
}

.range-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.range-label-row span {
    color: var(--dash-primary);
    font-size: 18px;
    font-weight: 800;
}

input[type=range]::-webkit-slider-runnable-track {
    height: 7px;
    border-radius: 999px;
    background: var(--dash-primary-soft);
}

input[type=range]::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    margin-top: -5px;
    border: 2px solid var(--surface-solid);
    border-radius: 50%;
    background: var(--dash-primary);
    box-shadow: none;
}

.advanced-block {
    padding-top: 14px;
    border-top: 1px solid var(--dash-border);
}

.advanced-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--dash-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    cursor: pointer;
}

.page-panel a[href^="mailto:"] {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.advanced-content {
    margin-top: 14px;
}

.advanced-content p,
.inline-panel p {
    margin-top: 7px;
    color: var(--dash-muted);
    font-size: 11px;
}

.inline-panel {
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid var(--dash-border);
    border-radius: 8px;
    background: var(--dash-hover);
}

.segmented-control {
    width: 100%;
}

.mode-btn {
    flex: 1;
    min-height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--dash-muted);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.mode-btn.active {
    background: var(--dash-primary);
    color: var(--surface-solid) !important;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.activity-card {
    min-height: 320px;
}

.result-support {
    margin: 14px 0 16px;
    padding: 12px;
    border: 1px solid var(--dash-border-light);
    border-radius: 8px;
    background: var(--dash-hover);
    color: var(--dash-muted);
    font-size: 13px;
}

.result-support p,
.summary-box p,
.advisor-message p {
    max-width: 64ch;
}

.chart-shell {
    height: 300px;
    min-height: 260px;
}

.chart-legend {
    display: inline-flex;
    gap: 12px;
    color: var(--dash-muted);
    font-size: 11px;
    font-weight: 650;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.chart-legend i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-primary {
    background: var(--dash-primary);
}

.legend-secondary {
    background: var(--dash-secondary);
}

.performance-grid,
.insight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.performance-card {
    min-height: 210px;
}

.performance-card p,
.comparison-card p,
.guide-card p {
    margin-top: 8px;
    color: var(--dash-muted);
    font-size: 13px;
}

.assumption-list {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding: 0;
    list-style: none;
}

.assumption-list li {
    padding: 9px 10px;
    border-radius: 8px;
    background: var(--dash-hover);
    color: var(--dash-muted);
    font-size: 12px;
}

.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--dash-muted);
    font-size: 11px;
    font-weight: 700;
}

.status-dot::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-healthy::before {
    background: var(--dash-primary);
}

.status-stable::before {
    background: var(--dash-secondary);
}

.progress-stack {
    height: 7px;
    margin-top: 18px;
    border-radius: 999px;
    background: var(--dash-primary-soft);
    overflow: hidden;
}

.progress-stack span {
    display: block;
    width: var(--progress, 50%);
    height: 100%;
    border-radius: inherit;
    background: var(--dash-primary);
    animation: progressFill 0.8s ease-out both;
}

.progress-secondary {
    background: var(--dash-secondary-soft);
}

.progress-secondary span {
    background: var(--dash-secondary);
}

.summary-box {
    padding: 18px;
    border: 1px solid var(--dash-border);
    border-radius: 8px;
    background: var(--dash-hover);
}

.summary-box p {
    color: var(--dash-heading);
    font-size: 16px;
    font-weight: 600;
}

.comparison-card,
.guide-card {
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
}

.dashboard-body .resource-link {
    display: inline-flex;
    align-items: center;
    width: max-content;
    max-width: 100%;
    margin-top: 12px;
    padding: 8px 10px;
    border: 1px solid var(--dash-border);
    border-radius: 8px;
    background: var(--dash-surface);
    color: var(--dash-heading);
    font-size: 12px;
    font-weight: 700;
}

.table-shell {
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--dash-border);
    border-radius: 8px;
}

.table-shell table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.table-shell th,
.table-shell td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--dash-border-light);
    text-align: left;
}

.table-shell th {
    position: sticky;
    top: 0;
    background: var(--dash-hover);
    color: var(--dash-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.resources-table {
    display: grid;
    border: 1px solid var(--dash-border);
    border-radius: 8px;
    overflow: hidden;
}

.resources-table a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.95fr);
    gap: 14px;
    min-height: 44px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--dash-border-light);
    color: var(--dash-heading);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.resources-table a:last-child {
    border-bottom: 0;
}

.resources-table a:hover {
    background: var(--dash-hover);
}

.resources-table span {
    font-size: 12px;
    font-weight: 700;
}

.resources-table strong {
    color: var(--dash-muted);
    font-size: 11px;
    font-weight: 500;
}

.dashboard-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    color: var(--dash-muted);
    font-size: 11px;
}

.dashboard-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 6px;
}

.dashboard-footer-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 4px;
    color: var(--dash-muted);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.dashboard-footer-links a:hover,
.dashboard-footer-links a:focus-visible {
    color: var(--dash-heading);
}

.calculator-hero {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(420px, 1.1fr);
    gap: 28px;
    align-items: start;
    margin-top: 28px;
}

.calculator-hero > *,
.decision-calculator,
.decision-calculator > * {
    min-width: 0;
}

.calculator-page .dashboard-card-header {
    flex-wrap: wrap;
}

.calculator-hero .hero-copy {
    position: sticky;
    top: 24px;
}

.hero-note {
    margin-top: 14px;
    color: var(--dash-muted);
    font-size: 15px;
}

.decision-calculator,
.plain-result-card {
    border: 1px solid var(--dash-border);
    border-radius: 8px;
    background: var(--dash-surface);
    box-shadow: var(--dash-shadow);
}

.decision-calculator {
    display: grid;
    gap: 18px;
    padding: 20px;
}

.result-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.result-strip article,
.result-definition-grid div {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--dash-border);
    border-radius: 8px;
    background: var(--dash-hover);
}

.result-strip span,
.result-definition-grid dt {
    display: block;
    color: var(--dash-muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.result-strip strong,
.result-definition-grid dd {
    display: block;
    margin: 7px 0 0;
    color: var(--dash-heading);
    font-family: var(--font-mono);
    font-size: clamp(18px, 2vw, 24px);
    font-weight: 800;
}

.plain-result-card,
.content-disclaimer {
    padding: 16px;
    color: var(--dash-heading);
    font-weight: 650;
    line-height: 1.55;
}

.last-updated {
    margin: 0 0 0.5rem;
    color: var(--dash-muted);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0;
}

.decision-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 22px;
}

.calculator-page .page-panel {
    margin-top: 22px;
}

.calculator-page .page-panel:first-child {
    margin-top: 0;
}

.result-definition-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.result-definition-grid div:last-child {
    grid-column: 1 / -1;
}

.calculator-page details {
    border-top: 1px solid var(--dash-border-light);
    padding: 14px 0;
}

.calculator-page details:first-of-type {
    border-top: 0;
}

.calculator-page summary {
    min-height: 44px;
    color: var(--dash-heading);
    cursor: pointer;
    font-weight: 800;
}

.calculator-page details p {
    margin-top: 6px;
}

.calculator-page .resource-link,
.calculator-page .button-primary,
.calculator-page .button-secondary,
.page-body .button-primary,
.page-body .button-secondary {
    min-height: 44px;
}

.calculator-page .chart-shell {
    height: 320px;
    margin: 14px 0;
}

.calculator-page .table-shell {
    max-width: 100%;
    overflow-x: auto;
    contain: layout paint;
}

.calculator-page .table-shell table {
    min-width: 100%;
    table-layout: fixed;
}

.calculator-page .table-shell th,
.calculator-page .table-shell td {
    padding: 10px 8px;
    overflow-wrap: anywhere;
}

.advisor-panel {
    display: flex;
    flex-direction: column;
    padding: 20px;
    animation: fadeInUp 0.5s ease-out both;
}

.advisor-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--dash-border);
}

.advisor-header h2 {
    color: var(--dash-heading);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.advisor-header button,
.advisor-status {
    border: 1px solid var(--dash-border);
    border-radius: 999px;
    background: var(--dash-surface);
    color: var(--dash-muted);
    font-size: 11px;
    font-weight: 800;
}

.advisor-status {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
}

.advisor-feed {
    display: grid;
    gap: 14px;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 0;
}

.advisor-message {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    animation: fadeInUp 0.5s ease-out both;
}

.ai-message {
    animation-delay: 0.05s;
}

.avatar {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 800;
}

.ai-avatar {
    background: var(--dash-primary);
    color: var(--surface-solid);
}

.advisor-message p {
    color: var(--dash-muted);
    font-size: 12px;
}

.ai-response-card {
    display: grid;
    gap: 8px;
    margin-top: 12px;
    padding: 10px;
    border-radius: 10px;
    background: var(--dash-bg);
}

.advisor-option {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--dash-border);
    border-radius: 8px;
    background: var(--dash-surface);
    color: var(--dash-heading);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.advisor-option:hover,
.advisor-option:focus-visible {
    border-color: var(--dash-primary);
    background: var(--dash-primary-soft);
}

.option-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
}

.option-primary {
    background: var(--dash-primary-soft);
    color: var(--dash-primary);
}

.option-secondary {
    background: var(--dash-secondary-soft);
    color: var(--dash-secondary);
}

.option-muted {
    background: var(--dash-hover);
    color: var(--dash-muted);
}

.advisor-option strong,
.advisor-option small {
    display: block;
}

.advisor-option strong {
    font-size: 12px;
    font-weight: 700;
}

.advisor-option small {
    margin-top: 2px;
    color: var(--dash-subtle);
    font-size: 10px;
    line-height: 1.35;
}

.advisor-footnote {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: 8px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--dash-border);
}

.advisor-footnote {
    grid-template-columns: 1fr;
    color: var(--dash-subtle);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.45;
}

/* Result-led homepage facelift. These rules replace the fixed rail layout
   while preserving the existing calculator controls and runtime hooks. */
.dashboard-body {
    background: var(--dash-bg);
}

.dashboard-shell {
    display: block;
    width: min(100% - 32px, 1440px);
    min-height: 100dvh;
    margin: 0 auto;
    padding: 18px 0 56px;
}

.dashboard-topbar {
    position: sticky;
    top: 12px;
    z-index: 40;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 28px;
    min-height: 70px;
    padding: 10px 14px 10px 12px;
    border: 1px solid var(--dash-border);
    border-radius: 16px;
    background: var(--dash-surface);
    box-shadow: var(--dash-shadow-raised);
}

.dashboard-brand {
    gap: 10px;
    min-width: max-content;
    min-height: 44px;
    padding: 0;
}

.dashboard-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px 10px 10px 3px;
    font-size: 14px;
}

.dashboard-brand strong {
    font-family: var(--font-display);
    font-size: 15px;
    letter-spacing: -0.02em;
}

.dashboard-brand small {
    margin-top: 1px;
    font-size: 10px;
    letter-spacing: 0.12em;
}

.dashboard-topbar .dashboard-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    overflow: visible;
    padding: 0;
}

.dashboard-topbar .dashboard-nav-link {
    width: auto;
    min-width: 0;
    min-height: 44px;
    padding: 10px 13px;
    border-radius: 8px;
    font-size: 12px;
    text-align: center;
}

.dashboard-topbar .dashboard-nav-link.active {
    background: var(--dash-primary-soft);
    color: var(--dash-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-support,
.dashboard-body #themeToggle {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 44px;
    padding: 9px 12px;
    border: 1px solid var(--dash-border);
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    color: var(--dash-muted);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.topbar-support:hover,
.dashboard-body #themeToggle:hover {
    transform: none;
    border-color: var(--dash-primary);
    color: var(--dash-primary);
}

.dashboard-main {
    display: grid;
    gap: 28px;
    width: 100%;
    max-width: none;
    padding: 0;
}

.dashboard-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 32px;
    padding: 64px 12px 22px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.dashboard-header h1 {
    max-width: 780px;
    margin-top: 10px;
    font-size: clamp(36px, 4.6vw, 68px);
    font-weight: 700;
    line-height: 0.98;
    letter-spacing: -0.045em;
}

.dashboard-header p {
    max-width: 66ch;
    margin-top: 14px;
    font-size: 15px;
    line-height: 1.65;
}

.dashboard-header .last-updated {
    margin-top: 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.dashboard-actions {
    align-self: start;
    padding-top: 2px;
}

.calculator-workspace {
    display: grid;
    grid-template-columns: minmax(340px, 0.72fr) minmax(0, 1.28fr);
    align-items: start;
    gap: 22px;
}

.workspace-results {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    gap: 16px;
}

.calculator-card {
    position: sticky;
    top: 100px;
    min-width: 0;
    padding: 18px;
    border-color: var(--dash-border);
    border-radius: 18px;
    box-shadow: var(--dash-shadow-raised);
}

.calculator-mode-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(max-content, 1fr));
    gap: 4px;
    margin-bottom: 24px;
    padding: 4px;
    border-radius: 11px;
    background: var(--dash-hover);
}

.calculator-mode-nav .dashboard-nav-link {
    width: auto;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 11px;
    text-align: center;
    white-space: nowrap;
}

.calculator-mode-nav .dashboard-nav-link.active-mode {
    background: var(--dash-surface);
    box-shadow: var(--dash-shadow);
    color: var(--dash-primary);
}

.calculator-card > .dashboard-card-header {
    align-items: center;
}

.calculator-card .dashboard-card-header h2 {
    max-width: 20ch;
    margin-top: 4px;
    font-size: 24px;
    line-height: 1.08;
}

.preset-grid {
    display: flex;
    gap: 8px;
    margin: 22px -2px 24px;
    padding: 2px 2px 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
}

.preset-button {
    flex: 0 0 154px;
    min-height: 90px;
    scroll-snap-align: start;
    border-radius: 10px;
}

.dashboard-form {
    gap: 18px;
}

.dashboard-form label {
    margin-bottom: 8px;
    font-size: 11px;
    letter-spacing: 0.02em;
}

.input-field {
    min-height: 48px;
    padding: 11px 13px;
    border-color: var(--dash-border);
    border-radius: 9px;
    background: var(--input-bg);
    font-size: 15px;
}

.action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 22px;
}

.date-selector,
.export-button,
.dashboard-body .button-primary,
.dashboard-body .button-secondary {
    min-height: 46px;
    border-radius: 9px;
}

.metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.metric-card {
    min-height: 140px;
    padding: 22px;
    border-radius: 16px;
    box-shadow: none;
}

.metric-card-primary {
    grid-column: 1 / -1;
    min-height: 190px;
    padding: 28px;
    border-color: var(--dash-result-border);
    background: var(--dash-result-surface);
    box-shadow: var(--dash-shadow-raised);
}

[data-theme="dark"] .metric-card-primary {
    background: var(--dash-result-surface);
}

.metric-card-primary .metric-card-header > span:first-child,
.metric-card-primary .metric-value {
    color: var(--dash-result-text);
}

.metric-card-primary .metric-card-header > span:first-child {
    max-width: 32ch;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.metric-card-primary .metric-value {
    margin-top: 28px;
    font-size: clamp(46px, 7vw, 76px);
    font-weight: 700;
    letter-spacing: -0.055em;
}

.metric-card-primary .metric-icon-primary {
    background: var(--dash-result-border);
    color: var(--dash-result-text);
}

.metric-card-primary .trend-positive {
    background: var(--dash-result-border);
    color: var(--dash-result-muted);
}

.dashboard-card,
.metric-card {
    border-radius: 16px;
}

.activity-card {
    min-height: 390px;
    padding: 24px;
}

.result-support {
    margin: 18px 0 12px;
    padding: 14px 0 16px;
    border: 0;
    border-bottom: 1px solid var(--dash-border-light);
    border-radius: 0;
    background: transparent;
    font-size: 14px;
    line-height: 1.6;
}

.chart-shell {
    height: 300px;
}

.performance-grid,
.insight-grid {
    gap: 12px;
}

.performance-card {
    min-height: 190px;
}

.summary-box {
    padding: 20px;
    border: 0;
    border-left: 3px solid var(--dash-primary);
    border-radius: 0 10px 10px 0;
}

.summary-box p {
    font-family: var(--font-display);
    font-size: 18px;
    line-height: 1.45;
}

.advisor-panel {
    position: static;
    width: 100%;
    height: auto;
    padding: 24px;
    border: 1px solid var(--dash-border);
    border-radius: 16px;
    background: var(--dash-surface);
    box-shadow: none;
    overflow: visible;
}

.advisor-feed {
    margin-top: 18px;
    overflow: visible;
}

.advisor-message {
    grid-template-columns: 32px minmax(0, 1fr);
    padding: 0;
    border: 0;
    background: transparent;
}

.advisor-message.ai-message {
    align-self: stretch;
}

.ai-response-card {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 16px;
}

.advisor-option {
    align-items: flex-start;
    min-height: 108px;
    padding: 13px;
    border-radius: 10px;
    background: var(--dash-hover);
}

.advisor-footnote {
    margin-top: 16px;
    padding: 12px 0 0;
    border-top: 1px solid var(--dash-border-light);
    background: transparent;
}

.resources-card {
    padding: 30px;
}

.resources-table {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 6px;
    border-radius: 12px;
}

.resources-table a {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 5px;
    min-height: 74px;
    padding: 14px 16px;
}

.resources-table a:nth-child(odd) {
    border-right: 1px solid var(--dash-border-light);
}

.resources-table span {
    font-size: 13px;
}

.resources-table strong {
    line-height: 1.45;
}

/* Homepage navbar blend and mobile drawer. */
.dashboard-body.drawer-open {
    overflow: hidden;
}

.dashboard-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 10px;
}

.dashboard-topbar {
    top: 10px;
    min-height: 70px;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.dashboard-topbar.is-scrolled {
    top: 0;
    border-bottom-color: var(--nav-border-scrolled);
    background: var(--nav-surface);
    box-shadow: var(--nav-shadow-scrolled);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dashboard-brand,
.dashboard-topbar .dashboard-nav-link {
    color: var(--dash-heading);
}

.dashboard-topbar .dashboard-nav-link {
    position: relative;
    border-radius: 0;
    background: transparent;
}

.dashboard-topbar .dashboard-nav-link:hover,
.dashboard-topbar .dashboard-nav-link:focus-visible {
    background: transparent;
    color: var(--dash-primary);
    transform: none;
}

.dashboard-topbar .dashboard-nav-link:focus-visible,
.dashboard-brand:focus-visible {
    outline: 3px solid var(--dashboard-focus-outline);
    outline-offset: 2px;
}

.dashboard-topbar .dashboard-nav-link.active,
.dashboard-topbar .dashboard-nav-link[aria-current] {
    background: transparent;
    color: var(--dash-primary) !important;
}

.dashboard-topbar .dashboard-nav-link::after {
    content: '';
    position: absolute;
    right: 13px;
    bottom: 5px;
    left: 13px;
    height: 1px;
    background: var(--dash-primary);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.2s ease;
}

.dashboard-topbar .dashboard-nav-link.active::after,
.dashboard-topbar .dashboard-nav-link[aria-current]::after {
    transform: scaleX(1);
}

.menu-toggle,
.drawer-close,
.drawer-theme button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    width: 44px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--dash-heading);
}

.menu-toggle span {
    width: 18px;
    height: 1px;
    background: currentColor;
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: var(--drawer-backdrop);
    opacity: 0;
    transition: opacity 0.24s ease;
}

.drawer-backdrop[data-visible="true"] {
    opacity: 1;
}

.mobile-drawer {
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 80;
    display: flex;
    flex-direction: column;
    width: min(88vw, 390px);
    padding: 20px;
    border-left: 1px solid var(--dash-border);
    background: var(--dash-surface);
    box-shadow: var(--nav-shadow-scrolled);
    transform: translateX(0);
    transition: transform 0.24s ease;
}

.mobile-drawer[aria-hidden="true"] {
    transform: translateX(100%);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--dash-border-light);
}

.drawer-title {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
}

.drawer-close {
    width: 44px;
    padding: 0;
    border: 1px solid var(--dash-border);
    border-radius: 50%;
    background: transparent;
    color: var(--dash-heading);
    font-size: 25px;
}

.drawer-nav {
    display: grid;
    margin-top: 14px;
}

.drawer-nav a {
    display: flex;
    align-items: center;
    min-height: 52px;
    border-bottom: 1px solid var(--dash-border-light);
    color: var(--dash-heading);
    font-size: 17px;
    font-weight: 600;
}

.drawer-theme {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--dash-border-light);
    color: var(--dash-muted);
    font-size: 13px;
}

.drawer-theme button {
    padding: 8px 12px;
    border: 1px solid var(--dash-border);
    border-radius: 10px;
    background: var(--dash-hover);
    color: var(--dash-heading);
    font-size: 12px;
    font-weight: 700;
}
