:root {
      --bg-base: #090d16;
      --bg-surface: #111827;
      --bg-card: rgba(17, 24, 39, 0.75);
      --bg-card-hover: rgba(31, 41, 55, 0.85);
      --border-subtle: rgba(255, 255, 255, 0.08);
      --border-focus: rgba(6, 182, 212, 0.5);
      
      --accent: #06b6d4;
      --accent-glow: rgba(6, 182, 212, 0.25);
      --accent-hover: #0891b2;
      
      --success: #10b981;
      --warning: #f59e0b;
      --danger: #ef4444;
      --info: #3b82f6;
      
      --text-main: #f8fafc;
      --text-muted: #94a3b8;
      --text-dim: #64748b;
      
      --font-display: 'Outfit', -apple-system, sans-serif;
      --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;
      --sidebar-width: 260px;
    }

    * { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      font-family: var(--font-body);
      background: var(--bg-base);
      color: var(--text-main);
      min-height: 100vh;
      display: flex;
      overflow-x: hidden;
    }

    /* Scrollbar */
    ::-webkit-scrollbar { width: 6px; height: 6px; }
    ::-webkit-scrollbar-track { background: var(--bg-base); }
    ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 999px; }

    /* Layout */
    .sidebar {
      width: var(--sidebar-width);
      background: var(--bg-surface);
      border-right: 1px solid var(--border-subtle);
      display: flex;
      flex-direction: column;
      position: fixed;
      top: 0; bottom: 0; left: 0;
      z-index: 100;
    }

    .main-content {
      margin-left: var(--sidebar-width);
      flex: 1;
      display: flex;
      flex-direction: column;
      min-height: 100vh;
      min-width: 0;
      max-width: calc(100vw - var(--sidebar-width));
      background: radial-gradient(circle at 80% 10%, rgba(6, 182, 212, 0.06), transparent 40%),
                  radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.04), transparent 50%),
                  var(--bg-base);
    }

    /* Sidebar Header */
    .brand {
      padding: 24px 20px;
      display: flex;
      align-items: center;
      gap: 12px;
      border-bottom: 1px solid var(--border-subtle);
    }
    .brand-icon {
      width: 42px; height: 42px;
      background: linear-gradient(135deg, var(--accent), #3b82f6);
      border-radius: 12px;
      display: flex; align-items: center; justify-content: center;
      font-size: 1.25rem; color: #fff;
      box-shadow: 0 4px 14px var(--accent-glow);
    }
    .brand-text h2 {
      font-family: var(--font-display);
      font-size: 1.15rem; font-weight: 700;
      background: linear-gradient(to right, #fff, var(--text-muted));
      -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    }
    .brand-text span {
      font-size: 0.72rem; color: var(--accent);
      font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    }

    /* Navigation links */
    .nav-list {
      padding: 16px 12px;
      list-style: none;
      flex: 1;
      display: flex; flex-direction: column; gap: 4px;
      overflow-y: auto;
    }
    .nav-item button {
      width: 100%;
      display: flex; align-items: center; gap: 12px;
      padding: 12px 14px;
      background: transparent;
      border: 1px solid transparent;
      border-radius: 10px;
      color: var(--text-muted);
      font-family: var(--font-body);
      font-size: 0.9rem; font-weight: 500;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      text-align: left;
    }
    .nav-item button i { font-size: 1.05rem; width: 20px; text-align: center; }
    .nav-item button:hover {
      background: rgba(255, 255, 255, 0.04);
      color: var(--text-main);
    }
    .nav-item button.active {
      background: rgba(6, 182, 212, 0.12);
      color: var(--accent);
      border-color: rgba(6, 182, 212, 0.25);
      font-weight: 600;
    }
    .nav-badge {
      margin-left: auto;
      padding: 2px 7px;
      border-radius: 999px;
      font-size: 0.7rem; font-weight: 700;
      background: rgba(239, 68, 68, 0.2);
      color: var(--danger);
    }

    /* Sidebar Footer */
    .admin-profile-pill {
      margin: 16px 12px;
      padding: 12px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border-subtle);
      border-radius: 12px;
      display: flex; align-items: center; gap: 10px;
    }
    .admin-avatar {
      width: 38px; height: 38px;
      border-radius: 50%;
      object-fit: cover;
      border: 2px solid var(--accent);
    }
    .admin-info { flex: 1; min-width: 0; }
    .admin-info .name {
      font-size: 0.85rem; font-weight: 700;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .admin-info .role { font-size: 0.72rem; color: var(--accent); }

    /* Top Bar - Opaque & Elevated to prevent text overlapping when scrolling */
    .topbar {
      min-height: 74px;
      padding: 12px 32px;
      background: rgba(11, 15, 25, 0.96);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border-bottom: 1px solid var(--border-subtle);
      display: flex; align-items: center; justify-content: space-between;
      position: sticky; top: 0; z-index: 95;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    }
    .page-title {
      display: flex;
      flex-direction: column;
      justify-content: center;
    }
    .page-title h1 {
      font-family: var(--font-display);
      font-size: 1.35rem; font-weight: 700;
      margin: 0;
      padding: 0;
      line-height: 1.35;
      letter-spacing: -0.01em;
      color: #fff;
    }
    .page-title p {
      font-size: 0.8rem;
      color: var(--text-dim);
      margin: 3px 0 0 0;
      line-height: 1.25;
    }

    .topbar-actions { display: flex; align-items: center; gap: 14px; }
    .status-badge {
      display: flex; align-items: center; gap: 8px;
      padding: 6px 12px;
      border-radius: 999px;
      background: rgba(16, 185, 129, 0.1);
      border: 1px solid rgba(16, 185, 129, 0.25);
      color: var(--success);
      font-size: 0.78rem; font-weight: 600;
    }
    .status-pulse {
      width: 8px; height: 8px; border-radius: 50%;
      background: var(--success);
      box-shadow: 0 0 10px var(--success);
      animation: pulse 2s infinite;
    }
    @keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.85); } }

    .btn {
      padding: 8px 16px;
      border-radius: 8px;
      font-family: var(--font-body);
      font-size: 0.85rem; font-weight: 600;
      cursor: pointer;
      display: inline-flex; align-items: center; gap: 8px;
      transition: all 0.2s;
      border: 1px solid transparent;
      text-decoration: none;
    }
    .btn-primary {
      background: var(--accent);
      color: #0b0f19;
      box-shadow: 0 2px 10px var(--accent-glow);
    }
    .btn-primary:hover { background: var(--accent-hover); color: #fff; }
    .btn-outline {
      background: transparent;
      border-color: var(--border-subtle);
      color: var(--text-main);
    }
    .btn-outline:hover { background: rgba(255, 255, 255, 0.05); }

    /* Content Area */
    .content-container { padding: 16px 18px; flex: 1; min-width: 0; max-width: 100%; }
    .tab-section { display: none; min-width: 0; max-width: 100%; }
    .tab-section.active { display: block; animation: fadeIn 0.25s ease-out; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

    /* Metric Cards Grid */
    .metrics-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
      gap: 20px;
      margin-bottom: 28px;
    }
    .metric-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: 14px;
      padding: 20px;
      display: flex; align-items: center; gap: 16px;
      backdrop-filter: blur(10px);
      transition: transform 0.2s, border-color 0.2s;
    }
    .metric-card:hover {
      transform: translateY(-2px);
      border-color: var(--border-focus);
    }
    .metric-icon {
      width: 48px; height: 48px;
      border-radius: 12px;
      display: flex; align-items: center; justify-content: center;
      font-size: 1.35rem;
    }
    .metric-info h3 { font-size: 1.65rem; font-family: var(--font-display); font-weight: 800; }
    .metric-info p { font-size: 0.8rem; color: var(--text-muted); }

    /* Panel Card */
    .panel-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: 16px;
      padding: 16px 18px;
      margin-bottom: 20px;
      backdrop-filter: blur(10px);
      min-width: 0;
      max-width: 100%;
      overflow: hidden;
    }
    .panel-header {
      display: flex; align-items: center; justify-content: space-between;
      margin-bottom: 20px;
    }
    .panel-header h2 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }

    /* Tables */
    .table-responsive {
      width: 100%;
      max-width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }
    .table-responsive::-webkit-scrollbar {
      height: 7px;
    }
    .table-responsive::-webkit-scrollbar-track {
      background: rgba(15, 23, 42, 0.6);
      border-radius: 4px;
    }
    .table-responsive::-webkit-scrollbar-thumb {
      background: rgba(6, 182, 212, 0.45);
      border-radius: 4px;
    }
    .table-responsive::-webkit-scrollbar-thumb:hover {
      background: rgba(6, 182, 212, 0.8);
    }
    .admin-table {
      width: 100%; border-collapse: collapse; text-align: left;
      font-size: 0.82rem;
    }
    .admin-table th {
      padding: 9px 8px;
      background: rgba(255, 255, 255, 0.02);
      border-bottom: 1px solid var(--border-subtle);
      color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 0.72rem;
      white-space: nowrap;
    }
    .admin-table td {
      padding: 8px 8px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
      vertical-align: middle;
    }
    .admin-table tr:hover td { background: rgba(255, 255, 255, 0.025); }

    /* Tag badges */
    .badge {
      display: inline-block; padding: 4px 8px; border-radius: 6px;
      font-size: 0.72rem; font-weight: 700;
    }
    .badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
    .badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
    .badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
    .badge-info { background: rgba(59, 130, 246, 0.15); color: var(--info); }

    /* Action Pills for Audit Logs */
    .action-pill {
      font-family: monospace;
      font-size: 0.72rem;
      padding: 3px 8px;
      border-radius: 6px;
      font-weight: 700;
      letter-spacing: 0.5px;
      display: inline-block;
    }
    .action-admin { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }
    .action-sos { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
    .action-user { background: rgba(6, 182, 212, 0.2); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.4); }
    .action-system { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }

    /* Radar Map */
    #admin-radar-map {
      height: 520px; width: 100%;
      border-radius: 12px;
      border: 1px solid var(--border-subtle);
      background: #1e293b;
    }

    /* Hardware GPS Pulse Beacon */
    .custom-hardware-gps-marker {
      background: transparent !important;
      border: none !important;
    }
    .gps-pulse-beacon {
      position: relative;
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .gps-wave-ring {
      position: absolute;
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: rgba(6, 182, 212, 0.5);
      box-shadow: 0 0 14px rgba(6, 182, 212, 0.85);
      animation: gpsWavePulse 2s ease-out infinite;
    }
    .gps-center-dot {
      position: absolute;
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: #06b6d4;
      border: 2.5px solid #ffffff;
      box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
      z-index: 2;
    }
    @keyframes gpsWavePulse {
      0% { transform: scale(0.6); opacity: 0.9; }
      70% { transform: scale(2.5); opacity: 0; }
      100% { transform: scale(2.8); opacity: 0; }
    }

    /* =========================================================================
       COMMAND PROMPT (CMD) AUDIT LOG CONSOLE - STREAM 1 DÒNG GỌN GÀNG DỄ NHÌN
       ========================================================================= */
    .cmd-terminal-box {
      background: #080c14;
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
      font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
      margin-top: 10px;
    }

    .cmd-terminal-header {
      background: #0d131f;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      padding: 10px 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      user-select: none;
    }

    .cmd-terminal-dots {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .cmd-dot {
      width: 11px;
      height: 11px;
      border-radius: 50%;
      display: inline-block;
    }
    .cmd-dot-red { background: #ef4444; }
    .cmd-dot-yellow { background: #f59e0b; }
    .cmd-dot-green { background: #10b981; }

    .cmd-terminal-title {
      font-size: 0.82rem;
      color: #94a3b8;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .cmd-terminal-stream {
      padding: 12px 14px;
      max-height: 560px;
      min-height: 220px;
      overflow-y: auto;
      overflow-x: auto;
      display: flex;
      flex-direction: column;
      gap: 4px;
      background: #060911;
    }

    .cmd-log-row {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 6px 12px;
      border-radius: 6px;
      font-size: 0.8rem;
      line-height: 1.5;
      white-space: nowrap;
      transition: all 0.15s ease;
      color: #cbd5e1;
      border-left: 2px solid transparent;
      cursor: pointer;
    }

    .cmd-log-row:hover {
      background: rgba(255, 255, 255, 0.04);
      border-left-color: var(--accent);
    }

    .cmd-log-prompt {
      color: #38bdf8;
      font-weight: 700;
      flex-shrink: 0;
    }

    .cmd-log-time {
      color: #64748b;
      flex-shrink: 0;
      font-size: 0.76rem;
    }

    .cmd-log-ip {
      color: #f59e0b;
      flex-shrink: 0;
      font-size: 0.76rem;
    }

    .cmd-log-actor {
      color: #38bdf8;
      font-weight: 700;
      flex-shrink: 0;
    }

    .cmd-log-id {
      flex-shrink: 0;
      font-size: 0.78rem;
    }

    .cmd-log-school {
      flex-shrink: 0;
      font-size: 0.78rem;
    }

    .cmd-log-arrow {
      color: #475569;
      flex-shrink: 0;
      font-size: 0.75rem;
    }

    .cmd-log-action {
      flex-shrink: 0;
    }

    .cmd-log-details {
      color: #94a3b8;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 0.78rem;
    }

    /* ===================================================
       ANNOUNCEMENT STUDIO & LIVE PHONE PREVIEW STYLES
       =================================================== */
    .announcement-studio-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
      gap: 24px;
      align-items: start;
    }

    @media (max-width: 1080px) {
      .announcement-studio-grid {
        grid-template-columns: 1fr;
      }
    }

    .broadcast-type-pills {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
      gap: 10px;
      margin-bottom: 4px;
    }

    .broadcast-pill {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 14px;
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.03);
      border: 1.5px solid var(--border-subtle);
      cursor: pointer;
      transition: all 0.2s ease;
      font-size: 0.82rem;
      font-weight: 600;
      color: var(--text-muted);
      user-select: none;
    }

    .broadcast-pill:hover {
      background: rgba(255, 255, 255, 0.06);
      color: #fff;
      transform: translateY(-1px);
    }

    .broadcast-pill.active[data-type="emergency"] {
      background: rgba(239, 68, 68, 0.15);
      border-color: #ef4444;
      color: #fca5a5;
      box-shadow: 0 0 16px rgba(239, 68, 68, 0.25);
    }

    .broadcast-pill.active[data-type="general"] {
      background: rgba(6, 182, 212, 0.15);
      border-color: #06b6d4;
      color: #67e8f9;
      box-shadow: 0 0 16px rgba(6, 182, 212, 0.25);
    }

    .broadcast-pill.active[data-type="ride"] {
      background: rgba(16, 185, 129, 0.15);
      border-color: #10b981;
      color: #6ee7b7;
      box-shadow: 0 0 16px rgba(16, 185, 129, 0.25);
    }

    .broadcast-pill.active[data-type="system"] {
      background: rgba(245, 158, 11, 0.15);
      border-color: #f59e0b;
      color: #fcd34d;
      box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
    }

    .quick-templates-wrap {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .btn-template {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 12px;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.08);
      font-size: 0.76rem;
      color: var(--text-muted);
      cursor: pointer;
      transition: all 0.15s;
    }

    .btn-template:hover {
      background: rgba(6, 182, 212, 0.12);
      border-color: rgba(6, 182, 212, 0.35);
      color: #67e8f9;
    }

    /* Smartphone Live Preview Mockup */
    .mockup-outer {
      background: linear-gradient(145deg, #182234, #0b0f19);
      border: 2px solid rgba(255, 255, 255, 0.12);
      border-radius: 36px;
      padding: 16px;
      box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), inset 0 1px 2px rgba(255, 255, 255, 0.15);
      position: sticky;
      top: 96px;
    }

    .mockup-inner {
      background: radial-gradient(circle at 50% 20%, #1e293b, #0f172a 80%);
      border-radius: 26px;
      padding: 16px 16px 22px 16px;
      border: 1px solid rgba(255, 255, 255, 0.06);
      display: flex;
      flex-direction: column;
      gap: 14px;
      position: relative;
      overflow: hidden;
    }

    .mockup-notch {
      width: 110px;
      height: 20px;
      background: #000;
      border-radius: 0 0 14px 14px;
      margin: -16px auto 4px auto;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
    }

    .mockup-camera {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #1e293b;
      box-shadow: inset 0 0 2px #38bdf8;
    }

    .mockup-speaker {
      width: 36px;
      height: 3px;
      border-radius: 2px;
      background: #334155;
    }

    .mockup-statusbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.74rem;
      font-weight: 600;
      color: #cbd5e1;
      padding: 0 4px;
    }

    .mockup-notif-card {
      background: rgba(30, 41, 59, 0.78);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border: 1px solid rgba(255, 255, 255, 0.14);
      border-radius: 16px;
      padding: 14px;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
      transition: all 0.25s ease;
      position: relative;
    }

    .mockup-notif-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
    }

    .mockup-notif-app {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 0.74rem;
      font-weight: 600;
      color: #94a3b8;
    }

    .mockup-notif-badge {
      font-size: 0.68rem;
      font-weight: 700;
      padding: 2px 7px;
      border-radius: 6px;
      letter-spacing: 0.5px;
    }

    .mockup-notif-title {
      font-size: 0.92rem;
      font-weight: 700;
      color: #fff;
      line-height: 1.35;
      margin-bottom: 4px;
      word-break: break-word;
    }

    .mockup-notif-body {
      font-size: 0.8rem;
      color: #cbd5e1;
      line-height: 1.4;
      word-break: break-word;
      max-height: 140px;
      overflow-y: auto;
    }

    /* Full Detail Modal */
    .ann-detail-box {
      background: rgba(15, 23, 42, 0.8);
      border: 1px solid var(--border-subtle);
      border-radius: 12px;
      padding: 16px;
      line-height: 1.6;
      font-size: 0.9rem;
      color: #e2e8f0;
      max-height: 380px;
      overflow-y: auto;
      white-space: pre-wrap;
      word-break: break-word;
    }