.hidden {
    display: none;
}

/* Skeleton loader */

.portfolio-loader.hidden {
    display: none;
}

.skel {
    position: relative;
    overflow: hidden;
    background: var(--bg-2);
    border-radius: var(--radius-md);
}

.skel::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        transparent,
        var(--skel-shine),
        transparent
    );
    animation: skel-shimmer 1.4s ease-in-out infinite;
}

@keyframes skel-shimmer {
    100% {
        transform: translateX(100%);
    }
}

.skel-hero {
    height: 108px;
    margin-bottom: 16px;
}

.kpi-row .skel-tile {
    height: 76px;
    border-radius: 12px;
}

.skel-line {
    height: 44px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.skel-line.short {
    width: 60%;
}

.skel-table {
    height: 220px;
    margin-top: 18px;
    border-radius: 12px;
}

/* Empty state */

.empty-state {
    background: var(--surface-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 32px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.empty-state h2 {
    margin: 0 0 8px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.empty-state p {
    margin: 0 0 24px;
    color: var(--text-muted);
    font-size: 14px;
}

.empty-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.auth-btn {
    display: inline-block;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    background: var(--accent);
    color: var(--on-accent);
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease), transform 0.1s var(--ease);
}

.auth-btn:hover {
    background: var(--accent-dim);
    box-shadow: var(--shadow-blue);
}

.auth-btn:active {
    transform: translateY(1px);
}

.upload-label {
    background: transparent;
    border: 1px solid var(--border-2);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.upload-label:hover {
    background: var(--bg-2);
    box-shadow: none;
}

/* Hero + KPI row */

.hero-box {
    position: relative;
    overflow: hidden;
    background: var(--surface-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px 28px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.hero-box::before {
    content: "";
    position: absolute;
    top: -60%;
    right: -10%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, var(--accent-soft) 0%, transparent 70%);
    pointer-events: none;
}

.hero-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    position: relative;
}

.hero-value {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    position: relative;
    font-variant-numeric: tabular-nums;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .kpi-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 420px) {
    .kpi-row {
        grid-template-columns: 1fr;
    }
    .hero-value {
        font-size: 30px;
    }
}

.kpi-row .stat-tile {
    background: var(--surface-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--border);
    padding: 16px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}

.kpi-row .stat-tile:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.kpi-row .stat-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Admin overview's "AUA as of Xm ago" note — that figure comes from a
   background-refreshed cache (see admin.py), not a live computation on
   every page load, so it's worth being explicit about how fresh it is. */
.stat-tile-note {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-faint);
}

/* Returns Matrix — portfolio vs. benchmark, trailing return per period. */

.matrix-card {
    background: var(--surface-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.matrix-card.hidden {
    display: none;
}

.matrix-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.matrix-title {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.matrix-title .sub {
    font-weight: 400;
    color: var(--text-faint);
    font-size: 13px;
}

.matrix-pill {
    font-size: 11px;
    font-weight: 700;
    background: var(--accent-soft);
    color: var(--accent-dim);
    border: 1px solid var(--accent-border);
    padding: 4px 11px;
    border-radius: var(--radius-full);
}

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.matrix-tile {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 8px;
    text-align: center;
    background: var(--bg-2);
}

.matrix-tile.highlight {
    background: var(--accent-soft);
    border-color: var(--accent-border);
}

.matrix-tile .m-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 9px;
}

.matrix-tile.highlight .m-label {
    color: var(--accent-dim);
}

.matrix-tile .m-value {
    font-size: 16px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    margin-bottom: 4px;
    color: var(--text);
}

.matrix-tile .m-value.up {
    color: var(--success);
}

.matrix-tile .m-value.down {
    color: var(--danger);
}

.matrix-tile .m-bench {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.matrix-insight {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--success-soft);
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13px;
}

.matrix-insight.hidden {
    display: none;
}

.matrix-insight svg {
    color: var(--success);
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.matrix-insight b {
    color: var(--success);
}

.matrix-insight.underperform {
    background: var(--danger-soft);
    border-color: var(--danger);
}

.matrix-insight.underperform svg,
.matrix-insight.underperform b {
    color: var(--danger);
}

@media (max-width: 900px) {
    .matrix-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 560px) {
    .matrix-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Today's Gain/Loss — compact horizontally-scrolling glass chip strip, one
   chip per portfolio._daily_gain_category bucket (Equity/MF/Gold/Debt/
   Liquid). Equity refreshes client-side every 60s (see dashboard.js's
   refreshDailyGainQuiet) since its prices move intraday; the others don't
   need polling since NAV/gold-rate data only changes once a day. */

.live-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
}

.live-dot, .chip-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 rgba(18, 183, 106, 0.6);
    animation: live-pulse 1.8s infinite;
}

.chip-live-dot {
    width: 6px;
    height: 6px;
}

/* Outside NSE/BSE market hours (9:00-16:00 IST, Mon-Fri) — see
   dashboard.js's isNseMarketHoursIST. No pulse: nothing's actually
   refreshing, so an animated dot would be a lie. */
.live-badge.badge-closed .live-dot {
    background: var(--text-faint);
    animation: none;
    box-shadow: none;
}

@keyframes live-pulse {
    0% { box-shadow: 0 0 0 0 rgba(18, 183, 106, 0.55); }
    70% { box-shadow: 0 0 0 6px rgba(18, 183, 106, 0); }
    100% { box-shadow: 0 0 0 0 rgba(18, 183, 106, 0); }
}

.daily-gain-strip {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.daily-gain-chip {
    --chip-accent: var(--accent);
    position: relative;
    flex: 0 0 auto;
    min-width: 190px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--surface-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--border);
    border-top: 2px solid var(--chip-accent);
    border-radius: var(--radius-md);
    padding: 14px 30px 14px 16px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s var(--ease), transform 0.15s var(--ease);
}

.daily-gain-chip:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.chip-info-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--border-2);
    background: var(--surface);
    color: var(--text-faint);
    font-size: 11px;
    font-style: italic;
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.chip-info-btn:hover, .chip-info-btn:focus-visible {
    color: var(--accent);
    border-color: var(--accent);
}

.chip-info-popover {
    position: fixed;
    z-index: 60;
    width: 260px;
    max-width: calc(100vw - 16px);
    /* short viewports (phones in landscape, small laptops) get a smaller cap
       so the list still fits on screen; it scrolls inside either way */
    max-height: min(280px, 70vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;   /* momentum scroll on iOS */
    overscroll-behavior: contain;        /* don't chain-scroll the page at the ends */
    background: var(--surface-glass-strong);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 12px 14px;
}

.chip-info-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 8px;
}

.chip-info-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.chip-info-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 12.5px;
}

.chip-info-name {
    color: var(--text);
    min-width: 0;
    overflow-wrap: anywhere;
}

.chip-info-caveat {
    color: var(--text-faint);
    font-size: 11px;
}

.chip-info-value {
    flex-shrink: 0;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.chip-info-value.up {
    color: var(--success);
}

.chip-info-value.down {
    color: var(--danger);
}

.daily-gain-chip-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--chip-accent) 16%, transparent);
    color: var(--chip-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.daily-gain-chip-icon svg {
    width: 17px;
    height: 17px;
}

.daily-gain-chip-body {
    min-width: 0;
}

.daily-gain-chip-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    white-space: nowrap;
}

.daily-gain-chip-value {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.daily-gain-chip-value.up {
    color: var(--success);
}

.daily-gain-chip-value.down {
    color: var(--danger);
}

.daily-gain-chip-sub {
    font-size: 11.5px;
    color: var(--text-faint);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Sections */

.section {
    margin-bottom: 28px;
}

.section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.section-header h2 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Asset-type tabs above the holdings table */

.asset-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.asset-tab {
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s var(--ease);
}

.asset-tab:hover:not(.active) {
    color: var(--text);
    border-color: var(--border-2);
    background: var(--bg-2);
}

.asset-tab.active {
    background: var(--accent);
    color: var(--on-accent);
    border-color: var(--accent);
    box-shadow: var(--shadow-blue);
}

/* Portfolio tabs (P1, P2, ..., Consolidated) — reuses .asset-tabs/.asset-tab's
   pill styling above for visual consistency with the rest of the dashboard. */

.portfolio-tabs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.portfolio-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.portfolio-tab-consolidated {
    margin-left: 6px;
    border-left: 1px solid var(--border);
    padding-left: 12px !important;
}

.portfolio-tabs-actions {
    display: flex;
    gap: 14px;
    flex-shrink: 0;
}

.portfolio-rename-input {
    font-size: 12.5px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--accent);
    width: 140px;
}

.portfolio-new-menu {
    position: fixed;
    z-index: 30;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    width: 260px;
}

.portfolio-new-menu-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    transition: background 0.1s var(--ease);
}

.portfolio-new-menu-item:hover {
    background: var(--bg-2);
}

.portfolio-new-menu-item strong {
    font-size: 13.5px;
}

.portfolio-new-menu-item span {
    font-size: 12px;
    color: var(--text-muted);
}

.richie-teaser {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    margin-bottom: 20px;
    text-decoration: none;
    transition: box-shadow 0.15s var(--ease);
}

.richie-teaser:hover {
    box-shadow: var(--shadow-md);
}

.richie-teaser-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--surface);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.richie-teaser-icon svg {
    width: 18px;
    height: 18px;
}

.richie-teaser-body {
    flex: 1;
    min-width: 0;
}

.richie-teaser-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--accent-dim);
}

.richie-teaser-text {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.richie-teaser-arrow {
    color: var(--accent);
    font-size: 18px;
    flex-shrink: 0;
}

/* Allocation bars — single accent hue; identity carried by the label, not color */

.allocation-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 900px) {
    .allocation-row {
        grid-template-columns: 1fr;
    }
}

.allocation-box {
    position: relative;
    background: var(--surface-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s var(--ease);
}

.allocation-box:hover {
    box-shadow: var(--shadow-md);
}

.allocation-box .section-header {
    margin-bottom: 14px;
}

.allocation-box .alloc-row {
    grid-template-columns: 70px 1fr 60px;
    gap: 8px;
    font-size: 12.5px;
}

.allocation-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alloc-row {
    display: grid;
    grid-template-columns: 130px 1fr 90px;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

@media (max-width: 480px) {
    .alloc-row {
        grid-template-columns: 88px 1fr 72px;
        gap: 8px;
        font-size: 12.5px;
    }
}

.alloc-label {
    color: var(--text);
    font-weight: 600;
}

.alloc-track {
    background: var(--bg-2);
    border-radius: var(--radius-full);
    height: 8px;
    overflow: hidden;
}

.alloc-fill {
    background: linear-gradient(90deg, var(--accent-light), var(--accent));
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.4s var(--ease);
}

.alloc-value {
    text-align: right;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Exposure Allocation — donut chart */

.pie-chart-wrapper {
    position: relative;
    width: 100%;
    max-width: 200px;
    margin: 4px auto 16px;
}

.pie-chart {
    width: 100%;
    height: auto;
    display: block;
}

.pie-slice {
    cursor: pointer;
    transition: transform 0.15s var(--ease), opacity 0.15s var(--ease);
    transform-origin: 100px 100px;
    stroke: var(--surface);
    stroke-width: 2;
}

.pie-slice:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.pie-slice.dimmed-slice {
    opacity: 0.4;
}

.pie-center-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    text-align: center;
    max-width: 100px;
}

.pie-center-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.pie-center-caption {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 2px;
}

.pie-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pie-legend-row {
    display: grid;
    grid-template-columns: 12px 1fr auto;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 0;
    transition: opacity 0.15s var(--ease);
}

.pie-legend-row.dimmed {
    opacity: 0.45;
}

.pie-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.pie-legend-label {
    color: var(--text);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pie-legend-value {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

/* Holdings table */

.table-wrapper {
    overflow-x: auto;
    background: var(--surface-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.holdings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    white-space: nowrap;
}

.holdings-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-2);
}

.holdings-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s var(--ease);
}

.holdings-table th.sortable:hover {
    color: var(--text);
}

.holdings-table th.sortable::after {
    content: "\2195";
    display: inline-block;
    margin-left: 5px;
    opacity: 0.35;
    font-size: 11px;
}

.holdings-table th.sortable.sort-asc::after {
    content: "\2191";
    opacity: 1;
    color: var(--accent);
}

.holdings-table th.sortable.sort-desc::after {
    content: "\2193";
    opacity: 1;
    color: var(--accent);
}

.holdings-table th:first-child {
    border-top-left-radius: var(--radius-md);
}

.holdings-table th:last-child {
    border-top-right-radius: var(--radius-md);
}

.holdings-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}

.holdings-table tr:last-child td {
    border-bottom: none;
}

.holdings-table tbody tr {
    transition: background 0.1s var(--ease);
}

.holdings-table tbody tr:hover {
    background: var(--bg-2);
}

.holdings-table tr.holding-lots-row:hover {
    background: none;
}

/* Per-holding lot detail — expand-only, never shown as a top-level row (see
   dashboard.js's renderHoldingsRows / toggleHoldingLots and
   portfolio.get_holding_lots). */

.holdings-table th.lots-toggle-col,
.holdings-table td.lots-toggle-col {
    width: 32px;
    padding-left: 14px;
    padding-right: 4px;
}

.lots-toggle-btn {
    width: 22px;
    height: 22px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-faint);
    cursor: pointer;
    transition: color 0.15s var(--ease), transform 0.15s var(--ease), background 0.15s var(--ease);
}

.lots-toggle-btn:hover {
    color: var(--accent);
    background: var(--bg-2);
}

.lots-toggle-btn svg {
    width: 15px;
    height: 15px;
    transition: transform 0.15s var(--ease);
}

.lots-toggle-btn.expanded svg {
    transform: rotate(90deg);
}

.holding-lots-row td {
    padding: 0 14px 16px 46px;
    background: var(--bg-2);
    white-space: normal;
}

.holding-lots-row.hidden {
    display: none;
}

.lots-panel {
    padding-top: 12px;
}

.lots-price-line {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.lots-loading, .lots-empty {
    font-size: 12.5px;
    color: var(--text-muted);
    padding: 6px 0;
}

.lots-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.lots-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.lots-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}

.lots-table tr:last-child td {
    border-bottom: none;
}

.lots-table td.up {
    color: var(--success);
}

.lots-table td.down {
    color: var(--danger);
}

.lots-table td.na {
    color: var(--text-faint);
    font-style: italic;
}

.holdings-table td.up {
    color: var(--success);
}

.holdings-table td.down {
    color: var(--danger);
}

.identifier-link {
    color: var(--accent-dim);
    font-weight: 700;
    text-decoration: none;
    transition: color 0.1s var(--ease);
}

.identifier-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Unread-chat dot next to a client's name on the advisor dashboard (see
   advisor_dashboard.js's loadChatUnreadBadges). */
.advisor-chat-unread-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    margin-left: 8px;
    vertical-align: middle;
}

.advisor-chat-unread-badge.hidden {
    display: none;
}

.holdings-table td.na {
    color: var(--text-muted);
}

/* Asset cell — company/fund name on top, ticker/scheme identifier below. */

.holdings-table td.id-cell {
    white-space: normal;
}

.id-cell .id-name {
    font-weight: 700;
}

.id-cell .id-name .identifier-link {
    font-weight: 700;
}

.id-cell .id-sub {
    font-size: 11.5px;
    color: var(--text-faint);
    margin-top: 2px;
}

.id-analytics-link {
    display: inline-block;
    margin-top: 3px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
}

.id-analytics-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.price-stale-note {
    font-size: 11px;
    color: var(--chart-secondary);
    margin-top: 2px;
    cursor: help;
}

.remove-client-btn {
    background: none;
    border: 1px solid var(--danger-border);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s var(--ease);
}

.remove-client-btn:hover {
    background: var(--danger-soft);
    border-color: var(--danger);
}

.weight-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 110px;
}

.weight-bar {
    width: 56px;
    height: 6px;
    background: var(--bg-2);
    border-radius: var(--radius-full);
    overflow: hidden;
    flex-shrink: 0;
}

.weight-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-light), var(--accent));
    border-radius: var(--radius-full);
}

.weight-cell span {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Section header action group (Add Holding / Re-upload) */

.section-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Add Holding modal */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(12, 21, 36, 0.48);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
    animation: modal-backdrop-in 0.15s var(--ease);
}

@keyframes modal-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-backdrop.hidden {
    display: none;
}

.modal {
    background: var(--surface-glass-strong);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modal-in 0.18s var(--ease);
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.modal-close:hover {
    background: var(--bg-2);
    color: var(--text);
}

.modal-body {
    padding: 24px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-body.hidden {
    display: none;
}

.modal-body .search-wrapper {
    position: relative;
    margin-bottom: 8px;
}

.modal-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 10px;
}

.modal-body input[type="text"],
.modal-body input[type="number"],
.modal-body input[type="date"],
.modal-body input[type="password"],
.modal-body input[type="file"] {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    padding: 10px 12px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
}

.import-request-help {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 13px;
}

.import-request-help summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent-dim);
}

.import-request-help p {
    margin: 8px 0 0;
    color: var(--text-muted);
}

.import-request-help a {
    color: var(--accent-dim);
}

.import-preview-wrapper {
    max-height: 320px;
    overflow-y: auto;
}

.import-preview-wrapper th:first-child,
.import-preview-wrapper td:first-child {
    width: 32px;
}

.modal-body input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3.5px var(--accent-soft);
}

.modal-body .suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
}

.sugg-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--accent-dim);
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-full);
    padding: 2px 8px;
    flex-shrink: 0;
}

.suggestions li.gold-option .sugg-symbol {
    min-width: 0;
}

.selected-asset {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 4px;
}

.selected-asset .sel-label {
    font-weight: 700;
    font-size: 14px;
}

.selected-asset .sel-sub {
    font-size: 12.5px;
    color: var(--text-muted);
}

.modal-hint {
    font-size: 12.5px;
    color: var(--text-muted);
}

.modal-hint.hidden {
    display: none;
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    gap: 12px;
}

.modal-label-optional {
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}

/* Benchmark comparison */

.benchmark-select {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    padding: 6px 28px 6px 10px; /* right space for the global select chevron, see style.css */
    cursor: pointer;
    transition: border-color 0.15s var(--ease);
}

.benchmark-select:hover {
    border-color: var(--accent);
}

.benchmark-card {
    background: var(--surface-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.benchmark-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.benchmark-custom-range {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.benchmark-custom-range.hidden {
    display: none;
}

.benchmark-custom-range input[type="date"] {
    font-family: inherit;
    font-size: 13px;
    padding: 6px 10px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
}

.benchmark-custom-range input[type="date"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3.5px var(--accent-soft);
}

.benchmark-range-sep {
    font-size: 12.5px;
    color: var(--text-muted);
}

#benchmark-apply-custom {
    font-size: 13px;
    padding: 6px 14px;
}

.benchmark-summary {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.benchmark-stat {
    display: flex;
    align-items: center;
    gap: 10px;
}

.benchmark-swatch {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.benchmark-stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.benchmark-stat-value {
    font-size: 18px;
    font-weight: 700;
}

.benchmark-stat-value.up {
    color: var(--success);
}

.benchmark-stat-value.down {
    color: var(--danger);
}

.benchmark-chart-wrapper {
    height: 280px;
}

#benchmark-chart {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

.benchmark-note {
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--text-muted);
}
