:root {
    --bg-main: #0d0d0f;
    --bg-panel: #161618;
    --border-color: #2a2a2c;
    --text-primary: #ffffff;
    --text-muted: #7b7b7f;
    --color-green: #c6ff00;
    --color-green-muted: rgba(198, 255, 0, 0.2);
    --color-red: #ff4d4f;
    --font-main: 'Inter', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding: 20px;
    min-height: 100vh;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 20px 0;
}

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

.logo-icon {
    background: #e0e0e0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-text h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 2px;
}

.subtitle {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.position-label {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.dot {
    width: 6px;
    height: 6px;
    background-color: var(--color-green);
    border-radius: 50%;
    display: inline-block;
}

.live-status {
    color: var(--color-green);
    font-weight: 700;
}

/* Typography & Colors */
.text-green { color: var(--color-green); }
.text-red { color: var(--color-red); }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.border-green {
    border-color: rgba(198, 255, 0, 0.4);
}

.stat-title {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

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

/* Main Content (History & Log) */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    height: 400px;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid transparent;
}

.panel-header h2 {
    font-size: 14px;
    font-weight: 700;
}

.panel-header span {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
}

/* Chart Container */
.chart-container {
    flex: 1;
    display: flex;
    position: relative;
    padding: 0 20px 20px 20px;
}

.chart-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    padding-right: 15px;
    padding-top: 20px;
    padding-bottom: 40px;
}

.chart-area {
    flex: 1;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.line-chart {
    width: 100%;
    height: 100%;
    display: block;
}

.volume-bars {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    padding-left: 10px;
}

.bar {
    width: 6px;
    border-radius: 1px 1px 0 0;
}

.bar.green { background: var(--color-green); }
.bar.red { background: var(--color-red); }
.bar.h-1 { height: 10%; }
.bar.h-2 { height: 20%; }
.bar.h-3 { height: 30%; }
.bar.h-4 { height: 40%; }
.bar.h-5 { height: 50%; }
.bar.h-6 { height: 60%; }
.bar.h-7 { height: 70%; }
.bar.h-8 { height: 80%; }


/* Activity Log */
.activity-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px 20px;
    display: flex;
    flex-direction: column;
    font-family: var(--font-mono);
    font-size: 11px;
    gap: 8px;
}

.activity-list::-webkit-scrollbar {
    width: 6px;
}
.activity-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.activity-row {
    display: grid;
    grid-template-columns: 80px 50px 1fr 50px;
    align-items: center;
}

.activity-row .time { color: var(--text-muted); }
.activity-row .asset { color: var(--text-primary); }
.activity-row .result { text-align: right; }

.fade { opacity: 0.6; }
.fade-more { opacity: 0.3; }

/* Footer Section */
.footer-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.heartbeat-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px 20px;
}

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

.heartbeat-header h2 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.heartbeat-header span {
    font-family: var(--font-mono);
    font-size: 12px;
}

.heartbeat-wave {
    height: 40px;
    width: 100%;
}

.wave-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Agents Grid */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1px; /* To create inner borders like effect if needed, but we'll use gaps */
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.agent-card {
    background: var(--bg-panel);
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    position: relative;
}

.agent-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-muted);
}

.agent-status {
    font-weight: 700;
}

.agent-icon {
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.agent-icon img {
    border-radius: 50%;
}

.grayscale {
    filter: grayscale(100%) opacity(0.5);
}

.agent-name {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

/* Active agent styling */
.active-run {
    border: 1px solid rgba(255, 59, 48, 0.5); /* Reddish border like screenshot for the active box */
    z-index: 10;
    box-shadow: inset 0 0 10px rgba(255, 59, 48, 0.1);
}

.active-run .agent-name {
    color: var(--text-primary);
}

.active-run .agent-icon.glow {
    filter: drop-shadow(0 0 8px rgba(0, 150, 255, 0.6));
}

.border-active {
    border: 1px solid #ff4d4f;
    border-radius: 8px; /* Depending on overlap */
}

/* Responsive Design */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .agents-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .panel {
        height: 400px;
    }

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

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}
