@charset "UTF-8";

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #060c14;
    --side: #080f18;
    --panel: #101827;
    --panel2: #0c1522;
    --border: #1a2535;
    --text: #eef2f8;
    --dim: #8fa3be;
    --mute: #5a6d85;
    --blue: #165dff;
    --blue-d: #0e46c4;
    --up: #ef4444;
    --down: #10b981;
    --warn: #f59e0b;
    --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --mono: Consolas, "Cascadia Mono", monospace;
    --side-w: 200px;
}

html {
    font-size: 14px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    overflow-x: auto;
    min-width: 1920px;
}

a {
    color: inherit;
    text-decoration: none;
}

.terminal {
    display: flex;
    min-height: 100vh;
    width: 1920px;
    margin: 0 auto;
}

.sidebar {
    width: var(--side-w);
    flex-shrink: 0;
    background: var(--side);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
}

.brand-icon {
    width: 30px;
    height: 30px;
    border-radius: 5px;
    background: linear-gradient(135deg, var(--blue), #0a3d9e);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.brand h1 {
    font-size: 14px;
    font-weight: 700;
}

.brand p {
    font-size: 11px;
    color: var(--dim);
    margin-top: 1px;
}

.side-nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0 8px;
}

.side-item {
    display: block;
    margin: 2px 8px;
    padding: 7px 11px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    border-left: 3px solid transparent;
}

.side-item.active {
    background: rgba(22, 93, 255, 0.2);
    border-left-color: var(--blue);
    color: #fff;
}

.side-group-label {
    padding: 10px 14px 3px;
    font-size: 14px;
    font-weight: 700;
    color: #b8c8dc;
}

.side-sub {
    display: block;
    padding: 5px 14px 5px 20px;
    font-size: 14px;
    color: var(--dim);
}

.side-sub:hover {
    color: var(--text);
}

.side-bottom {
    border-top: 1px solid var(--border);
    padding: 10px 8px 12px;
}

.side-bottom-item {
    display: block;
    padding: 7px 10px;
    font-size: 14px;
    color: var(--dim);
}

.side-bottom-item:hover {
    color: var(--text);
}

.workspace {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    background: var(--side);
}

.top-tabs {
    display: flex;
    height: 100%;
}

.top-tab {
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-size: 14px;
    color: var(--dim);
    border-bottom: 2px solid transparent;
    height: 100%;
}

.top-tab.active {
    color: #fff;
    border-bottom-color: var(--blue);
    font-weight: 600;
}

.top-tools {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search {
    width: 188px;
    height: 28px;
    padding: 0 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 11px;
    outline: none;
}

.search:focus {
    border-color: var(--blue);
}

.search::placeholder {
    color: var(--mute);
}

.icon-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--panel);
    color: var(--text);
}

.user-pill {
    font-size: 11px;
}

.ticker-bar {
    display: none;
    height: 32px;
    align-items: center;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    background: #070d15;
    gap: 12px;
}

.ticker-bar.has-data {
    display: flex;
}

.ticker-scroll {
    flex: 1;
    display: flex;
    gap: 24px;
    overflow: hidden;
    white-space: nowrap;
    font-size: 13px;
    color: var(--dim);
}

.ticker-empty {
    color: var(--mute);
}

.ticker-item b {
    font-family: var(--mono);
    font-weight: 600;
    margin-left: 5px;
}

.ticker-item b.color-up {
    color: var(--up);
}

.ticker-item b.color-down {
    color: var(--down);
}

.ticker-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-family: var(--mono);
    color: var(--dim);
    flex-shrink: 0;
}

.dashboard {
    flex: 1;
    display: grid;
    grid-template-columns: 1.22fr 1.02fr 1.02fr;
    grid-template-rows: 108px 312px minmax(180px, 1fr) 128px;
    grid-template-areas:
        "monitor monitor heat"
        "month   product   heat"
        "matrix  research  volume"
        "matrix  research  ai";
    gap: 8px;
    padding: 8px 10px 10px;
}

.monitor-panel { grid-area: monitor; }
.heat-panel { grid-area: heat; }
.cross-month-panel { grid-area: month; }
.cross-product-panel { grid-area: product; }
.volume-panel { grid-area: volume; }
.matrix-panel { grid-area: matrix; }
.research-panel { grid-area: research; }
.ai-panel { grid-area: ai; }

.cross-month-panel .panel-head,
.cross-product-panel .panel-head {
    margin-bottom: 5px;
}

.cross-month-panel,
.cross-product-panel {
    padding: 8px 12px;
}

.cross-month-panel .data-table,
.cross-product-panel .data-table {
    font-size: 13.5px;
}

.cross-month-panel .data-table thead th,
.cross-product-panel .data-table thead th {
    font-size: 13px;
    padding: 8px 9px;
}

.cross-month-panel .data-table tbody td,
.cross-product-panel .data-table tbody td {
    font-size: 13.5px;
    padding: 8px 9px;
}

.cross-month-panel .data-table .col-name,
.cross-product-panel .data-table .col-name {
    font-size: 13.5px;
    font-weight: 700;
}

.cross-month-panel .data-table .col-rank,
.cross-product-panel .data-table .col-rank {
    font-size: 14px;
    font-weight: 800;
}

.cross-product-panel .panel-hint,
.cross-month-panel .panel-hint {
    font-size: 12px;
}

.cross-product-panel .btn-view {
    font-size: 12.5px;
    padding: 3px 10px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #fff;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.panel-head .panel-title {
    margin-bottom: 0;
}

.panel-hint {
    font-size: 10px;
    color: var(--mute);
}

.monitor-panel {
    padding: 6px 10px 5px;
}

.monitor-panel .panel-title {
    margin-bottom: 4px;
}

.monitor-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

.monitor-card {
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 8px 5px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    min-height: 0;
    overflow: hidden;
}

.monitor-card > p {
    font-size: 12.5px;
    color: var(--dim);
    line-height: 1.15;
    white-space: nowrap;
    flex-shrink: 0;
}

.monitor-row {
    display: flex;
    align-items: baseline;
    margin-top: 0;
    flex: 0 0 auto;
    min-height: 0;
}

.monitor-num {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    white-space: nowrap;
    line-height: 1;
}

.monitor-num strong {
    font-size: 24px;
    font-weight: 700;
    font-family: var(--mono);
    color: var(--up);
    line-height: 1;
}

.monitor-num.neutral strong {
    color: var(--text);
}

.monitor-num span {
    font-size: 12.5px;
    color: var(--dim);
    line-height: 1;
}

.monitor-delta {
    margin-top: 2px;
    font-size: 13px;
    line-height: 1.2;
    color: var(--mute);
    flex-shrink: 0;
}

.monitor-delta em {
    font-style: normal;
    font-family: var(--mono);
    font-weight: 700;
}

.monitor-delta em.color-up {
    color: var(--up);
}

.monitor-delta em.color-down {
    color: var(--down);
}

.chips {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.chip {
    padding: 3px 10px;
    font-size: 11px;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--dim);
    cursor: pointer;
    background: transparent;
    font-family: var(--font);
}

.chip.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.heatmap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto 1fr 1fr;
    gap: 10px;
    flex: 1;
    align-content: stretch;
    overflow-y: auto;
    padding: 4px 0;
    min-height: 0;
}

.heat-panel {
    min-height: 0;
}

.heat-panel .chips {
    margin-bottom: 6px;
}

.heat-sector-bar {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: 3px;
    font-size: 12px;
    border: 1px solid var(--border);
}

.heat-sector-bar .sector-pct {
    font-family: var(--mono);
    font-weight: 700;
}

.heat-tile {
    min-height: 72px;
    height: 100%;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 6px;
    border: 1px solid rgba(0, 0, 0, 0.35);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.heat-tile .sym,
.heat-tile .pct {
    color: #fff;
    -webkit-text-stroke: 0.35px rgba(0, 0, 0, 0.55);
    text-shadow:
        0 0 3px rgba(0, 0, 0, 0.95),
        0 2px 4px rgba(0, 0, 0, 0.9),
        0 0 8px rgba(0, 0, 0, 0.45);
}

.heat-tile .sym {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
    opacity: 0.96;
}

.heat-tile .heat-contract {
    font-size: 11px;
    font-family: var(--mono);
    font-weight: 600;
    letter-spacing: 0.02em;
    opacity: 0.92;
}

.heat-tile .pct {
    font-size: 14px;
    font-family: var(--mono);
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1;
}

.color-up { color: var(--up); }
.color-down { color: var(--down); }

.table-wrap {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #0c1522;
    padding: 7px 8px;
    text-align: left;
    font-weight: 600;
    color: var(--mute);
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 7px 8px;
    border-bottom: 1px solid rgba(26, 37, 53, 0.55);
    font-family: var(--mono);
    font-size: 13px;
    white-space: nowrap;
}

.data-table tbody tr:hover td {
    background: rgba(22, 93, 255, 0.06);
}

.data-table .col-rank {
    color: var(--warn);
    font-weight: 700;
    width: 32px;
}

.data-table .col-name {
    font-family: var(--font);
    font-weight: 600;
}

.data-table td.color-up { color: var(--up); }
.data-table td.color-down { color: var(--down); }

.data-table .cell-spark {
    width: 52px;
    padding: 3px 4px;
}

.btn-view {
    padding: 2px 9px;
    font-size: 10px;
    font-family: var(--font);
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.btn-view:hover {
    background: var(--blue-d);
}

.empty-hint {
    padding: 20px;
    text-align: center;
    color: var(--mute);
    font-size: 12.5px;
}

.matrix-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 6px;
}

.matrix-tab {
    padding: 4px 12px;
    font-size: 13px;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--dim);
    cursor: pointer;
}

.matrix-tab.active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.matrix-panel .panel-hint {
    font-size: 12px;
}

.matrix-panel .empty-hint {
    font-size: 13.5px;
    padding: 12px 8px;
    text-align: left;
}

.matrix-wrap {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    font-family: var(--mono);
}

.matrix th,
.matrix td {
    padding: 6px 7px;
    text-align: center;
    border: 1px solid rgba(26, 37, 53, 0.45);
    min-width: 42px;
}

.matrix thead th {
    background: #0c1522;
    color: var(--mute);
    font-size: 13px;
    font-weight: 600;
}

.matrix tbody th {
    background: #0c1522;
    color: var(--dim);
    text-align: left;
    font-size: 13px;
    font-weight: 600;
}

.matrix td.diag {
    background: #c41e1e !important;
    color: #fff;
    font-weight: 700;
}

.research-list {
    list-style: none;
    flex: 1;
    overflow: auto;
}

.research-list .empty-hint {
    list-style: none;
}

.research-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(26, 37, 53, 0.6);
    font-size: 12.5px;
    line-height: 1.45;
}

.research-item:last-child {
    border-bottom: none;
}

.tag {
    flex-shrink: 0;
    padding: 1px 6px;
    border-radius: 2px;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
}

.tag-chem { background: var(--blue); }
.tag-black { background: #374151; }
.tag-agri { background: #047857; }
.tag-other { background: #b45309; }

.research-text { flex: 1; }

.research-meta {
    flex-shrink: 0;
    font-size: 10px;
    color: var(--mute);
    font-family: var(--mono);
}

.volume-panel {
    min-height: 0;
    padding: 8px 12px;
}

.volume-panel .data-table thead th,
.volume-panel .data-table tbody td {
    font-size: 13.5px;
    padding: 8px 9px;
}

.ai-panel {
    min-height: 0;
    padding: 8px 12px 10px;
    display: flex;
    flex-direction: column;
}

.ai-body {
    flex: 1;
    overflow: auto;
    color: var(--dim);
    font-size: 13px;
    line-height: 1.6;
    min-height: 0;
}

.ai-body p {
    margin: 0;
}

.ai-body .inline-empty {
    padding: 0;
    text-align: left;
}

.ai-focus {
    margin-top: 6px;
    padding: 6px 8px;
    background: var(--panel2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 12px;
    line-height: 1.45;
}

.matrix-panel,
.research-panel {
    min-height: 0;
}

.load-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    color: var(--warn);
    padding: 40px;
    text-align: center;
}

.sparkline {
    display: block;
}
