:root {
    --sidebar-bg: #0f172a;
    --bg-main: #f8fafc;
    --accent-amber: #f59e0b;
    --accent-emerald: #10b981;
    --accent-sky: #0ea5e9;
    --accent-violet: #8b5cf6;
    --text-muted: #94a3b8;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background: var(--bg-main);
    color: #1e293b;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 320px;
    background: var(--sidebar-bg);
    color: white;
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.brand {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand__logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
}

.section-label {
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.input-group { margin-bottom: 24px; }

.status-panel {
    margin-bottom: 24px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    line-height: 1.4;
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
}

.status-panel--info {
    border-color: #334155;
}

.status-panel--success {
    border-color: rgba(16, 185, 129, 0.5);
    color: #d1fae5;
}

.status-panel--error {
    border-color: rgba(239, 68, 68, 0.45);
    color: #fecaca;
}

label { 
    display: block; 
    font-size: 0.8rem; 
    margin-bottom: 8px; 
    color: #cbd5e1;
}

select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #334155;
    background: #1e293b;
    color: white;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
select:focus { border-color: var(--accent-amber); outline: none; }

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 28px;
}

.credit-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.credit-link {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.85rem;
    padding: 10px 12px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #1e293b;
    transition: background 0.2s, transform 0.2s, border-color 0.2s;
}

.credit-link:hover {
    background: #263449;
    border-color: #475569;
    transform: translateY(-1px);
}

.credit-link__icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    padding: 2px;
    object-fit: contain;
}

.stat-card {
    background: #1e293b;
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid transparent;
    transition: transform 0.2s, background 0.2s;
}
.stat-card:hover { transform: translateY(-2px); background: #263449; }

.stat-card span { display: block; font-size: 0.7rem; color: var(--text-muted); margin-bottom: 4px; }
.stat-card b { font-size: 1.1rem; display: block; }

.stat-peak { border-left-color: var(--accent-amber); }
.stat-avg { border-left-color: var(--accent-emerald); }
.stat-min { border-left-color: var(--accent-sky); }
.stat-prob { border-left-color: var(--accent-violet); }

.main-content {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

.card-container {
    background: white;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#map-card { height: 40%; position: relative; }
#map { height: 100%; width: 100%; }

#chart-card { height: 60%; padding: 24px; }

.chart-header {
    margin-bottom: 10px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.chart-header h3 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.chart-header p { margin: 4px 0 0; font-size: 0.85rem; color: #64748b; }

.chart-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-switch__slider {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.toggle-switch__slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 3px rgb(15 23 42 / 0.25);
    transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-switch__slider {
    background: #f59e0b;
}

.toggle-switch input:checked + .toggle-switch__slider::after {
    transform: translateX(18px);
}

.toggle-switch__label {
    line-height: 1;
}

.chart-note {
    margin: 0 0 12px;
    font-size: 0.8rem;
    color: #64748b;
}

.canvas-wrapper { flex: 1; position: relative; min-height: 0; }
