/* ═══════════════════════════════════════════════════════════════════
   RedLineCAD v2 — Mobile Responsive Stylesheet
   styles/mobile.css

   Covers four form factors — all rules are scoped inside media
   queries so ZERO desktop styles are affected.

   Breakpoints:
     Phone  (portrait)  : ≤ 480px
     Phone  (landscape) : 481px – 767px
     Tablet (portrait)  : 768px – 1023px
     Tablet (landscape) : 1024px – 1199px
     Desktop            : ≥ 1200px  ← untouched by this file

   Device targeting:
     iPhone / Android phone  : ≤ 767px
     iPad / Android tablet   : 768px – 1199px

   PWA safe-area support via env(safe-area-inset-*)
   ═══════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────
   SHARED MOBILE TOKENS  (phones + tablets, ≤ 1199px)
   ───────────────────────────────────────────────────────────────── */
@media (max-width: 1199px) {
  :root {
    --mob-red:          #cc0000;
    --mob-red-glow:     rgba(204,0,0,0.22);
    --mob-bg:           #05080f;
    --mob-surface:      #0d1117;
    --mob-elevated:     #161b24;
    --mob-border:       rgba(255,255,255,0.08);
    --mob-text:         #e8eaf0;
    --mob-text-dim:     #8b95a8;
    --mob-radius:       12px;
    --mob-radius-sm:    8px;
    --mob-tap:          44px;       /* minimum tap target height */
    --mob-bottom-nav:   56px;       /* bottom tab bar height     */
    --mob-topbar:       52px;       /* mobile top bar height     */
    --mob-drawer:       280px;      /* slide-out drawer width    */
  }

  /* Prevent horizontal scroll globally on mobile */
  body, #app, .app-shell {
    overflow-x: hidden;
  }

  /* Smooth momentum scrolling everywhere */
  * {
    -webkit-overflow-scrolling: touch;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   PHONE LAYOUT  (iPhone + Android phone, ≤ 767px)
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── App Shell ──────────────────────────────────────────────────── */
  .app-shell {
    flex-direction: column;
    height: 100dvh;               /* dynamic viewport height for mobile */
    position: relative;
    overflow: hidden;
  }

  /* ── Hide desktop sidebar ───────────────────────────────────────── */
  #sidebar,
  .sidebar {
    display: none !important;
  }

  /* ── Main content area ──────────────────────────────────────────── */
  .main-content {
    flex: 1;
    height: calc(100dvh - var(--mob-topbar) - var(--mob-bottom-nav)
                 - env(safe-area-inset-top, 0px)
                 - env(safe-area-inset-bottom, 0px));
    margin-top: var(--mob-topbar);
    margin-bottom: calc(var(--mob-bottom-nav) + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--mob-bg);
  }

  /* ── Mobile Top Bar ─────────────────────────────────────────────── */
  #mob-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--mob-topbar) + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    background: var(--mob-surface);
    border-bottom: 1px solid var(--mob-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 16px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  }

  #mob-topbar .mob-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  #mob-topbar .mob-hamburger {
    width: var(--mob-tap);
    height: var(--mob-tap);
    background: none;
    border: none;
    color: var(--mob-text);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mob-radius-sm);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  #mob-topbar .mob-topbar-logo {
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--mob-text);
    line-height: 1;
  }

  #mob-topbar .mob-topbar-logo span {
    color: var(--mob-red);
  }

  #mob-topbar .mob-topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  #mob-topbar .mob-topbar-icon-btn {
    width: var(--mob-tap);
    height: var(--mob-tap);
    background: none;
    border: none;
    color: var(--mob-text-dim);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mob-radius-sm);
    -webkit-tap-highlight-color: transparent;
    position: relative;
  }

  #mob-topbar .mob-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mob-red);
  }

  /* ── Slide-out Navigation Drawer ───────────────────────────────── */
  #mob-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--mob-drawer);
    background: var(--mob-surface);
    border-right: 1px solid var(--mob-border);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding-top: env(safe-area-inset-top, 0px);
    box-shadow: 4px 0 24px rgba(0,0,0,0.6);
  }

  #mob-drawer.open {
    transform: translateX(0);
  }

  #mob-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    backdrop-filter: blur(2px);
  }

  #mob-drawer-overlay.visible {
    opacity: 1;
    pointer-events: all;
  }

  /* Drawer header */
  .mob-drawer-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--mob-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .mob-drawer-logo {
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--mob-text);
  }

  .mob-drawer-logo span { color: var(--mob-red); }

  .mob-drawer-close {
    width: var(--mob-tap);
    height: var(--mob-tap);
    background: none;
    border: none;
    color: var(--mob-text-dim);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mob-radius-sm);
    -webkit-tap-highlight-color: transparent;
  }

  /* Drawer user chip */
  .mob-drawer-user {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--mob-border);
  }

  .mob-drawer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--mob-red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display, sans-serif);
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
  }

  .mob-drawer-user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--mob-text);
    line-height: 1.2;
  }

  .mob-drawer-user-role {
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--mob-red);
    font-family: var(--font-mono, monospace);
    text-transform: uppercase;
  }

  .mob-drawer-status {
    font-size: 10px;
    color: #00cc66;
    font-family: var(--font-mono, monospace);
    letter-spacing: 1px;
  }

  /* Drawer nav sections */
  .mob-drawer-section-label {
    padding: 12px 16px 4px;
    font-size: 9px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--mob-text-dim);
    font-family: var(--font-mono, monospace);
  }

  .mob-drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: var(--mob-tap);
    background: none;
    border: none;
    color: var(--mob-text);
    font-size: 14px;
    font-family: var(--font-sans, sans-serif);
    cursor: pointer;
    width: 100%;
    text-align: left;
    border-radius: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
  }

  .mob-drawer-nav-item:active,
  .mob-drawer-nav-item.active {
    background: var(--mob-red-glow);
    color: var(--mob-red);
  }

  .mob-drawer-nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
  }

  /* Quick actions in drawer */
  .mob-drawer-quick-actions {
    padding: 12px 16px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    border-top: 1px solid var(--mob-border);
    margin-top: auto;
  }

  .mob-quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    background: var(--mob-elevated);
    border: 1px solid var(--mob-border);
    border-radius: var(--mob-radius-sm);
    color: var(--mob-text);
    font-size: 9px;
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.5px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mob-quick-action-btn .qa-icon {
    font-size: 20px;
  }

  .mob-quick-action-btn.danger { border-color: rgba(204,0,0,0.4); color: var(--mob-red); }

  /* ── Bottom Navigation Tab Bar ──────────────────────────────────── */
  #mob-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mob-bottom-nav) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--mob-surface);
    border-top: 1px solid var(--mob-border);
    display: flex;
    align-items: stretch;
    z-index: 1000;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.4);
  }

  .mob-tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--mob-text-dim);
    font-size: 9px;
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
    position: relative;
  }

  .mob-tab-btn .tab-icon {
    font-size: 20px;
    line-height: 1;
  }

  .mob-tab-btn.active {
    color: var(--mob-red);
  }

  .mob-tab-btn.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 2px;
    background: var(--mob-red);
    border-radius: 0 0 2px 2px;
  }

  /* FAB — center create button */
  .mob-tab-fab {
    flex: 0 0 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    top: -10px;
  }

  .mob-tab-fab-inner {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--mob-red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    box-shadow: 0 4px 16px var(--mob-red-glow);
    transition: transform 0.15s, box-shadow 0.15s;
  }

  .mob-tab-fab:active .mob-tab-fab-inner {
    transform: scale(0.93);
    box-shadow: 0 2px 8px var(--mob-red-glow);
  }

  /* ── Page content overrides for phones ─────────────────────────── */

  /* Remove desktop page padding/margins */
  .dept-admin,
  .page,
  .page-content,
  [class*="dept-"] {
    padding: 12px !important;
    height: auto !important;
    min-height: unset !important;
  }

  /* Page header bar — compact on mobile */
  .page-header-bar {
    padding: 12px 16px 10px !important;
    flex-wrap: wrap;
    gap: 8px;
  }

  .page-title-sm {
    font-size: 18px !important;
  }

  .page-eyebrow {
    font-size: 9px !important;
  }

  /* Stat cards — single column on small phones, 2-col on larger */
  .stats-grid,
  .stat-cards,
  [class*="stats-row"],
  [class*="stat-row"] {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* Tables → card list on mobile */
  table.mob-card-table,
  .data-table {
    display: block;
    width: 100%;
  }

  .data-table thead { display: none; }

  .data-table tbody { display: block; }

  .data-table tr {
    display: block;
    background: var(--mob-elevated);
    border: 1px solid var(--mob-border);
    border-radius: var(--mob-radius);
    padding: 12px;
    margin-bottom: 8px;
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border: none;
    font-size: 13px;
  }

  .data-table td::before {
    content: attr(data-label);
    font-size: 10px;
    color: var(--mob-text-dim);
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    flex-shrink: 0;
    margin-right: 8px;
  }

  /* Form cards — full width */
  .form-card {
    border-radius: var(--mob-radius) !important;
    padding: 14px !important;
    margin-bottom: 10px !important;
  }

  /* Modals — full screen on phone */
  .modal,
  [class*="-modal"],
  [id*="-modal"] {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    transform: none !important;
    top: 0 !important;
    left: 0 !important;
    overflow-y: auto !important;
  }

  /* Tabs — scrollable horizontal */
  .tabs {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 4px !important;
    padding-bottom: 2px !important;
    scrollbar-width: none !important;
  }

  .tabs::-webkit-scrollbar { display: none; }

  .tab-btn {
    flex-shrink: 0 !important;
    padding: 8px 14px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  /* Buttons — full width on phone forms */
  .btn-row,
  .form-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .btn-row .btn,
  .form-actions .btn {
    width: 100% !important;
  }

  /* Incident / call cards */
  .incident-card,
  .call-card,
  [class*="incident-row"],
  [class*="call-row"] {
    border-radius: var(--mob-radius) !important;
    padding: 12px !important;
    margin-bottom: 8px !important;
  }

  /* Status badges — larger tap area */
  .status-badge,
  [class*="-badge"] {
    padding: 4px 10px !important;
    font-size: 10px !important;
    border-radius: 20px !important;
  }

  /* MDT pages — remove fixed heights */
  .mdt-shell,
  .mdt-body,
  [class*="mdt-"] {
    height: auto !important;
    min-height: unset !important;
    overflow: visible !important;
  }

  /* Panic button — move above bottom nav */
  #panic-float-btn {
    bottom: calc(var(--mob-bottom-nav) + env(safe-area-inset-bottom, 0px) + 12px) !important;
    right: 16px !important;
    width: 48px !important;
    height: 48px !important;
    font-size: 8px !important;
  }

  /* Civilian Hub — full width cards */
  .civhub-page {
    height: calc(100dvh - var(--mob-topbar) - var(--mob-bottom-nav)
                 - env(safe-area-inset-top, 0px)
                 - env(safe-area-inset-bottom, 0px)) !important;
  }

  .civhub-titlebar {
    padding: 10px 14px !important;
  }

  /* Stores Hub */
  .sh-root {
    height: auto !important;
  }

  .sh-topbar {
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 10px 14px !important;
  }

  .sh-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    padding: 12px !important;
  }

  /* Law & Order MDT */
  .lo-shell {
    height: auto !important;
  }

  /* Radio PTT — center the big button */
  .ptt-btn,
  [class*="ptt-"] {
    margin: 0 auto !important;
  }

  /* Dashboard stat numbers — bigger on phone */
  .stat-value,
  [class*="stat-num"] {
    font-size: 28px !important;
  }

  /* Section labels */
  .section-label,
  .sidebar-section {
    font-size: 9px !important;
    letter-spacing: 2px !important;
  }

  /* Input fields — larger on mobile */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px !important; /* prevents iOS zoom on focus */
    min-height: var(--mob-tap) !important;
    padding: 10px 12px !important;
    border-radius: var(--mob-radius-sm) !important;
  }

  /* Search bars */
  .search-bar,
  [class*="search-input"] {
    height: var(--mob-tap) !important;
    font-size: 14px !important;
    border-radius: 22px !important;
    padding: 0 16px !important;
  }

  /* Unit list rows */
  .unit-row,
  [class*="unit-item"] {
    padding: 12px 14px !important;
    border-radius: var(--mob-radius-sm) !important;
    margin-bottom: 6px !important;
  }

  /* Messages list */
  .msg-row,
  [class*="message-item"],
  [class*="msg-item"] {
    padding: 12px 14px !important;
    border-radius: var(--mob-radius-sm) !important;
  }

  /* BOLO cards */
  .bolo-card,
  [class*="bolo-item"] {
    border-radius: var(--mob-radius) !important;
    padding: 14px !important;
    margin-bottom: 10px !important;
  }

  /* Incident detail — tab bar */
  .detail-tabs,
  [class*="detail-tab"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Update status button — full width, prominent */
  [onclick*="updateStatus"],
  [onclick*="update-status"],
  .update-status-btn {
    width: 100% !important;
    height: 48px !important;
    font-size: 14px !important;
    letter-spacing: 2px !important;
    border-radius: var(--mob-radius) !important;
    margin-top: 12px !important;
  }

  /* Auth screens — full screen */
  .auth-card,
  .login-card,
  .signup-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    min-height: 100dvh !important;
    padding: 32px 20px !important;
  }
}

/* ─────────────────────────────────────────────────────────────────
   PHONE LANDSCAPE  (481px – 767px, e.g. iPhone rotated)
   ───────────────────────────────────────────────────────────────── */
@media (min-width: 481px) and (max-width: 767px) {
  .sh-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  .stats-grid,
  .stat-cards {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   TABLET LAYOUT  (iPad + Android tablet, 768px – 1199px)
   ═══════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1199px) {

  /* ── App shell — row layout with sidebar + content ────────────── */
  .app-shell {
    flex-direction: row;
    height: 100dvh;
  }

  /* ── Sidebar — always visible, narrower on tablet ──────────────── */
  #sidebar,
  .sidebar {
    display: flex !important;
    width: 220px !important;
    min-width: 220px !important;
    flex-shrink: 0;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Sidebar nav items — slightly larger tap targets */
  .nav-item {
    height: 44px !important;
    font-size: 13px !important;
    padding: 0 14px !important;
  }

  .nav-icon {
    font-size: 16px !important;
  }

  /* ── Main content — fills remaining space ─────────────────────── */
  .main-content {
    flex: 1;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* ── No mobile topbar on tablets (sidebar is always visible) ───── */
  #mob-topbar {
    display: none !important;
  }

  /* ── No bottom nav on tablets ───────────────────────────────────── */
  #mob-bottom-nav {
    display: none !important;
  }

  /* ── Tablet page layout ─────────────────────────────────────────── */
  .dept-admin,
  .page,
  .page-content,
  [class*="dept-"] {
    padding: 16px !important;
  }

  /* Stats — 4 column grid on tablet */
  .stats-grid,
  .stat-cards {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 12px !important;
  }

  /* Tables — show normally on tablet */
  .data-table thead { display: table-header-group; }
  .data-table tbody { display: table-row-group; }
  .data-table tr    { display: table-row; background: none; border: none; padding: 0; margin: 0; }
  .data-table td    { display: table-cell; padding: 10px 12px; }
  .data-table td::before { display: none; }

  /* Modals — centered sheet on tablet */
  .modal,
  [class*="-modal"],
  [id*="-modal"] {
    position: fixed !important;
    inset: auto !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90% !important;
    max-width: 680px !important;
    height: auto !important;
    max-height: 85dvh !important;
    border-radius: var(--mob-radius) !important;
    overflow-y: auto !important;
  }

  /* Stores Hub — 3 col grid */
  .sh-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 14px !important;
    padding: 16px !important;
  }

  /* Incident detail — two-pane: info left, units right */
  .incident-detail-wrap {
    display: grid !important;
    grid-template-columns: 1fr 280px !important;
    gap: 16px !important;
    align-items: start !important;
  }

  /* Unit list — show more columns */
  .unit-row,
  [class*="unit-item"] {
    display: grid !important;
    grid-template-columns: 80px 1fr 120px 120px auto !important;
    align-items: center !important;
    gap: 12px !important;
  }

  /* Input fields — normal size on tablet */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  select,
  textarea {
    font-size: 14px !important;
    min-height: 40px !important;
  }

  /* Panic button — keep at bottom right */
  #panic-float-btn {
    bottom: calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    right: 20px !important;
  }

  /* Civilian Hub */
  .civhub-page {
    height: 100dvh !important;
  }

  /* Auth screens — centered card on tablet */
  .auth-card,
  .login-card,
  .signup-card {
    width: 480px !important;
    max-width: 90% !important;
    border-radius: var(--mob-radius) !important;
    min-height: auto !important;
  }

  /* Radio PTT — centered */
  .ptt-btn,
  [class*="ptt-"] {
    margin: 0 auto !important;
  }
}

/* ─────────────────────────────────────────────────────────────────
   TABLET PORTRAIT  (768px – 1023px)
   ───────────────────────────────────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Sidebar slightly narrower in portrait */
  #sidebar,
  .sidebar {
    width: 200px !important;
    min-width: 200px !important;
  }

  .stats-grid,
  .stat-cards {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .sh-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .incident-detail-wrap {
    grid-template-columns: 1fr !important;
  }
}

/* ─────────────────────────────────────────────────────────────────
   TABLET LANDSCAPE  (1024px – 1199px)
   ───────────────────────────────────────────────────────────────── */
@media (min-width: 1024px) and (max-width: 1199px) {
  #sidebar,
  .sidebar {
    width: 220px !important;
    min-width: 220px !important;
  }

  .stats-grid,
  .stat-cards {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  .sh-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE DASHBOARD  (phone-specific dashboard cards)
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* Dashboard stat card */
  .mob-stat-card {
    background: var(--mob-elevated);
    border: 1px solid var(--mob-border);
    border-radius: var(--mob-radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .mob-stat-card .stat-label {
    font-size: 10px;
    color: var(--mob-text-dim);
    font-family: var(--font-mono, monospace);
    letter-spacing: 1px;
    text-transform: uppercase;
  }

  .mob-stat-card .stat-value {
    font-size: 32px !important;
    font-weight: 700;
    font-family: var(--font-display, sans-serif);
    color: var(--mob-text);
    line-height: 1;
  }

  .mob-stat-card .stat-sub {
    font-size: 11px;
    color: var(--mob-text-dim);
  }

  .mob-stat-card .stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
  }

  /* Incident list item */
  .mob-incident-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--mob-border);
  }

  .mob-incident-item:last-child {
    border-bottom: none;
  }

  .mob-incident-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .mob-incident-info {
    flex: 1;
    min-width: 0;
  }

  .mob-incident-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--mob-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mob-incident-sub {
    font-size: 11px;
    color: var(--mob-text-dim);
  }

  .mob-incident-badge {
    font-size: 9px;
    font-family: var(--font-mono, monospace);
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 700;
    flex-shrink: 0;
  }

  .mob-incident-badge.leo   { background: rgba(26,111,255,0.2); color: #1a6fff; }
  .mob-incident-badge.fire  { background: rgba(255,102,0,0.2);  color: #ff6600; }
  .mob-incident-badge.ems   { background: rgba(0,204,102,0.2);  color: #00cc66; }

  /* Section header with "View All" */
  .mob-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }

  .mob-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--mob-text);
    font-family: var(--font-display, sans-serif);
    letter-spacing: 0.5px;
  }

  .mob-view-all {
    font-size: 11px;
    color: var(--mob-red);
    font-family: var(--font-mono, monospace);
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* Sparkline / chart area */
  .mob-chart-area {
    height: 48px;
    position: relative;
    overflow: hidden;
  }

  /* Active incidents hero card */
  .mob-hero-card {
    background: var(--mob-elevated);
    border: 1px solid var(--mob-border);
    border-radius: var(--mob-radius);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .mob-hero-number {
    font-size: 52px;
    font-weight: 900;
    font-family: var(--font-display, sans-serif);
    color: var(--mob-red);
    line-height: 1;
  }

  .mob-hero-label {
    font-size: 12px;
    color: var(--mob-text-dim);
    font-family: var(--font-mono, monospace);
    letter-spacing: 1px;
    text-transform: uppercase;
  }

  .mob-hero-delta {
    font-size: 11px;
    color: var(--mob-red);
    font-family: var(--font-mono, monospace);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   RADIO PTT PAGE  (all mobile)
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1199px) {
  .mob-ptt-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    gap: 20px;
  }

  .mob-ptt-channel {
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-display, sans-serif);
    color: var(--mob-text);
    letter-spacing: 1px;
  }

  .mob-ptt-status {
    font-size: 11px;
    font-family: var(--font-mono, monospace);
    letter-spacing: 2px;
    text-transform: uppercase;
  }

  .mob-ptt-status.online { color: #00cc66; }

  /* Big circular PTT button */
  .mob-ptt-btn {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: var(--mob-elevated);
    border: 3px solid var(--mob-red);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 0 40px var(--mob-red-glow);
    transition: transform 0.1s, box-shadow 0.1s;
    user-select: none;
    -webkit-user-select: none;
  }

  .mob-ptt-btn:active,
  .mob-ptt-btn.transmitting {
    transform: scale(0.96);
    box-shadow: 0 0 60px rgba(204,0,0,0.5);
    border-color: #ff2020;
    background: rgba(204,0,0,0.12);
  }

  .mob-ptt-mic-icon {
    font-size: 40px;
    color: var(--mob-red);
  }

  .mob-ptt-label {
    font-size: 10px;
    letter-spacing: 3px;
    font-family: var(--font-mono, monospace);
    color: var(--mob-text-dim);
    text-transform: uppercase;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   UNIT STATUS PAGE  (phone)
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .mob-unit-status-wrap {
    padding: 16px;
  }

  .mob-unit-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--mob-elevated);
    border-radius: var(--mob-radius);
    border: 1px solid var(--mob-border);
  }

  .mob-unit-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--mob-surface);
    border: 2px solid var(--mob-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
  }

  .mob-unit-callsign {
    font-size: 22px;
    font-weight: 900;
    font-family: var(--font-display, sans-serif);
    color: var(--mob-text);
    letter-spacing: 1px;
  }

  .mob-unit-name {
    font-size: 13px;
    color: var(--mob-text-dim);
  }

  /* Status progress bar */
  .mob-status-track {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 16px 0;
    position: relative;
  }

  .mob-status-track::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--mob-border);
    transform: translateY(-50%);
    z-index: 0;
  }

  .mob-status-node {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 1;
  }

  .mob-status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--mob-border);
    border: 2px solid var(--mob-surface);
  }

  .mob-status-dot.active {
    background: var(--mob-red);
    box-shadow: 0 0 8px var(--mob-red-glow);
  }

  .mob-status-node-label {
    font-size: 8px;
    font-family: var(--font-mono, monospace);
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--mob-text-dim);
    text-align: center;
  }

  /* Change status button */
  .mob-change-status-btn {
    width: 100%;
    height: 52px;
    background: var(--mob-red);
    border: none;
    border-radius: var(--mob-radius);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-display, sans-serif);
    letter-spacing: 2px;
    text-transform: uppercase;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    margin-top: 20px;
    box-shadow: 0 4px 16px var(--mob-red-glow);
  }
}

/* ═══════════════════════════════════════════════════════════════════
   SAFE AREA UTILITIES  (notch / home indicator)
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 1199px) {
  .safe-top    { padding-top:    env(safe-area-inset-top, 0px); }
  .safe-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .safe-left   { padding-left:   env(safe-area-inset-left, 0px); }
  .safe-right  { padding-right:  env(safe-area-inset-right, 0px); }
}

/* ═══════════════════════════════════════════════════════════════════
   PRINT / DESKTOP GUARD  (≥ 1200px — this file does nothing)
   ═══════════════════════════════════════════════════════════════════ */
@media (min-width: 1200px) {
  #mob-topbar,
  #mob-bottom-nav,
  #mob-drawer,
  #mob-drawer-overlay {
    display: none !important;
  }
}
