/* ═══════════════════════════════════════════════════════
   Cincinnati Fire Department Portal — iOS-Inspired Design System
   ═══════════════════════════════════════════════════════ */

:root {
    /* City of Cincinnati brand palette */
    --cfd-navy: #0B2240;
    --cfd-navy-light: #163158;
    --cfd-navy-bg: #E8EDF3;
    --cfd-blue: #1B6CB0;
    --cfd-blue-light: #5BA4D9;
    --cfd-green: #8CC63F;
    --cfd-green-dark: #6BA030;
    --cfd-teal: #00A6A0;
    /* Semantic aliases */
    --primary: #0B2240;
    --primary-dark: #071829;
    --primary-light: #E8EDF3;
    --accent: #1B6CB0;
    --accent-light: #DBEAFE;
    --highlight: #8CC63F;
    --ios-blue: #1B6CB0;
    --ios-green: #8CC63F;
    --ios-orange: #FF9500;
    --ios-yellow: #FFCC00;
    --ios-bg: #F2F4F7;
    --ios-card: #FFFFFF;
    --ios-sidebar: #0B2240;
    --ios-text: #0B2240;
    --ios-secondary: #5A6A7E;
    --ios-tertiary: #8E99A8;
    --ios-border: #D8DEE6;
    --ios-separator: #C2CAD4;
    --ios-radius: 12px;
    --ios-radius-sm: 8px;
    --ios-radius-pill: 20px;
    --ios-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --ios-shadow-lg: 0 4px 12px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.08);
    --header-height: 64px;
    --ticker-height: 36px;
    --top-offset: calc(var(--header-height) + var(--ticker-height));
    --sidebar-width: 240px;
    --footer-height: 40px;
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, sans-serif;
    --transition: all 0.2s ease;
}

/* ─── Reset ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-sans);
    background: var(--ios-bg);
    color: var(--ios-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}
a { color: var(--ios-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ─── Layout ─────────────────────────────────────────── */
.header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: var(--ios-card);
    border-bottom: 1px solid var(--ios-border);
    box-shadow: 0 1px 4px rgba(11,34,64,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 100;
    gap: 16px;
}

.sidebar {
    position: fixed;
    top: var(--top-offset);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--ios-sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 90;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 89;
}

.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--top-offset);
    min-height: calc(100vh - var(--top-offset) - var(--footer-height));
    padding: 24px;
    transition: margin-left 0.3s ease;
    overflow-x: hidden;
}

.footer {
    margin-left: var(--sidebar-width);
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    font-size: 12px;
    color: var(--ios-tertiary);
    border-top: 1px solid var(--ios-border);
    background: var(--ios-card);
    transition: margin-left 0.3s ease;
}

/* ─── Header Components ──────────────────────────────── */
.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.header-datetime {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.header-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.2px;
    font-variant-numeric: tabular-nums;
}

.header-time {
    font-size: 20px;
    font-weight: 300;
    color: var(--primary);
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.header-holiday {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--highlight), var(--cfd-teal));
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: var(--ios-radius-pill);
    white-space: nowrap;
    animation: holidayGlow 2s ease-in-out infinite alternate;
}

@keyframes holidayGlow {
    0% { box-shadow: 0 0 0 0 rgba(140, 198, 63, 0); }
    100% { box-shadow: 0 0 12px 2px rgba(140, 198, 63, 0.25); }
}

/* ─── River Level ────────────────────────────────────── */
.river-level {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--ios-radius-pill);
    background: rgba(11, 34, 64, 0.06);
    font-variant-numeric: tabular-nums;
    cursor: default;
    transition: var(--transition);
}
.river-level:hover {
    background: rgba(11, 34, 64, 0.1);
}

.river-icon {
    color: var(--accent);
    animation: riverWave 2.5s ease-in-out infinite;
    flex-shrink: 0;
}

.river-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.2px;
}

.river-label {
    font-size: 10px;
    color: var(--ios-tertiary);
    font-weight: 500;
}

.river-level[data-status="action"] { background: rgba(255, 204, 0, 0.12); }
.river-level[data-status="action"] .river-icon { color: #FFCC00; }
.river-level[data-status="action"] .river-value { color: #92400E; }

.river-level[data-status="moderate_flood"] { background: rgba(255, 149, 0, 0.12); }
.river-level[data-status="moderate_flood"] .river-icon { color: #FF9500; animation: riverPulse 1s ease-in-out infinite; }
.river-level[data-status="moderate_flood"] .river-value { color: #C2410C; }

.river-level[data-status="major_flood"] { background: rgba(220, 38, 38, 0.12); }
.river-level[data-status="major_flood"] .river-icon { color: #DC2626; animation: riverPulse 0.6s ease-in-out infinite; }
.river-level[data-status="major_flood"] .river-value { color: #DC2626; font-weight: 800; }

@keyframes riverWave {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-1.5px); }
}

@keyframes riverPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ─── Ticker Bar (below header) ──────────────────────── */
.ticker-bar {
    position: fixed;
    top: var(--header-height);
    left: 0; right: 0;
    height: var(--ticker-height);
    background: var(--primary);
    display: flex;
    align-items: center;
    z-index: 99;
    overflow: hidden;
}
.ticker-bar-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px 0 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
}
.ticker-bar-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--highlight);
    animation: tickerPulse 2s ease-in-out infinite;
}
@keyframes tickerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--ios-text);
    padding: 6px;
    border-radius: 6px;
}
.sidebar-toggle:hover { background: var(--ios-bg); }

.header-logo {
    height: 32px;
    width: 32px;
    object-fit: contain;
    border-radius: 6px;
}

.header-logo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    border-radius: 6px;
}

.header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ios-text);
    white-space: nowrap;
}

.header-sep {
    color: var(--ios-border);
    font-size: 18px;
    font-weight: 300;
}

/* Weather Widget (header) */
.weather-widget {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--ios-secondary);
    white-space: nowrap;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--ios-radius-sm);
    transition: var(--transition);
}
.weather-widget:hover { background: var(--ios-bg); }
.weather-widget img { width: 32px; height: 32px; margin: -4px 0; }
.weather-temp { font-weight: 700; color: var(--primary); font-size: 16px; }
.weather-cond { color: var(--ios-secondary); font-size: 13px; }
.weather-loading { font-size: 12px; color: var(--ios-tertiary); }

/* ─── Weather Forecast Modal ────────────────────────── */
.modal.weather-modal {
    max-width: 480px;
    width: 95%;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(165deg, #0B2240 0%, #163158 50%, #1B6CB0 100%) !important;
    box-shadow: 0 24px 80px rgba(0,0,0,0.4);
    color: #fff;
    padding: 0 !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
}

.weather-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 28px 28px 0;
}

.weather-modal-current {
    display: flex;
    align-items: center;
    gap: 16px;
}

.weather-modal-icon {
    width: 72px;
    height: 72px;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.2));
}

.weather-modal-temp {
    font-size: 44px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
}

.weather-modal-cond {
    font-size: 16px;
    color: rgba(255,255,255,0.7);
    text-transform: capitalize;
    margin-top: 4px;
}

.weather-modal-city {
    font-size: 13px;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
}

.weather-modal-close {
    background: rgba(255,255,255,0.1);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
}
.weather-modal-close:hover { background: rgba(255,255,255,0.2); color: #fff; }

.weather-modal-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: rgba(255,255,255,0.06);
    margin: 24px 28px 0;
    border-radius: 14px;
    overflow: hidden;
}

.weather-detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 8px;
    background: rgba(255,255,255,0.04);
}
.weather-detail-item svg { color: rgba(255,255,255,0.4); }
.weather-detail-label { font-size: 10px; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.weather-detail-value { font-size: 14px; font-weight: 700; color: #fff; }

.weather-modal-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 24px 28px 0;
}

.weather-forecast-title {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 16px 28px 0;
}

.weather-forecast-list {
    padding: 12px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.weather-forecast-day {
    display: grid;
    grid-template-columns: 50px 56px 40px 80px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    transition: var(--transition);
}
.weather-forecast-day:hover { background: rgba(255,255,255,0.06); }
.weather-forecast-today { background: rgba(255,255,255,0.08); border-radius: 10px; }

.forecast-day-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.forecast-date {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

.forecast-icon {
    width: 36px;
    height: 36px;
}

.forecast-temps {
    display: flex;
    gap: 6px;
    align-items: baseline;
}
.forecast-high { font-size: 16px; font-weight: 700; color: #fff; }
.forecast-low { font-size: 14px; color: rgba(255,255,255,0.4); }

.forecast-cond {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    text-transform: capitalize;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.forecast-rain {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: var(--cfd-blue-light);
    font-weight: 600;
}

@media (max-width: 480px) {
    .weather-modal { border-radius: 16px 16px 0 0; position: fixed; bottom: 0; max-height: 90vh; }
    .weather-modal-details { grid-template-columns: repeat(2, 1fr); }
    .weather-forecast-day { grid-template-columns: 44px 48px 36px 64px 1fr; }
    .forecast-rain { display: none; }
}

/* Today's Shift Badge */
.shift-today-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px 7px 12px;
    border-radius: var(--ios-radius-pill);
    background: var(--primary);
    color: #fff;
    white-space: nowrap;
    line-height: 1;
}
.shift-today-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}
.shift-today-unit {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

/* Radio Toggle */
.radio-toggle {
    background: none;
    border: none;
    color: var(--ios-secondary);
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
}
.radio-toggle:hover { background: var(--ios-bg); color: var(--ios-text); }
.radio-toggle.active { color: var(--primary); }
.radio-toggle.active .radio-waves { stroke: var(--primary); }

/* User Menu */
.user-menu { position: relative; }
.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: var(--ios-radius-sm);
    transition: var(--transition);
    color: var(--ios-text);
}
.user-menu-trigger:hover { background: var(--ios-bg); }

.user-avatar, .user-avatar-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    border-radius: 50%;
}
.user-avatar { width: 32px; height: 32px; font-size: 12px; }
.user-avatar-sm { width: 28px; height: 28px; font-size: 10px; }

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ios-text);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--ios-card);
    border-radius: var(--ios-radius);
    box-shadow: var(--ios-shadow-lg), 0 0 0 1px rgba(0,0,0,0.05);
    min-width: 200px;
    z-index: 110;
    overflow: hidden;
}
.user-dropdown.open { display: block; }

.dropdown-header {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dropdown-header strong { font-size: 14px; }
.dropdown-divider { height: 1px; background: var(--ios-border); }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--ios-text);
    text-decoration: none;
    transition: background 0.15s;
}
.dropdown-item:hover { background: var(--ios-bg); text-decoration: none; }
.dropdown-item--danger { color: var(--primary); }
.dropdown-item--danger:hover { background: var(--primary-light); }

/* ─── Sidebar Components ─────────────────────────────── */
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-logo { height: 36px; width: 36px; object-fit: contain; border-radius: 8px; }
.sidebar-logo-text {
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}
.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
    text-decoration: none;
}
.nav-item.active {
    color: #fff;
    background: var(--accent);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(27,108,176,0.3);
}
.nav-item svg { flex-shrink: 0; opacity: 0.6; }
.nav-item:hover svg { opacity: 0.9; }
.nav-item.active svg { opacity: 1; }

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 8px 12px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.1);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; }
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,0.45); }

/* ─── Cards ──────────────────────────────────────────── */
.card {
    background: var(--ios-card);
    border-radius: var(--ios-radius);
    box-shadow: 0 1px 3px rgba(11,34,64,0.06), 0 1px 2px rgba(11,34,64,0.04);
    border: 1px solid var(--ios-border);
    padding: 20px;
    transition: var(--transition);
}
.card:hover { box-shadow: 0 4px 12px rgba(11,34,64,0.08), 0 1px 3px rgba(11,34,64,0.06); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.card-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--ios-text);
}
.card-subtitle {
    font-size: 13px;
    color: var(--ios-secondary);
}

/* ─── Grid Layouts ───────────────────────────────────── */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-full { grid-template-columns: 1fr; }

/* ─── Stat Cards ─────────────────────────────────────── */
.stat-card {
    background: var(--ios-card);
    border-radius: var(--ios-radius);
    box-shadow: var(--ios-shadow);
    padding: 22px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 3px solid var(--accent);
    transition: var(--transition);
}
.stat-card:hover {
    box-shadow: var(--ios-shadow-lg);
    transform: translateY(-1px);
}
.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}
.stat-label {
    font-size: 13px;
    color: var(--ios-secondary);
    font-weight: 500;
    letter-spacing: 0.1px;
}
.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--ios-radius-pill);
}
.stat-badge--up { background: #D1FAE5; color: #065F46; }
.stat-badge--down { background: #FEE2E2; color: #991B1B; }

/* ─── Buttons ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--ios-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--ios-bg); color: var(--ios-text); }
.btn-secondary:hover { background: var(--ios-border); }
.btn-outline { background: transparent; border: 1.5px solid var(--ios-border); color: var(--ios-text); }
.btn-outline:hover { border-color: var(--ios-secondary); }
.btn-danger { background: var(--primary); color: #fff; }
.btn-success { background: var(--ios-green); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

/* ─── Forms ──────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #3A3A3C;
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
    border: 1px solid var(--ios-border);
    border-radius: 10px;
    background: #F9F9F9;
    color: var(--ios-text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(220,38,38,0.12);
    background: #fff;
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238E8E93' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ─── Tables ─────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--ios-radius); }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    color: var(--ios-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--ios-border);
    background: #FAFAFA;
}
table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--ios-border);
    vertical-align: middle;
}
table tbody tr:hover { background: #F9F9FB; }
table tbody tr:last-child td { border-bottom: none; }

/* ─── Badges & Pills ─────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--ios-radius-pill);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.badge-red { background: var(--primary-light); color: var(--primary); }
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-blue { background: #DBEAFE; color: #1E40AF; }
.badge-orange { background: #FEF3C7; color: #92400E; }
.badge-gray { background: #F3F4F6; color: #6B7280; }

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--ios-radius-pill);
    font-size: 11px;
    font-weight: 600;
    background: var(--ios-bg);
    color: var(--ios-secondary);
}

/* ─── Segmented Control (Tab Switching) ──────────────── */
.segmented-control {
    display: inline-flex;
    background: var(--ios-bg);
    border-radius: var(--ios-radius-sm);
    padding: 3px;
    gap: 2px;
}
.seg-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ios-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.seg-btn:hover { color: var(--ios-text); }
.seg-btn.active {
    background: var(--ios-card);
    color: var(--ios-text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ─── Alerts ─────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
}
.alert-error { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-warning { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.alert-info { background: #DBEAFE; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ─── Modal / Sheet ──────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--ios-card);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.25s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close {
    background: var(--ios-bg);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ios-secondary);
    font-size: 16px;
    cursor: pointer;
}
.modal-body { padding: 16px 24px 24px; }
.modal-footer {
    padding: 12px 24px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ─── Skeleton Loading ───────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #E5E5EA 25%, #F2F2F7 50%, #E5E5EA 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--ios-radius-sm);
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text:last-child { width: 60%; }
.skeleton-card { height: 120px; }

/* ─── Radio Player ───────────────────────────────────── */
.radio-player {
    position: fixed;
    bottom: var(--footer-height);
    right: 24px;
    z-index: 95;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.radio-player-inner {
    background: var(--ios-card);
    border-radius: var(--ios-radius);
    box-shadow: var(--ios-shadow-lg);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.radio-label { font-size: 13px; font-weight: 600; color: var(--ios-text); }
.radio-fallback-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--primary);
    color: #fff;
    border-radius: var(--ios-radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

/* ─── Incident Priority Colors ───────────────────────── */
.priority-1 { border-left: 4px solid var(--primary); }
.priority-2 { border-left: 4px solid var(--ios-orange); }
.priority-3 { border-left: 4px solid var(--ios-yellow); }

/* ─── Unit Badges ────────────────────────────────────── */
.unit-badge {
    display: inline-flex;
    padding: 2px 8px;
    background: var(--ios-blue);
    color: #fff;
    border-radius: var(--ios-radius-pill);
    font-size: 11px;
    font-weight: 700;
}

/* ─── Empty States ───────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--ios-secondary);
}
.empty-state svg { margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 17px; color: var(--ios-text); margin-bottom: 4px; }
.empty-state p { font-size: 14px; }

/* ─── Page Header ────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ios-border);
}
.page-header h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.3px;
}

/* ─── Tab Panel (for modules with tabs) ──────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── File Upload Dropzone ───────────────────────────── */
.dropzone {
    border: 2px dashed var(--ios-border);
    border-radius: var(--ios-radius);
    padding: 40px 20px;
    text-align: center;
    color: var(--ios-secondary);
    transition: var(--transition);
    cursor: pointer;
}
.dropzone:hover, .dropzone.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

/* ─── Pagination ─────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}
.page-btn {
    padding: 6px 12px;
    border: 1px solid var(--ios-border);
    border-radius: var(--ios-radius-sm);
    background: var(--ios-card);
    color: var(--ios-text);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}
.page-btn:hover { background: var(--ios-bg); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── Responsive ─────────────────────────────────────── */
/* ═══════════════════════════════════════════════════════
   RESPONSIVE — iOS-native mobile experience
   ═══════════════════════════════════════════════════════ */

/* ── 1024px: Tablet / small laptop ──────────────────── */
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .header-title { display: none; }
    .shift-today-badge { font-size: 12px; padding: 5px 12px 5px 8px; }
    .header-datetime { display: none; }
    .header-holiday { display: none; }
    .header-river { display: none; }
}

/* ── 768px: Full mobile mode ────────────────────────── */
@media (max-width: 768px) {
    /* Header: compact */
    .header {
        height: 56px;
        padding: 0 12px;
    }
    .header-left img { height: 28px; }
    .header-center { display: none; }
    .header-sep { display: none; }
    .header-river { display: none; }
    .header-radio-toggle { display: none; }
    .shift-today-badge { display: none; }
    .header-datetime { display: none; }

    /* Sidebar: hidden, replaced by tab bar */
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); z-index: 200; }
    .sidebar-overlay.open { display: block; z-index: 199; }
    .sidebar-toggle { display: block; }

    /* Main content */
    .main-content, .footer {
        margin-left: 0;
    }
    .main-content {
        padding: 12px;
        padding-bottom: 90px; /* space for bottom tab bar */
        margin-top: 56px;
    }
    .footer {
        margin-bottom: 70px;
    }

    /* Grids: single column */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    /* Ticker */
    .ticker-bar-label { padding-left: 12px; }
    .ticker-bar { left: 0; top: 56px; }

    /* Stat cards */
    .stat-card { min-height: auto; }
    .stat-value { font-size: 24px; }

    /* Cards */
    .card { padding: 14px; border-radius: 14px; }

    /* Page headers */
    .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .page-header h1 { font-size: 22px; }

    /* Forms: prevent iOS zoom */
    input, textarea, select {
        font-size: 16px !important;
        min-height: 44px;
    }
    .btn, button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Modals: iOS bottom sheet */
    .modal {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto !important;
        max-height: 90vh;
        animation: sheetIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        margin: 0;
    }
    .modal::before {
        content: '';
        display: block;
        width: 36px;
        height: 5px;
        background: rgba(0,0,0,0.15);
        border-radius: 3px;
        margin: 8px auto 12px;
    }
    @keyframes sheetIn {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* Slide panel tabs: hide on mobile */
    .slide-panel-tabs { display: none; }
    .slide-panel { display: none; }

    /* Voice FAB: adjust for tab bar */
    .voice-fab { bottom: 86px; }

    /* Data descriptor bars */
    .data-descriptor-bar,
    [style*="display:flex"][style*="justify-content:space-between"][style*="padding:10px 16px"] {
        flex-direction: column;
        gap: 8px;
        font-size: 11px;
    }

    /* ── iOS Bottom Tab Bar ──────────────────────────── */
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 150;
        height: 70px;
        padding-bottom: env(safe-area-inset-bottom, 0);
        background: rgba(255,255,255,0.92);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-top: 0.5px solid rgba(0,0,0,0.12);
        align-items: flex-start;
        justify-content: space-around;
        padding-top: 6px;
    }
    .mobile-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        text-decoration: none;
        color: #8E8E93;
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.1px;
        min-width: 44px;
        min-height: 44px;
        padding: 4px 8px;
    }
    .mobile-tab.active { color: var(--accent, #1B6CB0); }
    .mobile-tab svg { width: 24px; height: 24px; }

    /* ── iOS Action Sheet (More menu) ────────────────── */
    .action-sheet-overlay {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 300;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
    }
    .action-sheet-overlay.open { display: flex; align-items: flex-end; justify-content: center; }
    .action-sheet {
        width: calc(100% - 16px);
        max-width: 400px;
        margin-bottom: calc(8px + env(safe-area-inset-bottom, 0));
        animation: sheetIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .action-sheet-group {
        background: rgba(255,255,255,0.95);
        backdrop-filter: blur(20px);
        border-radius: 14px;
        overflow: hidden;
        margin-bottom: 8px;
    }
    .action-sheet-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 20px;
        font-size: 17px;
        color: var(--primary, #0B2240);
        text-decoration: none;
        border-bottom: 0.5px solid rgba(0,0,0,0.08);
        min-height: 44px;
    }
    .action-sheet-item:last-child { border-bottom: none; }
    .action-sheet-item:active { background: rgba(0,0,0,0.04); }
    .action-sheet-item svg { width: 20px; height: 20px; color: var(--accent, #1B6CB0); flex-shrink: 0; }
    .action-sheet-cancel {
        display: block;
        text-align: center;
        padding: 14px;
        font-size: 17px;
        font-weight: 600;
        color: var(--accent, #1B6CB0);
        background: rgba(255,255,255,0.95);
        backdrop-filter: blur(20px);
        border-radius: 14px;
        border: none;
        width: 100%;
        cursor: pointer;
        min-height: 44px;
    }
}

/* ── 480px: Small phones ────────────────────────────── */
@media (max-width: 480px) {
    .header-left img { height: 22px; }
    .main-content { padding: 10px; padding-bottom: 90px; }
    .page-header h1 { font-size: 18px; }
    .card { padding: 12px; border-radius: 12px; }
    .stat-value { font-size: 20px; }
    .stat-label { font-size: 10px; }
    .grid-4 { gap: 8px; }
    .story-carousel { height: 220px; }
    .story-title { font-size: 16px; }
    .story-content { padding: 16px 20px; }
}

/* ── Touch devices: remove hover effects ────────────── */
@media (hover: none) {
    .card:hover { transform: none; box-shadow: none; }
    .btn:hover { transform: none; }
    .sidebar-nav-item:hover { background: none; }
}

/* ── Safe areas (notch / Dynamic Island) ────────────── */
@supports (padding: env(safe-area-inset-top)) {
    .header { padding-top: env(safe-area-inset-top); }
    .mobile-tab-bar { padding-bottom: env(safe-area-inset-bottom); }
}

/* ── Desktop: hide mobile-only elements ─────────────── */
@media (min-width: 769px) {
    .mobile-tab-bar { display: none !important; }
    .action-sheet-overlay { display: none !important; }
}

/* ─── Print ──────────────────────────────────────────── */
@media print {
    .header, .sidebar, .footer, .toast-container, .radio-player { display: none !important; }
    .main-content { margin: 0; padding: 0; }
}
