:root {
    --primary: #0f172a;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #059669;
    --bg-main: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

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

body { 
    font-family: 'Inter', sans-serif; 
    background: var(--bg-main); 
    color: var(--text-main); 
    line-height: 1.5;
    overflow-x: hidden;
}

/* HEADER */
.main-header {
    background: var(--primary);
    color: white;
    padding: 0 24px;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 2000;
}

.header-left { display: flex; align-items: center; gap: 20px; }
.school-name { font-size: 11px; font-weight: 800; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
.app-name { font-size: 18px; font-weight: 600; }

.datetime-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
    position: sticky;
    top: 64px;
    z-index: 1000;
}
.current-time { margin-left: auto; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }

/* SIDEBAR */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: -260px;
    background: var(--white);
    border-right: 1px solid var(--border);
    z-index: 1500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.open { transform: translateX(260px); box-shadow: 20px 0 25px -5px rgb(0 0 0 / 0.1); }
.sidebar-inner { padding: 80px 16px 20px; height: 100%; display: flex; flex-direction: column; }
.brand-sub { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 24px; padding: 0 12px; }

.nav-menu { list-style: none; flex-grow: 1; }
.nav-link {
    padding: 12px;
    display: block;
    text-decoration: none;
    color: var(--text-main);
    border-radius: 8px;
    margin-bottom: 4px;
    font-weight: 500;
    transition: background 0.2s;
}
.nav-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* MAIN CONTENT */
#main-content { padding: 32px 24px; max-width: 1100px; margin: 0 auto; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.mini-card { background: white; padding: 20px; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.micro-border { border-bottom: 4px solid var(--accent); }

.label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; display: block;}
.value { font-size: 24px; font-weight: 700; color: var(--primary); }

.card { background: var(--white); border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: #fafafa; }

/* MAP STYLING */
.map-view { padding: 24px; background: #f1f5f9; }
.mock-map { 
    height: 400px; background-color: #e2e8f0; border-radius: 12px; position: relative; 
    display: flex; align-items: center; justify-content: center; border: 2px dashed #cbd5e1;
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px); background-size: 20px 20px;
}
.hazard-pin { 
    position: absolute; width: 32px; height: 32px; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; color: white; font-weight: bold;
    animation: pulse 2s infinite; cursor: pointer;
}
.pin-danger { background: var(--danger); box-shadow: 0 0 0 8px rgba(220, 38, 38, 0.2); }
.pin-warning { background: var(--warning); box-shadow: 0 0 0 8px rgba(217, 119, 6, 0.2); }

/* ANALYTICS */
.analytics-body { padding: 32px; display: flex; flex-direction: column; gap: 30px; }
.chart-container { display: flex; align-items: flex-end; gap: 20px; height: 180px; border-bottom: 1px solid var(--border); }
.bar-wrapper { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bar { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; opacity: 0.8; transition: 0.3s; }
.bar:hover { opacity: 1; }
.bar-label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.analytics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.stat-highlight { font-weight: 700; color: var(--primary); }

/* PROTOCOLS */
.protocol-card { padding: 20px; border-radius: 12px; border: 1px solid var(--border); border-left: 6px solid #94a3b8; margin-bottom: 16px; }
.protocol-card.critical { border-left-color: var(--danger); background: #fff1f2; }
.protocol-card.warning { border-left-color: var(--warning); background: #fffbeb; }

/* MODAL & FAB */
.fab { position: fixed; bottom: 32px; right: 32px; width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: white; border: none; font-size: 24px; cursor: pointer; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3); z-index: 3000; }
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 4000; }
.modal-content { background: white; padding: 32px; border-radius: 20px; width: 90%; max-width: 420px; }
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
select, input { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.submit-btn { width: 100%; padding: 14px; background: var(--accent); color: white; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; }
.cancel-btn { width: 100%; background: none; border: none; margin-top: 12px; color: var(--text-muted); cursor: pointer; font-size: 14px;}
.modal-hint { font-size: 11px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.4; }

/* UTILS */
.status-chip { background: #dcfce7; color: var(--success); padding: 6px 12px; border-radius: 8px; font-size: 11px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }
.badge { padding: 4px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; }
.badge.danger { background: #fee2e2; color: var(--danger); }
.text-success { color: var(--success); }

.menu-btn { background: none; border: none; cursor: pointer; display: flex; flex-direction: column; gap: 5px; width: 24px; }
.menu-btn span { width: 100%; height: 2px; background: white; border-radius: 2px; }

.content-section { display: none; }
.content-section.active { display: block; animation: fadeIn 0.4s ease; }

@keyframes pulse { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.7; transform: scale(1.1); } 100% { opacity: 1; transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
