/* ─── Design Tokens ─────────────────────────────────────────────────────── */
:root {
  --bg-deep: #06080c;
  --bg-panel: #0c1018;
  --bg-card: #111722;
  --bg-elevated: #161d2e;
  --bg-input: #0a0f18;

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-medium: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(245, 158, 11, 0.35);

  --text-primary: #e8ecf4;
  --text-secondary: #8b95a8;
  --text-muted: #5a6478;

  --amber: #f59e0b;
  --amber-dim: rgba(245, 158, 11, 0.15);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.12);
  --green-glow: rgba(34, 197, 94, 0.4);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --blue-pd: #3b82f6;
  --blue-pd-dim: rgba(59, 130, 246, 0.12);
  --red-ems: #f43f5e;
  --red-ems-dim: rgba(244, 63, 94, 0.12);
  --orange-dot: #fb923c;
  --orange-dot-dim: rgba(251, 146, 60, 0.12);
  --amber-busy: #eab308;
  --amber-busy-dim: rgba(234, 179, 8, 0.12);

  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-panel: 0 4px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-deep);
  line-height: 1.5;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59, 130, 246, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(245, 158, 11, 0.05), transparent),
    linear-gradient(180deg, #06080c 0%, #0a0e16 100%);
  pointer-events: none;
  z-index: 0;
}

.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

.noise {
  position: fixed;
  inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9998;
}

.hidden { display: none !important; }

/* ─── Auth pages (login, pending) ───────────────────────────────────────── */
body.auth-page {
  overflow: auto;
}

body.auth-page .login-page,
body.auth-page .pending-page {
  position: relative;
  z-index: 1;
}

/* ─── Top Bar ─────────────────────────────────────────────────────────────── */
.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 24px;
  background: rgba(12, 16, 24, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar__seal {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--amber-dim), transparent);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  color: var(--amber);
}

.topbar__seal svg { width: 24px; height: 24px; }

.topbar__title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  line-height: 1.1;
}

.topbar__subtitle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar__stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-width: 90px;
}

.stat-pill__value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
}

.stat-pill__label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-pill--green .stat-pill__value { color: var(--green); }
.stat-pill--amber .stat-pill__value { color: var(--amber-busy); }
.stat-pill--red .stat-pill__value { color: var(--red); }
.stat-pill--blue .stat-pill__value { color: var(--blue-pd); }

.topbar__clock {
  text-align: right;
  font-family: var(--font-mono);
}

.topbar__date {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.topbar__time {
  display: block;
  font-size: 24px;
  font-weight: 600;
  color: var(--amber);
  letter-spacing: 0.06em;
}

/* ─── Dashboard Layout ────────────────────────────────────────────────────── */
.dashboard {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 340px 1fr 360px;
  gap: 16px;
  padding: 16px 24px 24px;
  height: calc(100vh - 70px);
}

/* ─── Panels ──────────────────────────────────────────────────────────────── */
.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  animation: panelIn 0.5s ease backwards;
}

.panel--units { animation-delay: 0.05s; }
.panel--scenes { animation-delay: 0.1s; }
.panel--intel { animation-delay: 0.15s; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.01);
}

.panel__title-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.panel__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel__badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

.panel__badge--pulse {
  color: var(--red);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.panel__body {
  flex: 1;
  padding: 12px;
}

.panel__body--scroll {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-medium) transparent;
}

.panel__body--scroll::-webkit-scrollbar { width: 6px; }
.panel__body--scroll::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}

.panel__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  color: var(--text-muted);
  text-align: center;
  gap: 8px;
}

.panel__empty svg {
  width: 40px;
  height: 40px;
  opacity: 0.3;
  margin-bottom: 8px;
}

/* ─── Department Tabs ─────────────────────────────────────────────────────── */
.dept-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px 0;
}

.dept-tab {
  flex: 1;
  padding: 8px 4px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  transition: var(--transition);
}

.dept-tab:hover { color: var(--text-secondary); }

.dept-tab.active {
  color: var(--text-primary);
  background: var(--bg-card);
  border-color: var(--border-subtle);
  border-bottom-color: var(--bg-card);
}

.dept-tab--pd.active { color: var(--blue-pd); border-top: 2px solid var(--blue-pd); }
.dept-tab--ems.active { color: var(--red-ems); border-top: 2px solid var(--red-ems); }
.dept-tab--dot.active { color: var(--orange-dot); border-top: 2px solid var(--orange-dot); }
.dept-tab--all.active { color: var(--amber); border-top: 2px solid var(--amber); }

/* ─── Discord VC Panel ────────────────────────────────────────────────────── */
.vc-panel {
  margin: 0 12px 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.08), rgba(12, 16, 24, 0.6));
  border: 1px solid rgba(88, 101, 242, 0.25);
  border-radius: var(--radius-md);
}

.vc-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.vc-panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a5b4fc;
}

.vc-panel__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.vc-panel__dot--live {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
  animation: pulse 2s ease infinite;
}

.vc-panel__dot--off { background: var(--amber-busy); }
.vc-panel__dot--err { background: var(--red); }

.vc-panel__count {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  background: rgba(88, 101, 242, 0.15);
  border-radius: 10px;
  color: #c7d2fe;
}

.vc-panel__actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.vc-panel__channel-select {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(88, 101, 242, 0.35);
  background: rgba(8, 12, 20, 0.85);
  color: #c7d2fe;
  max-width: 220px;
  min-width: 160px;
  cursor: pointer;
}

.vc-panel__channel-select:focus {
  outline: none;
  border-color: rgba(88, 101, 242, 0.7);
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.15);
}

.vc-panel__status {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-family: var(--font-mono);
}

.vc-panel__auto-label {
  font-size: 9px;
  color: var(--green);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-family: var(--font-display);
  opacity: 0.85;
}

.vc-panel__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
}

.vc-panel__empty {
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 0;
  text-align: center;
  line-height: 1.5;
}

.vc-panel__hint {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  opacity: 0.85;
}

.vc-panel__hint code {
  font-family: var(--font-mono);
  font-size: 9px;
}

.vc-panel__linked {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 6px;
  min-height: 12px;
}

.vc-link-modal {
  max-width: 560px;
}

.vc-link-modal__help {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
}

.vc-link-modal__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.vc-link-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}

.vc-link-option:hover {
  border-color: rgba(88, 101, 242, 0.5);
  background: rgba(88, 101, 242, 0.08);
}

.vc-link-option--active {
  border-color: var(--green);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
}

.vc-link-option__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.vc-link-option__names {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.vc-link-modal__empty {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 12px;
}

.vc-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.vc-member__avatar {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(88, 101, 242, 0.3);
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  color: #c7d2fe;
  flex-shrink: 0;
}

.vc-member__info { flex: 1; min-width: 0; }

.vc-member__name {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vc-member__user {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.vc-member__flags {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.vc-flag {
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 2px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.vc-flag--mute { color: var(--amber); }
.vc-flag--deaf { color: var(--red); }
.vc-flag--stream { color: #a78bfa; background: rgba(167, 139, 250, 0.15); }

/* ─── Unit Cards ──────────────────────────────────────────────────────────── */
.unit-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  margin-bottom: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--text-muted);
  transition: var(--transition);
}

.unit-card:hover {
  border-color: var(--border-medium);
  background: var(--bg-elevated);
}

.unit-card--PD { border-left-color: var(--blue-pd); }
.unit-card--EMS { border-left-color: var(--red-ems); }
.unit-card--DOT { border-left-color: var(--orange-dot); }

.unit-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.unit-card__callsign {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.unit-card__dept {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.unit-card__dept--PD { background: var(--blue-pd-dim); color: var(--blue-pd); }
.unit-card__dept--EMS { background: var(--red-ems-dim); color: var(--red-ems); }
.unit-card__dept--DOT { background: var(--orange-dot-dim); color: var(--orange-dot); }

.unit-card__officer {
  font-size: 13px;
  color: var(--text-secondary);
}

.unit-card__status-row {
  display: flex;
  gap: 4px;
}

.status-btn {
  flex: 1;
  padding: 6px 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.status-btn:hover { border-color: var(--border-medium); color: var(--text-secondary); }

.status-btn.active--108 {
  background: var(--green-dim);
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 12px var(--green-glow);
}

.status-btn.active--107 {
  background: var(--amber-busy-dim);
  border-color: var(--amber-busy);
  color: var(--amber-busy);
}

.status-btn.active--off {
  background: rgba(90, 100, 120, 0.15);
  border-color: var(--text-muted);
  color: var(--text-muted);
}

.status-btn--disabled,
.status-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.unit-card__delete {
  align-self: flex-end;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
}

.unit-card:hover .unit-card__delete { opacity: 1; }
.unit-card__delete:hover { color: var(--red); }

/* ─── Scene Cards ─────────────────────────────────────────────────────────── */
.scene-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  transition: var(--transition);
}

.scene-card:hover { border-color: var(--border-medium); }

.scene-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  gap: 12px;
}

.scene-card__header:hover { background: rgba(255, 255, 255, 0.02); }

.scene-card__location {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.scene-card__desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.scene-card__meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.priority-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.priority-badge--low { background: rgba(34, 197, 94, 0.15); color: var(--green); }
.priority-badge--medium { background: var(--amber-dim); color: var(--amber); }
.priority-badge--high { background: var(--red-dim); color: var(--red); }
.priority-badge--critical {
  background: var(--red);
  color: white;
  animation: pulse 1.5s ease infinite;
}

.scene-card__expand {
  color: var(--text-muted);
  transition: transform var(--transition);
}

.scene-card.expanded .scene-card__expand { transform: rotate(180deg); }

.scene-card__body {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border-subtle);
}

.scene-card.expanded .scene-card__body { display: block; }

.scene-card__people-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
}

.scene-card__people-header h4 {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.person-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.person-chip__role {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--bg-elevated);
  color: var(--text-muted);
  flex-shrink: 0;
}

.person-chip__role--suspect { background: var(--red-dim); color: var(--red); }
.person-chip__role--victim { background: var(--blue-pd-dim); color: var(--blue-pd); }
.person-chip__role--witness { background: var(--amber-dim); color: var(--amber); }
.person-chip__role--officer { background: var(--green-dim); color: var(--green); }

.person-chip__info { flex: 1; min-width: 0; }
.person-chip__name { font-weight: 500; font-size: 13px; }
.person-chip__desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.person-chip__remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  line-height: 1;
}

.person-chip__remove:hover { color: var(--red); }

.scene-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* ─── Intel Panel (BOLOs / Warrants) ──────────────────────────────────────── */
.intel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
}

.intel-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 12px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.intel-tab svg { width: 16px; height: 16px; }

.intel-tab:hover { color: var(--text-secondary); }

.intel-tab.active {
  color: var(--amber);
  border-bottom-color: var(--amber);
  background: rgba(245, 158, 11, 0.04);
}

.intel-tab__count {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  background: var(--bg-elevated);
  border-radius: 10px;
}

.intel-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.intel-content__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 8px;
}

.intel-content__header h3 {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ─── BOLO / Warrant Cards ────────────────────────────────────────────────── */
.intel-card {
  padding: 14px;
  margin-bottom: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.intel-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--amber), transparent);
}

.intel-card--cleared {
  opacity: 0.5;
}

.intel-card--cleared::before {
  background: var(--text-muted);
}

.intel-card__plate {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--amber);
  margin-bottom: 6px;
}

.intel-card__plate--unknown {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.intel-card__title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.intel-card__reason {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.intel-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.intel-card__time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.intel-card__actions {
  display: flex;
  gap: 6px;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn svg { width: 14px; height: 14px; }

.btn--primary {
  background: linear-gradient(135deg, #d97706, var(--amber));
  color: #0a0e16;
  border-color: rgba(245, 158, 11, 0.5);
}

.btn--primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.25);
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn--ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn--danger {
  background: var(--red-dim);
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn--danger:hover {
  background: var(--red);
  color: white;
}

.btn--success {
  background: var(--green-dim);
  color: var(--green);
  border-color: rgba(34, 197, 94, 0.3);
}

.btn--success:hover {
  background: var(--green);
  color: #0a0e16;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn--xs {
  padding: 4px 8px;
  font-size: 11px;
}

/* ─── Forms ───────────────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group label .optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  opacity: 0.7;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal__title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modal__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.modal__close:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.modal__body {
  padding: 20px;
  overflow-y: auto;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
}

/* ─── Toast ───────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  font-size: 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease;
}

.toast--success { border-left: 3px solid var(--green); }
.toast--error { border-left: 3px solid var(--red); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .dashboard {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    height: auto;
    min-height: calc(100vh - 70px);
    overflow-y: auto;
  }

  .panel--intel {
    grid-column: 1 / -1;
    max-height: 400px;
  }

  body { overflow: auto; }
}

@media (max-width: 768px) {
  .dashboard {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .topbar {
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .topbar__stats { order: 3; width: 100%; justify-content: center; }
}

/* ─── AI Dispatch Assistant ───────────────────────────────────────────────── */
.ai-chat__fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: 1px solid var(--border-accent);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(59, 130, 246, 0.15));
  backdrop-filter: blur(12px);
  color: var(--amber);
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 24px rgba(245, 158, 11, 0.15);
  transition: var(--transition);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ai-chat__fab svg {
  width: 22px;
  height: 22px;
}

.ai-chat__fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 32px rgba(245, 158, 11, 0.25);
}

.ai-chat {
  position: fixed;
  bottom: 88px;
  right: 24px;
  z-index: 899;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  background: rgba(12, 16, 24, 0.96);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-panel), 0 0 40px rgba(59, 130, 246, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.98);
  transition: var(--transition);
  pointer-events: none;
}

.ai-chat--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.ai-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.ai-chat__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}

.ai-chat__pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow);
  animation: aiPulse 2s ease-in-out infinite;
}

@keyframes aiPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.ai-chat__header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-chat__new {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.ai-chat__new svg {
  width: 14px;
  height: 14px;
}

.ai-chat__new:hover {
  color: var(--amber);
  border-color: var(--border-accent);
  background: var(--amber-dim);
}

.ai-chat__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

.ai-chat__close:hover { color: var(--text-primary); }

.ai-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-chat__msg {
  display: flex;
  flex-direction: column;
  max-width: 92%;
}

.ai-chat__msg--user {
  align-self: flex-end;
  align-items: flex-end;
}

.ai-chat__msg--assistant,
.ai-chat__msg--system {
  align-self: flex-start;
}

.ai-chat__bubble {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-chat__msg--user .ai-chat__bubble {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--text-primary);
  border-bottom-right-radius: 2px;
}

.ai-chat__msg--assistant .ai-chat__bubble {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 2px;
}

.ai-chat__msg--system .ai-chat__bubble {
  background: var(--amber-dim);
  border: 1px solid rgba(245, 158, 11, 0.2);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--amber);
}

.ai-chat__bubble--thinking {
  opacity: 0.6;
  font-style: italic;
}

.ai-chat__meta {
  font-size: 10px;
  color: var(--red);
  margin-top: 4px;
}

.ai-chat__status {
  min-height: 18px;
  padding: 0 16px;
  font-size: 11px;
  color: var(--amber);
  font-family: var(--font-mono);
}

.ai-chat__input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
}

.ai-chat__input {
  flex: 1;
  resize: none;
  min-height: 40px;
  max-height: 100px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.4;
}

.ai-chat__input:focus {
  outline: none;
  border-color: var(--border-accent);
}

.ai-chat__mic,
.ai-chat__send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.ai-chat__mic svg,
.ai-chat__send svg {
  width: 18px;
  height: 18px;
}

.ai-chat__mic:hover,
.ai-chat__send:hover {
  color: var(--amber);
  border-color: var(--border-accent);
}

.ai-chat__mic--active {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-dim);
  animation: aiMicPulse 1s ease-in-out infinite;
}

@keyframes aiMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

.ai-chat__send {
  background: var(--amber-dim);
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.3);
}

.ai-chat__send:disabled,
.ai-chat__mic:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ai-chat__hint {
  padding: 0 16px 12px;
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
}

.auth-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 16px;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.auth-user-chip__name {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user-chip__logout {
  border: none;
  background: transparent;
  color: var(--amber);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
}

.auth-user-chip__logout:hover {
  text-decoration: underline;
}

.auth-user-chip__admin {
  font-size: 11px;
  color: var(--cyan, #5ec8e8);
  text-decoration: none;
  padding: 2px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm, 4px);
}

.auth-user-chip__admin:hover {
  color: var(--amber);
  border-color: var(--amber);
}

/* ─── Admin dashboard ─────────────────────────────────────────────────────── */

.admin-main {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.admin-back-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
}

.admin-back-link:hover {
  color: var(--amber);
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.admin-tab {
  padding: 8px 16px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
}

.admin-tab.active,
.admin-tab:hover {
  color: var(--amber);
  border-color: var(--amber);
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  background: var(--bg-panel, rgba(12, 16, 24, 0.9));
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.admin-table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.admin-user-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-muted {
  color: var(--text-muted);
  font-size: 12px;
}

.admin-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

.admin-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-status--pending { background: rgba(245, 158, 11, 0.15); color: var(--amber); }
.admin-status--approved { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.admin-status--denied { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.admin-status--revoked { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px !important;
}
