:root {
    --bg-color: #0d0f17;
    --card-bg: rgba(20, 26, 42, 0.4);
    --border-color: rgba(255, 255, 255, 0.05);
    --neon-cyan: #00f2ff;
    --emerald-up: #10b981;
    --rose-down: #f43f5e;
    --amber-warn: #fbbf24;
    --text-main: #f1f5f9;
    --text-dim: #94a3b8;
    --font-legion: 'Orbitron', sans-serif;
    --font-data: 'Inter', sans-serif;
    --glass-blur: blur(20px);
    --bento-gap: 24px;
    --bento-radius: 16px;
}

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

body.legion-theme {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Noto Sans KR', sans-serif;
    overflow-x: hidden;
    /* Removed height: 100vh to allow page scrolling */
    background-image:
        radial-gradient(circle at 50% 50%, rgba(13, 110, 253, 0.05) 0%, transparent 80%),
        linear-gradient(rgba(18, 18, 18, 0.8) 1px, transparent 1px),
        linear-gradient(90deg, rgba(18, 18, 18, 0.8) 1px, transparent 1px);
    background-size: 100% 100%, 30px 30px, 30px 30px;
}

/* Custom Scrollbar for Premium Feel */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
::-webkit-scrollbar-thumb { background: rgba(56, 189, 248, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(56, 189, 248, 0.4); }

.main-title {
    font-family: var(--font-legion);
    font-weight: 700;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 15px rgba(0, 242, 255, 0.3);
}

.main-title span { color: var(--neon-cyan); }

/* Slim Premium Header */
.main-header {
    background: rgba(13, 15, 23, 0.8);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: var(--glass-blur);
}

.header-left { display: flex; align-items: center; gap: 20px; }
.header-right { display: flex; align-items: center; gap: 24px; }

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--emerald-up); box-shadow: 0 0 10px var(--emerald-up); }

.status-badge {
    background: var(--neon-cyan);
    color: #000;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 2px;
    margin-right: 10px;
}

.pulse { animation: pulse-animation 2s infinite; }
@keyframes pulse-animation {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.highlight { color: var(--neon-cyan); font-weight: bold; }

.combat-ready-btn {
    background: transparent;
    border: 1px solid var(--neon-green);
    color: var(--neon-green);
    font-family: var(--font-legion);
    padding: 5px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

/* Dashboard Layout */
.dashboard-content {
    display: flex; /* Using flex for sidebar + tactical */
    flex: 1;
    overflow: hidden;
}

/* Tactical Area (Bento Grid) */
.tactical-area {
    flex: 1;
    overflow-y: auto;
    padding: var(--bento-gap);
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: min-content;
    gap: var(--bento-gap);
}

/* Stats Cards Section (Bento Items) */
.top-stats-grid {
    grid-column: span 12;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--bento-gap);
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 24px;
    border-radius: var(--bento-radius);
    backdrop-filter: var(--glass-blur);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-card:hover { 
    transform: translateY(-4px); 
    border-color: rgba(0, 242, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.stat-card.pnl-card { border-left-color: var(--rose-down); }

.stat-card .label { 
    font-size: 10px; 
    color: var(--text-dim); 
    margin-bottom: 8px; 
    font-family: var(--font-legion);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.stat-card .value { 
    font-size: 28px; 
    font-weight: 700; 
    font-family: var(--font-data); 
    color: #fff;
}
.stat-card .unit { font-size: 12px; color: var(--text-dim); }
.stat-card .sub-label { font-size: 10px; color: var(--text-dim); margin-top: 5px; }

.pnl-header { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-dim); margin-bottom: 8px; }
.pnl-values { display: flex; gap: 15px; }
.pnl-item { display: flex; flex-direction: column; }
.pnl-val { font-size: 16px; font-weight: bold; }
.pnl-pct { font-size: 11px; }
.plus { color: var(--emerald-up); }
.minus { color: var(--rose-down); }

/* Command Logs (Bento Item) */
.command-logs-container {
    grid-column: span 8;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--bento-radius);
    overflow: hidden;
    backdrop-filter: var(--glass-blur);
}

.log-header {
    background: rgba(16, 22, 38, 0.5);
    padding: 10px 15px;
    font-size: 12px;
    font-family: var(--font-legion);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #222;
}

.log-body {
    height: 100px;
    padding: 10px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    overflow-y: auto;
    color: #0f0;
}

/* Ledger Table (Bento Item) */
.ledger-container {
    grid-column: span 12;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--bento-radius);
    backdrop-filter: var(--glass-blur);
    overflow: hidden;
}

/* Formation Grids (Bento Items) */
.formation-box {
    grid-column: span 4;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--bento-radius);
    height: 320px;
    display: flex;
    flex-direction: column;
    backdrop-filter: var(--glass-blur);
    transition: transform 0.3s ease;
}

.formation-box:hover { transform: scale(1.01); border-color: rgba(56, 189, 248, 0.25); }

/* Sparkline Container */
.sparkline {
    width: 60px;
    height: 24px;
    margin-right: 12px;
}

.stock-item {
    padding: 12px 16px;
    /* ... rest ... */
}

/* Sidebar Styling */
.info-sidebar {
    width: 320px;
    background: rgba(10, 15, 28, 0.98);
    border-left: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 50px; /* Aligned below the sticky header */
    height: calc(100vh - 50px);
    overflow-y: auto;
}

.legion-title { text-align: right; border-right: 4px solid var(--neon-cyan); padding-right: 15px; margin-bottom: 10px; }
.main-title { font-size: 20px; font-weight: bold; font-family: var(--font-legion); color: var(--neon-cyan); }
.sub-title { font-size: 12px; color: var(--text-dim); font-family: var(--font-legion); }

/* Sentiment Gauge */
.sentiment-box { text-align: center; margin: 10px 0; }
.gauge-container {
    position: relative;
    width: 180px;
    height: 90px;
    margin: 0 auto;
    overflow: hidden;
}

.gauge-base {
    width: 180px;
    height: 180px;
    border: 15px solid #1a2c4e;
    border-bottom-color: transparent;
    border-left-color: var(--neon-green);
    border-right-color: var(--neon-red);
    border-radius: 50%;
    transform: rotate(135deg);
}

.gauge-needle {
    position: absolute;
    bottom: 0;
    left: 89px;
    width: 2px;
    height: 60px;
    background: #fff;
    transform-origin: bottom center;
    transform: rotate(-30deg);
    transition: transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.gauge-value { font-size: 24px; font-weight: bold; margin-top: 5px; font-family: var(--font-legion); }

/* Scrollbar Styling */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--neon-cyan); }
