/* MinJi Dashboard — O8.2 MVP */
:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --border: #2a2d37;
    --text: #e4e4e7;
    --text-muted: #8b8d97;
    --accent: #3b82f6;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #eab308;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-mono);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.5;
}

/* Header */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.badge {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-running { background: #166534; color: #86efac; }
.badge-stopped { background: #7f1d1d; color: #fca5a5; }
.badge-unknown { background: #374151; color: #9ca3af; }

.header-stats {
    display: flex;
    gap: 20px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-value {
    font-size: 12px;
    font-weight: 500;
}

/* Main */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.card-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.card-value {
    font-size: 18px;
    font-weight: 600;
}

.card-value.positive { color: var(--green); }
.card-value.negative { color: var(--red); }

/* Risk Gauges */
.risk-section {
    margin-bottom: 24px;
}

.risk-section h2 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.risk-gauges {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.gauge {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
}

.gauge-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.gauge-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.gauge-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--green);
    transition: width 0.3s ease, background 0.3s ease;
}

.gauge-fill.warn { background: var(--yellow); }
.gauge-fill.danger { background: var(--red); }

.gauge-text {
    font-size: 12px;
    color: var(--text-muted);
}

/* Intelligence */
.intelligence-section {
    margin-bottom: 24px;
}

.intelligence-section h2 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.intelligence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.intel-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
    text-align: center;
}

.intel-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.intel-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.regime-badge {
    text-transform: uppercase;
    font-size: 13px;
}

.regime-sideways { color: var(--yellow); }
.regime-uptrend { color: var(--green); }
.regime-downtrend { color: var(--red); }
.regime-unstable { color: #f97316; }
.regime-no_trade { color: var(--text-muted); }

/* Chart */
.chart-section {
    margin-bottom: 24px;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.chart-header h2 {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

.chart-filters {
    display: flex;
    gap: 4px;
}

.filter-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-mono);
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    color: var(--text);
    border-color: var(--accent);
}

.filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.chart-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    height: 250px;
}

.chart-container-tall { height: 350px; }

/* Active Grid Orders */
.orders-section {
    margin-bottom: 24px;
}

.orders-section h2 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.orders-summary {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.orders-tag {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    text-transform: uppercase;
}

.orders-tag strong {
    margin-left: 4px;
    font-size: 13px;
}

.buy-tag { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.sell-tag { background: rgba(239, 68, 68, 0.15); color: var(--red); }
.neutral-tag { background: rgba(59, 130, 246, 0.15); color: var(--accent); }

.orders-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.orders-table th {
    text-align: left;
    padding: 10px 14px;
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    background: rgba(42, 45, 55, 0.4);
}

.orders-table td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
}

.orders-table tr:last-child td {
    border-bottom: none;
}

.orders-table .text-right {
    text-align: right;
}

.orders-table .side-buy {
    color: var(--green);
    font-weight: 600;
}

.orders-table .side-sell {
    color: var(--red);
    font-weight: 600;
}

.orders-table .dist-cell {
    font-weight: 600;
    font-size: 11px;
}

.orders-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 20px 14px !important;
}

/* Timeline */
.timeline-section {
    margin-bottom: 24px;
}

.timeline-section h2 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.timeline {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 12px;
}

.timeline-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.timeline-event {
    display: flex;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border);
}

.timeline-event:last-child { border-bottom: none; }

.timeline-time {
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 70px;
}

.timeline-type {
    font-weight: 600;
    min-width: 140px;
}

.timeline-type.system { color: var(--accent); }
.timeline-type.order { color: var(--green); }
.timeline-type.risk { color: var(--yellow); }
.timeline-type.error { color: var(--red); }
.timeline-type.pipeline { color: #a78bfa; }
.timeline-type.checkpoint { color: #67e8f9; }
.timeline-type.portfolio { color: #f0abfc; }
.timeline-type.position { color: #fbbf24; }

.timeline-detail {
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Footer */
footer {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    color: var(--text-muted);
    font-size: 11px;
    border-top: 1px solid var(--border);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
