:root {
    --bg: #05070b;
    --bg-panel: rgba(12, 16, 24, 0.92);
    --bg-panel-strong: rgba(8, 11, 18, 0.98);
    --border: rgba(96, 129, 172, 0.18);
    --text: #eef2ff;
    --muted: #92a0bd;
    --green: #16c784;
    --red: #ff5d73;
    --blue: #59a7ff;
    --gold: #ffce54;
    --amber: #ffb347;
    --line: rgba(255, 255, 255, 0.06);
    --shadow: 0 24px 50px rgba(0, 0, 0, 0.38);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI Variable", "Bahnschrift", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(34, 84, 176, 0.18), transparent 28%),
        radial-gradient(circle at right 20%, rgba(18, 199, 132, 0.1), transparent 24%),
        linear-gradient(180deg, #04060a 0%, #060914 38%, #04070f 100%);
}

.shell {
    width: min(1500px, calc(100% - 32px));
    margin: 18px auto;
    display: grid;
    gap: 18px;
}

.topbar,
.chart-panel,
.sidebar .card,
.history-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.topbar {
    border-radius: 22px;
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-mark {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: linear-gradient(145deg, #091526, #16355f);
    border: 1px solid rgba(88, 158, 255, 0.3);
    color: #b9d7ff;
}

.eyebrow {
    margin: 0 0 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--muted);
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    font-size: 1.25rem;
    letter-spacing: 0.06em;
}

h2 {
    font-size: 1.08rem;
}

h3 {
    margin-top: 8px;
    font-size: 1.05rem;
}

.topbar-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

.symbol-picker,
.stat-chip,
.price-pill {
    min-height: 56px;
    border-radius: 16px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.symbol-picker span,
.stat-chip .label,
.price-pill span {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.symbol-picker select {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 0.98rem;
    outline: none;
}

.price-pill strong {
    font-size: 1.18rem;
}

.status strong {
    color: var(--gold);
}

.warning-banner {
    padding: 14px 18px;
    border-radius: 16px;
    background: rgba(255, 179, 71, 0.14);
    border: 1px solid rgba(255, 179, 71, 0.35);
    color: #ffd798;
}

.hidden {
    display: none;
}

body.modal-open {
    overflow: hidden;
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.65fr);
    gap: 18px;
}

.chart-panel {
    border-radius: 24px;
    padding: 20px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-head.compact {
    padding: 20px 20px 8px;
}

.panel-head-stats {
    display: flex;
    gap: 18px;
}

.panel-head-stats div,
.info-row,
.metric {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.panel-head-stats span,
.info-row span,
.metric span {
    color: var(--muted);
}

.chart {
    height: 600px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent),
        #050913;
}

.chart-shell {
    position: relative;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(5, 9, 19, 0.72), rgba(5, 9, 19, 0.88));
    text-align: center;
    pointer-events: none;
}

.chart-empty strong {
    font-size: 1rem;
}

.chart-empty span {
    color: var(--muted);
    max-width: 420px;
    line-height: 1.5;
}

.legend {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--muted);
    font-size: 0.9rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.liq-buy {
    background: var(--green);
}

.liq-sell {
    background: var(--red);
}

.se-conf {
    background: var(--blue);
}

.hybrid {
    background: var(--gold);
}

.sidebar {
    display: grid;
    gap: 18px;
}

.sidebar .card {
    border-radius: 22px;
    padding: 18px;
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.badge {
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.badge.buy {
    color: #8dffd2;
    background: rgba(22, 199, 132, 0.14);
    border-color: rgba(22, 199, 132, 0.35);
}

.badge.sell {
    color: #ffbac6;
    background: rgba(255, 93, 115, 0.15);
    border-color: rgba(255, 93, 115, 0.35);
}

.badge.hybrid {
    color: #ffe5a3;
    background: rgba(255, 206, 84, 0.14);
    border-color: rgba(255, 206, 84, 0.35);
}

.badge.neutral {
    color: #cad6f5;
    background: rgba(89, 167, 255, 0.09);
    border-color: rgba(89, 167, 255, 0.2);
}

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

.metric {
    flex-direction: column;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.metric strong {
    font-size: 1.05rem;
}

.info-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.info-row:last-child {
    border-bottom: none;
}

.muted {
    color: var(--muted);
}

.footnote {
    margin-top: 12px;
    line-height: 1.55;
}

.history-panel {
    border-radius: 24px;
    overflow: hidden;
}

.plans-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 18px;
}

.plans-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 7, 13, 0.78);
    backdrop-filter: blur(10px);
}

.plans-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(1100px, 100%);
    max-height: 90vh;
    overflow: auto;
    border-radius: 26px;
    padding: 24px;
    background: rgba(9, 13, 22, 0.96);
    border: 1px solid rgba(96, 129, 172, 0.2);
    box-shadow: var(--shadow);
}

.plans-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.plans-modal-copy {
    margin-top: 10px;
    max-width: 720px;
    color: var(--muted);
    line-height: 1.6;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.plan-card {
    border-radius: 22px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    gap: 14px;
    align-content: start;
}

.plan-card.highlight {
    border-color: rgba(255, 206, 84, 0.34);
    background: linear-gradient(180deg, rgba(255, 206, 84, 0.12), rgba(255,255,255,0.035));
}

.plan-card h3 {
    margin: 0;
    font-size: 1.2rem;
}

.plan-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.plan-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.plan-price strong {
    font-size: 2.1rem;
}

.plan-price span {
    color: var(--muted);
}

.plan-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.plan-features li {
    color: #dbe6fb;
    line-height: 1.45;
}

.plan-actions {
    display: grid;
    gap: 10px;
}

.panel-action {
    min-height: 42px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.panel-action.primary {
    color: #071017;
    background: linear-gradient(135deg, var(--gold), #ffe8a0);
    border-color: rgba(255, 206, 84, 0.4);
}

.panel-action.secondary {
    background: rgba(255,255,255,0.03);
}

.panel-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.plans-modal-footer {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.table-wrap {
    overflow: auto;
    padding: 0 20px 20px;
}

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

th,
td {
    padding: 14px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

.type-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.type-pill.liq {
    background: rgba(22, 199, 132, 0.12);
    color: #90f7cb;
}

.type-pill.se {
    background: rgba(89, 167, 255, 0.12);
    color: #b9dcff;
}

.type-pill.hybrid {
    background: rgba(255, 206, 84, 0.12);
    color: #ffe39d;
}

.side-buy {
    color: #8ef0c4;
}

.side-sell {
    color: #ff9dad;
}

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

    .chart {
        height: 480px;
    }
}

@media (max-width: 820px) {
    .shell {
        width: min(100% - 18px, 100%);
        margin: 10px auto 18px;
    }

    .topbar {
        padding: 16px;
    }

    .topbar,
    .panel-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-controls {
        justify-content: flex-start;
    }

    .chart {
        height: 360px;
    }

    .plans-modal-head,
    .plans-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }
}
