:root {
    color-scheme: dark;
    --bg: #090b0d;
    --panel: #121519;
    --panel-strong: #171b20;
    --border: #262c33;
    --border-soft: #1d2228;
    --text: #f4f7fb;
    --muted: #8d96a3;
    --muted-strong: #b1bac5;
    --blue: #64a8df;
    --blue-bright: #8bc8f5;
    --cyan: #67c8e8;
    --orange: #ff9a4d;
    --pink: #e77fb2;
    --green: #64d4a3;
    --danger: #ff8a8a;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--bg);
}

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 15% -10%, rgba(71, 129, 175, .17), transparent 30%),
        radial-gradient(circle at 86% 2%, rgba(255, 154, 77, .07), transparent 25%),
        var(--bg);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
a {
    font: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 76px;
    padding: 12px clamp(18px, 3vw, 44px);
    background: rgba(9, 11, 13, .9);
    border-bottom: 1px solid rgba(56, 65, 75, .65);
    backdrop-filter: blur(18px);
}

.site-header__identity,
.header-actions,
.card-heading,
.page-footer {
    display: flex;
    align-items: center;
}

.site-header__identity {
    gap: 18px;
}

.header-link {
    text-decoration: none;
    transition: .2s ease;
}

.eyebrow,
.section-kicker {
    margin: 0 0 4px;
    color: #6d7885;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .16em;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 20px;
    letter-spacing: -.02em;
}

h2 {
    margin-bottom: 0;
    font-size: 18px;
    letter-spacing: -.02em;
}

.header-actions {
    gap: 9px;
    color: var(--muted);
    font-size: 12px;
}

.header-link {
    min-height: 34px;
    padding: 8px 12px;
    color: #eaf4ff;
    background: rgba(71, 129, 175, .12);
    border: 1px solid rgba(100, 168, 223, .3);
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
}

.header-link--cyan {
    color: #dff8ff;
    background: rgba(92, 194, 218, .09);
    border-color: rgba(92, 194, 218, .28);
}

.header-link:hover {
    background: rgba(100, 168, 223, .2);
}

.refresh-cadence {
    padding: 6px 9px;
    color: #83909c;
    background: rgba(255, 255, 255, .025);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    font-size: 10px;
    white-space: nowrap;
}

.status-dot {
    width: 7px;
    height: 7px;
    margin-left: 5px;
    background: var(--orange);
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(255, 154, 77, .09);
}

.status-dot.is-live {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(100, 212, 163, .09);
}

.status-dot.is-error {
    background: var(--danger);
    box-shadow: 0 0 0 4px rgba(255, 138, 138, .09);
}

.refresh-button {
    min-height: 34px;
    padding: 0 13px;
    color: var(--muted-strong);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 9px;
    cursor: pointer;
}

.refresh-button:hover {
    color: var(--text);
    background: var(--panel-strong);
}

.refresh-button:disabled {
    opacity: .55;
    cursor: wait;
}

.dashboard-shell {
    width: min(1580px, 100%);
    margin: 0 auto;
    padding: 22px clamp(16px, 3vw, 44px) 42px;
}

.quality-chip {
    padding: 5px 8px;
    color: var(--cyan);
    background: rgba(103, 200, 232, .09);
    border: 1px solid rgba(103, 200, 232, .23);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
}

.quality-chip.is-warning {
    color: #f2bd7f;
    background: rgba(255, 154, 77, .09);
    border-color: rgba(255, 154, 77, .24);
}

.notice {
    margin-top: 14px;
    padding: 11px 14px;
    color: #f4d5a9;
    background: rgba(108, 70, 24, .24);
    border: 1px solid rgba(225, 155, 69, .35);
    border-radius: 10px;
    font-size: 12px;
}

.panel {
    min-width: 0;
    background: linear-gradient(145deg, rgba(25, 29, 34, .97), rgba(16, 19, 23, .97));
    border: 1px solid var(--border-soft);
    box-shadow: 0 16px 50px rgba(0, 0, 0, .14);
}

.overview-section {
    margin-top: 14px;
}

.portfolio-hero,
.strip-card,
.chart-card,
.stock-panel {
    border-radius: 18px;
}

.portfolio-hero {
    display: grid;
    min-height: 300px;
    overflow: hidden;
    grid-template-columns: minmax(410px, .88fr) minmax(440px, 1.12fr);
    background:
        linear-gradient(112deg, rgba(100, 168, 223, .09), transparent 42%),
        linear-gradient(145deg, rgba(25, 29, 34, .98), rgba(14, 17, 20, .98));
}

.portfolio-hero__value,
.portfolio-hero__trend {
    min-width: 0;
    padding: 30px 32px;
}

.portfolio-hero__value {
    display: flex;
    flex-direction: column;
}

.portfolio-hero__trend {
    border-left: 1px solid var(--border-soft);
    background: rgba(9, 12, 15, .36);
}

.card-heading {
    justify-content: space-between;
    gap: 18px;
    min-height: 42px;
}

.hero-value {
    display: block;
    margin: auto 0 10px;
    color: #f7f9fc;
    font-size: clamp(48px, 5.6vw, 82px);
    font-weight: 520;
    letter-spacing: -.065em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.hero-meta {
    display: grid;
    gap: 6px;
}

.hero-meta strong {
    color: #dfe4e8;
    font-size: 15px;
}

.hero-meta span,
.formula-note,
.strip-card > span {
    color: #737d89;
    font-size: 11px;
    line-height: 1.5;
}

.hero-meta span.is-positive,
.value-positive {
    color: var(--green);
}

.hero-meta span.is-negative,
.value-negative {
    color: var(--pink);
}

.formula-note {
    margin-top: 20px;
    color: #68737e;
}

.trend-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.trend-heading strong {
    color: #cbd3da;
    font-size: 14px;
}

.trend-heading > span {
    color: var(--muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.chart--spark {
    height: 205px;
    margin-top: 8px;
}

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

.strip-card {
    min-height: 164px;
    padding: 20px 22px;
}

.strip-card--account {
    grid-column: span 3;
}

.strip-card--price {
    grid-column: span 2;
}

.strip-card__heading,
.price-symbol {
    display: flex;
    align-items: center;
}

.strip-card__heading {
    gap: 11px;
}

.strip-card h2 {
    margin: 0;
    color: var(--muted-strong);
    font-size: 13px;
    font-weight: 650;
}

.metric-icon {
    display: grid;
    width: 34px;
    height: 34px;
    color: var(--blue-bright);
    background: rgba(100, 168, 223, .1);
    border: 1px solid rgba(100, 168, 223, .2);
    border-radius: 10px;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
}

.metric-icon--orange {
    color: #ffc08e;
    background: rgba(255, 154, 77, .1);
    border-color: rgba(255, 154, 77, .2);
}

.strip-card > strong {
    display: block;
    overflow: hidden;
    margin: 24px 0 8px;
    color: #f4f7fb;
    font-size: clamp(27px, 2.6vw, 44px);
    font-weight: 560;
    letter-spacing: -.045em;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.strip-card > strong.is-orange {
    color: #ffc08e;
}

.strip-card--price > strong {
    margin-top: 23px;
    color: var(--blue-bright);
    font-size: clamp(24px, 2.15vw, 36px);
}

.price-symbol {
    gap: 9px;
}

.price-symbol > span {
    display: grid;
    width: 29px;
    height: 29px;
    color: var(--blue-bright);
    background: rgba(100, 168, 223, .09);
    border-radius: 50%;
    place-items: center;
    font-size: 14px;
}

.price-symbol > strong {
    color: #b9c3cc;
    font-size: 11px;
    letter-spacing: .1em;
}

.composition-grid,
.account-history-grid {
    display: grid;
    gap: 14px;
    margin-top: 14px;
}

.composition-grid {
    grid-template-columns: minmax(520px, 1fr) minmax(0, 1.15fr);
}

.account-history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chart-card,
.stock-panel {
    position: relative;
    padding: 22px 22px 14px;
}

.card-note {
    color: #6f7985;
    font-size: 11px;
    text-align: right;
}

.chart {
    width: 100%;
}

.asset-layout {
    display: grid;
    align-items: center;
    gap: 12px;
    grid-template-columns: minmax(260px, .9fr) minmax(250px, 1.1fr);
}

.chart--asset {
    height: 340px;
}

.asset-breakdown {
    display: grid;
    gap: 4px;
    padding: 14px 4px 8px 8px;
}

.breakdown-loading {
    color: var(--muted);
    font-size: 12px;
}

.breakdown-row {
    display: grid;
    min-height: 48px;
    padding: 7px 8px;
    align-items: center;
    border-bottom: 1px solid rgba(38, 44, 51, .66);
    grid-template-columns: 9px minmax(0, 1fr) auto;
    gap: 11px;
}

.breakdown-marker {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .025);
}

.breakdown-row > div {
    display: grid;
    gap: 3px;
}

.breakdown-row > div strong {
    color: #d5dce2;
    font-size: 12px;
}

.breakdown-row > div span {
    color: #68737e;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.breakdown-percent {
    color: #aeb8c1;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.chart--wallet {
    height: 315px;
}

.wallet-summary {
    display: grid;
    gap: 8px;
    padding: 4px 0 8px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wallet-summary-item {
    display: grid;
    min-height: 55px;
    padding: 9px 11px;
    align-items: center;
    background: rgba(8, 11, 14, .42);
    border: 1px solid var(--border-soft);
    border-radius: 11px;
    grid-template-columns: 7px minmax(0, 1fr) auto;
    gap: 9px;
}

.wallet-summary-item > span {
    width: 6px;
    height: 28px;
    border-radius: 99px;
}

.wallet-summary-item > div {
    display: grid;
    gap: 3px;
}

.wallet-summary-item > div strong {
    color: #cfd6dc;
    font-size: 10px;
}

.wallet-summary-item small {
    color: #626e79;
    font-size: 9px;
}

.wallet-summary-item > strong {
    color: #aeb8c1;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
}

.chart--history {
    height: 450px;
}

.chart--account {
    height: 340px;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    color: var(--muted);
    font-size: 12px;
    transform: translate(-50%, -50%);
}

.stock-panel,
.history-panel {
    margin-top: 14px;
}

.table-scroll {
    margin-top: 14px;
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
}

th,
td {
    padding: 15px 12px;
    border-bottom: 1px solid var(--border-soft);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

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

th {
    color: #7193ad;
    background: rgba(100, 168, 223, .05);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
}

td {
    color: #cbd2d9;
    font-size: 13px;
}

td:first-child {
    color: var(--text);
    font-weight: 750;
    letter-spacing: .04em;
}

.table-state {
    padding: 42px;
    color: var(--muted);
    text-align: center !important;
}

.stock-formula-note {
    margin: 13px 2px 3px;
    color: #616b75;
    font-size: 10px;
    line-height: 1.55;
}

.page-footer {
    justify-content: space-between;
    gap: 16px;
    padding: 20px 4px 0;
    color: #5f6974;
    font-size: 10px;
}

noscript {
    display: block;
    padding: 20px;
    color: var(--danger);
    text-align: center;
}

@media (max-width: 1160px) {
    .portfolio-hero {
        grid-template-columns: minmax(360px, .9fr) minmax(400px, 1.1fr);
    }

    .strip-card--account {
        grid-column: span 6;
    }

    .strip-card--price {
        grid-column: span 4;
    }

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

    .asset-layout {
        grid-template-columns: minmax(300px, .8fr) minmax(280px, 1.2fr);
    }
}

@media (max-width: 880px) {
    .site-header {
        position: static;
        align-items: flex-start;
        gap: 12px;
    }

    .site-header__divider,
    .header-actions > span:not(.status-dot) {
        display: none;
    }

    .portfolio-hero,
    .account-history-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-hero__trend {
        padding-top: 22px;
        border-top: 1px solid var(--border-soft);
        border-left: 0;
    }

    .chart--spark {
        height: 180px;
    }

}

@media (max-width: 680px) {
    .site-header {
        padding: 10px 14px;
    }

    .site-header__identity {
        gap: 10px;
    }

    .site-header__identity > div,
    .header-link:first-child {
        display: none;
    }

    .header-link {
        min-height: 34px;
        padding: 0 10px;
        font-size: 10px;
    }

    .dashboard-shell {
        padding: 14px 12px 32px;
    }

    .strip-card--account {
        grid-column: span 12;
    }

    .strip-card--price {
        padding: 14px 12px;
        grid-column: span 4;
    }

    .strip-card--price > strong {
        margin-top: 18px;
        font-size: clamp(18px, 5.2vw, 24px);
    }

    .price-symbol {
        gap: 6px;
    }

    .price-symbol > span {
        width: 24px;
        height: 24px;
    }

    .portfolio-hero,
    .strip-card,
    .chart-card,
    .stock-panel {
        border-radius: 14px;
    }

    .portfolio-hero__value,
    .portfolio-hero__trend {
        padding-right: 20px;
        padding-left: 20px;
    }

    .hero-value {
        font-size: 48px;
    }

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

    .chart--asset {
        height: 300px;
    }

    .wallet-summary {
        grid-template-columns: 1fr;
    }

    .chart-card,
    .stock-panel {
        padding: 18px 14px 10px;
    }

    .chart--history {
        height: 370px;
    }

    .page-footer {
        align-items: flex-start;
        flex-direction: column;
    }
}
