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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

:root {
  --bg-primary: #0b0c0d;
  --bg-secondary: #0e0f10;
  --bg-tertiary: #111213;
  --bg-highlight: #161310;
  --text-primary: #dededa;
  --text-secondary: #999994;
  --text-muted: #616160;
  --text-dim: #404040;
  --accent: #e8a833;
  --accent-dim: #8c6719;
  --accent-rule: #4c3810;
  --alert: #e84545;
  --success: #3fb950;
  --border: #252528;
  --sidebar-width: 240px;
  --header-height: 52px;
  --font-mono: 'Martian Mono', 'JetBrains Mono', monospace;
}

html, body {
  height: 100%;
  font-family: var(--font-mono);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

input, select, textarea {
  font-size: 16px; /* prevents iOS zoom on focus */
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  gap: 16px;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  font-size: 20px;
}

.header-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2.5px;
  color: var(--text-primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Contact button */
.header-contact-btn {
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
}

.header-contact-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Legal link */
.header-legal-link {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  text-decoration: none;
  transition: color 150ms, border-color 150ms;
  flex-shrink: 0;
}

.header-legal-link:hover {
  color: var(--text-secondary);
  border-color: var(--text-secondary);
}

/* Contact modal */
.contact-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.contact-overlay.open {
  display: flex;
}

.contact-modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  max-width: 360px;
  width: 90%;
  text-align: center;
  position: relative;
}

.contact-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.contact-close:hover {
  color: var(--text-primary);
}

.contact-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.contact-text {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.contact-email {
  display: inline-block;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 150ms, color 150ms;
}

.contact-email:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Tabs */
.header-tabs {
  display: flex;
  gap: 2px;
  margin-left: 0;
  border-left: 1px solid var(--border);
  padding-left: 16px;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  padding: 8px 14px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1.8px;
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

.tab-btn:hover:not(.active) {
  color: var(--text-primary);
}

.tab-content {
  display: none !important;
}

.tab-content.active {
  display: flex !important;
}

.header-spacer {
  flex: 1;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1.5px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--alert);
}

.status-dot.live {
  background: var(--accent);
  box-shadow: 0 0 6px rgba(232, 168, 51, 0.4);
  animation: pulse 2s ease-in-out infinite;
}

.status-text {
  color: var(--text-secondary);
}

.status-text.live {
  color: var(--accent);
}

.status-text.disconnected {
  color: var(--alert);
}

.llm-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 1.2px;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.header-admin-link {
  margin-left: 8px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  transition: color 150ms, border-color 150ms;
}
.header-admin-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.header-admin-link.admin-active {
  color: var(--alert);
  border-color: var(--alert);
}

.llm-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}

.llm-dot.active {
  background: var(--accent);
  box-shadow: 0 0 5px rgba(232, 168, 51, 0.3);
}

.llm-dot.unavailable {
  background: var(--alert);
  box-shadow: 0 0 5px rgba(232, 69, 69, 0.4);
}

.llm-text {
  color: var(--text-muted);
}

.llm-text.active {
  color: var(--accent);
}

.llm-text.unavailable {
  color: var(--alert);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

/* ===== Layout ===== */
.layout {
  display: flex;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child {
  border-bottom: none;
}

.sidebar-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 2.2px;
  color: var(--accent);
  margin-bottom: 12px;
}

/* Search */
.search-box {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 8px 10px 8px 28px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  outline: none;
  transition: border-color 0.15s;
  text-transform: uppercase;
}

.search-box:focus {
  border-color: var(--accent);
}

.search-box::placeholder {
  color: var(--text-muted);
  text-transform: uppercase;
}

.search-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
}

/* Stats grid — field-label pairs */
.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-value.alert-value {
  color: var(--alert);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

/* Recent alerts */
.alerts-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.alert-item {
  background: rgba(232, 69, 69, 0.04);
  border-left: 2px solid var(--alert);
  padding: 6px 0 6px 10px;
  font-size: 10px;
}

.alert-item-time {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.alert-item-text {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-primary);
  margin-top: 2px;
  line-height: 1.5;
  word-break: break-word;
}

.alert-item-keywords {
  margin-top: 3px;
}

.alert-keyword-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.5px;
  color: var(--alert);
  font-weight: 500;
  margin-right: 4px;
}

.alerts-empty {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 9px;
  font-style: normal;
  letter-spacing: 0.5px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s;
}

.btn-secondary {
  background: none;
  color: var(--text-secondary);
}

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

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  font-weight: 600;
}

.btn-primary:hover {
  opacity: 0.85;
}

.btn-danger {
  color: var(--alert);
  background: rgba(232, 69, 69, 0.1);
  border-color: rgba(232, 69, 69, 0.3);
}

.btn-danger:hover {
  background: rgba(232, 69, 69, 0.2);
}

.btn-full {
  width: 100%;
}

/* ===== Main Feed ===== */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.feed-bar {
  padding: 0 20px;
  height: 40px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.feed-bar-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.feed-bar-title::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 2px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 12px;
}

.feed-bar-count {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-left: auto;
}

.btn-back-to-live {
  display: none;
}

.btn-back-to-live.visible {
  display: inline-flex;
}

.feed {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
}

.feed::-webkit-scrollbar,
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.feed::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

.feed::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
}

.feed::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Transcript entries */
.entry {
  display: flex;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid #1a1a1c;
  transition: background 0.15s;
}

.entry:hover {
  background: rgba(232, 168, 51, 0.02);
}

.entry.alert-entry {
  background: rgba(232, 69, 69, 0.03);
  border-left: 2px solid var(--alert);
}

.entry.alert-entry:hover {
  background: rgba(232, 69, 69, 0.05);
}

.entry-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 56px;
  padding-top: 2px;
  letter-spacing: 0.5px;
}

.entry-body {
  flex: 1;
  min-width: 0;
  padding-right: 44px;
}

.entry-location {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin-bottom: 5px;
  text-transform: uppercase;
}

.entry-text {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
  letter-spacing: 0.2px;
  color: var(--text-primary);
  word-break: break-word;
}

.entry.alert-entry .entry-text {
  color: var(--text-primary);
}

.entry-meta {
  display: flex;
  gap: 8px;
  margin-top: 5px;
  align-items: center;
}

.entry-confidence {
  font-family: var(--font-mono);
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

.entry-keyword-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.8px;
  color: var(--alert);
  font-weight: 500;
}

/* Jump to live */
.jump-to-live {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  padding: 7px 18px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 10;
  transition: opacity 0.15s;
}

.jump-to-live:hover {
  opacity: 0.85;
}

.jump-to-live.visible {
  display: block;
}

/* Empty state */
.feed-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 1px;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  width: 440px;
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

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

.modal-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.8px;
  color: var(--text-primary);
  text-transform: uppercase;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 2px 6px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 16px 20px;
  flex: 1;
  overflow-y: auto;
}

.modal-body p {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.keywords-textarea {
  width: 100%;
  min-height: 160px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 10px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.keywords-textarea:focus {
  border-color: var(--accent);
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== Active states (tap feedback) ===== */
.btn:active {
  transform: scale(0.97);
}

.tab-btn:active {
  transform: scale(0.95);
}

.entry-play-btn:active,
.map-entry-play:active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}

.jump-to-live:active {
  transform: translateX(-50%) scale(0.95);
}

.hamburger:active {
  color: var(--accent);
}

.modal-close:active {
  background: var(--border);
}

/* ===== Focus-visible states (keyboard a11y) ===== */
.btn:focus-visible,
.tab-btn:focus-visible,
.entry-play-btn:focus-visible,
.map-entry-play:focus-visible,
.jump-to-live:focus-visible,
.modal-close:focus-visible,
.hamburger:focus-visible,
.map-filters select:focus-visible,
.map-controls select:focus-visible,
.prop-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ===== New entry slide-in ===== */
@keyframes entrySlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.entry.animate-in {
  animation: entrySlideIn 0.2s ease-out;
}

/* ===== Custom select styling ===== */
.map-controls select,
.map-filters select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23616160'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}

/* ===== Sidebar overlay for mobile ===== */
.sidebar-overlay {
  display: none;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  /* Header */
  .header {
    padding: 0 10px;
    gap: 6px;
  }

  .header-title {
    display: none;
  }

  .hamburger {
    display: block;
  }

  .header-tabs {
    margin-left: 2px;
    gap: 1px;
    border-left: none;
    padding-left: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 1;
    min-width: 0;
  }

  .tab-btn {
    padding: 4px 7px;
    font-size: 9px;
    letter-spacing: 1px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .status-indicator { display: none; }
  .llm-indicator { display: none; }
  .header-admin-link { display: none; }

  /* Feed sidebar — slide-in drawer */
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 85vw;
    max-width: 320px;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 80;
  }

  .sidebar-overlay.open {
    display: block;
  }

  /* Feed main area */
  .main {
    width: 100%;
  }

  .feed-bar {
    padding: 8px 12px;
  }

  .entry {
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
  }

  .entry-time {
    min-width: unset;
    font-size: 9px;
    letter-spacing: 0.8px;
    padding-top: 0;
  }

  .entry-text {
    font-size: 11px;
  }

  .entry-body {
    padding-right: 40px;
  }

  .entry-play-btn {
    width: 40px;
    height: 40px;
    font-size: 13px;
  }

  .hamburger {
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .modal-close {
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Map tab — map on top, transmissions at bottom */
  #tab-map.layout {
    flex-direction: column !important;
    overflow: hidden;
  }

  #tab-map .map-container {
    width: 100%;
    flex: 1;
    min-height: 0;
    order: 1;
  }

  #tab-map .map-sidebar {
    width: 100%;
    min-height: 0;
    border-right: none;
    border-top: 1px solid var(--border);
    border-bottom: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    height: 180px;
    transition: height 0.2s ease;
    flex-shrink: 0;
    order: 3;
  }

  #tab-map .map-sidebar.collapsed {
    height: 0 !important;
    min-height: 0 !important;
    overflow: hidden;
    border-top: none;
  }

  /* Drag handle — !important overrides the base display:none that comes later in file */
  .map-drag-handle {
    display: flex !important;
    justify-content: center;
    align-items: center;
    height: 28px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    order: 2;
    cursor: ns-resize;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    z-index: 5;
  }

  .map-drag-handle:active .drag-pill,
  .map-drag-handle.dragging .drag-pill {
    background: var(--accent);
  }

  .map-drag-handle .drag-pill {
    width: 48px;
    height: 5px;
    border-radius: 3px;
    background: var(--text-secondary);
    pointer-events: none;
  }

  /* While dragging, disable transitions so resize is instant */
  #tab-map .map-sidebar.dragging {
    transition: none;
  }

  .map-sidebar-header {
    padding: 6px 10px;
  }

  .sidebar-label {
    font-size: 10px;
  }

  .map-filters {
    margin-top: 4px;
    gap: 4px;
  }

  .map-filters select {
    font-size: 11px;
    padding: 4px 6px;
  }

  .map-entry {
    padding: 5px 8px;
    font-size: 11px;
  }

  .map-entry-time {
    font-size: 9px;
  }

  .map-entry-play {
    width: 36px;
    height: 36px;
    font-size: 11px;
  }

  /* Feed tab — full width, no sidebar visible */
  #tab-feed.layout {
    flex-direction: column;
  }

  #tab-feed .main {
    width: 100%;
    flex: 1;
    min-height: 0;
  }

  /* Layers button — labeled button to open/close overlay panel */
  .map-layers-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 5px;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1001;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-dim);
    border-radius: 6px;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    -webkit-tap-highlight-color: transparent;
  }
  .layers-icon {
    font-size: 14px;
    line-height: 1;
  }

  .map-layers-btn:active {
    background: var(--bg-tertiary);
  }
  .map-layers-btn.open {
    border-color: var(--accent);
    background: rgba(232, 168, 51, 0.08);
  }

  /* Overlay panel — hidden by default on mobile, shown via JS */
  .map-overlay-controls {
    display: none;
    top: 52px;
    left: 10px;
    right: auto;
    bottom: auto;
    padding: 8px 12px;
    max-width: 200px;
  }

  .map-overlay-controls.open {
    display: block;
  }

  .prop-toggle-text {
    font-size: 11px;
  }

  .map-jump-live {
    bottom: 10px;
  }

  /* Modal */
  .modal {
    width: 92vw;
    max-height: 80vh;
    margin: 10vh auto;
  }

  .modal-body textarea {
    min-height: 120px;
  }

  /* Jump to live */
  .jump-to-live {
    bottom: 12px;
    right: 12px;
    padding: 8px 14px;
    font-size: 12px;
  }

  /* Call icons */
  .call-icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}

/* Small phones */
@media (max-width: 400px) {
  .tab-btn {
    padding: 3px 5px;
    font-size: 8px;
    letter-spacing: 0.8px;
  }
  .llm-text {
    display: none;
  }

  #tab-map .map-sidebar {
    height: 140px;
  }
}

/* Play button — feed entries, vertically centered far-right */
.entry {
  position: relative;
}

.entry-play-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.entry-play-btn:hover {
  background: rgba(232, 168, 51, 0.1);
  border-color: var(--accent);
}

/* Volume slider */
.volume-section {
  padding: 10px 16px;
}

.volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-icon {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.volume-slider {
  flex: 1;
  height: 2px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  background: var(--accent-dim);
  cursor: pointer;
}

.volume-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  background: var(--accent-dim);
  cursor: pointer;
  border: none;
}

.volume-val {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-secondary);
  min-width: 28px;
  text-align: right;
  letter-spacing: 0.5px;
}

/* ===== Map Tab ===== */
.map-sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.map-sidebar-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.map-filters {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.map-filters select {
  flex: 1;
}

.map-controls select,
.map-filters select {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 5px 8px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-transform: uppercase;
  transition: border-color 150ms ease, color 150ms ease;
}

.map-controls select:hover,
.map-filters select:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Layers button — hidden on desktop, shown on mobile to toggle overlay panel */
.map-layers-btn {
  display: none;
}

.map-overlay-controls {
  position: absolute;
  bottom: 24px;
  left: 12px;
  z-index: 1000;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 12px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

/* Map jump to live */
.map-jump-live {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--bg-primary);
  border: none;
  padding: 7px 18px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 10;
  transition: opacity 0.15s;
}

.map-jump-live:hover {
  opacity: 0.85;
}

.map-jump-live:active {
  transform: translateX(-50%) scale(0.95);
}

.map-jump-live.visible {
  display: block;
}

.overlay-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.prop-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  letter-spacing: 0.5px;
}

.prop-switch {
  display: inline-block;
  width: 32px;
  height: 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}

.prop-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  background: var(--text-muted);
  transition: transform 0.2s, background 0.2s;
}

.prop-toggle.active .prop-switch {
  background: rgba(232, 168, 51, 0.15);
  border-color: var(--accent);
}

.prop-toggle.active .prop-switch-knob {
  transform: translateX(16px);
  background: var(--accent);
}

.prop-toggle.active .prop-toggle-text {
  color: var(--text-primary);
}

.prop-toggle-text {
  font-weight: 500;
}

.prop-opacity {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.prop-opacity.visible {
  display: flex;
}

.prop-opacity-slider {
  flex: 1;
  height: 2px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  outline: none;
}

.prop-opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  background: var(--accent);
  cursor: pointer;
}

.prop-opacity-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

.prop-opacity-val {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-secondary);
  min-width: 24px;
  text-align: right;
}

.prop-tooltip {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 0 !important;
  padding: 6px 10px !important;
  font-size: 10px !important;
  font-family: var(--font-mono) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
  pointer-events: none;
}

.prop-tooltip::before {
  border-top-color: var(--border) !important;
}

/* Move Leaflet zoom to top-right */
.leaflet-control-zoom {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  left: auto !important;
}

.leaflet-control-zoom-custom {
  background: rgba(14, 15, 16, 0.9) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Hidden on desktop */
.map-drag-handle {
  display: none;
}
.map-swipe-hint {
  display: none !important;
}

.map-feed {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
}

.map-feed::-webkit-scrollbar {
  width: 4px;
}

.map-feed::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.map-feed::-webkit-scrollbar-thumb {
  background: var(--border);
}

.map-feed::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.map-entry {
  display: flex;
  border-bottom: 1px solid var(--accent-rule);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.map-entry:hover {
  background: rgba(232, 168, 51, 0.02);
}

.map-entry-indicator {
  width: 2px;
  flex-shrink: 0;
}

.map-entry.active {
  background: var(--bg-highlight);
}

.map-entry:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.map-entry.active .map-entry-indicator {
  background: var(--accent);
}

.map-entry-content {
  padding: 10px 44px 10px 14px;
  flex: 1;
  min-width: 0;
}

.map-entry.clustered {
  border-left: 2px solid var(--accent-dim);
}

.map-entry.clustered + .map-entry.clustered {
  border-top: none;
  padding-top: 0;
}

.map-entry.clustered + .map-entry.clustered .map-entry-content {
  padding-top: 4px;
}

.map-entry.clustered:not(.clustered + .map-entry.clustered) {
  margin-top: 4px;
}

.map-entry.clustered:last-child,
.map-entry.clustered:not(:has(+ .map-entry.clustered)) {
  margin-bottom: 4px;
}

.map-entry-time {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.map-entry-text {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-primary);
  line-height: 1.55;
}

.map-entry-location {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--accent);
  margin-top: 4px;
  text-transform: uppercase;
}

.map-entry-play {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-size: 10px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.map-entry.active .map-entry-play {
  border-color: var(--accent);
}

.map-entry-play:hover {
  background: rgba(232, 168, 51, 0.1);
  border-color: var(--accent);
}

.map-container {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
}

/* Leaflet dark theme overrides */
.leaflet-container {
  background: #1a1a2e;
}

.leaflet-control-zoom a {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}

.leaflet-control-zoom-custom a {
  background: transparent !important;
  color: var(--text-primary) !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
  font-weight: 400 !important;
  transition: background 150ms ease, color 150ms ease;
}

.leaflet-control-zoom-custom a:last-child {
  border-bottom: none !important;
}

.leaflet-control-zoom-custom a:hover {
  background: rgba(232, 168, 51, 0.12) !important;
  color: var(--accent) !important;
}

.leaflet-control-zoom-custom a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: rgba(232, 168, 51, 0.12) !important;
  color: var(--accent) !important;
}

.leaflet-control-zoom-custom a.leaflet-disabled {
  color: var(--text-muted) !important;
  cursor: default;
  background: transparent !important;
  pointer-events: none;
}

.leaflet-control-zoom-custom a.leaflet-disabled:hover {
  background: transparent !important;
  color: var(--text-muted) !important;
}

.leaflet-control-attribution {
  background: rgba(22, 27, 34, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a {
  color: var(--text-secondary) !important;
}

.leaflet-popup-content-wrapper {
  background: linear-gradient(180deg, rgba(14,15,16,0.98), rgba(11,12,13,0.98)) !important;
  color: var(--text-primary) !important;
  border-radius: 8px !important;
  border: 1px solid rgba(232, 168, 51, 0.25) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6), 0 0 0 1px rgba(232,168,51,0.15) !important;
  position: relative;
  overflow: hidden;
}

.leaflet-popup-content-wrapper::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 12px; height: 12px;
  border-top: 1.5px solid var(--accent);
  border-left: 1.5px solid var(--accent);
  border-top-left-radius: 8px;
  pointer-events: none;
}

.leaflet-popup-tip {
  background: rgba(11,12,13,0.98) !important;
  border: 1px solid rgba(232, 168, 51, 0.25) !important;
}

.leaflet-popup-content {
  font-size: 12px;
  line-height: 1.5;
  margin: 12px 16px !important;
}

.popup-time {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.popup-text {
  margin-top: 6px;
  color: var(--text-primary);
}

.popup-location {
  color: var(--accent);
  font-size: 11px;
  margin-top: 6px;
  letter-spacing: 0.02em;
}

.map-entry-property {
  color: #3fb950;
  font-size: 10px;
  font-family: var(--font-mono);
  margin-top: 2px;
}

.popup-property {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 11px;
}

.popup-prop-val {
  color: #3fb950;
  font-weight: 600;
}

.popup-prop-type {
  color: var(--text-secondary);
}

.popup-prop-year {
  color: var(--text-muted);
}

.popup-prop-sale {
  color: var(--text-secondary);
  font-size: 10px;
}

.call-marker {
  background: transparent !important;
  border: none !important;
}

.call-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.3);
}

.call-type-badge {
  font-size: 12px;
}

.map-empty {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ===== Marker Clusters ===== */
.scanner-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(0, 180, 216, 0.6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 180, 216, 0.3);
}

.scanner-cluster-small {
  background: rgba(0, 119, 182, 0.85);
  width: 36px;
  height: 36px;
}

.scanner-cluster-medium {
  background: rgba(248, 150, 30, 0.85);
  border-color: rgba(248, 150, 30, 0.6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 12px rgba(248, 150, 30, 0.3);
  width: 44px;
  height: 44px;
}

.scanner-cluster-large {
  background: rgba(248, 81, 73, 0.85);
  border-color: rgba(248, 81, 73, 0.6);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), 0 0 12px rgba(248, 81, 73, 0.3);
  width: 52px;
  height: 52px;
}

.cluster-count {
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.scanner-cluster-medium .cluster-count {
  font-size: 14px;
}

.scanner-cluster-large .cluster-count {
  font-size: 16px;
}

.cluster-header {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-primary);
}

.cluster-list {
  max-height: 220px;
  overflow-y: auto;
}

.cluster-entry {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.cluster-entry:last-child {
  border-bottom: none;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: none !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: none !important;
}

/* ===== TACTICAL DISPATCH BOARD — Summary Tab ===== */
#tab-summary {
  display: none !important;
}
#tab-summary.active {
  display: flex !important;
  flex-direction: row;
}

/* --- Sidebar --- */
.stac-sidebar {
  width: 240px;
  min-width: 240px;
  height: calc(100vh - var(--header-height));
  background: #0e0f10;
  border-right: 1px solid #252528;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.stac-sidebar-header {
  padding: 22px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stac-sidebar-title {
  font-family: 'Martian Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 2.2px;
  color: #e8a833;
}
.stac-sidebar-sub {
  font-family: 'Martian Mono', monospace;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 1.2px;
  color: #616160;
}
.stac-sidebar-divider {
  height: 1px;
  background: #252528;
}
.stac-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.stac-sidebar-footer {
  padding: 14px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stac-sidebar-clock {
  font-family: 'Martian Mono', monospace;
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.8px;
  color: #616160;
}
.stac-sidebar-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e8a833;
}
.stac-date-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 8px;
}
.stac-date-header:first-child {
  padding-top: 6px;
}
.stac-date-label {
  font-family: 'Martian Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.8px;
  color: #dededa;
  white-space: nowrap;
}
.stac-date-rule {
  flex: 1;
  height: 1px;
  background: #252528;
}
.stac-shift-row {
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background 0.15s;
}
.stac-shift-row:hover {
  background: rgba(232, 168, 51, 0.04);
}
.stac-shift-row.active {
  background: #161310;
}
.stac-shift-indicator {
  width: 2px;
  align-self: stretch;
}
.stac-shift-row.active .stac-shift-indicator {
  background: #e8a833;
}
.stac-shift-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px 9px 18px;
  flex: 1;
  min-width: 0;
}
.stac-shift-label {
  font-family: 'Martian Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: #dededa;
  width: 36px;
  flex-shrink: 0;
}
.stac-shift-row.active .stac-shift-label {
  font-weight: 600;
  color: #e8a833;
}
.stac-shift-count {
  font-family: 'Martian Mono', monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.3px;
  color: #999994;
  width: 26px;
  text-align: right;
  flex-shrink: 0;
}
.stac-shift-row.active .stac-shift-count {
  color: #dededa;
}
.stac-shift-bar {
  flex: 1;
  height: 2px;
  background: #252528;
  overflow: hidden;
}
.stac-shift-bar-fill {
  height: 100%;
  background: #8c6719;
  transition: width 0.3s;
}
.stac-shift-row.active .stac-shift-bar-fill {
  background: #e8a833;
}

/* --- Main Pane --- */
.stac-main {
  flex: 1;
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  background: #0b0c0d;
  display: flex;
  flex-direction: column;
}
.stac-class-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 44px;
  flex-shrink: 0;
}
.stac-class-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.stac-class-rule {
  width: 24px;
  height: 2px;
  background: #e8a833;
  flex-shrink: 0;
}
.stac-class-label {
  font-family: 'Martian Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 2px;
  color: #e8a833;
}
.stac-class-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stac-class-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e8a833;
}
.stac-class-sync {
  font-family: 'Martian Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1.5px;
  color: #999994;
}
.stac-strip-border {
  height: 1px;
  background: #252528;
  flex-shrink: 0;
}
.stac-content {
  flex: 1;
  padding: 32px 48px 40px;
  max-width: 880px;
}
.stac-header-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 14px;
  flex-wrap: wrap;
}
.stac-header-id {
  font-family: 'Martian Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #dededa;
}
.stac-header-sep {
  font-family: 'Martian Mono', monospace;
  font-size: 12px;
  font-weight: 400;
  color: #404040;
}
.stac-header-shift {
  font-family: 'Martian Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.5px;
  color: #e8a833;
}
.stac-header-date,
.stac-header-period {
  font-family: 'Martian Mono', monospace;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: #999994;
}
.stac-header-spacer {
  flex: 1;
}
.stac-header-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e8a833;
  flex-shrink: 0;
}
.stac-header-status {
  font-family: 'Martian Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.8px;
  color: #999994;
}
.stac-header-rule {
  height: 1px;
  background: #8c6719;
}
.stac-meta {
  padding: 16px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.stac-meta-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.stac-meta-label {
  font-family: 'Martian Mono', monospace;
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 1.8px;
  color: #616160;
  width: 116px;
  flex-shrink: 0;
}
.stac-meta-value {
  font-family: 'Martian Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.6px;
  color: #dededa;
}
.stac-meta-value.amber {
  color: #e8a833;
}
.stac-body {
  padding-top: 8px;
}
.stac-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.stac-section-header:first-child {
  padding-top: 0;
}
.stac-section-num {
  font-family: 'Martian Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #e8a833;
  width: 24px;
  flex-shrink: 0;
}
.stac-section-label {
  font-family: 'Martian Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
  color: #dededa;
  white-space: nowrap;
}
.stac-section-rule {
  flex: 1;
  height: 1px;
  background: #4c3810;
}
.stac-section-body {
  padding-left: 40px;
  padding-bottom: 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid #252528;
  font-family: 'Martian Mono', monospace;
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.2px;
  line-height: 1.6;
  color: #dededa;
}
.stac-section-body:last-child {
  border-bottom: none;
}
/* Kill empty paragraphs and stray br tags from simpleMarkdown */
.stac-section-body p:empty { display: none; }
.stac-section-body > br:first-child { display: none; }
.stac-section-body ul > br { display: none; }
.stac-section-body ul + br { display: none; }
.stac-section-body p + br { display: none; }
.stac-section-body br + ul { margin-top: 0; }
.stac-section-body h3 + br { display: none; }
.stac-section-body p {
  font-family: 'Martian Mono', monospace;
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.2px;
  line-height: 1.6;
  color: #dededa;
  margin: 0 0 6px;
}
.stac-section-body p:last-child {
  margin-bottom: 0;
}
.stac-section-body strong {
  font-weight: 500;
  color: #f0f0ee;
}
/* H2: section-level sub-heading (rare in GPT output) */
.stac-section-body h2 {
  font-family: 'Martian Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #e8a833;
  margin: 14px 0 6px;
  padding-top: 12px;
  border-top: 1px solid #252528;
}
.stac-section-body h2:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}
/* H3: incident header (GPT uses ### for timestamped incidents) */
.stac-section-body h3 {
  font-family: 'Martian Mono', monospace;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: #e8a833;
  margin: 24px 0 8px;
  padding-top: 18px;
  border-top: 1px solid rgba(232, 168, 51, 0.25);
}
.stac-section-body h3:first-of-type {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}
.stac-section-body ul {
  list-style: none;
  padding-left: 0;
  margin: 2px 0 6px;
}
.stac-section-body li {
  font-family: 'Martian Mono', monospace;
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0.2px;
  line-height: 1.6;
  color: #dededa;
  margin: 1px 0;
  padding-left: 28px;
  position: relative;
}
.stac-section-body li::before {
  content: '->';
  position: absolute;
  left: 0;
  color: #8c6719;
  font-family: 'Martian Mono', monospace;
  font-size: 12.5px;
}
/* Non-synopsis sections: slightly smaller text */
.stac-section-body--detail {
  font-size: 11.5px;
}
.stac-section-body--detail p,
.stac-section-body--detail li {
  font-size: 11.5px;
}
.stac-section-body--detail li::before {
  font-size: 11.5px;
}
/* Divider between incidents: each <ul> after the first marks a new incident */
.stac-section-body--detail ul ~ ul {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(232, 168, 51, 0.18);
}
.stac-section-body .kw {
  display: inline;
  padding: 0 1px;
  border-radius: 0;
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  border: none;
  border-bottom: 1.5px solid;
}
.stac-section-body .kw-fire {
  color: #e36230;
  border-bottom-color: rgba(227, 98, 48, 0.4);
}
.stac-section-body .kw-medical {
  color: #38ada9;
  border-bottom-color: rgba(56, 173, 169, 0.4);
}
.stac-section-body .kw-police {
  color: #c9a227;
  border-bottom-color: rgba(201, 162, 39, 0.4);
}
.stac-section-body .kw-traffic {
  color: #a569d2;
  border-bottom-color: rgba(165, 105, 210, 0.4);
}
.stac-loading,
.stac-empty {
  font-family: 'Martian Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.5px;
  color: #616160;
  text-align: center;
  padding: 80px 20px;
}

/* Nav toggle — hidden on desktop */
.stac-nav-toggle {
  display: none;
}

/* Pull-to-refresh indicator */
.stac-refresh-indicator {
  display: none;
  text-align: center;
  padding: 12px 0;
  font-family: 'Martian Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 1.5px;
  color: #e8a833;
}
.stac-refresh-indicator.visible {
  display: block;
}

/* --- Mobile --- */
@media (max-width: 900px) {
  .stac-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 240px !important;
    min-width: 240px !important;
    max-width: 240px !important;
    right: auto !important;
    z-index: 90;
    background: #0e0f10;
    border-right: 1px solid #252528;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    display: flex;
  }
  .stac-sidebar.open {
    transform: translateX(0);
  }
  .stac-sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 89;
  }
  .stac-sidebar-overlay.open {
    display: block;
  }
  .stac-nav-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(232, 168, 51, 0.08);
    border: 1px solid rgba(232, 168, 51, 0.25);
    border-radius: 4px;
    color: #e8a833;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 1.2px;
    cursor: pointer;
    padding: 6px 10px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .stac-nav-toggle:active {
    background: rgba(232, 168, 51, 0.15);
  }
  .stac-nav-icon {
    font-size: 12px;
    line-height: 1;
  }
  .stac-content { padding: 20px 16px 40px; }
  .stac-class-strip { padding: 0 16px; height: 36px; }
  .stac-class-right { display: none; }
  .stac-class-label { font-size: 8px; letter-spacing: 1.2px; }
  .stac-class-rule { width: 16px; }
  .stac-header-row { flex-direction: column; gap: 4px; padding-bottom: 10px; }
  .stac-header-sep { display: none; }
  .stac-header-spacer { display: none; }
  .stac-header-id { font-size: 11px; }
  .stac-header-shift { font-size: 10px; }
  .stac-header-date,
  .stac-header-period { font-size: 9px; }
  .stac-header-status { font-size: 8px; }
  .stac-header-rule { margin-bottom: 8px; }
  .stac-meta { padding-bottom: 10px; }
  .stac-meta-row { flex-direction: column; gap: 2px; padding: 4px 0; }
  .stac-meta-label { width: auto; font-size: 8px; }
  .stac-meta-value { font-size: 10px; }
  .stac-section-header { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .stac-section-num { width: 18px; font-size: 10px; }
  .stac-section-label { font-size: 10px; letter-spacing: 1.5px; }
  .stac-section-body { padding-left: 12px; padding-bottom: 12px; font-size: 11px; }
  .stac-section-body p,
  .stac-section-body li { font-size: 11px; line-height: 1.65; }
  .stac-section-body li { padding-left: 22px; }
  .stac-section-body li::before { font-size: 11px; }
  .stac-section-body--detail { font-size: 10.5px; }
  .stac-section-body--detail p,
  .stac-section-body--detail li { font-size: 10.5px; }
  .stac-section-body--detail li::before { font-size: 10.5px; }
  .stac-section-body--detail ul ~ ul { margin-top: 16px; padding-top: 12px; }
  .stac-section-body h3 { margin: 18px 0 6px; padding-top: 12px; }
}


/* ===== Map Polish — Motion ===== */
@keyframes scanner-marker-pop {
  0%   { opacity: 0; transform: scale(0.3); transform-origin: center; }
  60%  { opacity: 1; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1.0); }
}

.scanner-marker-enter {
  animation: scanner-marker-pop 200ms cubic-bezier(0.16, 1, 0.3, 1) both;
  transform-box: fill-box;
  transform-origin: center;
}

/* Active marker state */
.scanner-marker-active {
  fill: #f0c040 !important;
  stroke: #d97706 !important;
  stroke-width: 2.5px !important;
  filter: drop-shadow(0 0 8px rgba(240, 192, 64, 0.7));
}

@keyframes scanner-pulse-ring {
  0%   { r: 9; opacity: 0.85; stroke-width: 2; }
  100% { r: 28; opacity: 0; stroke-width: 0.5; }
}

.scanner-pulse-ring {
  fill: none;
  stroke: #f0c040;
  stroke-width: 2;
  pointer-events: none;
  animation: scanner-pulse-ring 2s ease-out infinite;
}

.scanner-pulse-ring.delayed {
  animation-delay: 0.6s;
}

/* Marker hover flash (from sidebar hover) */
.scanner-marker-flash {
  fill: #f0c040 !important;
  filter: drop-shadow(0 0 6px rgba(240, 192, 64, 0.6));
  transition: fill 150ms ease-out, filter 150ms ease-out;
}

.scanner-marker-active.scanner-marker-flash {
  /* Active takes precedence; don't weaken the glow */
  filter: drop-shadow(0 0 8px rgba(240, 192, 64, 0.7)) !important;
}

/* Sidebar loading skeleton */
@keyframes scanner-shimmer {
  0%   { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}

.map-skeleton {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.sk-bar {
  height: 8px;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    var(--bg-tertiary) 0%,
    rgba(232, 168, 51, 0.12) 50%,
    var(--bg-tertiary) 100%
  );
  background-size: 200% 100%;
  animation: scanner-shimmer 1.5s ease-in-out infinite;
}

.sk-bar + .sk-bar {
  margin-top: 6px;
}

.sk-time { width: 30%; height: 6px; }
.sk-text { width: 85%; }
.sk-loc  { width: 55%; height: 7px; }

@media (prefers-reduced-motion: reduce) {
  .scanner-pulse-ring,
  .scanner-marker-enter,
  .sk-bar {
    animation: none !important;
  }
  .scanner-pulse-ring {
    display: none;
  }
  .sk-bar {
    background: var(--bg-tertiary);
  }
}


