/* GreenScale - shared dashboard styling */
:root {
    --bg: #0a0e14;
    --surface: #111821;
    --surface-2: #182230;
    --border: #1f2937;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --green: #4ade80;
    --green-2: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.08);
    --amber: #f59e0b;
    --red: #ef4444;
    --blue: #60a5fa;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
    --radius: 10px;
    --radius-sm: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--bg); color: var(--text);
    font-family: var(--font);
    font-size: 14px; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
.gs-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
}
.gs-brand {
    display: flex; align-items: center; gap: 12px;
    font-weight: 700; font-size: 18px; letter-spacing: -0.01em;
}
.gs-brand-logo {
    width: 28px; height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--green) 0%, #14b8a6 100%);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 800; color: #0a0e14;
}
.gs-brand-tag {
    color: var(--muted); font-size: 12px; font-weight: 500;
    border-left: 1px solid var(--border);
    padding-left: 12px; margin-left: 4px;
}
.gs-nav { display: flex; gap: 4px; }
.gs-nav a {
    padding: 6px 12px; border-radius: var(--radius-sm);
    color: var(--muted); font-weight: 500; font-size: 13px;
    transition: all 0.15s;
}
.gs-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.gs-nav a.active { color: var(--green); background: var(--green-bg); }

/* Layout */
.gs-main {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
    padding: 16px;
    max-width: 1600px; margin: 0 auto;
    min-height: calc(100vh - 60px);
}
@media (max-width: 1100px) { .gs-main { grid-template-columns: 1fr; } }

.gs-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.stat .accent-green { color: var(--green); }
.stat .accent-amber { color: var(--amber); }
.stat .accent-red   { color: var(--red); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--surface-2);
}
.card-title { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.card-subtitle { color: var(--muted); font-size: 12px; }
.card-body { padding: 16px; }

/* Map */
.gs-map-wrap { display: flex; flex-direction: column; gap: 12px; }
#map {
    height: 460px; width: 100%;
    border-radius: var(--radius);
    background: #050810;
}
.leaflet-container { background: #0d1420 !important; font-family: var(--font) !important; }
.leaflet-popup-content-wrapper { background: var(--surface-2); color: var(--text); border-radius: var(--radius-sm); }
.leaflet-popup-tip { background: var(--surface-2); }
.leaflet-control-attribution {
    background: rgba(10,14,20,0.7) !important;
    color: var(--muted) !important;
    font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--green) !important; }

/* Region list */
.region-list { display: flex; flex-direction: column; gap: 8px; }
.region-row {
    display: grid; grid-template-columns: 12px 1fr auto;
    align-items: center; gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    transition: all 0.15s;
}
.region-row:hover { border-color: var(--green); }
.region-dot {
    width: 12px; height: 12px; border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
}
.region-name { font-weight: 600; font-size: 13px; }
.region-meta { color: var(--muted); font-size: 11px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.region-ci   { font-family: var(--mono); font-size: 12px; font-weight: 600; }

/* Decision feed */
.decisions { max-height: 420px; overflow-y: auto; padding: 4px 8px; }
.decisions::-webkit-scrollbar { width: 6px; }
.decisions::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.decision {
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px; align-items: center;
}
.decision:last-child { border-bottom: none; }
.decision-arrow {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--green-bg); color: var(--green);
    font-size: 14px;
}
.decision-arrow.same { background: rgba(148, 163, 184, 0.1); color: var(--muted); }
.decision-text { font-size: 12px; line-height: 1.4; }
.decision-text b { color: var(--green); font-weight: 600; }
.decision-text .baseline { color: var(--muted); text-decoration: line-through; }
.decision-meta { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.decision-saved { color: var(--green); font-weight: 600; font-size: 11px; }

/* Buttons */
.btn {
    background: var(--green);
    color: #0a0e14;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600; font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}
.btn:hover { background: var(--green-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-ghost {
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--green); background: var(--surface); }

/* Demo controls */
.demo-controls {
    display: grid; gap: 10px; padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.demo-controls input, .demo-controls select {
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 10px; font-family: var(--mono); font-size: 12px;
}
.demo-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-presets {
    display: flex; gap: 6px; flex-wrap: wrap;
    font-size: 11px;
}
.demo-presets button {
    background: transparent; color: var(--muted);
    border: 1px solid var(--border); border-radius: 999px;
    padding: 3px 10px; font-size: 11px;
    cursor: pointer; transition: all 0.15s;
}
.demo-presets button:hover { border-color: var(--green); color: var(--green); }

/* Weights sliders */
.weights { display: grid; gap: 6px; margin-top: 6px; }
.weight {
    display: grid; grid-template-columns: 80px 1fr 40px;
    align-items: center; gap: 8px; font-size: 11px;
}
.weight label { color: var(--muted); }
.weight input[type=range] { accent-color: var(--green); }
.weight .v { font-family: var(--mono); color: var(--text); text-align: right; }

/* Toast */
.toast {
    position: fixed; bottom: 20px; right: 20px;
    background: var(--surface-2); border: 1px solid var(--green);
    color: var(--text);
    padding: 12px 16px; border-radius: var(--radius);
    box-shadow: var(--shadow);
    transform: translateY(20px); opacity: 0;
    transition: all 0.3s;
    z-index: 200;
    max-width: 380px;
    font-size: 13px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: var(--red); }

/* Charts */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-wrap { height: 220px; padding: 6px 12px; }

/* Pulse animation for live elements */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--green); display: inline-block; margin-right: 6px;
    animation: pulse 2s infinite;
}

/* Footer */
.gs-footer {
    color: var(--muted); font-size: 11px;
    padding: 16px 24px; text-align: center;
    border-top: 1px solid var(--border);
    margin-top: 32px;
}
