.trade-dashboard-denied {
    padding: 18px 20px;
    border: 1px solid rgba(239, 68, 68, 0.36);
    border-radius: 8px;
    color: #fecaca;
    background: rgba(127, 29, 29, 0.22);
}

.td-root {
    --td-bg: #07090d;
    --td-panel: rgba(20, 24, 33, 0.72);
    --td-panel-strong: rgba(26, 31, 42, 0.86);
    --td-line: rgba(255, 255, 255, 0.10);
    --td-line-soft: rgba(255, 255, 255, 0.06);
    --td-text: #e6edf7;
    --td-muted: #8c98aa;
    --td-buy: #22c55e;
    --td-sell: #ef4444;
    --td-warning: #f59e0b;
    --td-info: #38bdf8;
    --td-shadow: 0 22px 80px rgba(0, 0, 0, 0.42);
    background:
        radial-gradient(circle at 18% 0%, rgba(56, 189, 248, 0.13), transparent 32%),
        radial-gradient(circle at 88% 12%, rgba(245, 158, 11, 0.09), transparent 24%),
        linear-gradient(135deg, #050609 0%, #0b0f17 48%, #07090d 100%);
    color: var(--td-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
    margin: 0;
    min-height: 100vh;
}

.td-root *,
.td-root *::before,
.td-root *::after {
    box-sizing: border-box;
}

.td-shell {
    margin: 0 auto;
    max-width: 1480px;
    padding: 32px 20px 44px;
}

.td-hero {
    align-items: flex-end;
    display: flex;
    gap: 20px;
    justify-content: space-between;
    margin-bottom: 22px;
}

.td-eyebrow,
.td-widget__kicker {
    color: var(--td-info);
    font-size: 12px;
    font-weight: 700;
    margin: 0 0 6px;
    text-transform: uppercase;
}

.td-hero h1 {
    color: var(--td-text);
    font-size: clamp(32px, 5vw, 64px);
    font-weight: 800;
    line-height: 1;
    margin: 0;
}

.td-hero__meta {
    align-items: center;
    background: rgba(12, 16, 24, 0.72);
    border: 1px solid var(--td-line);
    border-radius: 8px;
    color: var(--td-muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 13px;
    gap: 10px;
    justify-content: flex-end;
    padding: 12px 14px;
}

.td-heartbeat {
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid var(--td-line-soft);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 168px;
    padding: 9px 11px;
}

.td-heartbeat__status {
    align-items: center;
    color: var(--td-text);
    display: inline-flex;
    gap: 8px;
    line-height: 1.1;
}

.td-heartbeat__status strong {
    font-size: 14px;
}

.td-heartbeat__dot {
    background: var(--td-muted);
    border-radius: 999px;
    box-shadow: 0 0 0 5px rgba(140, 152, 170, 0.12);
    display: inline-block;
    height: 10px;
    width: 10px;
}

.td-heartbeat__age {
    color: var(--td-muted);
    font-size: 12px;
    white-space: nowrap;
}

.td-heartbeat.is-online {
    border-color: color-mix(in srgb, var(--td-buy) 38%, transparent);
}

.td-heartbeat.is-online .td-heartbeat__dot {
    background: var(--td-buy);
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.16);
}

.td-heartbeat.is-stale {
    border-color: color-mix(in srgb, var(--td-warning) 42%, transparent);
}

.td-heartbeat.is-stale .td-heartbeat__dot {
    background: var(--td-warning);
    box-shadow: 0 0 0 5px rgba(245, 158, 11, 0.16);
}

.td-heartbeat.is-offline {
    border-color: color-mix(in srgb, var(--td-sell) 42%, transparent);
}

.td-heartbeat.is-offline .td-heartbeat__dot {
    background: var(--td-sell);
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.14);
}

.td-divider {
    background: var(--td-line);
    height: 16px;
    width: 1px;
}

.td-source {
    color: var(--td-muted);
    font-size: 12px;
    white-space: nowrap;
}

.td-source strong {
    color: var(--td-text);
    font-weight: 800;
}

.td-live-dot {
    background: var(--td-muted);
    border-radius: 999px;
    box-shadow: 0 0 0 5px rgba(140, 152, 170, 0.12);
    display: inline-block;
    height: 8px;
    width: 8px;
}

.td-live-dot.is-running {
    background: var(--td-buy);
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.16);
}

.td-live-dot.is-stopped {
    background: var(--td-sell);
    box-shadow: 0 0 0 5px rgba(239, 68, 68, 0.14);
}

.td-alert {
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(245, 158, 11, 0.32);
    border-radius: 8px;
    color: #fde68a;
    margin-bottom: 16px;
    padding: 12px 14px;
}

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

.td-widget {
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    background: linear-gradient(180deg, rgba(28, 33, 45, 0.78), rgba(12, 15, 22, 0.70));
    border: 1px solid var(--td-line);
    border-radius: 8px;
    box-shadow: var(--td-shadow);
    grid-column: span 4;
    min-width: 0;
    overflow: hidden;
    padding: 18px;
}

.td-widget--wide {
    grid-column: span 12;
}

.td-widget[data-size="wide"] {
    grid-column: span 12;
}

.td-widget[data-size="half"] {
    grid-column: span 6;
}

.td-widget[data-size="third"] {
    grid-column: span 4;
}

.td-widget--account,
.td-widget--strategy,
.td-widget--risk {
    grid-column: span 4;
}

.td-widget--status {
    grid-column: span 12;
}

.td-widget__header {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.td-widget h2 {
    color: var(--td-text);
    font-size: 18px;
    line-height: 1.2;
    margin: 0;
}

.td-status-pill,
.td-chip,
.td-bias {
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--td-line);
    border-radius: 999px;
    color: var(--td-muted);
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    gap: 8px;
    min-height: 30px;
    padding: 6px 10px;
    white-space: nowrap;
}

.td-chip--warning {
    color: var(--td-warning);
}

.td-status-panel {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.td-status-panel > div,
.td-metric,
.td-key-grid > div,
.td-risk-stack > div,
.td-decision,
.td-events section,
.td-chart-placeholder {
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--td-line-soft);
    border-radius: 8px;
    min-width: 0;
}

.td-status-panel > div {
    padding: 16px;
}

.td-label,
.td-key-grid span,
.td-risk-stack span,
.td-decision span,
.td-chart-placeholder span {
    color: var(--td-muted);
    display: block;
    font-size: 12px;
    margin-bottom: 7px;
}

.td-status-panel strong {
    color: var(--td-text);
    display: block;
    font-size: 28px;
}

.td-metrics {
    display: grid;
    gap: 10px;
}

.td-metrics--account {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.td-metrics--positions {
    grid-template-columns: repeat(9, minmax(0, 1fr));
}

.td-metric {
    min-height: 92px;
    padding: 14px;
}

.td-metric strong {
    color: var(--td-text);
    display: block;
    font-size: 24px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.td-metric small {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-top: 4px;
}

.td-metric--hero {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.16), rgba(34, 197, 94, 0.08));
}

.td-metric--hero strong {
    font-size: 34px;
}

.td-positive,
.td-tone-positive {
    color: var(--td-buy) !important;
}

.td-negative,
.td-tone-negative {
    color: var(--td-sell) !important;
}

.td-tone-warning {
    color: var(--td-warning) !important;
}

.td-position-board {
    display: grid;
    gap: 12px;
}

.td-ratio-bar {
    background: rgba(239, 68, 68, 0.24);
    border: 1px solid var(--td-line);
    border-radius: 999px;
    display: flex;
    height: 12px;
    overflow: hidden;
}

.td-ratio-bar__long {
    background: linear-gradient(90deg, #16a34a, var(--td-buy));
    min-width: 0;
}

.td-ratio-bar__short {
    background: linear-gradient(90deg, var(--td-sell), #b91c1c);
    min-width: 0;
}

.td-table-wrap {
    margin-top: 16px;
    overflow-x: auto;
}

.td-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1120px;
    width: 100%;
}

.td-table th,
.td-table td {
    border-bottom: 1px solid var(--td-line-soft);
    padding: 12px 10px;
    text-align: right;
    white-space: nowrap;
}

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

.td-table th {
    color: var(--td-muted);
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    user-select: none;
}

.td-table td {
    color: var(--td-text);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.td-table tr:hover td {
    background: rgba(255, 255, 255, 0.035);
}

.td-side {
    border-radius: 999px;
    display: inline-flex;
    font-size: 11px;
    font-weight: 800;
    justify-content: center;
    min-width: 54px;
    padding: 5px 8px;
}

.td-side--long {
    background: rgba(34, 197, 94, 0.14);
    color: var(--td-buy);
}

.td-side--short {
    background: rgba(239, 68, 68, 0.14);
    color: var(--td-sell);
}

.td-position-cards {
    display: none;
}

.td-key-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.td-key-grid > div,
.td-risk-stack > div {
    padding: 13px;
}

.td-key-grid strong,
.td-risk-stack strong,
.td-decision strong {
    color: var(--td-text);
    display: block;
    font-size: 18px;
    overflow-wrap: anywhere;
}

.td-decision {
    margin-top: 10px;
    padding: 15px;
}

.td-decision p {
    color: var(--td-muted);
    margin: 8px 0 0;
}

.td-risk-stack {
    display: grid;
    gap: 10px;
}

.td-events {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.td-events section {
    padding: 14px;
}

.td-events h3 {
    color: var(--td-text);
    font-size: 15px;
    margin: 0 0 12px;
}

.td-event {
    border-top: 1px solid var(--td-line-soft);
    display: grid;
    gap: 4px;
    padding: 10px 0;
}

.td-event:first-child {
    border-top: 0;
    padding-top: 0;
}

.td-event strong {
    color: var(--td-text);
    font-size: 14px;
}

.td-event small,
.td-event p {
    color: var(--td-muted);
    margin: 0;
}

.td-chart-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.td-chart-placeholder {
    min-height: 210px;
    padding: 14px;
}

.td-chart-placeholder canvas {
    display: block;
    height: 160px;
    width: 100%;
}

@media (max-width: 1180px) {
    .td-widget--account,
    .td-widget--strategy,
    .td-widget--risk {
        grid-column: span 12;
    }

    .td-metrics--positions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .td-shell {
        padding: 22px 12px 32px;
    }

    .td-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .td-hero__meta {
        justify-content: flex-start;
        width: 100%;
    }

    .td-heartbeat {
        flex: 1 1 100%;
        min-width: 0;
        width: 100%;
    }

    .td-source {
        white-space: normal;
    }

    .td-widget {
        grid-column: span 12;
        padding: 14px;
    }

    .td-widget__header {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .td-status-panel,
    .td-metrics--account,
    .td-metrics--positions,
    .td-key-grid,
    .td-events,
    .td-chart-grid {
        grid-template-columns: 1fr;
    }

    .td-metric {
        min-height: 82px;
    }

    .td-table-wrap {
        display: none;
    }

    .td-position-cards {
        display: grid;
        gap: 10px;
        margin-top: 14px;
    }

    .td-position-card {
        background: rgba(255, 255, 255, 0.045);
        border: 1px solid var(--td-line-soft);
        border-radius: 8px;
        padding: 14px;
    }

    .td-position-card__top {
        align-items: center;
        display: flex;
        justify-content: space-between;
        margin-bottom: 12px;
    }

    .td-position-card__top strong {
        font-size: 18px;
    }

    .td-position-card__grid {
        display: grid;
        gap: 9px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .td-position-card__grid span {
        color: var(--td-muted);
        display: block;
        font-size: 11px;
    }

    .td-position-card__grid strong {
        color: var(--td-text);
        display: block;
        font-size: 14px;
        overflow-wrap: anywhere;
    }
}
