:root {
    /* Color Palette */
    --bg-dark: #0a0e17;
    --bg-panel: #111827;
    --bg-panel-hover: #1f2937;
    --border-color: #374151;
    
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    /* Accents */
    --teal: #0d9488;
    --teal-glow: rgba(13, 148, 136, 0.4);
    --amber: #d97706;
    --amber-glow: rgba(217, 119, 6, 0.4);
    --red: #dc2626;
    --red-glow: rgba(220, 38, 38, 0.5);
    --green: #16a34a;
    --purple: #7c3aed;
    
    --font-main: 'Inter', sans-serif;
    --font-mono: 'Roboto Mono', monospace;

    --sidebar-width: 260px;
    --topbar-height: 60px;
    
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Typography Utilities */
h1, h2, h3, h4, h5 { font-weight: 700; letter-spacing: -0.02em; }
.text-red { color: #f87171 !important; }
.text-amber { color: #fbbf24 !important; }
.text-teal { color: #2dd4bf !important; }
.text-green { color: #4ade80 !important; }
.text-gray { color: var(--text-secondary) !important; }
.text-sm { font-size: 0.875rem; }
.text-center { text-align: center; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.w-100 { width: 100%; }
.p-0 { padding: 0 !important; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-align: center;
}
.btn-sm { padding: 0.25rem 0.75rem; font-size: 0.75rem; }
.btn-primary { background: var(--teal); color: white; }
.btn-primary:hover { background: #0f766e; box-shadow: 0 0 10px var(--teal-glow); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-panel-hover); border-color: var(--text-secondary); }
.btn-outline-danger { background: transparent; border: 1px solid var(--red); color: #f87171; }
.btn-outline-danger:hover { background: var(--red); color: white; }
.btn-outline-success { background: transparent; border: 1px solid var(--green); color: #4ade80; }
.btn-outline-success:hover { background: var(--green); color: white; }
.btn-outline-warning { background: transparent; border: 1px solid var(--amber); color: #fbbf24; }
.btn-outline-warning:hover { background: var(--amber); color: white; }

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.brand h1 {
    font-size: 1.25rem;
    margin: 0 0.5rem;
    background: linear-gradient(90deg, #fff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.badge {
    background: var(--red);
    color: white;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 800;
    letter-spacing: 1px;
    animation: blink 2s infinite;
}

.nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}
.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    position: relative;
}
.nav-item i { width: 24px; font-size: 1.1rem; }
.nav-item:hover { color: var(--text-primary); background: var(--bg-panel-hover); }
.nav-item.active { color: var(--teal); background: rgba(13, 148, 136, 0.1); border-right: 3px solid var(--teal); }
.nav-badge { background: var(--red); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 10px; margin-left: auto; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0,0,0,0.2);
}
.status-indicator { display: flex; align-items: center; font-family: var(--font-mono); font-size: 0.75rem; color: var(--green); margin-bottom: 1rem; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; }
.pulse-dot.green { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse-green 2s infinite; }
.user-profile { display: flex; align-items: center; gap: 10px; }
.user-profile i { font-size: 1.5rem; color: var(--text-secondary); }
.user-info { display: flex; flex-direction: column; }
.user-info .name { font-weight: 600; font-size: 0.875rem; }
.user-info .role { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.top-bar {
    height: var(--topbar-height);
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    z-index: 10;
}
.mobile-menu-toggle { display: none; cursor: pointer; font-size: 1.25rem; color: var(--text-secondary); }
.search-bar { display: flex; align-items: center; background: var(--bg-dark); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 0.4rem 1rem; width: 300px; }
.search-bar i { color: var(--text-muted); margin-right: 8px; }
.search-bar input { background: transparent; border: none; color: var(--text-primary); width: 100%; outline: none; font-size: 0.875rem; }
.top-actions { display: flex; align-items: center; gap: 1rem; }
.action-btn { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; font-size: 1.1rem; transition: color 0.2s; }
.action-btn:hover { color: var(--text-primary); }
.datetime-display { font-family: var(--font-mono); font-size: 0.875rem; color: var(--teal); background: rgba(13, 148, 136, 0.1); padding: 0.25rem 0.75rem; border-radius: 4px; border: 1px solid rgba(13, 148, 136, 0.3); }

.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
}

/* Sections */
.view-section {
    display: none;
    animation: fadeIn 0.3s ease;
}
.view-section.active { display: block; }
.section-header { margin-bottom: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 1rem; }
.section-header h2 { font-size: 1.5rem; margin-bottom: 0.25rem; text-transform: uppercase; letter-spacing: 1px; color: #fff; }
.section-header p { color: var(--text-secondary); font-size: 0.9rem; }

/* Panels */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.panel-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-color); background: rgba(0,0,0,0.2); }
.panel-header h3 { font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.panel-body { padding: 1.25rem; }

/* --- 1. Dashboard --- */
.risk-banner {
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.15) 0%, rgba(220, 38, 38, 0.05) 100%);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-left: 4px solid var(--red);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}
.banner-icon { font-size: 2rem; color: var(--red); animation: pulse-red 2s infinite; }
.banner-content { flex: 1; }
.banner-content h4 { color: #fca5a5; margin-bottom: 0.25rem; font-size: 0.9rem; letter-spacing: 1px; }
.banner-content p { font-size: 0.85rem; color: var(--text-primary); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card { background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1.25rem; display: flex; align-items: center; gap: 1rem; transition: transform 0.2s; }
.kpi-card:hover { transform: translateY(-2px); border-color: var(--text-muted); }
.kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 1.25rem; }
.kpi-icon.teal { background: rgba(13, 148, 136, 0.1); color: var(--teal); }
.kpi-icon.red { background: rgba(220, 38, 38, 0.1); color: var(--red); }
.kpi-icon.green { background: rgba(22, 163, 74, 0.1); color: var(--green); }
.kpi-icon.amber { background: rgba(217, 119, 6, 0.1); color: var(--amber); }
.kpi-icon.purple { background: rgba(124, 58, 237, 0.1); color: var(--purple); }
.kpi-data h3 { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.kpi-data .value { font-size: 1.5rem; font-weight: 700; font-family: var(--font-mono); display: flex; align-items: center; gap: 8px; }
.trend { font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; font-family: var(--font-main); }
.trend.up { background: rgba(22, 163, 74, 0.1); color: var(--green); }
.trend.down { background: rgba(220, 38, 38, 0.1); color: var(--red); }

.dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.ai-insights { list-style: none; }
.ai-insights li { margin-bottom: 1rem; font-size: 0.9rem; line-height: 1.5; padding-bottom: 1rem; border-bottom: 1px solid var(--border-color); }
.ai-insights li:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.ai-insights i { color: var(--teal); margin-right: 8px; }
.highlight-amber { color: var(--amber); font-weight: 600; }
.highlight-red { color: var(--red); font-weight: 600; }
.highlight-teal { color: var(--teal); font-weight: 600; }

.alert-list-item { display: flex; align-items: center; gap: 1rem; padding: 1rem; border-radius: var(--radius); margin-bottom: 0.75rem; background: var(--bg-dark); border-left: 3px solid transparent; }
.alert-list-item.severity-high { border-left-color: var(--amber); }
.alert-list-item.severity-critical { border-left-color: var(--red); }
.ali-icon { font-size: 1.25rem; width: 40px; text-align: center; }
.severity-high .ali-icon { color: var(--amber); }
.severity-critical .ali-icon { color: var(--red); }
.ali-details { flex: 1; }
.ali-details h4 { font-size: 0.9rem; margin-bottom: 0.2rem; }
.ali-details span { font-size: 0.75rem; color: var(--text-muted); font-family: var(--font-mono); }

/* --- 2. Live Map --- */
.map-container { display: flex; gap: 1.5rem; height: calc(100vh - 200px); min-height: 500px; }
.map-wrapper { flex: 1; background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: var(--radius-lg); position: relative; overflow: hidden; }
.map-image { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; }
.map-sidebar { width: 300px; display: flex; flex-direction: column; gap: 1rem; }
.map-marker { position: absolute; width: 20px; height: 20px; transform: translate(-50%, -50%); cursor: pointer; }
.marker-core { width: 12px; height: 12px; border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2; }
.marker-ring { width: 40px; height: 40px; border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1; opacity: 0; }
.pulse-red .marker-core { background: var(--red); }
.pulse-red .marker-ring { border: 2px solid var(--red); animation: radar-pulse 2s infinite; }
.pulse-amber .marker-core { background: var(--amber); }
.pulse-amber .marker-ring { border: 2px solid var(--amber); animation: radar-pulse 2s infinite 0.5s; }
.pulse-teal .marker-core { background: var(--teal); }
.pulse-teal .marker-ring { border: 2px solid var(--teal); animation: radar-pulse 2s infinite 1s; }

.filter-group label { display: flex; align-items: center; gap: 8px; margin-bottom: 0.5rem; font-size: 0.875rem; cursor: pointer; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.red { background: var(--red); }
.dot.amber { background: var(--amber); }
.dot.teal { background: var(--teal); }
.detail-card h4 { margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-color); }
.data-row { display: flex; justify-content: space-between; font-size: 0.85rem; margin-bottom: 0.5rem; padding: 0.25rem 0; border-bottom: 1px dashed rgba(255,255,255,0.05); }

/* --- 3. SAR Monitor --- */
.sar-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.5rem; }
.sar-image { width: 100%; height: auto; display: block; border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-lg); filter: contrast(1.2); }
.sar-visual { position: relative; }
.scanline { position: absolute; top: 0; left: 0; width: 100%; height: 2px; background: rgba(45, 212, 191, 0.8); box-shadow: 0 0 10px var(--teal); animation: scan 4s linear infinite; pointer-events: none; z-index: 5; }

.telemetry-table { display: flex; flex-direction: column; gap: 0.5rem; }
.t-row { display: flex; justify-content: space-between; padding: 0.5rem; background: var(--bg-dark); border-radius: 4px; font-family: var(--font-mono); font-size: 0.8rem; }
.t-label { color: var(--text-secondary); }
.t-value { font-weight: 600; color: #fff; }
.ai-box { background: rgba(13, 148, 136, 0.05); border: 1px solid rgba(13, 148, 136, 0.2); padding: 1rem; border-radius: var(--radius); display: flex; gap: 1rem; align-items: flex-start; }
.ai-box i { color: var(--teal); font-size: 1.2rem; margin-top: 2px; }
.ai-box p { font-size: 0.85rem; line-height: 1.5; }

/* --- 4. Ground Station Feed --- */
.terminal-container { background: #000; border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; height: 500px; display: flex; flex-direction: column; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.terminal-header { background: #1f2937; padding: 0.5rem 1rem; display: flex; align-items: center; border-bottom: 1px solid #374151; }
.term-buttons { display: flex; gap: 6px; }
.term-buttons span { width: 12px; height: 12px; border-radius: 50%; }
.term-buttons span:nth-child(1) { background: #ff5f56; }
.term-buttons span:nth-child(2) { background: #ffbd2e; }
.term-buttons span:nth-child(3) { background: #27c93f; }
.term-title { flex: 1; text-align: center; font-family: var(--font-mono); font-size: 0.8rem; color: #9ca3af; }
.terminal-body { padding: 1rem; font-family: var(--font-mono); font-size: 0.85rem; color: #2dd4bf; overflow-y: auto; flex: 1; line-height: 1.6; }
.term-line { margin-bottom: 4px; opacity: 0.9; }
.term-line.success { color: #4ade80; }
.term-line.warning { color: #fbbf24; }
.term-line.error { color: #f87171; }
.cursor { display: inline-block; width: 8px; height: 15px; background: #2dd4bf; animation: blink 1s step-end infinite; vertical-align: middle; }

/* --- 5. Alerts Center --- */
.alerts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr)); gap: 1.5rem; }
.alert-card { background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; }
.alert-card.critical { border-top: 4px solid var(--red); }
.alert-card.high { border-top: 4px solid var(--amber); }
.ac-header { display: flex; justify-content: space-between; padding: 1rem 1.25rem; background: rgba(0,0,0,0.2); border-bottom: 1px solid var(--border-color); font-size: 0.85rem; font-weight: 600; }
.ac-type i { margin-right: 8px; }
.critical .ac-type { color: var(--red); }
.high .ac-type { color: var(--amber); }
.ac-time { color: var(--text-muted); font-family: var(--font-mono); }
.ac-body { padding: 1.25rem; flex: 1; }
.ac-body h3 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.ac-meta { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; margin-bottom: 1rem; font-family: var(--font-mono); }
.ac-desc { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1rem; line-height: 1.5; }
.ac-action-text { background: rgba(255,255,255,0.03); padding: 0.75rem; border-radius: 4px; border-left: 2px solid var(--teal); font-size: 0.85rem; }
.ac-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 0.75rem; }

/* --- 6. Citizen Safety --- */
.safety-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 1.5rem; }
.sos-panel { background: linear-gradient(180deg, #2a0808 0%, var(--bg-panel) 100%); border: 1px solid rgba(220, 38, 38, 0.3); border-radius: var(--radius-lg); padding: 2rem; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.sos-btn { width: 160px; height: 160px; border-radius: 50%; background: linear-gradient(135deg, #ef4444, #991b1b); border: 8px solid rgba(220, 38, 38, 0.2); box-shadow: 0 10px 30px rgba(220, 38, 38, 0.4), inset 0 -5px 15px rgba(0,0,0,0.3); color: white; display: flex; flex-direction: column; justify-content: center; align-items: center; cursor: pointer; margin-bottom: 2rem; transition: transform 0.1s; position: relative; overflow: hidden; }
.sos-btn:active { transform: scale(0.95); }
.sos-btn::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 60%); opacity: 0; transition: opacity 0.3s; }
.sos-btn:hover::after { opacity: 1; }
.sos-text { font-size: 2.5rem; font-weight: 800; letter-spacing: 2px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.sos-sub { font-size: 0.65rem; font-weight: 600; opacity: 0.8; margin-top: 4px; letter-spacing: 1px; }

.lang-switch { display: flex; background: var(--bg-dark); border-radius: 20px; overflow: hidden; border: 1px solid var(--border-color); }
.lang-btn { background: transparent; border: none; color: var(--text-secondary); padding: 4px 12px; font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.lang-btn.active { background: var(--teal); color: white; }
.instructions-list { list-style: none; }
.instructions-list li { padding: 1rem; background: var(--bg-dark); margin-bottom: 0.5rem; border-radius: var(--radius); border-left: 3px solid var(--amber); font-size: 0.9rem; }
.safe-zone-list { display: flex; flex-direction: column; gap: 0.75rem; }
.sz-item { display: flex; justify-content: space-between; align-items: center; padding: 1rem; background: var(--bg-dark); border-radius: var(--radius); border: 1px solid var(--border-color); }
.sz-info { display: flex; flex-direction: column; }
.sz-info span { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* --- 7. Resources & Analysis --- */
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.chart-mockup { height: 200px; display: flex; align-items: flex-end; justify-content: space-around; padding: 1rem 0; border-bottom: 1px solid var(--border-color); border-left: 1px solid var(--border-color); margin-top: 1.5rem; }
.bar { width: 40px; background: var(--bg-panel-hover); border-top-left-radius: 4px; border-top-right-radius: 4px; position: relative; transition: height 1s ease; }
.bar span { position: absolute; bottom: -25px; left: 50%; transform: translateX(-50%); font-size: 0.75rem; color: var(--text-secondary); }
.resource-links { list-style: none; margin-top: 1rem; }
.resource-links li { margin-bottom: 0.75rem; }
.resource-links a { display: flex; align-items: center; gap: 10px; padding: 1rem; background: var(--bg-dark); border-radius: var(--radius); text-decoration: none; color: var(--text-primary); transition: all 0.2s; border: 1px solid var(--border-color); }
.resource-links a:hover { border-color: var(--teal); background: rgba(13, 148, 136, 0.05); }
.resource-links i { color: var(--teal); font-size: 1.2rem; }

/* --- 8. Case Study --- */
.case-study-card { background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; max-width: 900px; margin: 0 auto; }
.cs-image { width: 100%; height: 300px; object-fit: cover; border-bottom: 1px solid var(--border-color); }
.cs-content { padding: 2rem; }
.cs-tag { font-size: 0.7rem; font-weight: 700; color: var(--amber); background: rgba(217, 119, 6, 0.1); padding: 4px 8px; border-radius: 4px; letter-spacing: 1px; }
.cs-content h2 { font-size: 1.75rem; margin: 0.5rem 0 0.25rem 0; }
.cs-date { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.85rem; margin-bottom: 1.5rem; }
.cs-body { font-size: 1rem; line-height: 1.6; color: var(--text-secondary); }
.cs-body h4 { color: var(--text-primary); margin: 1.5rem 0 0.75rem 0; font-size: 1.1rem; }
.cs-body ul { list-style-type: disc; padding-left: 1.5rem; margin-bottom: 1.5rem; }
.cs-body li { margin-bottom: 0.5rem; }
.impact-statement { font-style: italic; font-weight: 500; color: var(--teal); border-left: 4px solid var(--teal); padding-left: 1rem; margin-top: 2rem; font-size: 1.1rem; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes pulse-green { 0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); } 70% { box-shadow: 0 0 0 15px rgba(220, 38, 38, 0); } 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); } }
@keyframes radar-pulse { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; } }
@keyframes scan { 0% { top: 0; } 50% { top: 100%; } 100% { top: 0; } }

/* Media Queries */
@media (max-width: 1024px) {
    .dashboard-row { grid-template-columns: 1fr; }
    .sar-grid { grid-template-columns: 1fr; }
    .safety-grid { grid-template-columns: 1fr; }
    .analytics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { position: fixed; left: -100%; height: 100vh; transition: left 0.3s; box-shadow: 5px 0 15px rgba(0,0,0,0.5); }
    .sidebar.open { left: 0; }
    .mobile-menu-toggle { display: block; }
    .search-bar { display: none; }
    .map-container { flex-direction: column; height: auto; }
    .map-sidebar { width: 100%; }
    .map-wrapper { height: 300px; }
}
/* --- IoT Monitor Styles --- */
.iot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.sensor-card {
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.sensor-card:hover {
    border-color: var(--teal);
    background: rgba(13, 148, 136, 0.05);
}

.sensor-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.sensor-header i {
    font-size: 2rem;
    color: var(--teal);
}

.sensor-value {
    font-size: 3rem;
    font-weight: 800;
    font-family: var(--font-mono);
    margin-bottom: 0.5rem;
    color: #fff;
}

.sensor-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.iot-log {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    height: 200px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.log-entry {
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: space-between;
    animation: slideInRight 0.3s ease;
}

.log-time { color: var(--text-muted); }
.log-data { color: var(--teal); }

@keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
/* --- Global Alert Flash --- */
.alert-flash {
    animation: alert-flash-anim 1s infinite;
}

@keyframes alert-flash-anim {
    0%, 100% { background-color: var(--bg-panel); }
    50% { background-color: rgba(220, 38, 38, 0.4); }
}

/* --- Settings Inputs & Form Focus States --- */
.form-control {
    width: 100%;
    box-sizing: border-box;
}
.form-control:focus {
    border-color: var(--teal) !important;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

/* --- Simulator Slider Style --- */
.sim-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    transition: background 0.3s;
}
.sim-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--teal);
    cursor: pointer;
    box-shadow: 0 0 8px var(--teal);
    transition: transform 0.1s;
}
.sim-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* --- Help Box Styling --- */
.help-box ol li::marker {
    color: var(--teal);
    font-weight: bold;
}
.help-box a {
    color: var(--teal);
    text-decoration: none;
    border-bottom: 1px dashed var(--teal);
}
.help-box a:hover {
    color: #fff;
    border-bottom-style: solid;
}

