:root {
    --bg: #07090d;
    --panel: #0e1117;
    --panel2: #11151c;
    --border: #232832;
    --text: #e6e9ef;
    --muted: #858d9c;
    --accent: #d6d9df;
    --green: #53c28b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Arial,
        sans-serif;
}

.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: #090c11;
}

.brand {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1.6px;
}

.subtitle {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.status-area {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--green);
    border-radius: 50%;
}

.terminal-layout {
    display: grid;
    grid-template-columns: 210px 1fr;
    min-height: calc(100vh - 110px);
}

.sidebar {
    border-right: 1px solid var(--border);
    background: #090c11;
    padding: 20px 12px;
}

.nav-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    color: var(--muted);
    padding: 12px 14px;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    font-size: 14px;
}

.nav-item:hover {
    background: #12161d;
    color: var(--text);
}

.nav-item.active {
    background: #181d25;
    color: white;
}

.content {
    padding: 28px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 22px;
}

.page-header h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 600;
}

.page-description {
    margin-top: 7px;
    color: var(--muted);
    font-size: 13px;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.metric-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 17px;
}

.metric-name {
    color: var(--muted);
    font-size: 12px;
}

.metric-value {
    font-size: 27px;
    font-weight: 600;
    margin-top: 9px;
}

.metric-meta {
    margin-top: 6px;
    color: #676f7d;
    font-size: 11px;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 16px;
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 15px;
}

.placeholder {
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #626b78;
    border: 1px dashed #2b313b;
    border-radius: 6px;
    font-size: 13px;
}

.chart {
    height: 360px;
}

.status-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.status-table th {
    color: var(--muted);
    text-align: left;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    padding: 11px;
}

.status-table td {
    border-bottom: 1px solid #191e26;
    padding: 11px;
}

.fresh {
    color: var(--green);
}

footer {
    border-top: 1px solid var(--border);
    padding: 12px 28px;
    color: #59616f;
    font-size: 11px;
    text-align: right;
}

@media (max-width: 1000px) {

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

    .sidebar {
        display: flex;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .nav-item {
        min-width: 120px;
        width: auto;
    }

    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

}

@media (max-width: 600px) {

    .content {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .metric-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .metric-value {
        font-size: 22px;
    }

}


/* =========================================================
   US MACRO
   ========================================================= */

.macro-section {
    margin-bottom: 24px;
}

.macro-section-header {
    margin-bottom: 12px;
}

.macro-section-title {
    font-size: 18px;
    font-weight: 600;
}

.macro-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.macro-card {
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 14px;
    min-height: 105px;
}

.macro-card-label {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.macro-card-value {
    margin-top: 9px;
    font-size: 22px;
    font-weight: 600;
}

.macro-card-date {
    margin-top: 7px;
    font-size: 10px;
    color: #626b78;
}

.macro-chart {
    height: 330px;
}

.macro-error {
    color: #8f98a6;
    font-size: 12px;
}

@media (max-width: 1200px) {
    .macro-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 700px) {
    .macro-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .macro-chart {
        height: 290px;
    }
}


/* =========================================================
   DATA STATUS
   ========================================================= */

.status-fresh {
    color: #53c28b;
}

.status-stale {
    color: #d6a84b;
}

.status-error {
    color: #d15b64;
}

.status-nodata {
    color: #858d9c;
}

/* =========================================================
   RESPONSIVE TERMINAL — MOBILE / TABLET OVERRIDE
   ========================================================= */

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

img,
svg,
canvas {
    max-width: 100%;
}

.content,
.page,
.panel,
.metric-card,
.macro-card {
    min-width: 0;
}


/* TABLET */

@media (max-width: 1024px) {

    .terminal-layout {
        display: block;
        min-height: auto;
    }

    .sidebar {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        width: 100%;
        padding: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .sidebar::-webkit-scrollbar {
        display: none;
    }

    .nav-item {
        flex: 0 0 auto;
        width: auto;
        min-width: 110px;
        margin: 0;
        padding: 11px 14px;
        text-align: center;
        white-space: nowrap;
    }

    .content {
        width: 100%;
        max-width: none;
        padding: 22px;
    }

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

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

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

    .chart,
    .macro-chart {
        width: 100% !important;
        height: 320px;
    }

    .panel {
        overflow: hidden;
    }
}


/* MOBILE */

@media (max-width: 600px) {

    .topbar {
        height: auto;
        min-height: 72px;
        padding: 14px 16px;
        display: flex;
        align-items: flex-start;
        gap: 12px;
    }

    .brand {
        font-size: 17px;
        letter-spacing: 1.2px;
    }

    .subtitle {
        font-size: 11px;
    }

    .status-area {
        flex-shrink: 0;
        font-size: 10px;
        line-height: 1.4;
        text-align: right;
    }

    .status-dot {
        width: 7px;
        height: 7px;
        flex-shrink: 0;
    }

    .sidebar {
        padding: 10px 12px;
        gap: 5px;
    }

    .nav-item {
        min-width: auto;
        padding: 10px 13px;
        font-size: 13px;
        border-radius: 6px;
    }

    .content {
        padding: 18px 12px 24px;
    }

    .page-header {
        margin-bottom: 18px;
    }

    .page-header h1 {
        font-size: 23px;
        line-height: 1.25;
    }

    .page-description {
        margin-top: 6px;
        font-size: 12px;
        line-height: 1.5;
    }

    .metric-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .metric-card {
        width: 100%;
        padding: 15px;
    }

    .metric-name {
        font-size: 12px;
    }

    .metric-value {
        margin-top: 7px;
        font-size: 25px;
    }

    .metric-meta {
        margin-top: 5px;
        font-size: 10px;
    }

    .macro-section {
        margin-bottom: 22px;
    }

    .macro-section-title {
        font-size: 17px;
    }

    .macro-cards {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .macro-card {
        min-height: auto;
        padding: 14px;
    }

    .macro-card-label {
        font-size: 11px;
    }

    .macro-card-value {
        margin-top: 7px;
        font-size: 22px;
    }

    .macro-card-date {
        margin-top: 6px;
        font-size: 10px;
    }

    .panel {
        width: 100%;
        margin-bottom: 14px;
        padding: 12px;
        border-radius: 7px;
        overflow: hidden;
    }

    .chart,
    .macro-chart {
        width: 100% !important;
        max-width: 100% !important;
        height: 270px;
        min-height: 270px;
    }

    .js-plotly-plot,
    .plot-container,
    .svg-container {
        width: 100% !important;
        max-width: 100% !important;
    }

    .status-table {
        display: block;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        font-size: 11px;
        -webkit-overflow-scrolling: touch;
    }

    .status-table th,
    .status-table td {
        padding: 9px 10px;
    }

    footer {
        padding: 12px 14px;
        font-size: 10px;
        line-height: 1.5;
        text-align: center;
    }
}


/* VERY SMALL PHONES */

@media (max-width: 390px) {

    .topbar {
        padding: 12px;
    }

    .brand {
        font-size: 16px;
    }

    .status-area {
        font-size: 9px;
    }

    .content {
        padding-left: 10px;
        padding-right: 10px;
    }

    .page-header h1 {
        font-size: 21px;
    }

    .metric-value {
        font-size: 23px;
    }

    .chart,
    .macro-chart {
        height: 250px;
        min-height: 250px;
    }
}

