:root {
    --bg: #12151c;
    --panel: #1b2029;
    --panel-2: #232936;
    --border: #2d3442;
    --text: #e6e9ef;
    --muted: #98a2b3;
    --pos: #2fbf71;
    --neg: #e5534b;
    --accent: #4c8dff;
    --warn: #d9a441;
    --error: #e5534b;
    --ok: #2fbf71;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
}

h1, h2, h3 {
    margin: 0;
    font-weight: 600;
}

h1:focus {
    outline: none;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 12px;
}

.pos {
    color: var(--pos);
}

.neg {
    color: var(--neg);
}

/* ---------- shell ---------- */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: linear-gradient(180deg, #1d2330, #171b24);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    align-self: center;
}

.brand-title {
    font-size: 17px;
    font-weight: 700;
}

.brand-sub {
    color: var(--muted);
    font-size: 12px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.portfolio-nav-link {
    flex: 0 0 auto;
    color: #dce8ff;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 7px 12px;
    text-decoration: none;
    font-weight: 600;
}

.portfolio-nav-link:hover,
.portfolio-nav-link:focus-visible {
    border-color: var(--accent);
    color: #fff;
}

.user {
    color: var(--muted);
}

/* Development-only индикатор активного локального обхода входа. */
.dev-bypass-notice {
    background: rgba(217, 164, 65, 0.16);
    border-bottom: 1px solid rgba(217, 164, 65, 0.5);
    color: #f0d49a;
    padding: 8px 20px;
    font-size: 13px;
}

.app-main {
    padding: 16px 20px 40px;
    flex: 1;
}

/* ---------- grid & panels ---------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.span-2 {
    grid-column: span 2;
}

@media (max-width: 1100px) {
    .dashboard-grid {
        /* minmax(0, 1fr), а не 1fr: у одиночной колонки min-трек не должен
           раздуваться до min-content содержимого (таблица с nowrap-колонками). */
        grid-template-columns: minmax(0, 1fr);
    }

    .span-2 {
        grid-column: span 1;
    }
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    /* Страховка от grid-blowout: панель не расширяется под min-content потомков. */
    min-width: 0;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.panel-head h2 {
    font-size: 15px;
}

.heatmap-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 5px 8px;
    font-size: 12px;
}

/* ---------- buttons / inputs ---------- */
.btn {
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    border-radius: 7px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
}

.btn:hover {
    border-color: var(--accent);
}

.btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

.btn-ghost {
    background: transparent;
}

.btn-block {
    width: 100%;
}

.btn.active {
    border-color: var(--accent);
    color: var(--accent);
}

.search-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 7px;
    padding: 7px 10px;
    min-width: 240px;
}

.search-input::placeholder {
    color: var(--muted);
}

/* ---------- heatmap ---------- */
.heatmap-block {
    min-width: 0;
}

.sector-legend {
    min-width: 0;
    margin-bottom: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-2);
}

.sector-legend-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sector-legend-list li {
    min-width: 0;
    max-width: 100%;
    font-size: 13px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.heatmap {
    position: relative;
    width: 100%;
    height: clamp(400px, 54vw, 640px);
    border-radius: 8px;
    overflow: hidden;
    background: #0e1117;
    border: 1px solid var(--border);
}

.sector-group {
    position: absolute;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px #0b0d12;
    z-index: 1;
    container-type: size;
}

.sector-tiles {
    position: absolute;
    top: min(var(--sector-header-band-height), 50cqh);
    right: 0;
    left: 0;
    height: calc(100% - min(var(--sector-header-band-height), 50cqh));
}

.sector-label {
    position: absolute;
    z-index: 2;
    inset: 0 0 auto;
    height: min(var(--sector-header-band-height), 50cqh);
    display: flex;
    align-items: center;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 7px;
    border-bottom: 1px solid #303744;
    background: #141923;
    color: #fff;
    font-size: min(var(--sector-header-font-size), max(0px, calc(50cqh - 4px)));
    font-weight: 700;
    letter-spacing: 0.01em;
    pointer-events: none;
}

.sector-label-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tile {
    position: absolute;
    border: 1px solid rgba(0, 0, 0, 0.35);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    overflow: hidden;
    cursor: pointer;
    padding: 2px;
    font-family: inherit;
    container-type: size;
}

.tile:hover {
    outline: 2px solid #fff;
    z-index: 5;
}

.tile-selected {
    outline: 2px solid var(--accent);
    z-index: 4;
}

.tile-ticker {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: clamp(10px, min(12cqw, 24cqh), 28px);
    line-height: 1.1;
}

.tile-pct {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(9px, min(10cqw, 18cqh), 20px);
    opacity: 0.95;
    line-height: 1.1;
}

@container (max-width: 60px) {
    .tile-pct {
        display: none;
    }
}

@container (max-height: 36px) {
    .tile-pct {
        display: none;
    }
}

@container (max-width: 54px) {
    .tile-ticker,
    .tile-pct {
        display: none;
    }
}

@container (max-height: 30px) {
    .tile-ticker,
    .tile-pct {
        display: none;
    }
}

.unsized-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}

.chip {
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.35);
    color: #fff;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
}

.chip-selected {
    outline: 2px solid var(--accent);
}

.chip-pct {
    opacity: 0.9;
    margin-left: 4px;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    margin-top: 10px;
    font-size: 12px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ---------- FX / metals / futures ---------- */
.market-quote-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 8px;
}

.market-quote-card {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #171b24;
}

.market-quote-heading,
.market-quote-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: wrap;
}

.market-quote-contract {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.market-quote-value {
    display: flex;
    align-items: baseline;
    gap: 7px;
    margin-top: 10px;
    font-size: 19px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.market-quote-value .muted {
    font-size: 12px;
    font-weight: 400;
}

.market-quote-change {
    margin: 4px 0 9px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.market-quote-footer {
    justify-content: flex-start;
}

.market-quote-error {
    margin-top: 7px;
    color: var(--warn);
    font-size: 12px;
}

.badge-future {
    color: #f1d08a;
    background: rgba(217, 164, 65, 0.12);
    border-color: rgba(217, 164, 65, 0.45);
}

.swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
}

/* ---------- tables ---------- */
.table-scroll {
    overflow: auto;
    max-height: 520px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: var(--panel-2);
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    white-space: nowrap;
    z-index: 2;
}

.data-table thead th.num {
    text-align: right;
}

.data-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #232936;
    white-space: nowrap;
}

.data-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.data-table td.ticker {
    font-weight: 700;
}

.data-table td.name {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table tbody tr:hover {
    background: #232936;
}

.row-selected {
    background: rgba(76, 141, 255, 0.14);
}

.fx-clickable {
    cursor: pointer;
}

.sort-indicator {
    color: var(--accent);
    margin-left: 4px;
}

/* ---------- badges ---------- */
.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid transparent;
}

.badge-ok {
    background: rgba(47, 191, 113, 0.16);
    color: var(--ok);
    border-color: rgba(47, 191, 113, 0.4);
}

.badge-warn {
    background: rgba(217, 164, 65, 0.16);
    color: var(--warn);
    border-color: rgba(217, 164, 65, 0.4);
}

.badge-error {
    background: rgba(229, 83, 75, 0.16);
    color: var(--error);
    border-color: rgba(229, 83, 75, 0.4);
}

.badge-unknown {
    background: rgba(152, 162, 179, 0.14);
    color: var(--muted);
    border-color: rgba(152, 162, 179, 0.35);
}

/* ---------- status ---------- */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px 18px;
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.status-label {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.note {
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
}

.alert {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 13px;
}

.alert-error {
    background: rgba(229, 83, 75, 0.14);
    border: 1px solid rgba(229, 83, 75, 0.4);
    color: #ffb4ae;
}

.alert-warn {
    background: rgba(217, 164, 65, 0.14);
    border: 1px solid rgba(217, 164, 65, 0.4);
    color: #f0d49a;
}

.empty-state {
    padding: 24px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 8px;
}

/* ---------- indices ---------- */
.index-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.index-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-start;
    text-align: left;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
}

.index-card:hover {
    border-color: var(--accent);
}

.index-selected {
    outline: 2px solid var(--accent);
}

.index-ticker {
    font-weight: 700;
}

.index-name {
    color: var(--muted);
    font-size: 13px;
    min-height: 26px;
}

.index-value {
    font-size: 18px;
    font-variant-numeric: tabular-nums;
}

.index-change {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.index-time {
    font-size: 11px;
}

/* ---------- instrument card ---------- */
.instrument-card {
    min-width: 0;
}

.instrument-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 6px 18px;
    margin-bottom: 12px;
    font-size: 13px;
}

.period-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.candle-chart-container {
    width: 100%;
    min-width: 0;
}

.candle-chart {
    width: 100%;
    height: 360px;
    background: #0e1117;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.candle-chart .body.up {
    fill: var(--pos);
}

.candle-chart .body.down {
    fill: var(--neg);
}

.candle-chart .wick.up {
    stroke: var(--pos);
}

.candle-chart .wick.down {
    stroke: var(--neg);
}

.candle-chart .wick {
    stroke-width: 1;
}

.candle-chart .grid-line {
    stroke: #2a3240;
    stroke-width: 1;
}

.candle-chart .grid-label {
    fill: var(--muted);
    font-size: 11px;
}

.candle-chart .axis-label {
    fill: var(--muted);
    font-size: 11px;
}

/* Узкая ширина: длинные подписи оси «dd.MM HH:mm» (interval 60) могут пересекаться — уменьшаем кегль. */
@media (max-width: 480px) {
    .candle-chart .axis-label {
        font-size: 9px;
    }

    .heatmap {
        height: min(68vh, 560px);
        min-height: 380px;
    }

    .heatmap-controls {
        justify-content: flex-start;
    }

    /* Без горизонтального overflow на 400/320 px: шапка и строка поиска переносятся,
       поле поиска больше не удерживает min-width 240px, отступы основного контента меньше. */
    .app-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .app-main {
        padding-left: 12px;
        padding-right: 12px;
    }

    .search-row {
        flex-wrap: wrap;
    }

    .search-input {
        min-width: 0;
        flex: 1 1 auto;
    }
}

/* ---------- login ---------- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
}

.login-card {
    width: 340px;
    max-width: 100%;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.login-card h1 {
    font-size: 20px;
    margin-bottom: 4px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
}

.field span {
    color: var(--muted);
    font-size: 12px;
}

.field input {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 7px;
    padding: 9px 10px;
}

/* ---------- blazor error boundary ---------- */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Произошла ошибка.";
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: #333;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.development-mock-banner {
    padding: 10px 18px;
    border-bottom: 2px solid #f0a500;
    background: #4a3100;
    color: #fff3cd;
    font-weight: 600;
    text-align: center;
}

.portfolio-page {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.portfolio-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 4px 0 18px;
}

.portfolio-heading h1 {
    font-size: 24px;
    margin: 4px 0 6px;
}

.portfolio-heading p {
    margin-top: 0;
}

.eyebrow {
    color: #9bbdff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.portfolio-state {
    padding: 18px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.portfolio-state h2 {
    margin-bottom: 8px;
    font-size: 17px;
}

.portfolio-state-denied {
    border-color: rgba(217, 164, 65, .55);
}

.portfolio-state-error {
    border-color: rgba(229, 83, 75, .65);
}

.portfolio-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0 10px;
}

.portfolio-controls label {
    font-weight: 650;
}

.portfolio-account-select {
    min-width: min(320px, 100%);
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--panel-2);
    color: var(--text);
}

.portfolio-view-toggle {
    display: inline-flex;
    max-width: 100%;
    padding: 3px;
    gap: 3px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
}

.portfolio-view-toggle button {
    padding: 7px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    cursor: pointer;
}

.portfolio-view-toggle button.selected {
    background: #35445d;
    color: #fff;
}

.portfolio-view-toggle button:focus-visible,
.portfolio-expand-button:focus-visible {
    outline: 2px solid #8db4ff;
    outline-offset: 2px;
}

.portfolio-price-legend {
    margin: 4px 0 12px;
    color: var(--muted);
    font-size: 12px;
}

.portfolio-total-basis {
    color: #c6d0df;
    font-size: 12px;
}

.portfolio-negative {
    color: #ff817b;
}

.portfolio-positive {
    color: var(--pos);
}

.portfolio-account-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 8px;
}

.portfolio-account-status-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 10px;
    min-width: 0;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
}

.portfolio-summary {
    display: flex;
    gap: 18px;
    align-items: baseline;
    margin: 18px 0 8px;
}

.portfolio-total-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 8px;
    margin: 10px 0 14px;
}

.portfolio-total-card {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    overflow-wrap: anywhere;
}

.portfolio-price-basis {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    white-space: normal;
}

.portfolio-raw-note {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.portfolio-heatmap,
.portfolio-instrument-card {
    min-width: 0;
    margin: 0 0 16px;
}

.portfolio-heatmap-note {
    margin: 10px 0 0;
}

.portfolio-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    border: 1px solid var(--border);
    border-radius: 9px;
    scrollbar-color: #687386 var(--panel-2);
    scrollbar-width: thin;
}

.portfolio-table-scroll::-webkit-scrollbar {
    height: 10px;
}

.portfolio-table-scroll::-webkit-scrollbar-track {
    background: var(--panel-2);
}

.portfolio-table-scroll::-webkit-scrollbar-thumb {
    border: 2px solid var(--panel-2);
    border-radius: 8px;
    background: #687386;
}

.portfolio-table {
    width: 100%;
    min-width: 1180px;
    border-collapse: collapse;
    background: var(--panel);
    font-size: 12px;
    line-height: 1.35;
    font-variant-numeric: tabular-nums;
}

.portfolio-table th,
.portfolio-table td {
    padding: 8px 4px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.portfolio-table th.num,
.portfolio-table td.num {
    padding-left: 3px;
    padding-right: 3px;
}

.portfolio-table th {
    position: sticky;
    top: 0;
    background: var(--panel-2);
    color: #c6d0df;
    font-size: 11px;
    line-height: 1.25;
    vertical-align: bottom;
    text-align: center;
    white-space: normal;
}

.portfolio-table thead th.num {
    text-align: center;
}

.portfolio-table thead th[aria-sort] {
    padding: 0;
}

.portfolio-table thead th[aria-sort] .portfolio-sort-button {
    display: block;
    width: 100%;
    padding: 8px 3px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: center;
    white-space: normal;
    cursor: pointer;
}

.portfolio-table thead th[aria-sort] .portfolio-sort-button::before {
    content: "";
    position: absolute;
    inset: 0;
}

.portfolio-sort-label {
    overflow-wrap: break-word;
}

.portfolio-table thead th[aria-sort] .portfolio-sort-button:hover {
    color: #f2f6ff;
}

.portfolio-table thead th[aria-sort] .portfolio-sort-button:focus-visible {
    outline: 2px solid #7cc0ff;
    outline-offset: -2px;
}

.portfolio-sort-indicator {
    position: absolute;
    top: 0;
    right: 2px;
    color: #7cc0ff;
    font-size: 8px;
    line-height: 1;
    pointer-events: none;
}

.portfolio-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.portfolio-metric-note {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.2;
    text-align: inherit;
    white-space: normal;
    overflow-wrap: break-word;
}

.portfolio-table tbody tr:last-child td {
    border-bottom: 0;
}

.portfolio-table .portfolio-group-row {
    background: #252d3a;
}

.portfolio-table .portfolio-account-detail-row {
    background: #191e27;
}

.portfolio-table .portfolio-account-detail-row td:first-child {
    padding-left: 28px;
}

.portfolio-table td:nth-child(-n + 6) {
    white-space: normal;
}

.portfolio-table td:nth-child(1),
.portfolio-table td:nth-child(2),
.portfolio-table td:nth-child(3),
.portfolio-table td:nth-child(5) {
    overflow-wrap: break-word;
}

.portfolio-table td:nth-child(2) {
    min-width: 84px;
}

.portfolio-table td:nth-child(3) {
    min-width: 60px;
}

.portfolio-table td:nth-child(5) {
    min-width: 84px;
}

.portfolio-table td:first-child {
    white-space: normal;
    min-width: 140px;
}

.portfolio-table td:first-child small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.portfolio-expand-button {
    padding: 0;
    border: 0;
    background: none;
    color: #dce8ff;
    font: inherit;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}

@media (max-width: 700px) {
    .app-header {
        padding: 10px 12px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .brand {
        flex: 1 1 210px;
        gap: 7px;
        flex-wrap: wrap;
    }

    .brand-sub {
        flex-basis: 100%;
        margin-left: 17px;
    }

    .portfolio-nav-link {
        padding: 6px 9px;
    }

    .header-actions {
        gap: 7px;
    }

    .app-main {
        padding: 14px 12px 32px;
    }

    .portfolio-heading {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .portfolio-heading h1 {
        font-size: 22px;
    }

    .portfolio-heading .btn {
        flex: 0 0 auto;
    }

    .portfolio-summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .portfolio-controls {
        align-items: flex-start;
    }

    .portfolio-account-select {
        flex: 1 1 100%;
    }

    .portfolio-view-toggle {
        flex: 1 1 100%;
    }

    .portfolio-view-toggle button {
        flex: 1 1 50%;
        padding-inline: 6px;
    }
}
