:root {
    color-scheme: light;
    --bg: #eef1f6;
    --bg-elevated: #f7f9fc;
    --panel: #ffffff;
    --panel-2: #f3f6fa;
    --text: #1a2332;
    --muted: #5a6778;
    --muted-2: #8a96a8;
    --brand: #3d5afe;
    --brand-2: #7c4dff;
    --brand-soft: rgba(61, 90, 254, 0.1);
    --border: rgba(26, 35, 50, 0.1);
    --border-strong: rgba(26, 35, 50, 0.16);
    --positive: #0d9488;
    --negative: #dc2626;
    --flat: #d97706;
    --row-alt: rgba(61, 90, 254, 0.04);
    --ai-bg: linear-gradient(90deg, rgba(61, 90, 254, 0.08), rgba(124, 77, 255, 0.06));
    --sidebar-w: 26rem;
    --sticky-h: 7.25rem;
    --sym-cols: 3.2rem 4.65rem 2.45rem 2.45rem 2.45rem 2.45rem 3.35rem;
    --radius: 10px;
    --radius-lg: 14px;
    --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
    box-sizing: border-box;
}

html, body.app-shell {
    height: 100%;
    overflow: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    font-size: 13px;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    display: flex;
    flex-direction: column;
}

.app-sticky-top {
    position: sticky;
    top: 0;
    z-index: 200;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    background: rgba(247, 249, 252, 0.94);
    box-shadow: 0 4px 18px rgba(26, 35, 50, 0.08);
}

.app-scroll-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

code {
    font-family: var(--mono);
    font-size: 0.85em;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: rgba(26, 35, 50, 0.06);
}

/* —— AI bar —— */
.ai-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    background: var(--ai-bg);
    border-bottom: 1px solid var(--border);
}

.ai-bar__badge {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--brand);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(61, 90, 254, 0.12);
}

.ai-bar__input-wrap {
    flex: 1;
    display: flex;
    gap: 0.5rem;
    min-width: 0;
}

.ai-bar__input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 0.55rem 0.85rem;
    background: #fff;
    color: var(--text);
    font: inherit;
}

.ai-bar__input::placeholder {
    color: var(--muted-2);
}

.ai-bar__input:focus {
    outline: none;
    border-color: rgba(107, 138, 253, 0.55);
}

.ai-bar__btn {
    flex-shrink: 0;
    border: none;
    border-radius: var(--radius);
    padding: 0.55rem 1rem;
    background: rgba(107, 138, 253, 0.35);
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    cursor: not-allowed;
}

/* —— Top bar —— */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.topbar__brand h1 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.topbar__brand span {
    display: block;
    font-size: 11px;
    color: var(--muted);
    margin-top: 0.1rem;
}

.market-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
}

.chip {
    font-size: 11px;
    color: var(--muted);
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
}

.chip strong {
    color: var(--text);
    font-weight: 600;
}

.live-ticker {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 11px;
    color: var(--muted);
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
}

.live-ticker__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted-2);
}

.live-ticker.is-live .live-ticker__dot {
    background: var(--positive);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.25);
    animation: livePulse 1.6s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(0.92); }
}

.sym-cell.flash-up {
    animation: priceFlashUp 0.65s ease;
}

.sym-cell.flash-down {
    animation: priceFlashDown 0.65s ease;
}

@keyframes priceFlashUp {
    0% { background: rgba(13, 148, 136, 0.35); }
    100% { background: transparent; }
}

@keyframes priceFlashDown {
    0% { background: rgba(220, 38, 38, 0.28); }
    100% { background: transparent; }
}

/* —— Workspace —— */
.workspace {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--bg-elevated);
    min-height: 0;
    overflow: hidden;
    border-radius: 0 16px 16px 0;
}

.sidebar__filters {
    padding: 0.5rem 0.55rem 0.45rem;
    border-bottom: 1px solid var(--border);
    display: grid;
    gap: 0.35rem;
}

.sidebar__filters input {
    border-radius: 999px;
    padding: 0.5rem 0.75rem;
}

.filter-tabs--compact {
    gap: 0.25rem;
}

.filter-tabs--compact a {
    border-radius: 999px;
    padding: 0.35rem 0.5rem;
}

.sidebar__meta--top {
    border-bottom: none;
    padding: 0.35rem 0.65rem 0.15rem;
    font-size: 10px;
}

.sym-grid,
.symbol-row {
    display: grid;
    grid-template-columns: var(--sym-cols);
    column-gap: 0.2rem;
    align-items: center;
    padding: 0.38rem 0.5rem;
    margin-left: 0.45rem;
    margin-right: 0.45rem;
    font-variant-numeric: tabular-nums;
}

.sidebar__list-head.sym-grid {
    position: sticky;
    top: 0;
    z-index: 6;
    margin-bottom: 0.25rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    box-shadow: 0 4px 12px rgba(26, 35, 50, 0.05);
}

.sym-grid--head .sym-cell {
    font-family: var(--font);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 0.03em;
    color: var(--muted-2);
}

.sym-grid--head .col-sort {
    border-radius: 6px;
    min-width: 0;
    text-decoration: none;
}

.sym-grid--head .col-sort:hover {
    color: var(--brand);
}

.symbol-list {
    padding: 0 0.45rem 0.45rem;
}

.symbol-row {
    grid-template-rows: auto;
    transition: background 0.12s ease, border-color 0.12s ease;
    border-radius: 12px;
    border: 1px solid transparent;
    margin-bottom: 0.18rem;
}

.symbol-list .symbol-row:nth-child(even) {
    background: var(--row-alt);
}

.symbol-row.active {
    border-color: rgba(61, 90, 254, 0.35);
    background: rgba(61, 90, 254, 0.08);
}

.symbol-row > :nth-child(1) { grid-column: 1; }
.symbol-row > :nth-child(2) { grid-column: 2; }
.symbol-row > :nth-child(3) { grid-column: 3; }
.symbol-row > :nth-child(4) { grid-column: 4; }
.symbol-row > :nth-child(5) { grid-column: 5; }
.symbol-row > :nth-child(6) { grid-column: 6; }
.symbol-row > :nth-child(7) { grid-column: 7; }

.sym-cell--name {
    display: none;
}

.asset-icon {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 999px;
}

.sidebar__col-legend {
    display: none;
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 1rem 1.5rem;
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 2px;
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid var(--border);
}

.filter-tabs a {
    flex: 1 1 22%;
    min-width: 3.2rem;
    text-align: center;
    font-size: 10px;
    padding: 0.35rem 0.2rem;
}

.sidebar__filters input,
.sidebar__filters select {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    font: inherit;
    font-size: 12px;
}

.filter-tabs a {
    text-align: center;
    padding: 0.35rem 0.25rem;
    font-size: 11px;
    font-weight: 600;
    border-radius: 7px;
    color: var(--muted);
}

.filter-tabs a.active {
    background: var(--brand-soft);
    color: var(--text);
}

.sidebar__meta {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0.65rem;
    font-size: 11px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
}

.symbol-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.symbol-row {
    grid-template-rows: auto;
    gap: 0.1rem 0.15rem;
    transition: background 0.12s ease, border-color 0.12s ease;
    align-items: center;
}

.symbol-list .symbol-row:nth-child(even) {
    background: var(--row-alt);
}

.sym-cell {
    font-size: 10px;
    font-family: var(--mono);
    text-align: right;
    line-height: 1.25;
}

.sym-cell--code {
    grid-column: 1;
    text-align: left;
    font-family: var(--font);
    font-weight: 700;
    font-size: 11px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sym-cell--price {
    grid-column: 2;
    font-weight: 600;
    font-size: 10px;
    white-space: nowrap;
}

.sym-cell--vol {
    grid-column: 7;
    color: var(--muted);
    font-size: 9px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sym-cell--name {
    grid-column: 1 / -1;
    grid-row: 2;
    text-align: left;
    font-family: var(--font);
    font-size: 10px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sym-cell.empty {
    color: var(--muted-2);
}

.symbol-row__tag {
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--muted-2);
    padding: 0.05rem 0.25rem;
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: var(--font);
}

.symbol-row:hover {
    background: var(--brand-soft);
}

.symbol-row.active {
    background: rgba(61, 90, 254, 0.12);
    box-shadow: inset 3px 0 0 var(--brand);
}

.sidebar__pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.65rem;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--muted);
}

.sidebar__pager a {
    padding: 0.25rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.sidebar__pager a.disabled {
    opacity: 0.35;
    pointer-events: none;
}

.quote-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}

.quote-header__title h2 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.quote-header__title p {
    margin: 0.25rem 0 0;
    color: var(--muted);
    font-size: 12px;
    max-width: 36rem;
}

.quote-header__price {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.quote-header__price .value {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.quote-header__price .meta {
    font-size: 11px;
    color: var(--muted);
    margin-top: 0.2rem;
}

.quote-header__extras {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    width: 100%;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
}

.kpi-mini {
    font-size: 11px;
    color: var(--muted);
}

.kpi-mini strong {
    display: block;
    font-size: 13px;
    color: var(--text);
    margin-top: 0.15rem;
}

.chart-block {
    padding: 0.85rem 1.25rem 0;
    background: var(--bg);
}

.chart-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.chart-toolbar h3 {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.range-pills {
    display: flex;
    gap: 0.25rem;
}

.range-pills button {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.25rem 0.55rem;
    background: var(--panel);
    color: var(--muted);
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

.range-pills button.active,
.range-pills button:hover {
    border-color: rgba(107, 138, 253, 0.5);
    color: var(--text);
    background: var(--brand-soft);
}

.chart-wrap {
    height: 220px;
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--panel);
    padding: 0.5rem;
}

.chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 1px;
    margin: 0.85rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--border);
}

.stat-cell {
    background: var(--panel);
    padding: 0.55rem 0.65rem;
}

.stat-cell small {
    display: block;
    font-size: 10px;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

.stat-cell strong {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.panel-tabs {
    display: flex;
    gap: 0;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border);
}

.panel-tabs button {
    border: none;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 0.65rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.panel-tabs button.active {
    color: var(--text);
    border-bottom-color: var(--brand);
}

.tab-panel {
    display: none;
    padding: 0 1.25rem 1.25rem;
}

.tab-panel.active {
    display: block;
}

.data-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--panel);
}

.data-table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    color: var(--muted);
}

.data-table-toolbar .actions {
    display: flex;
    gap: 0.35rem;
}

.data-table-toolbar button {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    background: var(--panel-2);
    color: var(--text);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.data-table-scroll {
    max-height: 340px;
    overflow: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #0d141c;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.data-table th,
.data-table td {
    padding: 0.45rem 0.75rem;
    border-top: 1px solid var(--border);
    text-align: right;
    white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
    text-align: left;
}

.data-table tbody tr {
    cursor: pointer;
}

.data-table tbody tr:hover,
.data-table tbody tr.selected {
    background: var(--brand-soft);
}

.data-table tbody tr.selected td:first-child {
    box-shadow: inset 3px 0 0 var(--brand);
}

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

.fundamentals-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--panel);
    overflow: hidden;
}

.fundamentals-card h4 {
    margin: 0;
    padding: 0.6rem 0.85rem;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: var(--panel-2);
}

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

.fundamentals-card td {
    padding: 0.45rem 0.85rem;
    border-top: 1px solid var(--border);
}

.fundamentals-card td:first-child {
    color: var(--muted);
}

.fundamentals-card td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.fundamentals-note {
    grid-column: 1 / -1;
    font-size: 11px;
    color: var(--muted);
    padding: 0.5rem 0;
}

.positive {
    color: var(--positive);
    font-weight: 600;
}

.negative {
    color: var(--negative);
    font-weight: 600;
}

.flat {
    color: var(--flat);
    font-weight: 600;
}

.empty-state {
    padding: 2rem 1.25rem;
    color: var(--muted);
}

.empty-state--hero {
    margin: 1rem 0 2rem;
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-strong);
    background: linear-gradient(145deg, var(--panel), var(--panel-2));
    text-align: center;
}

.empty-state--hero h2 {
    margin: 0 0 0.5rem;
    color: var(--text);
    font-size: 1.35rem;
}

.empty-state__quick {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.25rem;
}

.empty-state__chip {
    font-weight: 600;
    font-size: 12px;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--panel);
    color: var(--brand);
}

.empty-state__chip:hover {
    background: var(--brand-soft);
}

.empty-state h2 {
    color: var(--text);
    margin-top: 0;
}

.layout-single {
    padding: 2rem 1.25rem;
}

@media (max-width: 1100px) {
    .stats-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

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

    .sidebar {
        max-height: 40vh;
    }

    .fundamentals-grid {
        grid-template-columns: 1fr;
    }
}

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

    .quote-header__price {
        text-align: left;
    }
}

/* —— v4: auth, reco, portfolio —— */
.topbar {
    flex-wrap: wrap;
}

.topbar__auth {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
}

.btn-primary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    text-decoration: none;
}

.btn-primary--sm {
    padding: 0.35rem 0.65rem;
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-strong);
    color: var(--text);
    text-decoration: none;
}

.btn-primary:hover,
.btn-ghost:hover {
    transform: translateY(-1px);
}

.chip--warn {
    color: #f5c678;
    border-color: rgba(245, 198, 120, 0.35);
}

.banner {
    margin: 0.65rem 1rem 0;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius);
    font-size: 12px;
}

.banner--info {
    background: rgba(107, 138, 253, 0.12);
    border: 1px solid rgba(107, 138, 253, 0.25);
}

.reco-rail {
    padding: 0;
    animation: none;
}

.radar-band {
    flex-shrink: 0;
    margin: 0;
    padding: 0.65rem 1rem 0.55rem;
    background: linear-gradient(180deg, #fff 0%, var(--bg-elevated) 100%);
    border-bottom: 2px solid rgba(61, 90, 254, 0.15);
    box-shadow: 0 8px 24px rgba(26, 35, 50, 0.06);
}

.radar-band .reco-rail__track {
    padding-bottom: 0.25rem;
}

.reco-card__top {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.reco-card__basis {
    display: block;
    font-size: 9px;
    color: var(--muted-2);
    margin-top: 0.2rem;
}

.reco-card__top strong {
    flex: 1;
}

.asset-icon-wrap {
    display: inline-flex;
    flex-shrink: 0;
}

.asset-icon {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 6px;
    object-fit: contain;
    background: var(--panel-2);
    border: 1px solid var(--border);
}

.asset-icon--fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: var(--muted);
    font-family: var(--font);
}

.sym-cell--code {
    gap: 0.2rem;
}

.sidebar__list-head .col-sort {
    color: inherit;
    font-size: 9px;
    text-decoration: none;
}

.sidebar__list-head .col-sort:hover {
    color: var(--brand);
}

#detail-pane.is-loading {
    opacity: 0.55;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.metric-basis {
    display: block;
    font-size: 10px;
    color: var(--muted);
    margin-top: 0.15rem;
}

.quote-header__periods span {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
}

.quote-header__periods em {
    font-style: normal;
    font-size: 9px;
    font-weight: 500;
    color: var(--muted-2);
}

.quote-header__title-row {
    align-items: center;
}

.quote-header__icon .asset-icon {
    width: 2rem;
    height: 2rem;
}

.reco-rail__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}

.reco-rail__head h2 {
    margin: 0;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.reco-rail__hint {
    margin: 0.15rem 0 0;
    font-size: 11px;
    color: var(--muted);
}

.reco-rail__meta {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--brand);
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    background: var(--brand-soft);
    border: 1px solid rgba(61, 90, 254, 0.2);
}

.reco-rail__track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 1fr);
    gap: 0.55rem;
    overflow-x: auto;
    padding-bottom: 0.35rem;
    scroll-snap-type: x mandatory;
}

.reco-card {
    scroll-snap-align: start;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.7rem 0.8rem;
    box-shadow: 0 6px 20px rgba(26, 35, 50, 0.06);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.reco-card.is-active {
    border-color: rgba(61, 90, 254, 0.45);
    box-shadow: 0 8px 24px rgba(61, 90, 254, 0.12);
}

.reco-card:hover {
    transform: translateY(-2px);
    border-color: rgba(61, 90, 254, 0.35);
}

.reco-card__quote {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0.35rem 0 0.2rem;
}

.reco-card__price {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.reco-card__chg {
    font-family: var(--mono);
    font-size: 11px;
}

.reco-card__reason {
    display: block;
    margin-top: 0.35rem;
    font-size: 10px;
    color: var(--muted);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reco-card__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reco-card__score {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--brand);
}

.reco-card p {
    margin: 0.25rem 0 0.35rem;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reco-card ul {
    margin: 0;
    padding-left: 1rem;
    color: var(--text);
    font-size: 11px;
}

.favorite-btn {
    border: 1px solid var(--border-strong);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    border-radius: 8px;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    transition: color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.favorite-btn.is-active {
    color: #f5c678;
    box-shadow: 0 0 18px rgba(245, 198, 120, 0.25);
}

.quote-header__title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.portfolio-head h3 {
    margin: 0 0 0.25rem;
}

.portfolio-head p {
    margin: 0 0 0.75rem;
    color: var(--muted);
    font-size: 12px;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 0.75rem;
}

.portfolio-panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.65rem;
}

.portfolio-panel h4 {
    margin: 0 0 0.5rem;
    font-size: 12px;
    color: var(--muted);
}

.tag {
    font-size: 10px;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
}

.tag--new { color: var(--positive); }
.tag--removed { color: var(--negative); }
.tag--changed { color: var(--brand); }

.symbol-row {
    transition: background 0.12s ease, transform 0.12s ease;
}

.symbol-row:hover {
    transform: translateX(2px);
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background: radial-gradient(1200px 600px at 20% -10%, rgba(107, 138, 253, 0.18), transparent), var(--bg);
}

.auth-card {
    width: min(420px, 92vw);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.auth-card h1 {
    margin: 0 0 0.35rem;
}

.auth-card__lead {
    color: var(--muted);
    margin: 0 0 1rem;
}

.auth-form label {
    display: block;
    margin-bottom: 0.65rem;
    font-size: 12px;
    color: var(--muted);
}

.auth-form input {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    font: inherit;
}

.auth-card__error {
    color: var(--negative);
    font-size: 12px;
}

.auth-card__foot {
    margin-top: 0.85rem;
    font-size: 12px;
    color: var(--muted);
}

.auth-card__foot a {
    color: var(--brand);
}

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

    .detail-layout--fund {
        grid-template-columns: 1fr;
    }

    .fund-rail {
        position: static;
        max-height: none;
    }
}

/* —— v5 layout & tooltips —— */
.detail-layout {
    display: block;
}

.detail-layout--fund {
    display: grid;
    grid-template-columns: minmax(0, 1fr) min(22rem, 34vw);
    gap: 0.85rem;
    align-items: start;
}

.fund-rail {
    position: sticky;
    top: 0.5rem;
    max-height: calc(100vh - var(--sticky-h) - 1rem);
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
}

.fund-rail__head h3 {
    margin: 0;
    font-size: 0.95rem;
}

.fund-rail__sub {
    margin: 0.25rem 0 0.65rem;
    font-size: 11px;
    color: var(--muted);
}

.fund-rail__table {
    max-height: 16rem;
    margin-bottom: 0.65rem;
}

.fund-rail__changes-title {
    margin: 0.5rem 0 0.35rem;
    font-size: 11px;
    color: var(--muted);
}

.data-table--compact td,
.data-table--compact th {
    padding: 0.35rem 0.4rem;
    font-size: 11px;
}

.quote-header__periods {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    font-size: 12px;
    font-weight: 600;
}

.quote-header__periods small {
    color: var(--muted);
    font-weight: 500;
    margin-right: 0.15rem;
}

.tip-layer {
    position: fixed;
    z-index: 10050;
    max-width: 18rem;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid var(--border-strong);
    box-shadow: 0 12px 32px rgba(26, 35, 50, 0.14);
    font-size: 11px;
    line-height: 1.45;
    color: var(--text);
    pointer-events: none;
    transform: translate(-50%, -100%);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.tip-layer.is-visible {
    opacity: 1;
}

.compare-block {
    margin: 0 0 0.85rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--panel);
}

.compare-block__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.compare-block__head h3 {
    margin: 0;
    font-size: 0.95rem;
}

.compare-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.compare-metrics__col {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
}

.compare-metrics__col h4 {
    margin: 0 0 0.15rem;
    font-size: 12px;
}

.compare-metrics__col table {
    width: 100%;
    font-size: 11px;
    margin-top: 0.35rem;
}

.compare-metrics__col td:last-child {
    text-align: right;
    font-weight: 600;
}

.fund-compare-form {
    display: flex;
    gap: 0.35rem;
    align-items: flex-end;
    margin-bottom: 0.65rem;
}

.fund-compare-form label {
    flex: 1;
    font-size: 11px;
    color: var(--muted);
    display: grid;
    gap: 0.2rem;
}

.fund-compare-form input {
    padding: 0.35rem 0.45rem;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: var(--bg);
    color: var(--text);
    font: inherit;
}

.holdings-cell {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.holdings-cell .tag {
    align-self: flex-start;
    margin-top: 0.15rem;
}

.chip--fresh {
    font-size: 10px;
    padding: 0.1rem 0.35rem;
}
