* {
    box-sizing: border-box;
}


:root {
    --bg: #0b0f14;
    --panel: #111720;
    --panel-soft: #161d27;
    --border: #263140;
    --text: #edf2f7;
    --muted: #8c98a8;
    --accent: #5aa9ff;
    --green: #34d399;
    --red: #fb7185;
    --yellow: #fbbf24;
}


body {
    margin: 0;

    background:
        radial-gradient(
            circle at top right,
            rgba(90, 169, 255, 0.08),
            transparent 30%
        ),
        var(--bg);

    color: var(--text);

    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}


button,
select {
    font: inherit;
}


.app {
    width: min(
        1500px,
        calc(100% - 32px)
    );

    margin: 0 auto;

    padding:
        24px
        0
        40px;
}


/* =========================================================
   Header
   ========================================================= */

.topbar {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 28px;
}


.brand {
    font-size: 28px;

    font-weight: 800;

    letter-spacing: -0.03em;
}


.subtitle {
    color: var(--muted);

    margin-top: 4px;

    font-size: 13px;
}


.header-right {
    display: flex;

    gap: 14px;

    align-items: center;
}


.status-badge,
.small-badge {
    padding:
        6px
        10px;

    border-radius: 999px;

    background: var(--panel-soft);

    border: 1px solid var(--border);

    font-size: 12px;

    font-weight: 700;

    letter-spacing: 0.05em;
}


.last-update {
    color: var(--muted);

    font-size: 12px;
}


/* =========================================================
   Navigation
   ========================================================= */

.asset-navigation {
    display: flex;

    gap: 10px;

    align-items: center;

    margin-bottom: 22px;
}


.asset-button {
    border: 1px solid var(--border);

    background: var(--panel);

    color: var(--muted);

    padding:
        9px
        15px;

    border-radius: 9px;

    cursor: pointer;
}


.asset-button:hover {
    border-color: var(--accent);

    color: var(--text);
}


.asset-button.active {
    background: var(--accent);

    color: #07111f;

    border-color: var(--accent);

    font-weight: 800;
}


#timeframe {
    margin-left: auto;

    border:
        1px solid
        var(--border);

    background:
        var(--panel);

    color:
        var(--text);

    border-radius:
        9px;

    padding:
        9px
        12px;
}


/* =========================================================
   Summary
   ========================================================= */

.summary-grid {
    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 14px;

    margin-bottom: 22px;
}


.summary-card {
    background: var(--panel);

    border:
        1px solid
        var(--border);

    border-radius: 14px;

    padding: 18px;
}


.summary-card span {
    display: block;

    color: var(--muted);

    font-size: 12px;

    margin-bottom: 8px;
}


.summary-card strong {
    font-size: 26px;
}


/* =========================================================
   Asset Header
   ========================================================= */

.asset-header {
    display: flex;

    justify-content: space-between;

    align-items: end;

    margin-bottom: 18px;
}


.eyebrow {
    color: var(--muted);

    font-size: 11px;

    font-weight: 700;

    letter-spacing: 0.13em;
}


.asset-header h1 {
    margin:
        6px
        0
        0;

    font-size: 36px;
}


.asset-meta {
    text-align: right;

    color: var(--muted);

    font-size: 12px;
}


.asset-meta strong {
    display: block;

    color: var(--text);

    margin-top: 5px;
}


/* =========================================================
   Dashboard Grid
   ========================================================= */

.dashboard-grid {
    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );

    gap: 14px;

    margin-bottom: 14px;
}


.panel {
    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,0.015),
            rgba(255,255,255,0)
        ),
        var(--panel);

    border:
        1px solid
        var(--border);

    border-radius:
        14px;

    padding:
        18px;
}


.panel-header {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-bottom: 18px;
}


.panel-header h2 {
    margin: 0;

    font-size: 15px;
}


.full-panel {
    margin-top: 14px;
}


/* =========================================================
   Recommendation
   ========================================================= */

.signal-value {
    font-size: 38px;

    font-weight: 900;

    letter-spacing: -0.04em;

    margin:
        10px
        0
        20px;
}


.signal-long {
    color: var(--green);
}


.signal-short {
    color: var(--red);
}


.signal-hold {
    color: var(--yellow);
}


/* =========================================================
   Metrics
   ========================================================= */

.metric-row {
    display: flex;

    justify-content: space-between;

    gap: 15px;

    padding:
        9px
        0;

    border-bottom:
        1px
        solid
        rgba(
            255,
            255,
            255,
            0.05
        );
}


.metric-row:last-child {
    border-bottom: 0;
}


.metric-row span {
    color: var(--muted);

    font-size: 12px;
}


.metric-row strong {
    font-size: 13px;

    text-align: right;
}


.metric-grid {
    display: grid;

    grid-template-columns:
        repeat(
            2,
            minmax(0, 1fr)
        );

    gap: 12px;
}


.metric {
    background:
        var(--panel-soft);

    border-radius:
        10px;

    padding:
        11px;
}


.metric span {
    display: block;

    color: var(--muted);

    font-size: 11px;

    margin-bottom: 5px;
}


.metric strong {
    font-size: 14px;
}


/* =========================================================
   Timeline / Lists
   ========================================================= */

#timeline,
#news-list,
#social-list {
    display: grid;

    gap: 9px;
}


.timeline-item,
.news-item,
.social-item {
    background:
        var(--panel-soft);

    border:
        1px
        solid
        rgba(
            255,
            255,
            255,
            0.05
        );

    border-radius:
        10px;

    padding:
        12px;
}


.timeline-item {
    display: grid;

    grid-template-columns:
        180px
        1fr
        100px
        100px;

    gap: 10px;

    align-items: center;
}


.news-title {
    font-weight: 700;

    margin-bottom: 5px;
}


.news-summary,
.social-content {
    color: var(--muted);

    font-size: 13px;

    line-height: 1.5;
}


.news-meta {
    color: var(--muted);

    font-size: 11px;

    margin-top: 7px;
}


.empty-state {
    color: var(--muted);

    padding:
        18px
        0;

    text-align: center;

    font-size: 13px;
}


/* =========================================================
   Footer
   ========================================================= */

footer {
    display: flex;

    justify-content: center;

    gap: 18px;

    color: var(--muted);

    font-size: 11px;

    margin-top: 30px;
}


/* =========================================================
   Responsive
   ========================================================= */

@media (
    max-width: 1100px
) {

    .dashboard-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

}


@media (
    max-width: 760px
) {

    .app {
        width:
            min(
                100% - 20px,
                100%
            );

        padding-top:
            14px;
    }


    .topbar,
    .asset-header {
        align-items: flex-start;

        flex-direction: column;

        gap: 14px;
    }


    .header-right {
        width: 100%;

        justify-content:
            space-between;
    }


    .summary-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }


    .dashboard-grid {
        grid-template-columns: 1fr;
    }


    .timeline-item {
        grid-template-columns: 1fr;
    }


    footer {
        flex-direction: column;

        align-items: center;
    }

}


/* =========================================================
   Charts
   ========================================================= */

.chart-subtitle {
    color: var(--muted);

    font-size: 11px;

    margin-top: 4px;
}


.chart-container {
    position: relative;

    width: 100%;

    height: 360px;
}


.chart-container canvas {
    width: 100% !important;

    height: 100% !important;
}


/* =========================================================
   Decision History
   ========================================================= */

#decision-history {
    display: grid;

    gap: 8px;
}


.decision-history-item {
    display: grid;

    grid-template-columns:
        180px
        100px
        100px
        1fr;

    gap: 12px;

    align-items: center;

    background:
        var(--panel-soft);

    border:
        1px solid
        rgba(
            255,
            255,
            255,
            0.05
        );

    border-radius:
        10px;

    padding:
        12px;
}


.decision-history-time {
    color: var(--muted);

    font-size: 12px;
}


.decision-history-signal {
    font-weight: 800;
}


.decision-history-confidence {
    color: var(--muted);

    font-size: 12px;
}


.decision-history-reasons {
    color: var(--muted);

    font-size: 12px;

    line-height: 1.4;
}


@media (
    max-width: 760px
) {

    .chart-container {
        height: 280px;
    }


    .decision-history-item {
        grid-template-columns: 1fr;
        gap: 6px;
    }

}

/* =========================================================
   System Monitor
   ========================================================= */

.system-grid {

    display: grid;

    grid-template-columns:
        repeat(
            6,
            minmax(0, 1fr)
        );

    gap: 10px;
}


.system-metric {

    background:
        var(--panel-soft);

    border-radius:
        10px;

    padding:
        14px;
}


.system-metric span {

    display: block;

    color:
        var(--muted);

    font-size:
        11px;

    margin-bottom:
        7px;
}


.system-metric strong {

    font-size:
        17px;
}


/* =========================================================
   Recent Cycles
   ========================================================= */

#recent-cycles {

    display: grid;

    gap: 8px;
}


.cycle-row {

    display: grid;

    grid-template-columns:
        230px
        160px
        130px
        130px
        1fr;

    gap: 12px;

    align-items:
        center;

    background:
        var(--panel-soft);

    border:
        1px solid
        rgba(
            255,
            255,
            255,
            0.05
        );

    border-radius:
        10px;

    padding:
        12px;
}


.cycle-id {

    font-family:
        monospace;

    font-size:
        11px;

    color:
        var(--muted);

    overflow:
        hidden;

    text-overflow:
        ellipsis;
}


.cycle-status {

    font-size:
        12px;

    font-weight:
        800;
}


.cycle-status.success {
    color: var(--green);
}


.cycle-status.error {
    color: var(--red);
}


.cycle-status.running {
    color: var(--yellow);
}


.cycle-time {

    color:
        var(--muted);

    font-size:
        11px;
}


.cycle-error {

    color:
        var(--red);

    font-size:
        11px;

    white-space:
        nowrap;

    overflow:
        hidden;

    text-overflow:
        ellipsis;
}


@media (
    max-width: 1000px
) {

    .system-grid {

        grid-template-columns:
            repeat(
                3,
                minmax(0, 1fr)
            );
    }


    .cycle-row {

        grid-template-columns:
            1fr
            1fr;
    }

}


@media (
    max-width: 760px
) {

    .system-grid {

        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

}

/* =========================================================
   Market Chart
   ========================================================= */

.market-chart-container {

    width: 100%;

    height: 460px;

    border-radius: 10px;

    overflow: hidden;

    background:
        var(--panel-soft);
}


.chart-attribution {

    margin-top: 8px;

    text-align: right;

    color: var(--muted);

    font-size: 10px;
}


.chart-attribution a {

    color: var(--muted);

    text-decoration: none;
}


.chart-attribution a:hover {

    text-decoration: underline;
}


@media (
    max-width: 760px
) {

    .market-chart-container {

        height: 340px;
    }

}

/* =========================================================
   Health
   ========================================================= */

.health-grid {

    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 10px;
}


.health-card {

    background:
        var(--panel-soft);

    border:
        1px solid
        rgba(
            255,
            255,
            255,
            0.05
        );

    border-radius:
        10px;

    padding:
        14px;
}


.health-card-header {

    display: flex;

    justify-content:
        space-between;

    align-items:
        center;

    gap: 10px;

    margin-bottom:
        8px;
}


.health-name {

    font-weight:
        700;

    font-size:
        13px;
}


.health-status {

    font-size:
        10px;

    font-weight:
        800;

    padding:
        4px 7px;

    border-radius:
        999px;

    background:
        rgba(
            255,
            255,
            255,
            0.06
        );
}


.health-status.healthy {
    color: var(--green);
}


.health-status.error {
    color: var(--red);
}


.health-status.configured {
    color: var(--accent);
}


.health-status.unknown {
    color: var(--yellow);
}


.health-message {

    color:
        var(--muted);

    font-size:
        11px;

    line-height:
        1.5;
}


@media (
    max-width: 1000px
) {

    .health-grid {

        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

}


@media (
    max-width: 760px
) {

    .health-grid {

        grid-template-columns:
            1fr;
    }

}

/* =========================================================
   AI Diagnostics
   ========================================================= */

.diagnostics-grid {

    display: grid;

    grid-template-columns:
        repeat(
            4,
            minmax(0, 1fr)
        );

    gap: 10px;
}


.diagnostic-card {

    background:
        var(--panel-soft);

    border:
        1px solid
        rgba(
            255,
            255,
            255,
            0.05
        );

    border-radius:
        10px;

    padding:
        14px;
}


.diagnostic-card span {

    display: block;

    color:
        var(--muted);

    font-size:
        11px;

    margin-bottom:
        7px;
}


.diagnostic-card strong {

    display: block;

    font-size:
        16px;

    margin-bottom:
        5px;
}


.diagnostic-card small {

    color:
        var(--muted);

    font-size:
        10px;
}


.diagnostic-error {

    margin-top:
        10px;

    background:
        rgba(
            251,
            113,
            133,
            0.06
        );

    border:
        1px solid
        rgba(
            251,
            113,
            133,
            0.15
        );

    color:
        var(--muted);

    border-radius:
        10px;

    padding:
        12px;

    font-size:
        12px;

    line-height:
        1.5;

    word-break:
        break-word;
}


@media (
    max-width: 1000px
) {

    .diagnostics-grid {

        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

}


@media (
    max-width: 760px
) {

    .diagnostics-grid {

        grid-template-columns:
            1fr;
    }

}

.health-status.degraded {
    color: var(--yellow);
}

.health-status.stale {
    color: var(--yellow);
}


/* =========================================================
   Human Outcome
   ========================================================= */

.human-outcome-card {
    margin-top: 24px;
}


.human-outcome-content {
    margin-top: 18px;
}


.outcome-empty {
    padding: 18px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: #8c98a8;
}


.outcome-grid {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(180px, 1fr)
        );
    gap: 12px;
}


.outcome-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 18px;
}


.outcome-btn {
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 600;
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}


.outcome-btn:hover {
    filter: brightness(1.15);
}


.outcome-reject {
    background: rgba(251,113,133,0.18);
}


.outcome-execute {
    background: rgba(52,211,153,0.18);
}


.outcome-close {
    background: rgba(96,165,250,0.18);
}


.outcome-close-form {
    display: grid;
    grid-template-columns:
        repeat(
            auto-fit,
            minmax(180px, 1fr)
        );
    gap: 12px;
    margin-top: 18px;
}


.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}


.form-group label {
    font-size: 12px;
    color: #8c98a8;
}


.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 8px;
    padding: 9px 10px;
    background: rgba(255,255,255,0.04);
    color: #ffffff;
}


.outcome-notes {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    color: #c7d0dc;
}

.dataset-card {
    width: 100%;
}

.dataset-summary-content {
    margin-top: 16px;
}

.dataset-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(130px, 1fr)
    );
    gap: 12px;
}

.dataset-stat {
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--panel-background);
}

.dataset-stat span {
    display: block;
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 6px;
}

.dataset-stat strong {
    display: block;
    font-size: 20px;
}

.dataset-recent-section {
    margin-top: 24px;
}

.dataset-section-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

.dataset-recent-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dataset-record {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.dataset-record-symbol {
    font-weight: 600;
}

.dataset-record-symbol span {
    margin-left: 8px;
    opacity: 0.6;
    font-size: 12px;
}

.dataset-record-meta {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    font-size: 12px;
    opacity: 0.7;
    flex-wrap: wrap;
}

.dataset-record-result {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dataset-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.status-final {
    border: 1px solid currentColor;
}

.status-open {
    border: 1px solid currentColor;
}

.status-pending {
    border: 1px solid currentColor;
}

.dataset-result {
    font-weight: 600;
}

.dataset-pnl {
    font-size: 12px;
}

.dataset-loading,
.dataset-empty,
.dataset-error {
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    opacity: 0.75;
}

@media (max-width: 800px) {

    .dataset-record {
        flex-direction: column;
        align-items: flex-start;
    }

    .dataset-record-result {
        justify-content: flex-start;
    }
}

.pnl-positive {
    color: #34d399;
}

.pnl-negative {
    color: #fb7185;
}

.pnl-neutral {
    color: #8c98a8;
}


/* =========================================================
   Dashboard Views
   ========================================================= */

.dashboard-view {
    display: none;
}


.dashboard-view.active {
    display: block;
}


/* =========================================================
   Overview
   ========================================================= */

#overview-view {
    animation: dashboard-fade-in 0.18s ease;
}


#asset-view {
    animation: dashboard-fade-in 0.18s ease;
}


@keyframes dashboard-fade-in {

    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }

}


/* =========================================================
   Navigation
   ========================================================= */

.asset-navigation {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 22px;
    flex-wrap: wrap;
}


.asset-button {
    min-width: 92px;
    text-align: center;
    transition:
        border-color 0.15s ease,
        background 0.15s ease,
        color 0.15s ease,
        transform 0.15s ease;
}


.asset-button:active {
    transform: translateY(1px);
}


@media (max-width: 760px) {

    .asset-navigation {
        display: grid;
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }


    .asset-button {
        width: 100%;
    }


    #timeframe {
        width: 100%;
        margin-left: 0;
    }

}
