:root {
    --bg-base: #050505;
    --bg-panel: #0a0a0a;
    --border-dim: #1f2937;
    --border-bright: #374151;
    --text-primary: #f3f4f6;
    --text-muted: #6b7280;
    --accent-cyan: #00f2fe;
    --accent-green: #00ff88;
    --accent-orange: #ff6b00;
    --font-mono: 'JetBrains Mono', monospace;
    --font-sans: 'Inter', sans-serif;
}

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

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

.terminal-container {
    padding: 16px;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-bright);
    flex-wrap: wrap;
    gap: 16px;
}

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

.pulse {
    width: 8px;
    height: 8px;
    background-color: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-green);
    animation: blink 2s infinite;
    flex-shrink: 0;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

h1 {
    font-family: var(--font-mono);
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.version {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 8px;
}

.filter-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-end;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

select, input {
    background: var(--bg-base);
    border: 1px solid var(--border-bright);
    color: var(--accent-cyan);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 8px 12px;
    outline: none;
    transition: border-color 0.2s;
    height: 36px;
    border-radius: 4px;
    -webkit-appearance: none;
}

select:focus, input:focus {
    border-color: var(--accent-cyan);
}

input {
    width: 250px;
}

/* Custom arrow for select to look better on iOS */
select {
    padding-right: 30px;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23374151%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 10px auto;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    overflow: hidden;
}

.panel-header {
    background: var(--border-dim);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 6px 12px;
    letter-spacing: 1px;
}

.kpi-ticker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.kpi-box {
    background: var(--bg-panel);
    border: 1px solid var(--border-dim);
    border-radius: 6px;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.kpi-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    word-break: break-word;
}

.kpi-sub {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.highlight { color: var(--accent-cyan); }
.highlight-alt { color: var(--accent-green); }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    height: 350px;
}

.chart-panel {
    display: flex;
    flex-direction: column;
}

.chart-wrapper {
    padding: 16px;
    flex-grow: 1;
    position: relative;
    min-height: 250px;
}

.data-grid-panel {
    display: flex;
    flex-direction: column;
}

.table-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 400px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    min-width: 600px; /* Ensure table doesn't squish too much on mobile */
}

th, td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-dim);
    white-space: nowrap;
}

th {
    color: var(--text-muted);
    font-weight: 400;
    position: sticky;
    top: 0;
    background: var(--bg-panel);
    z-index: 10;
}

.numeric {
    text-align: right;
}

td.numeric {
    color: var(--accent-cyan);
}

tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* iPad & Tablet Landscape */
@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; height: auto; }
    .kpi-ticker { grid-template-columns: repeat(2, 1fr); }
    .filter-bar { justify-content: flex-start; }
}

/* Mobile & iPhone */
@media (max-width: 768px) {
    .terminal-container { padding: 8px; gap: 12px; }
    
    .terminal-header {
        flex-direction: column;
        align-items: flex-start;
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .filter-bar {
        flex-direction: column;
        gap: 8px;
        width: 100%;
        background: var(--bg-panel);
        padding: 12px;
        border-radius: 6px;
        border: 1px solid var(--border-dim);
    }
    
    .filter-group {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    /* Important for iOS: font-size >= 16px prevents zoom on focus */
    select, input {
        width: 100%;
        height: 44px; /* iOS minimum touch target */
        font-size: 16px;
    }

    .kpi-ticker { 
        grid-template-columns: 1fr 1fr; 
        gap: 8px; 
    }
    
    .kpi-box {
        padding: 12px;
    }

    .kpi-value {
        font-size: 1.5rem;
    }

    .chart-wrapper {
        min-height: 250px;
        padding: 8px;
    }
}
