/* --- Global Baseline & Typography --- */
:root {
    --primary-green: #16a34a;
    --alert-red: #dc2626;
    --text-muted: #94a3b8;
}

body {
    background: #09090b;
    color: #fff;
    font-family: system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 16px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

#app-container {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #27272a;
    padding-bottom: 12px;
}

h1 {
    font-size: 1.25rem;
    margin: 0;
}

/* Base Badge System */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge.connecting { background: #27272a; color: #94a3b8; }
.badge.connected { background: #16a34a; color: #fff; }
.badge.staging { background: #eab308; color: #000; }
.badge.processing { background: #2563eb; color: #fff; }

/* Status Pills (Phase 1 & Phase 2) */
.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.pill.pending { background: #27272a; color: #94a3b8; }
.pill.pillar1 { background: rgba(22, 163, 74, 0.2); color: #4ade80; border: 1px solid #16a34a; }
.pill.pillar2 { background: rgba(220, 38, 38, 0.2); color: #f87171; border: 1px solid #dc2626; }
.pill.pillar3 { background: rgba(234, 179, 8, 0.2); color: #facc15; border: 1px solid #eab308; }

/* Tab Navigation (Phase 1 / Phase 2 Switcher) */
.tab-bar {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.tab-btn {
    background: #18181b;
    color: #94a3b8;
    border: 1px solid #27272a;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tab-btn:hover {
    color: #fff;
    border-color: #3f3f46;
}

.tab-btn.active {
    background: #27272a;
    color: #fff;
    border-color: #16a34a;
}

/* Grid & Structural Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 16px 0;
}

@media (min-width: 600px) {
    .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.card {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 16px;
}

.card h3 {
    margin: 0 0 8px 0;
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.value-sub {
    font-size: 1.1rem;
    font-weight: 600;
    font-family: monospace;
    color: #cbd5e1;
    margin: 0;
}

/* Phase 1 Human Verification Pedal Buttons */
.model-prediction-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 0.85rem;
    color: #94a3b8;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.action-btn {
    flex: 1;
    min-width: 160px;
    padding: 10px 14px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    color: #fff;
    transition: opacity 0.15s ease;
}

.action-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.action-btn.p1 { background: #16a34a; }
.action-btn.p2 { background: #dc2626; }
.action-btn.p3 { background: #d97706; }

/* Chart Canvas Wrapper (Phase 1) */
.chart-container {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

#chart-title {
    font-size: 0.9rem;
    color: #94a3b8;
    margin: 0 0 12px 0;
}

.canvas-wrapper {
    width: 100%;
    position: relative;
}

/* Phase 2 Dynamic GridStack Workspace */
.grid-stack {
    background: #0c0c0e;
    border: 1px dashed #27272a;
    border-radius: 8px;
    min-height: 360px;
    padding: 4px;
}

.grid-stack-item-content {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gs-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.gs-card-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.gs-card-meta {
    font-size: 0.72rem;
    font-family: monospace;
    color: #22c55e;
}

.gs-canvas-box {
    flex: 1;
    width: 100%;
    min-height: 110px;
    position: relative;
}
