/* net-worth.css — dedicated look for the net-worth experience.
   Deliberately darker/richer than the utilitarian app pages: this page is a
   private-wealth statement, and feel is a first-class requirement
   (features-plan/NET-WORTH-PE-PAGES.md). System fonts only — no build step,
   no external font requests. */

:root {
    --nw-bg-0: #0a0f1e;
    --nw-bg-1: #101a30;
    --nw-surface: rgba(255, 255, 255, 0.035);
    --nw-surface-raised: rgba(255, 255, 255, 0.055);
    --nw-border: rgba(255, 255, 255, 0.09);
    --nw-border-strong: rgba(255, 255, 255, 0.16);
    --nw-text: #e8ecf4;
    --nw-muted: #98a2b6;
    --nw-dim: #5d6a80;
    --nw-gold: #d9bb78;
    --nw-gold-soft: rgba(217, 187, 120, 0.14);
    --nw-green: #56d999;
    --nw-green-soft: rgba(86, 217, 153, 0.12);
    --nw-red: #e07a6d;
    --nw-serif: "New York", ui-serif, Georgia, "Times New Roman", serif;
    --nw-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--nw-sans);
    color: var(--nw-text);
    background: var(--nw-bg-0);
    min-height: 100vh;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* Gradient lives on a fixed underlay, not background-attachment: fixed —
   that property repaints badly on scroll (Chrome) and is broken on iOS. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(1100px 500px at 75% -10%, rgba(217, 187, 120, 0.07), transparent 60%),
        radial-gradient(900px 600px at -10% 20%, rgba(64, 106, 191, 0.12), transparent 55%),
        linear-gradient(175deg, var(--nw-bg-1), var(--nw-bg-0) 55%);
}

/* --- Nav ------------------------------------------------------------- */

.nw-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 40px;
    border-bottom: 1px solid var(--nw-border);
}

.nw-nav-logo {
    font-family: var(--nw-serif);
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    color: var(--nw-text);
    text-decoration: none;
}

.nw-nav-logo span {
    color: var(--nw-gold);
}

.nw-nav-links {
    display: flex;
    gap: 22px;
    align-items: center;
    font-size: 0.85rem;
}

.nw-nav-links a {
    color: var(--nw-muted);
    text-decoration: none;
}

.nw-nav-links a:hover {
    color: var(--nw-text);
}

.nw-nav-current {
    color: var(--nw-gold);
    border-bottom: 1px solid var(--nw-gold);
    padding-bottom: 2px;
}

/* --- Layout ----------------------------------------------------------- */

.nw-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

.nw-pagehead {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 12px;
    flex-wrap: wrap;
}

.nw-title {
    font-family: var(--nw-serif);
    font-weight: 600;
    font-size: 2rem;
    letter-spacing: 0.01em;
    line-height: 1.15;
}

.nw-subtitle {
    display: block;
    color: var(--nw-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    margin-top: 6px;
}

.nw-asof {
    color: var(--nw-muted);
    font-size: 0.8rem;
    border: 1px solid var(--nw-border-strong);
    border-radius: 999px;
    padding: 5px 14px;
    white-space: nowrap;
}

.nw-pagehead-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.nw-sync-btn {
    color: var(--nw-text);
    background: transparent;
    font-size: 0.8rem;
    font-family: inherit;
    border: 1px solid var(--nw-border-strong);
    border-radius: 999px;
    padding: 5px 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.nw-sync-btn:hover:not(:disabled) {
    border-color: var(--nw-gold);
    color: var(--nw-gold);
}

.nw-sync-btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.nw-sync-status {
    color: var(--nw-muted);
    font-size: 0.72rem;
    max-width: 240px;
    text-align: right;
}

.nw-sync-status[data-level="warn"] {
    color: var(--nw-gold);
}

.nw-sync-status[data-level="error"] {
    color: var(--nw-red);
}

.nw-liab-banner {
    margin-bottom: 20px;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.4;
    border: 1px solid var(--nw-gold);
    background: var(--nw-gold-soft);
    color: var(--nw-gold);
}

/* --- Public portfolio -------------------------------------------------- */

.nw-card-intro {
    color: var(--nw-muted);
    font-size: 0.82rem;
    margin: -8px 0 20px;
}

.nw-portfolio-account + .nw-portfolio-account {
    border-top: 1px solid var(--nw-border);
    margin-top: 24px;
    padding-top: 24px;
}

.nw-portfolio-account-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.nw-portfolio-account-head h3 {
    font-family: var(--nw-serif);
    font-size: 1rem;
    font-weight: 600;
}

.nw-portfolio-account-head strong {
    color: var(--nw-gold);
    font-size: 1rem;
    white-space: nowrap;
}

.nw-portfolio-stale,
.nw-position-ticker,
.nw-position-type {
    display: inline-block;
    margin-left: 8px;
    border: 1px solid var(--nw-border-strong);
    border-radius: 999px;
    padding: 1px 7px;
    color: var(--nw-muted);
    font-family: var(--nw-sans);
    font-size: 0.65rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nw-portfolio-stale {
    margin: 4px 0 0;
    color: var(--nw-gold);
    border-color: var(--nw-gold);
}

.nw-position-ticker {
    color: var(--nw-gold);
}

.nw-position-type {
    border: 0;
    padding-left: 0;
}

/* --- Headline figures -------------------------------------------------- */

.nw-headline {
    border: 1px solid var(--nw-border);
    background: var(--nw-surface);
    border-radius: 18px;
    padding: 34px 36px 26px;
    margin-bottom: 22px;
}

.nw-headline-figures {
    display: flex;
    align-items: stretch;
    gap: 36px;
    flex-wrap: wrap;
}

.nw-figure {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 260px;
}

.nw-figure-divider {
    width: 1px;
    background: linear-gradient(to bottom, transparent, var(--nw-border-strong), transparent);
}

.nw-figure-label {
    color: var(--nw-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
}

.nw-figure-value {
    font-family: var(--nw-serif);
    font-size: clamp(2.1rem, 4.5vw, 3rem);
    font-weight: 600;
    letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
}

.nw-figure-marked .nw-figure-value {
    color: var(--nw-gold);
}

.nw-figure-sub {
    color: var(--nw-dim);
    font-size: 0.82rem;
}

.nw-note {
    color: var(--nw-muted);
    font-size: 0.86rem;
    max-width: 70ch;
    margin-top: 18px;
    border-top: 1px solid var(--nw-border);
    padding-top: 14px;
}

.nw-note-pe {
    border: none;
    padding: 2px 8px 0;
    margin: -10px 0 22px;
}

/* --- Cards ------------------------------------------------------------- */

.nw-card {
    border: 1px solid var(--nw-border);
    background: var(--nw-surface);
    border-radius: 18px;
    padding: 26px 30px;
    margin-bottom: 22px;
}

.nw-card-title {
    font-family: var(--nw-serif);
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--nw-muted);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}

.nw-card-total {
    font-family: var(--nw-serif);
    font-size: 1.25rem;
    color: var(--nw-text);
    text-transform: none;
    font-variant-numeric: tabular-nums;
}

.nw-card-total.nw-liability {
    color: var(--nw-red);
}

/* --- Allocation --------------------------------------------------------- */

.nw-alloc-bar {
    display: flex;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    gap: 2px;
    margin-bottom: 14px;
}

.nw-alloc-seg {
    min-width: 4px;
}

.nw-alloc-c0 { background: #d9bb78; }
.nw-alloc-c1 { background: #6f9be0; }
.nw-alloc-c2 { background: #56d999; }
.nw-alloc-c3 { background: #b48ce0; }
.nw-alloc-c4 { background: #64c7cf; }
.nw-alloc-c5 { background: #8a94a7; }

.nw-alloc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    font-size: 0.83rem;
    color: var(--nw-muted);
}

.nw-alloc-key {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.nw-alloc-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.nw-alloc-pct {
    color: var(--nw-text);
    font-variant-numeric: tabular-nums;
}

/* --- Balance sheet ------------------------------------------------------ */

.nw-balance {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.nw-lines {
    list-style: none;
}

.nw-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 9px 0;
    border-top: 1px solid var(--nw-border);
    font-size: 0.92rem;
}

.nw-line-name {
    color: var(--nw-text);
}

.nw-line-note {
    display: block;
    color: var(--nw-dim);
    font-size: 0.78rem;
}

.nw-line-value {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.nw-net-line {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--nw-border-strong);
    font-family: var(--nw-serif);
    font-size: 1.05rem;
    color: var(--nw-gold);
    font-variant-numeric: tabular-nums;
}

/* --- PE table ------------------------------------------------------------ */

.nw-table-wrap {
    overflow-x: auto;
}

.nw-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.nw-table th {
    text-align: left;
    color: var(--nw-dim);
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    padding: 8px 12px;
}

.nw-table td {
    padding: 11px 12px;
    border-top: 1px solid var(--nw-border);
    vertical-align: top;
}

.nw-table tbody tr:hover td {
    background: var(--nw-surface-raised);
}

.nw-td-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.nw-td-name {
    font-weight: 500;
}

.nw-td-basis {
    color: var(--nw-muted);
    font-size: 0.8rem;
    max-width: 26ch;
}

.nw-dim {
    color: var(--nw-dim);
}

.nw-cash-chip {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--nw-green);
    background: var(--nw-green-soft);
    border: 1px solid rgba(86, 217, 153, 0.3);
    white-space: nowrap;
}

.nw-pill {
    display: inline-block;
    min-width: 58px;
    text-align: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
}

.nw-pill-up {
    color: var(--nw-gold);
    background: var(--nw-gold-soft);
    border: 1px solid rgba(217, 187, 120, 0.35);
}

.nw-pill-flat {
    color: var(--nw-muted);
    border: 1px solid var(--nw-border-strong);
}

.nw-totals td {
    border-top: 1px solid var(--nw-border-strong);
    font-family: var(--nw-serif);
    font-size: 0.98rem;
    color: var(--nw-text);
}

/* --- Pipeline ------------------------------------------------------------- */

.nw-pipe-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.nw-pipe-card {
    border: 1px dashed var(--nw-border-strong);
    border-radius: 14px;
    padding: 16px 18px;
}

.nw-pipe-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.nw-pipe-name {
    font-weight: 600;
}

.nw-pipe-badge {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--nw-gold);
    border: 1px solid rgba(217, 187, 120, 0.4);
    border-radius: 999px;
    padding: 2px 10px;
    white-space: nowrap;
}

.nw-pipe-summary {
    color: var(--nw-muted);
    font-size: 0.84rem;
    margin-top: 8px;
}

/* --- Investment detail page --------------------------------------------------- */

.nw-back {
    display: inline-block;
    color: var(--nw-muted);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 22px;
}

.nw-back:hover {
    color: var(--nw-gold);
}

.nw-deal-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.nw-deal-link:hover {
    color: var(--nw-gold);
    border-bottom-color: var(--nw-gold);
}

a.nw-nav-current {
    text-decoration: none;
}

.nw-inv-hero {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-bottom: 26px;
}

.nw-inv-monogram {
    width: 72px;
    height: 72px;
    flex: none;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--nw-serif);
    font-size: 1.7rem;
    color: var(--nw-gold);
    background:
        radial-gradient(60px 60px at 30% 25%, rgba(217, 187, 120, 0.22), transparent 70%),
        var(--nw-surface-raised);
    border: 1px solid rgba(217, 187, 120, 0.3);
}

.nw-inv-image {
    width: 72px;
    height: 72px;
    flex: none;
    border-radius: 18px;
    object-fit: cover;
    border: 1px solid var(--nw-border-strong);
}

.nw-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 22px;
}

.nw-stat {
    border: 1px solid var(--nw-border);
    background: var(--nw-surface);
    border-radius: 16px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nw-stat-label {
    color: var(--nw-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.nw-stat-value {
    font-family: var(--nw-serif);
    font-size: 1.6rem;
    font-variant-numeric: tabular-nums;
}

.nw-stat-multiple .nw-stat-value {
    color: var(--nw-gold);
}

.nw-basis-text {
    font-size: 0.95rem;
    max-width: 70ch;
}

.nw-timeline {
    list-style: none;
    border-left: 1px solid var(--nw-border-strong);
    margin-left: 6px;
    padding-left: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nw-timeline-item {
    position: relative;
}

.nw-timeline-item::before {
    content: '';
    position: absolute;
    left: -29px;
    top: 7px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--nw-gold);
    box-shadow: 0 0 0 4px var(--nw-gold-soft);
}

.nw-timeline-date {
    display: block;
    color: var(--nw-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.nw-timeline-title {
    font-weight: 600;
}

.nw-timeline-summary {
    color: var(--nw-muted);
    font-size: 0.88rem;
    max-width: 68ch;
}

.nw-timeline-empty {
    color: var(--nw-dim);
    font-size: 0.9rem;
}

/* --- States / footer -------------------------------------------------------- */

.nw-loading,
.nw-error {
    color: var(--nw-muted);
    text-align: center;
    padding: 80px 0;
}

.nw-error p {
    margin-top: 12px;
}

.nw-footer {
    text-align: center;
    color: var(--nw-dim);
    font-size: 0.75rem;
    margin-top: 34px;
    letter-spacing: 0.08em;
}

/* --- Responsive --------------------------------------------------------------- */

@media (max-width: 760px) {
    .nw-nav {
        padding: 14px 20px;
    }

    .nw-container {
        padding: 26px 14px 40px;
    }

    .nw-headline {
        padding: 24px 20px 20px;
    }

    .nw-figure-divider {
        display: none;
    }

    .nw-balance,
    .nw-pipe-grid {
        grid-template-columns: 1fr;
    }

    .nw-stats {
        grid-template-columns: 1fr 1fr;
    }

    .nw-card {
        padding: 20px 16px;
    }
}

/* ----------------------------------------------------------------------------
   Mobile bottom tab bar — dark-theme override of the shared mobile-nav.css so
   the tab bar matches the "private wealth" aesthetic instead of a white bar.
   ---------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .mobile-bottom-nav {
        background-color: rgba(16, 26, 48, 0.96);
        border-top: 1px solid var(--nw-border);
        box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.45);
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
    }

    .mobile-nav-item {
        color: var(--nw-dim);
    }

    .mobile-nav-item.active {
        color: var(--nw-gold);
    }
}

/* ----------------------------------------------------------------------------
   Shared app-shell alignment. The wealth theme keeps its palette and editorial
   type while using the same geometry and interaction language as Transactions.
   ---------------------------------------------------------------------------- */

.nw-nav.app-shell-nav {
    display: block;
    min-height: 64px;
    padding: 0;
    border-bottom: 1px solid var(--app-border);
    background: rgba(10, 15, 30, 0.86);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.nw-nav-logo.app-brand {
    color: var(--app-text);
    font-size: 1.08rem;
}

.nw-nav-links {
    gap: 6px;
    font-size: inherit;
}

.nw-nav-links a.app-shell-link {
    color: var(--app-muted);
}

.nw-nav-links a.app-shell-link:hover {
    color: var(--app-text);
}

.nw-nav-links a.app-shell-link.is-active,
.nw-nav-links a.nw-nav-current {
    color: var(--app-accent);
    border-bottom: 0;
    background: var(--app-accent-soft);
}

.nw-container.app-page {
    max-width: var(--app-content-width);
    padding: 38px 24px 64px;
}

.nw-pagehead.app-pagehead {
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 26px;
}

.nw-title.app-page-title {
    margin: 0;
    color: var(--app-text);
    font-family: var(--nw-serif);
    font-size: clamp(1.75rem, 3vw, 2.15rem);
    line-height: 1.12;
}

.nw-subtitle.app-page-subtitle {
    margin-top: 7px;
    color: var(--app-muted);
    font-family: var(--nw-sans);
    font-size: 0.8rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.nw-pagehead-actions.app-pagehead-actions {
    align-items: flex-end;
    flex-direction: column;
    gap: 10px;
}

.nw-sync-actions {
    align-items: flex-start;
    gap: 7px;
}

.nw-sync-control {
    position: relative;
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 4px;
}

.nw-sync-btn.app-button {
    min-height: 34px;
    padding: 6px 11px;
    color: var(--app-text);
    border-color: var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface);
    font-size: 0.75rem;
}

.nw-sync-btn.app-button:hover:not(:disabled) {
    color: var(--app-accent);
    border-color: var(--app-accent);
    background: var(--app-accent-soft);
}

.nw-sync-status {
    max-width: 190px;
}

.nw-headline.app-metric-card {
    padding: 30px 32px 24px;
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
}

.nw-headline-figures.app-metric-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.nw-headline .nw-figure-divider {
    display: none;
}

.nw-figure.app-metric {
    padding: 0 28px;
    border-left: 1px solid var(--app-border);
}

.nw-figure.app-metric:first-child {
    padding-left: 0;
    border-left: 0;
}

.nw-figure.app-metric:last-child {
    padding-right: 0;
}

.nw-figure-label.app-metric-label {
    color: var(--app-muted);
}

.nw-figure-value.app-metric-value {
    margin-top: 5px;
    color: var(--app-text);
    font-family: var(--nw-serif);
    font-size: clamp(2rem, 4.2vw, 2.85rem);
}

.nw-figure-marked .nw-figure-value.app-metric-value {
    color: var(--app-accent);
}

.nw-figure-sub.app-metric-sub {
    color: var(--app-dim);
}

.nw-card.app-card {
    border-color: var(--app-border);
    border-radius: var(--app-radius-lg);
    background: var(--app-surface);
}

.nw-table.financial-table {
    margin: 0;
}

.nw-table.financial-table th {
    color: var(--app-dim);
    border-bottom: 1px solid var(--app-border-strong);
    font-weight: 600;
}

.nw-table.financial-table td {
    border-top: 0;
    border-bottom: 1px solid var(--app-border);
}

.nw-table.financial-table tbody tr:hover td {
    background: var(--app-surface-raised);
}

@media (max-width: 760px) {
    .nw-container.app-page {
        padding: 28px 16px 48px;
    }

    .nw-pagehead.app-pagehead {
        align-items: flex-start;
    }

    .nw-pagehead-actions.app-pagehead-actions {
        width: 100%;
        align-items: flex-start;
    }

    .nw-sync-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .nw-sync-control {
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .nw-nav.app-shell-nav {
        min-height: 58px;
        padding: 0;
    }

    .nw-container.app-page {
        padding: 22px 14px 36px;
    }

    .nw-headline.app-metric-card {
        padding: 22px 18px;
        border-radius: 15px;
    }

    .nw-headline-figures.app-metric-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .nw-figure.app-metric,
    .nw-figure.app-metric:last-child {
        padding: 0;
        border-left: 0;
    }

    .nw-figure.app-metric:last-child {
        padding-top: 18px;
        border-top: 1px solid var(--app-border);
    }

    .nw-sync-actions {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .nw-sync-control,
    .nw-sync-btn.app-button {
        width: 100%;
    }

    .nw-sync-status:not(:empty) {
        grid-column: 1 / -1;
    }
}
