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

    :root {
      --navy:       #0f2544;
      --navy-mid:   #1a3a5c;
      --navy-light: #1e4976;
      --accent:     #2563eb;
      --accent-hover: #1d4ed8;
      --surface:    #ffffff;
      --bg:         #f1f5f9;
      --border:     #e2e8f0;
      --text:       #0f172a;
      --text-muted: #64748b;
      --text-light: #94a3b8;
      --radius:     10px;
      --shadow-sm:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
      --shadow-md:  0 4px 12px rgba(0,0,0,0.08);
    }

    html, body { height: 100%; margin: 0; }

    body {
      font-family: -apple-system, 'Segoe UI', Arial, sans-serif;
      background: var(--bg);
      color: var(--text);
      font-size: 14px;
      line-height: 1.5;
    }

    #appWrapper {
      display: flex;
      min-height: 100vh;
      width: 100%;
    }

    /* ─────────── Sidebar ─────────── */
    .sidebar {
      width: 240px;
      background: var(--navy);
      display: flex;
      flex-direction: column;
      position: fixed;
      top: 0; bottom: 0; right: 0;
      z-index: 100;
      border-left: 1px solid rgba(255,255,255,0.06);
    }

    .sidebar-brand {
      padding: 22px 20px 18px;
      border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .brand-logo {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .brand-icon {
      width: 44px;
      height: 44px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .brand-icon img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      border-radius: 12px;
    }

    .brand-text { color: #fff; }
    .brand-text .title { font-size: 0.95rem; font-weight: 700; }
    .brand-text .sub   { font-size: 0.72rem; color: rgba(255,255,255,0.45); margin-top: 1px; }

    .nav-section {
      padding: 16px 12px 0;
      flex: 1;
    }

    .nav-label {
      font-size: 0.68rem;
      font-weight: 600;
      color: rgba(255,255,255,0.3);
      letter-spacing: 0.08em;
      text-transform: uppercase;
      padding: 0 8px;
      margin-bottom: 6px;
    }

    .nav-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 10px;
      border-radius: 7px;
      cursor: pointer;
      color: rgba(255,255,255,0.6);
      font-size: 0.875rem;
      font-weight: 500;
      margin-bottom: 2px;
      transition: background 0.12s, color 0.12s;
      user-select: none;
      text-decoration: none;
    }

    .nav-item svg { flex-shrink: 0; }
    .nav-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.9); }
    .nav-item.active { background: rgba(37,99,235,0.25); color: #fff; }
    .nav-item.active svg { color: #60a5fa; }
    .nav-item.has-alert::after {
      content: "";
      margin-right: auto;
      width: 8px;
      height: 8px;
      background: #ef4444;
      border-radius: 999px;
      flex-shrink: 0;
      box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
    }

    .sidebar-footer {
      padding: 14px 12px;
      border-top: 1px solid rgba(255,255,255,0.08);
      color: rgba(255,255,255,0.35);
      font-size: 0.72rem;
    }

    /* ─────────── Main ─────────── */
    .main {
      margin-right: 240px;
      flex: 1;
      display: flex;
      flex-direction: column;
      min-height: 100vh;
    }

    /* Topbar */
    .topbar {
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      padding: 0 28px;
      height: 56px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      position: sticky;
      top: 0;
      z-index: 50;
    }

    .topbar-title {
      font-size: 0.95rem;
      font-weight: 600;
      color: var(--text);
    }

    .topbar-right {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .topbar-badge {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 6px;
      padding: 5px 12px;
      font-size: 0.78rem;
      color: var(--text-muted);
      font-weight: 500;
    }

    .topbar-panel-select {
      height: 32px;
      border: 1px solid var(--border);
      border-radius: 7px;
      background: #fff;
      color: var(--text);
      font-family: inherit;
      font-size: 0.78rem;
      font-weight: 600;
      padding: 0 10px;
      min-width: 170px;
    }

    .department-hero {
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 14px;
      box-shadow: var(--shadow-sm);
      padding: 22px;
      display: grid;
      grid-template-columns: 1.25fr 0.75fr;
      gap: 20px;
      align-items: stretch;
      margin-bottom: 18px;
    }

    .department-kicker {
      font-size: 0.75rem;
      font-weight: 800;
      color: var(--accent);
      margin-bottom: 8px;
    }

    .department-title {
      font-size: 1.45rem;
      font-weight: 850;
      color: var(--text);
      margin-bottom: 8px;
      letter-spacing: 0;
    }

    .department-text {
      color: var(--text-muted);
      line-height: 1.7;
      max-width: 780px;
    }

    .department-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin-top: 16px;
    }

    .department-side {
      border: 1px solid #dbeafe;
      background: #f8fbff;
      border-radius: 12px;
      padding: 16px;
      display: grid;
      gap: 10px;
    }

    .department-side-row {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      border-bottom: 1px solid #e8eef8;
      padding-bottom: 9px;
      font-size: 0.82rem;
    }

    .department-side-row:last-child { border-bottom: none; padding-bottom: 0; }

    .department-workspace-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 14px;
      margin-bottom: 18px;
    }

    .department-workspace-card {
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 16px;
      box-shadow: var(--shadow-sm);
      display: grid;
      gap: 10px;
      min-height: 160px;
    }

    .department-workspace-card h4 {
      font-size: 0.92rem;
      color: var(--text);
      margin: 0;
    }

    .department-workspace-card p {
      font-size: 0.8rem;
      line-height: 1.6;
      color: var(--text-muted);
    }

    .department-flow {
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 12px;
      box-shadow: var(--shadow-sm);
      padding: 16px;
    }

    .department-flow-list {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 10px;
      margin-top: 12px;
    }

    .department-flow-step {
      border: 1px solid #e8eef8;
      border-radius: 10px;
      background: #fbfdff;
      padding: 12px;
      min-height: 96px;
    }

    .department-flow-step strong {
      display: block;
      font-size: 0.84rem;
      color: var(--text);
      margin-bottom: 5px;
    }

    .department-flow-step span {
      display: block;
      font-size: 0.76rem;
      color: var(--text-muted);
      line-height: 1.55;
    }

    /* Content */
    .content { padding: 24px 28px; flex: 1; }

    .section { display: none; }
    .section.active { display: block; }

    /* ─────────── Stat Cards ─────────── */
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 14px;
      margin-bottom: 24px;
    }

    .stat-card {
      background: var(--surface);
      border-radius: var(--radius);
      padding: 18px 20px;
      box-shadow: var(--shadow-sm);
      border: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .stat-top {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
    }

    .stat-icon {
      width: 36px;
      height: 36px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .stat-icon.blue   { background: #eff6ff; color: #2563eb; }
    .stat-icon.green  { background: #f0fdf4; color: #16a34a; }
    .stat-icon.amber  { background: #fffbeb; color: #d97706; }
    .stat-icon.red    { background: #fff1f2; color: #e11d48; }

    .stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; }
    .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); letter-spacing: -0.03em; }

    /* ─────────── Card / Table ─────────── */
    .card {
      background: var(--surface);
      border-radius: var(--radius);
      box-shadow: var(--shadow-sm);
      border: 1px solid var(--border);
      overflow: hidden;
      margin-bottom: 20px;
    }

    .card-header {
      padding: 14px 20px;
      border-bottom: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .card-header h3 {
      font-size: 0.875rem;
      font-weight: 600;
      color: var(--text);
    }

    .card-header .sub {
      font-size: 0.75rem;
      color: var(--text-muted);
      margin-top: 1px;
    }

    table { width: 100%; border-collapse: collapse; }

    thead th {
      background: #f8fafc;
      padding: 10px 16px;
      text-align: right;
      font-size: 0.75rem;
      font-weight: 600;
      color: var(--text-muted);
      letter-spacing: 0.02em;
      border-bottom: 1px solid var(--border);
      white-space: nowrap;
    }

    tbody td {
      padding: 11px 16px;
      border-bottom: 1px solid #f8fafc;
      font-size: 0.84rem;
      color: var(--text);
      vertical-align: middle;
    }

    tbody tr:last-child td { border-bottom: none; }
    tbody tr:hover td { background: #fafbff; }

    .mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.78rem; color: var(--text-muted); }

    /* ─────────── Badges ─────────── */
    .badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 3px 9px;
      border-radius: 20px;
      font-size: 0.74rem;
      font-weight: 600;
      white-space: nowrap;
    }

    .badge-dot {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    .badge-NEW              { background: #eff6ff; color: #1d4ed8; }
    .badge-NEW .badge-dot   { background: #3b82f6; }
    .badge-PICKED_UP        { background: #fffbeb; color: #92400e; }
    .badge-PICKED_UP .badge-dot { background: #f59e0b; }
    .badge-OUT_FOR_DELIVERY { background: #f0f9ff; color: #0369a1; }
    .badge-OUT_FOR_DELIVERY .badge-dot { background: #0ea5e9; }
    .badge-DELIVERED        { background: #f0fdf4; color: #15803d; }
    .badge-DELIVERED .badge-dot { background: #22c55e; }
    .badge-FAILED           { background: #fff1f2; color: #be123c; }
    .badge-FAILED .badge-dot { background: #f43f5e; }
    .badge-CANCEL_REQUESTED { background: #fdf4ff; color: #7e22ce; }
    .badge-CANCEL_REQUESTED .badge-dot { background: #a855f7; }
    .badge-CANCELLED_BEFORE_PICKUP     { background: #f8fafc; color: #475569; }
    .badge-CANCELLED_BEFORE_PICKUP .badge-dot { background: #94a3b8; }

    .badge-active   { background: #f0fdf4; color: #15803d; }
    .badge-active .badge-dot   { background: #22c55e; }
    .badge-warning { background: #fffbeb; color: #92400e; }
    .badge-warning .badge-dot { background: #f59e0b; }
    .badge-inactive { background: #fff1f2; color: #be123c; }
    .badge-inactive .badge-dot { background: #f43f5e; }

    .badge-OPEN        { background: #fffbeb; color: #92400e; }
    .badge-OPEN .badge-dot { background: #f59e0b; }
    .badge-IN_PROGRESS { background: #eff6ff; color: #1d4ed8; }
    .badge-IN_PROGRESS .badge-dot { background: #3b82f6; }
    .badge-RESOLVED    { background: #f0fdf4; color: #15803d; }
    .badge-RESOLVED .badge-dot { background: #22c55e; }
    .badge-CLOSED      { background: #f8fafc; color: #475569; }
    .badge-CLOSED .badge-dot { background: #94a3b8; }

    /* ─────────── Buttons ─────────── */
    .btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 7px 14px;
      border-radius: 7px;
      border: none;
      font-size: 0.82rem;
      font-weight: 500;
      cursor: pointer;
      font-family: inherit;
      transition: background 0.12s, box-shadow 0.12s;
      white-space: nowrap;
    }

    .btn-primary {
      background: var(--accent);
      color: #fff;
      box-shadow: 0 1px 2px rgba(37,99,235,0.3);
    }
    .btn-primary:hover { background: var(--accent-hover); }

    .btn-ghost {
      background: transparent;
      color: var(--text-muted);
      border: 1px solid var(--border);
    }
    .btn-ghost:hover { background: var(--bg); color: var(--text); }

    .btn-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
    .btn-danger:hover { background: #fecaca; }

    .btn-sm { padding: 5px 10px; font-size: 0.78rem; }

    .modal-tabs {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
    }

    .modal-tab {
      border: 1px solid var(--border);
      background: #fff;
      color: var(--text-muted);
      border-radius: 999px;
      padding: 8px 14px;
      font-size: 0.82rem;
      font-weight: 600;
      cursor: pointer;
      font-family: inherit;
    }

    .modal-tab.active {
      background: #eff6ff;
      border-color: #bfdbfe;
      color: #1d4ed8;
    }

    .topbar-logout {
      padding: 6px 12px;
      font-size: 0.78rem;
    }

    /* ─────────── Filters ─────────── */
    .toolbar {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 12px 20px;
      border-bottom: 1px solid var(--border);
      flex-wrap: wrap;
      background: #fafafa;
    }

    .toolbar select,
    .toolbar input[type="text"] {
      padding: 6px 11px;
      border: 1px solid var(--border);
      border-radius: 7px;
      font-size: 0.82rem;
      font-family: inherit;
      background: var(--surface);
      color: var(--text);
      height: 34px;
    }

    .toolbar select:focus,
    .toolbar input:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
    }

    .toolbar-spacer { flex: 1; }
    .detail-stack { display: grid; gap: 18px; }
    .detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
    .detail-stat {
      background: linear-gradient(180deg, #fff, #f8fbff);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 16px;
      box-shadow: var(--shadow-sm);
    }
    .detail-stat-kicker { font-size: 0.76rem; color: var(--text-muted); margin-bottom: 6px; }
    .detail-stat-value { font-size: 1.55rem; font-weight: 800; color: var(--text); letter-spacing: -0.03em; }
    .detail-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fff; }
    .detail-card-head {
      padding: 14px 18px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }
    .detail-card-title { font-size: 0.9rem; font-weight: 700; color: var(--text); }
    .detail-card-body { padding: 18px; }
    .billing-closing-workspace { display: grid; gap: 12px; }
    .billing-closing-grid {
      display: grid;
      grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
      gap: 12px;
      align-items: start;
    }
    .detail-lines { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
    .detail-line-label { font-size: 0.73rem; color: var(--text-muted); margin-bottom: 4px; }
    .detail-line-value { font-size: 0.88rem; color: var(--text); font-weight: 500; }
    .simple-list { display: grid; gap: 10px; }
    .simple-item {
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px 14px;
      background: #fbfdff;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }
    .simple-item-title { font-weight: 700; color: var(--text); }
    .simple-item-sub { font-size: 0.76rem; color: var(--text-muted); }
    .admin-mobile-backdrop,
    .admin-mobile-menu-button,
    .admin-mobile-bottom-nav { display: none; }

    .admin-mobile-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
    .mini-chip {
      display: inline-flex;
      align-items: center;
      padding: 4px 10px;
      border-radius: 999px;
      background: #eff6ff;
      color: #1d4ed8;
      font-size: 0.74rem;
      font-weight: 700;
    }
    .ops-inline {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    /* ─────────── Modal ─────────── */
    .overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(15,25,50,0.5);
      backdrop-filter: blur(2px);
      z-index: 200;
      justify-content: center;
      align-items: center;
    }
    .overlay.open { display: flex; }

    .modal {
      background: var(--surface);
      border-radius: 12px;
      width: 500px;
      max-width: 95vw;
      max-height: 88vh;
      overflow-y: auto;
      box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    }

    .modal-head {
      padding: 18px 22px 14px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .modal-head h3 {
      font-size: 0.95rem;
      font-weight: 600;
    }

    .modal-close {
      width: 28px;
      height: 28px;
      border-radius: 6px;
      border: none;
      background: transparent;
      color: var(--text-muted);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.1rem;
    }
    .modal-close:hover { background: var(--bg); color: var(--text); }

    .modal-body { padding: 20px 22px; }

    .modal-foot {
      padding: 14px 22px;
      border-top: 1px solid var(--border);
      display: flex;
      gap: 8px;
      justify-content: flex-end;
    }

    /* Form */
    .form-group { margin-bottom: 14px; }
    .form-group label {
      display: block;
      font-size: 0.8rem;
      font-weight: 500;
      color: var(--text-muted);
      margin-bottom: 5px;
    }
    .form-group input,
    .form-group select,
    .form-group textarea {
      width: 100%;
      padding: 8px 11px;
      border: 1px solid var(--border);
      border-radius: 7px;
      font-size: 0.875rem;
      font-family: inherit;
      color: var(--text);
      background: var(--surface);
      transition: border-color 0.12s, box-shadow 0.12s;
    }
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
    }
    .form-group input[readonly] { background: var(--bg); color: var(--text-muted); }
    .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
    .form-hint { font-size: 0.74rem; color: var(--text-light); margin-top: 4px; }

    /* Alert */
    .alert {
      padding: 9px 13px;
      border-radius: 7px;
      font-size: 0.82rem;
      margin-top: 10px;
      display: flex;
      align-items: center;
      gap: 7px;
    }
    .alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
    .alert-error   { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
    .alert-warn    { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

    /* Plan badge */
    .plan-badge { display:inline-flex; align-items:center; padding:2px 8px; border-radius:20px; font-size:0.7rem; font-weight:700; }
    .plan-STARTER    { background:#f0f9ff; color:#0369a1; }
    .plan-BASIC      { background:#eff6ff; color:#1d4ed8; }
    .plan-PRO        { background:#fdf4ff; color:#7e22ce; }
    .plan-ENTERPRISE { background:#f0fdf4; color:#15803d; }

    /* Usage bar */
    .usage-bar-wrap { width:100%; background:#f1f5f9; border-radius:4px; height:7px; overflow:hidden; min-width:80px; }
    .usage-bar      { height:100%; border-radius:4px; transition:width 0.3s; }
    .usage-ok   { background:#22c55e; }
    .usage-warn { background:#f59e0b; }
    .usage-over { background:#ef4444; }
    .network-anchor-pin {
      width: 18px;
      height: 18px;
      border-radius: 50% 50% 50% 0;
      transform: rotate(-45deg);
      border: 2px solid rgba(255,255,255,0.95);
      box-shadow: 0 6px 14px rgba(15,23,42,0.18);
    }
    .network-anchor-pin.business { background:#f97316; }
    .network-anchor-pin.client { background:#2563eb; }
    .network-listing-pin {
      min-width: 34px;
      height: 28px;
      border-radius: 10px 10px 10px 2px;
      transform: rotate(-12deg);
      border: 2px solid rgba(255,255,255,0.96);
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.72rem;
      font-weight: 800;
      box-shadow: 0 10px 18px rgba(15,23,42,0.2);
    }
    .network-listing-pin span { transform: rotate(12deg); line-height: 1; }
    .network-listing-pin.high { background:#dc2626; }
    .network-listing-pin.medium { background:#d97706; }
    .network-listing-pin.low { background:#2563eb; }
    .network-listing-pin.claimed { background:#7c3aed; }
    .network-map-legend {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 10px;
      color: var(--text-muted);
      font-size: 0.76rem;
    }
    .network-map-legend span {
      display: inline-flex;
      align-items: center;
      gap: 5px;
    }
    .network-map-legend i {
      width: 9px;
      height: 9px;
      border-radius: 99px;
      display: inline-block;
    }
    .network-fallback-map {
      position: relative;
      min-height: 420px;
      border: 1px solid var(--border);
      border-radius: 16px;
      overflow: hidden;
      background:
        linear-gradient(90deg, rgba(148,163,184,.18) 1px, transparent 1px),
        linear-gradient(0deg, rgba(148,163,184,.18) 1px, transparent 1px),
        linear-gradient(135deg, #eef6ff 0%, #f8fafc 45%, #ecfdf5 100%);
      background-size: 56px 56px, 56px 56px, auto;
    }
    .network-fallback-point {
      position: absolute;
      min-width: 26px;
      height: 26px;
      border-radius: 999px;
      transform: translate(-50%, -50%);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-size: .68rem;
      font-weight: 800;
      border: 2px solid rgba(255,255,255,.92);
      box-shadow: 0 10px 20px rgba(15,23,42,.2);
      cursor: pointer;
    }
    .network-fallback-point.courier { background:#0f766e; }
    .network-fallback-point.freelance { background:#2563eb; }
    .network-fallback-point.legal { background:#7c3aed; }
    .network-fallback-point.anchor { background:#f97316; }
    .network-fallback-point.listing { background:#dc2626; border-radius: 10px 10px 10px 2px; }
    .network-fallback-label {
      position: absolute;
      transform: translate(-50%, 18px);
      white-space: nowrap;
      font-size: .7rem;
      color: var(--text);
      background: rgba(255,255,255,.9);
      border: 1px solid var(--border);
      border-radius: 999px;
      padding: 2px 7px;
      box-shadow: 0 4px 10px rgba(15,23,42,.08);
    }
    .admin-live-map-shell {
      border: 1px solid rgba(203,213,225,.86);
      border-radius: 18px;
      background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
      box-shadow: 0 18px 42px rgba(15,23,42,.08);
      overflow: hidden;
    }
    .admin-live-map-toolbar {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
      padding: 18px 20px 14px;
      border-bottom: 1px solid rgba(226,232,240,.9);
    }
    .admin-live-map-body {
      padding: 16px 20px 20px;
    }
    .admin-live-map-layout {
      display: grid;
      grid-template-columns: minmax(0, 1.45fr) minmax(300px, .85fr);
      gap: 16px;
      align-items: stretch;
    }
    .admin-map-stage {
      position: relative;
      min-height: 442px;
      border: 1px solid rgba(203,213,225,.9);
      border-radius: 18px;
      overflow: hidden;
      background: #eef6ff;
      box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
    }
    .admin-map-surface {
      min-height: 442px;
      height: 100%;
    }
    .admin-map-stage:after {
      content: "";
      position: absolute;
      inset: 0;
      pointer-events: none;
      background:
        linear-gradient(180deg, rgba(255,255,255,.42) 0%, rgba(255,255,255,0) 24%),
        linear-gradient(0deg, rgba(15,23,42,.07) 0%, rgba(15,23,42,0) 28%);
      z-index: 1;
    }
    .admin-map-pillbar {
      position: absolute;
      top: 12px;
      right: 12px;
      z-index: 2;
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      max-width: calc(100% - 96px);
    }
    .admin-map-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 7px 10px;
      border: 1px solid rgba(203,213,225,.82);
      border-radius: 999px;
      background: rgba(255,255,255,.94);
      color: var(--text);
      font-size: .76rem;
      font-weight: 800;
      box-shadow: 0 10px 24px rgba(15,23,42,.08);
      backdrop-filter: blur(8px);
    }
    .admin-map-dot {
      width: 8px;
      height: 8px;
      border-radius: 999px;
      background: #2563eb;
      display: inline-block;
    }
    .admin-map-dot.high { background:#dc2626; }
    .admin-map-dot.medium { background:#d97706; }
    .admin-map-dot.claimed { background:#7c3aed; }
    .admin-map-dot.courier { background:#0f766e; }
    .admin-map-marker {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 5px;
      min-width: 38px;
      height: 30px;
      padding: 0 9px;
      border: 2px solid rgba(255,255,255,.96);
      border-radius: 14px 14px 14px 4px;
      color: #fff;
      font-size: .72rem;
      font-weight: 900;
      line-height: 1;
      box-shadow: 0 12px 24px rgba(15,23,42,.23);
      transform: translateY(-2px);
      cursor: pointer;
      white-space: nowrap;
    }
    .admin-map-marker:before {
      content: "";
      width: 7px;
      height: 7px;
      border-radius: 999px;
      background: rgba(255,255,255,.92);
      box-shadow: 0 0 0 2px rgba(255,255,255,.16);
    }
    .admin-map-marker.high { background:#dc2626; }
    .admin-map-marker.medium { background:#d97706; }
    .admin-map-marker.low { background:#2563eb; }
    .admin-map-marker.claimed { background:#7c3aed; }
    .admin-map-marker.anchor {
      width: 20px;
      min-width: 20px;
      height: 20px;
      padding: 0;
      border-radius: 50% 50% 50% 0;
      transform: rotate(-45deg);
    }
    .admin-map-marker.anchor:before { display:none; }
    .admin-map-marker.anchor.business { background:#f97316; }
    .admin-map-marker.anchor.client { background:#2563eb; }
    .admin-map-courier {
      width: 20px;
      height: 20px;
      border-radius: 999px;
      border: 2px solid rgba(255,255,255,.96);
      box-shadow: 0 12px 24px rgba(15,23,42,.24), 0 0 0 5px rgba(37,99,235,.12);
      background: #93c5fd;
      cursor: pointer;
    }
    .admin-map-courier.internal {
      width: 23px;
      height: 23px;
      background: #14b8a6;
      box-shadow: 0 12px 24px rgba(15,23,42,.24), 0 0 0 5px rgba(20,184,166,.16);
    }
    .admin-map-courier.legal {
      background: #c4b5fd;
      box-shadow: 0 12px 24px rgba(15,23,42,.24), 0 0 0 5px rgba(124,58,237,.14);
    }
    .admin-map-courier.route-courier {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 34px;
      height: 34px;
      color: #0891b2;
      background: transparent;
      border: 0;
      box-shadow: none;
    }
    .admin-map-courier.route-courier svg {
      width: 34px;
      height: 34px;
      filter: drop-shadow(0 8px 14px rgba(15,23,42,.22));
    }
    .admin-map-side-card {
      border: 1px solid rgba(203,213,225,.86);
      border-radius: 16px;
      background: #fff;
      padding: 14px;
      box-shadow: 0 10px 24px rgba(15,23,42,.05);
    }
    .admin-map-focus-row {
      border: 1px solid rgba(226,232,240,.92);
      border-radius: 13px;
      background: #f8fbff;
      padding: 10px 12px;
    }
    .admin-map-side-card strong,
    .admin-map-focus-row strong {
      color: var(--text);
    }
    .admin-live-map-shell .mapboxgl-ctrl-group {
      border-radius: 12px;
      overflow: hidden;
      box-shadow: 0 10px 24px rgba(15,23,42,.14);
    }
    .admin-live-map-shell .mapboxgl-popup-content {
      direction: rtl;
      text-align: right;
      border-radius: 14px;
      padding: 13px 14px;
      box-shadow: 0 18px 38px rgba(15,23,42,.2);
      border: 1px solid rgba(226,232,240,.95);
    }
    @media (max-width: 980px) {
      .admin-live-map-layout { grid-template-columns: 1fr; }
      .admin-map-stage, .admin-map-surface { min-height: 360px; }
      .admin-map-pillbar {
        position: static;
        padding: 10px;
        max-width: none;
        background: #f8fbff;
        border-bottom: 1px solid rgba(226,232,240,.9);
      }
    }

    .executive-board {
      display: grid;
      gap: 16px;
    }
    .executive-kpis {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
    }
    .executive-kpi {
      background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 16px 18px;
      box-shadow: var(--shadow-sm);
    }
    .executive-kpi-label {
      font-size: 0.76rem;
      color: var(--text-muted);
      margin-bottom: 6px;
    }
    .executive-kpi-value {
      font-size: 1.7rem;
      font-weight: 800;
      letter-spacing: -0.03em;
      color: var(--text);
    }
    .executive-kpi-sub {
      margin-top: 6px;
      font-size: 0.76rem;
      color: var(--text-light);
    }
    .executive-main {
      display: grid;
      grid-template-columns: 1.15fr 1fr;
      gap: 16px;
      align-items: stretch;
    }

    @media (max-width: 760px) {
      html, body { min-height: 100%; overflow-x: hidden; }
      body { font-size: 15px; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

      #appWrapper { display: block; min-height: 100dvh; }

      .sidebar {
        width: min(88vw, 340px);
        transform: translateX(105%);
        transition: transform .22s ease;
        box-shadow: -20px 0 50px rgba(15, 23, 42, .28);
        padding-top: env(safe-area-inset-top);
        overflow-y: auto;
        overscroll-behavior: contain;
        z-index: 400;
      }
      .admin-mobile-nav-open .sidebar { transform: translateX(0); }
      .nav-section { padding: 12px 12px 20px; overflow: visible; flex: 0 0 auto; }
      .nav-item { min-height: 48px; padding: 12px; border-radius: 11px; font-size: .95rem; }
      .nav-item svg { width: 20px; height: 20px; }
      .sidebar-brand { padding: 16px; }
      .sidebar-footer { position: static; margin-top: auto; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

      .admin-mobile-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        border: 0;
        background: rgba(15, 23, 42, .5);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
        z-index: 390;
      }
      .admin-mobile-nav-open .admin-mobile-backdrop { opacity: 1; pointer-events: auto; }

      .main { margin-right: 0; width: 100%; min-width: 0; min-height: 100dvh; }
      .topbar {
        height: auto;
        min-height: 58px;
        padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
        gap: 8px;
        z-index: 100;
      }
      .admin-mobile-menu-button {
        display: inline-flex;
        width: 42px;
        height: 42px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: #fff;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
        flex: 0 0 auto;
      }
      .admin-mobile-menu-button span { width: 18px; height: 2px; border-radius: 2px; background: var(--navy); }
      .topbar-title { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; }
      .topbar-right { gap: 6px; min-width: 0; }
      .topbar-panel-select { min-width: 0; width: 122px; max-width: 32vw; height: 40px; }
      #departmentPanelBadge, #topbar-date { display: none; }
      .topbar-logout { min-height: 40px; padding: 8px 10px; font-size: .78rem; }

      .content { padding: 12px 12px 24px; min-width: 0; }
      .section { min-width: 0; }
      .stats-grid,
      .department-workspace-grid,
      .executive-kpis,
      .executive-main,
      .grid-2,
      .grid-3,
      .ops-grid,
      .support-summary { grid-template-columns: 1fr !important; }
      .stats-grid { gap: 10px; }
      .stat-card, .card { border-radius: 14px; }
      .card { margin-bottom: 12px; overflow: hidden; }
      .card-header { padding: 14px; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
      .card-header h3 { font-size: 1rem; }
      .department-hero { grid-template-columns: 1fr; padding: 16px; gap: 14px; }
      .department-title { font-size: 1.25rem; }
      .department-actions, .toolbar, .ops-actions { width: 100%; gap: 8px; }
      .toolbar { padding: 12px; align-items: stretch; flex-direction: column; }
      .toolbar-spacer { display: none; }
      .toolbar input, .toolbar select, .toolbar button,
      .department-actions button, .ops-actions button { width: 100% !important; max-width: none !important; min-height: 46px; }
      input, select, textarea, button { font-size: 16px; }
      .btn, .modal-tab { min-height: 44px; }

      .modal-tabs {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
      }
      .modal-tabs::-webkit-scrollbar { display: none; }
      .modal-tab { flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap; padding: 10px 14px; }

      .table-wrap {
        width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
        border-radius: 0 0 14px 14px;
      }
      .table-wrap table { min-width: 720px; }
      .table-wrap th, .table-wrap td { padding: 12px 10px; }

      .table-wrap:has(.admin-mobile-card-table) { overflow: visible; background: transparent; }
      .admin-mobile-card-table { min-width: 0 !important; display: block; background: transparent; }
      .admin-mobile-card-table thead { display: none; }
      .admin-mobile-card-table tbody { display: grid; gap: 10px; padding: 0 10px 12px; }
      .admin-mobile-card-table tr {
        display: block;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 14px;
        box-shadow: var(--shadow-sm);
        overflow: hidden;
      }
      .admin-mobile-card-table td {
        width: 100% !important;
        min-width: 0 !important;
        display: grid;
        grid-template-columns: minmax(86px, 32%) minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        text-align: right !important;
        border: 0;
        border-bottom: 1px solid #eef2f7;
        white-space: normal !important;
        overflow-wrap: anywhere;
      }
      .admin-mobile-card-table td:last-child { border-bottom: 0; }
      .admin-mobile-card-table td::before {
        content: attr(data-mobile-label);
        color: var(--text-muted);
        font-size: .72rem;
        font-weight: 800;
        line-height: 1.5;
      }
      .admin-mobile-card-table td .btn,
      .admin-mobile-card-table td button { min-height: 40px; margin: 2px; }
      .admin-mobile-card-table td[colspan] { display: block; }
      .admin-mobile-card-table td[colspan]::before { display: none; }

      .overlay { align-items: flex-end; padding: 0; z-index: 500; }
      .modal {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 92dvh;
        border-radius: 20px 20px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
      }
      .modal-head { position: sticky; top: 0; z-index: 2; padding: 14px 16px; }
      .modal-body { padding: 14px; }
      .modal-foot {
        position: sticky;
        bottom: 0;
        z-index: 2;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
        background: #fff;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
      }
      .modal-foot .btn { width: 100%; min-height: 46px; }
      .modal-close { width: 42px; height: 42px; flex: 0 0 auto; }

      .admin-live-map-layout { grid-template-columns: 1fr !important; }
      .admin-map-stage, .admin-map-surface { min-height: 300px; }

      .admin-mobile-bottom-nav {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        position: fixed;
        right: 8px;
        left: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom));
        min-height: 60px;
        padding: 6px;
        border: 1px solid rgba(203, 213, 225, .9);
        border-radius: 18px;
        background: rgba(255, 255, 255, .96);
        box-shadow: 0 16px 38px rgba(15, 23, 42, .2);
        backdrop-filter: blur(14px);
        z-index: 300;
      }
      .admin-mobile-bottom-nav button {
        min-width: 0;
        min-height: 48px;
        border: 0;
        border-radius: 13px;
        background: transparent;
        color: #64748b;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1px;
        font-weight: 800;
      }
      .admin-mobile-bottom-nav button span { font-size: 1.2rem; line-height: 1; }
      .admin-mobile-bottom-nav button small { font-size: .68rem; }
      .admin-mobile-bottom-nav button.active { background: #eff6ff; color: #1d4ed8; }
    }
    .executive-hero {
      background: linear-gradient(135deg, #0f2544 0%, #17365a 100%);
      color: #fff;
      border-radius: 18px;
      padding: 22px;
      box-shadow: 0 18px 40px rgba(15, 37, 68, 0.18);
      display: grid;
      gap: 16px;
    }
    .executive-hero-kicker {
      font-size: 0.76rem;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: rgba(255,255,255,0.58);
    }
    .executive-hero-title {
      font-size: 1.4rem;
      font-weight: 800;
      line-height: 1.2;
    }
    .executive-hero-text {
      font-size: 0.93rem;
      line-height: 1.7;
      color: rgba(255,255,255,0.84);
    }
    .executive-hero-strip {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
    }
    .executive-hero-metric {
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.09);
      border-radius: 12px;
      padding: 12px;
    }
    .executive-hero-metric-label {
      font-size: 0.72rem;
      color: rgba(255,255,255,0.62);
      margin-bottom: 6px;
    }
    .executive-hero-metric-value {
      font-size: 1.2rem;
      font-weight: 800;
    }
    .executive-hero-chips {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }
    .executive-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      border-radius: 999px;
      padding: 8px 12px;
      background: rgba(255,255,255,0.08);
      border: 1px solid rgba(255,255,255,0.1);
      font-size: 0.78rem;
      color: rgba(255,255,255,0.86);
    }
    .executive-panels {
      display: grid;
      grid-template-columns: 1fr;
      gap: 14px;
    }
    .executive-panel {
      background: #fff;
      border: 1px solid var(--border);
      border-radius: 16px;
      box-shadow: var(--shadow-sm);
      padding: 18px;
      display: grid;
      gap: 14px;
    }
    .executive-panel-head {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
    }
    .executive-panel-title {
      font-size: 0.94rem;
      font-weight: 700;
      color: var(--text);
    }
    .executive-panel-sub {
      font-size: 0.76rem;
      color: var(--text-muted);
      margin-top: 4px;
      line-height: 1.6;
    }
    .executive-panel-value {
      font-size: 1.35rem;
      font-weight: 800;
      color: var(--text);
      white-space: nowrap;
    }
    .executive-panel-list {
      display: grid;
      gap: 10px;
    }
    .executive-panel-row {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 14px;
      border-top: 1px solid #eef2f7;
      padding-top: 10px;
    }
    .executive-panel-row:first-child {
      border-top: none;
      padding-top: 0;
    }
    .executive-panel-row-label {
      font-size: 0.8rem;
      color: var(--text-muted);
    }
    .executive-panel-row-value {
      font-size: 0.83rem;
      color: var(--text);
      font-weight: 600;
      text-align: left;
    }

    /* Over-limit alert banner */
    .over-limit-banner {
      background:#fff1f2; border:1px solid #fecdd3; border-radius:9px;
      padding:12px 16px; margin-bottom:16px;
      display:flex; align-items:center; gap:10px; font-size:0.85rem; color:#be123c;
    }
    .over-limit-banner strong { font-weight:700; }

    /* Empty / Loading */
    .empty {
      text-align: center;
      padding: 48px 20px;
      color: var(--text-light);
      font-size: 0.875rem;
    }

    .empty svg { margin: 0 auto 10px; display: block; opacity: 0.3; }

    .loading {
      text-align: center;
      padding: 40px;
      color: var(--text-light);
      font-size: 0.85rem;
    }

    /* Divider */
    .section-divider {
      height: 1px;
      background: var(--border);
      margin: 20px 0;
    }

    /* Scrollbar */
    ::-webkit-scrollbar { width: 5px; height: 5px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
    .global-footer {
      border-top: 1px solid var(--border);
      background: #fff;
      color: var(--text-light);
      text-align: center;
      padding: 14px 18px;
      font-size: 0.78rem;
    }
    #admin-billing-unified-workspace[data-admin-billing-hub="customer_first"] > .simple-item:first-of-type .toolbar button[onclick^="showSection("] {
      display: none;
    }

