:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #111827;
  --panel-alt: #1f2937;
  --border: #253044;
  --accent: #60a5fa;
  --accent-strong: #3b82f6;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --success: #34d399;
  --danger: #f87171;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
  --shadow-md: 0 8px 20px rgba(7, 12, 20, 0.45);
}

/* Light Theme */
[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-alt: #f1f5f9;
  --border: #e2e8f0;
  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --text: #1e293b;
  --muted: #64748b;
  --success: #22c55e;
  --danger: #ef4444;
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-header {
  padding: max(24px, env(safe-area-inset-top)) 28px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.app-header-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.header-row-top h1 {
  margin: 0;
}

.header-subtitle {
  margin: 0;
  text-align: right;
}

.header-subtitle.subtitle-disconnected {
  color: var(--danger);
  font-weight: 600;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-right {
  margin-left: auto;
}

@media (max-width: 900px) {
  .header-subtitle {
    text-align: left;
  }

  .nav-right {
    margin-left: 0;
  }
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
}

.branding-link {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.branding-link.is-link {
  cursor: pointer;
}

.branding-link.is-link:hover {
  text-decoration: underline;
}

.branding-link:not([href]) {
  cursor: default;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-alt);
  font-size: 0.85rem;
  color: var(--muted);
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.connection-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.listener-count {
  font-size: 0.85rem;
  color: var(--muted);
}

.volume-card h2 {
  margin: 0;
  font-size: 1rem;
}

.volume-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.volume-rate {
  font-weight: 600;
  color: var(--accent);
}

.rate-unit {
  color: var(--muted);
  margin-left: 4px;
  font-size: 0.85rem;
}

.volume-bar {
  position: relative;
  height: 8px;
  background: #1b2633;
  border-radius: 999px;
  overflow: hidden;
}

.volume-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4dd3ff, #f6c945);
  transition: width 0.3s ease;
}

.volume-scale {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.volume-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: #263343;
  color: var(--text);
  font-size: 0.8rem;
}

.volume-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* Compact horizontal volume bar */
.volume-compact {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.6));
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 12px;
  flex: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* When volume-compact is standalone (e.g., in right-panel previously) */
.right-panel > .volume-compact {
  margin-bottom: 20px;
}

/* Button inside volume compact */
.volume-compact button {
  white-space: nowrap;
}

.volume-compact-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 80px;
}

.volume-compact-rate {
  font-weight: 700;
  font-size: 1.1rem;
  color: rgba(96, 165, 250, 0.95);
  white-space: nowrap;
  line-height: 1.2;
}

.volume-compact-level {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(96, 165, 250, 0.15);
  color: rgba(148, 163, 184, 0.9);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  width: fit-content;
  border: 1px solid rgba(96, 165, 250, 0.25);
}

.volume-compact-bar {
  position: relative;
  height: 8px;
  background: rgba(15, 23, 42, 0.9);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(51, 65, 85, 0.6);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

.volume-compact-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.8), rgba(96, 165, 250, 0.95), rgba(246, 201, 69, 0.9));
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(96, 165, 250, 0.5);
}

.volume-compact-listeners {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(148, 163, 184, 0.9);
  white-space: nowrap;
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 8px;
  border: 1px solid rgba(51, 65, 85, 0.5);
}

/* Disconnected state - red */
.connection-status.disconnected {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}
.connection-status.disconnected .connection-status-dot {
  background: var(--danger);
}

/* Connected base state */
.connection-status.connected {
  background: rgba(51, 65, 85, 0.3);
  border-color: rgba(51, 65, 85, 0.5);
}

/* Paused state (connected but not live) */
.connection-status.status-paused {
  color: var(--muted);
}
.connection-status.status-paused .connection-status-dot {
  background: var(--muted);
  animation: none;
}

/* Waiting state (live but no active call) */
.connection-status.status-waiting {
  color: #eab308;
  border-color: rgba(234, 179, 8, 0.3);
  background: rgba(234, 179, 8, 0.1);
}
.connection-status.status-waiting .connection-status-dot {
  background: #eab308;
  animation: statusPulse 2s infinite;
}

/* Active/Live state (playing a call) */
.connection-status.status-active {
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.1);
}
.connection-status.status-active .connection-status-dot {
  background: var(--success);
  animation: statusPulse 1s infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Desktop: Simplify header status (sidebar shows full status) */
@media (min-width: 1101px) {
  .connection-status .connection-status-text {
    display: none;
  }
  .connection-status {
    padding: 8px;
    min-width: auto;
  }
}

.app-content {
  /* SPA: Grid layout now applied per-view (see #view-home, #view-archive, etc.) */
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Allow flex children to shrink below content size */
}

.archive-content {
  min-height: calc(100vh - 140px);
}


.left-panel,
.center-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.panel-card h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.panel-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.nav-actions {
  justify-content: space-between;
  width: 100%;
}

.nav-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-group-right {
  margin-left: auto;
}

.busy-card .panel-actions {
  justify-content: space-between;
  align-items: baseline;
}


.busy-card .panel-note {
  color: var(--muted);
  font-size: 0.8rem;
}

.panel-actions form {
  margin: 0;
}

.panel-actions .secondary {
  background: var(--panel-alt);
  color: var(--muted);
}

.panel-actions .secondary.active {
  background: var(--accent-strong);
  color: #0b1220;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.5), 0 8px 20px rgba(15, 23, 42, 0.45);
}


.call-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.call-filter-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  flex: 1 1 240px;
}

.call-filter-select {
  width: 100%;
}

.filter-label {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 15, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 150;
}

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

/* Keep filter modals above fixed mobile UI (compact player + bottom nav). */
#filter-modal,
#archive-filter-modal {
  z-index: 1600;
}

#cad-incident-modal {
  z-index: 1600;
}

body.cad-incident-modal-open {
  overflow: hidden;
}

.modal-card {
  width: min(900px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  margin: 0;
}

.correction-modal-card {
  width: min(820px, 100%);
}

.correction-text-block {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.45;
  color: var(--text);
}

#correction-input {
  min-height: 120px;
}

.correction-audio {
  width: 100%;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--border);
  padding: 6px;
}

.correction-suggestion {
  display: none;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: rgba(30, 64, 175, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
}

.correction-suggestion.active {
  display: block;
}

.correction-suggestion .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}

.correction-suggestion .source-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.correction-suggestion .source-badge.source-ai {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.45);
  color: #d8b4fe;
}

.correction-suggestion .source-badge.source-heuristic {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.45);
  color: #86efac;
}

.correction-suggestion .value {
  font-size: 0.95rem;
  line-height: 1.45;
}

.correction-suggestion .settings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.correction-suggestion .settings-item code {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 255, 0.35);
  border-radius: 6px;
  padding: 1px 6px;
  margin-right: 4px;
}

.correction-suggestion .settings-reason {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

.correction-suggestion .rationale {
  margin-top: 6px;
  color: var(--muted);
}

.correction-actions {
  align-items: center;
  gap: 10px;
}

.optimize-actions {
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.optimize-suggestion {
  margin-top: 10px;
}

.reprocess-filters {
  margin-top: 8px;
}

.reprocess-actions {
  margin-top: 6px;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-field-inline .settings-label {
  margin: 0;
  font-size: 0.85rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.modal-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.icon-btn {
  border: 1px solid #2b3b4d;
  background: #0c121a;
  color: var(--text);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.icon-btn:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.6);
  outline-offset: 2px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body::before {
  content: "";
  height: 1px;
  background: var(--border);
  opacity: 0.8;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-card select,
.modal-card input {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text);
}

.modal-card select:focus,
.modal-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.filter-search input {
  width: 100%;
}

.filter-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.filter-actions {
  display: flex;
  gap: 8px;
}

.ghost-btn {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
}

.ghost-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-list {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  background: var(--panel-alt);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
}

.filter-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 10px;
}

.filter-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  align-items: start;
  gap: 8px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(37, 48, 68, 0.7);
  border-radius: 10px;
  padding: 6px 8px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.filter-item input[type="checkbox"] {
  margin-top: 2px;
}

.filter-item span {
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1.2;
}

.filter-item:hover {
  border-color: rgba(96, 165, 250, 0.5);
}

.filter-item.selected {
  border-color: rgba(96, 165, 250, 0.7);
  background: rgba(30, 58, 95, 0.6);
}


.admin-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.admin-tab {
  background: #1f2b3a;
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid #2b3b4d;
  font-size: 0.85rem;
}

.admin-tab.active {
  background: var(--accent-strong);
  color: #04151d;
  border-color: rgba(96, 165, 250, 0.6);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.talkgroups-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(380px, 1fr);
  gap: 20px;
  align-items: start;
}

.talkgroups-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.talkgroups-main {
  min-height: 65vh;
  display: flex;
  flex-direction: column;
}

.talkgroups-main .list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

.retention-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

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

.danger-btn {
  background: linear-gradient(135deg, rgba(203, 75, 75, 0.85), rgba(168, 52, 52, 0.9));
  border-color: rgba(255, 120, 120, 0.35);
  color: #fff;
}

.admin-login {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 120px);
  padding: 20px;
}

.admin-login-card {
  width: min(420px, 100%);
}

.api-keys-card .list {
  max-height: 180px;
}

/* API Key Result Display */
.api-key-result {
  margin: 20px 0;
  padding: 16px;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.12), rgba(96, 165, 250, 0.05));
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 8px;
}

.api-key-result.hidden {
  display: none;
}

.api-key-result-header {
  margin-bottom: 12px;
  color: #fbbf24;
  font-size: 0.9rem;
}

.api-key-result-content {
  display: flex;
  gap: 12px;
  align-items: center;
}

.api-key-result code {
  flex: 1;
  padding: 10px 12px;
  background: rgba(17, 24, 39, 0.5);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 6px;
  color: #60a5fa;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  word-break: break-all;
  user-select: all;
}

.api-key-result button.success {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.4);
  color: #22c55e;
}

.reprocess-card .list {
  max-height: 440px;
}

.talkgroups-card .list {
  max-height: none;
}

.systems-card .list {
  max-height: 240px;
}

.tags-card .list {
  max-height: 200px;
}

.tg-details {
  border: 1px solid rgba(34, 48, 65, 0.7);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(8, 12, 18, 0.4);
  width: 100%;
}

.tg-details summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.tg-details summary::-webkit-details-marker {
  display: none;
}

.tg-details summary::after {
  content: "▾";
  color: var(--muted);
  margin-left: auto;
}

.tg-details[open] summary::after {
  content: "▴";
}

.tg-editor {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.talkgroups-main .list li {
  display: block;
  align-items: stretch;
  padding: 12px 10px;
}

.talkgroups-main .call-details {
  width: 100%;
}

.talkgroups-main .tg-details {
  width: 100%;
  display: block;
}

.talkgroups-main .tg-details summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.talkgroups-main .tg-details summary .call-details {
  min-width: 0;
}

.talkgroups-main .tg-details summary .call-details > div:first-child {
  font-weight: 600;
}

.talkgroups-main .tg-details summary .call-details > div:last-child {
  white-space: nowrap;
}

.tg-editor label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}


.tg-editor .tg-tag-custom {
  margin-top: 8px;
}

.tg-editor-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tg-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tg-editor .play-btn {
  width: fit-content;
}

/* Enhanced Talkgroup Item Styling */
.talkgroups-main .list li {
  transition: background 0.2s ease, border-color 0.2s ease;
  border-radius: 8px;
  border: 1px solid transparent;
}

.talkgroups-main .list li:hover {
  background: rgba(15, 23, 42, 0.4);
  border-color: rgba(96, 165, 250, 0.15);
}

/* Enhanced System and Tag List Items */
.systems-card .list li,
.tags-card .list li {
  transition: background 0.2s ease, border-color 0.2s ease;
  border-radius: 6px;
  border: 1px solid transparent;
}

.systems-card .list li:hover,
.tags-card .list li:hover {
  background: rgba(15, 23, 42, 0.3);
  border-color: rgba(96, 165, 250, 0.1);
}

.tg-details[open] {
  background: rgba(15, 23, 42, 0.3);
  border-radius: 8px;
  padding: 4px;
}

.tg-editor label span {
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

.tg-editor input,
.tg-editor select {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(37, 48, 68, 0.8);
  transition: border-color 0.2s ease;
}

.tg-editor input:focus,
.tg-editor select:focus {
  border-color: rgba(96, 165, 250, 0.5);
  outline: none;
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-group button.active {
  background: #1f2b3a;
  color: var(--muted);
}

.archive-content {
  display: grid;
  grid-template-columns: minmax(360px, 420px) 1fr;
  gap: 24px;
  align-items: stretch;
}

.archive-content .page-title {
  grid-column: 1 / -1;
}

.archive-content .archive-filters {
  grid-column: 1;
}

.archive-content .archive-results {
  grid-column: 2;
}

.archive-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.archive-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 6px;
}

.archive-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.archive-tab {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.archive-tab.active {
  color: #f8fafc;
  border-color: rgba(96, 165, 250, 0.6);
  background: rgba(30, 58, 95, 0.7);
}

.archive-tab:hover {
  border-color: rgba(96, 165, 250, 0.35);
}

.archive-tab:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.6);
  outline-offset: 2px;
}

.meta-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--muted);
}

.archive-quick .filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.archive-quick .filter-btn {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.archive-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.archive-grid .field-full {
  grid-column: 1 / -1;
}

.talkgroup-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  text-align: left;
}

.talkgroup-list.is-disabled {
  opacity: 0.7;
  pointer-events: none;
}

.talkgroup-empty {
  color: var(--muted);
  font-size: 0.8rem;
}

.talkgroup-option {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  column-gap: 10px;
  row-gap: 2px;
  font-size: 0.9rem;
  width: 100%;
}

.talkgroup-option input[type="checkbox"] {
  margin: 0;
}

.talkgroup-option span {
  text-align: left;
  line-height: 1.2;
}

[data-theme="light"] .talkgroup-list {
  background: var(--panel-alt);
  border-color: var(--border);
}

.talkgroup-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.talkgroup-actions .filter-btn {
  padding: 6px 10px;
  font-size: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.archive-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.archive-action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.archive-results {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  height: 100%;
}

.archive-results-list {
  max-height: none;
  flex: 1;
  overflow-y: auto;
}

.archive-load-more {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 8px 0 6px;
}

.archive-results-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.archive-filter-trigger {
  display: none;
  align-items: center;
  gap: 8px;
}

.archive-filter-trigger svg {
  flex-shrink: 0;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.pagination .page-size-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.pagination .page-size-control select {
  min-width: 88px;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
}

.calls-panel .list {
  max-height: 420px;
}

.archive-results-list.list {
  max-height: none;
}

.incident-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-alt);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.incident-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.incident-time {
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.incident-time-value {
  font-size: 0.85rem;
}

.incident-cleared-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fbbf24;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(120, 53, 15, 0.2);
  width: fit-content;
}

.incident-active-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  background: rgba(6, 95, 70, 0.25);
  width: fit-content;
}

.incident-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.incident-location {
  font-size: 0.98rem;
  font-weight: 600;
  color: #f8fafc;
}

.incident-location a {
  color: var(--accent);
  text-decoration: none;
}

.incident-location a:hover {
  text-decoration: underline;
}

.incident-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.incident-id {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.incident-cleared {
  color: #fbbf24;
  font-size: 0.75rem;
}

.incident-actions {
  display: flex;
  justify-content: flex-end;
}

.incident-details {
  margin-top: 12px;
}

.incident-details-card {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(12, 18, 26, 0.55);
}

.incident-details-title {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.incident-units {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.incident-units-header,
.incident-unit-row {
  display: grid;
  grid-template-columns: 160px 1fr 1fr;
  gap: 16px;
  padding: 6px 0;
}

.incident-units-header {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #233244;
}

.incident-unit-row {
  font-size: 0.85rem;
  border-bottom: 1px solid #1e2b3a;
}

.incident-unit-row:last-child {
  border-bottom: none;
}

.incident-units-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 6px 0;
}

/* Archive incident matches (similar to CAD matches) */
.incident-match-toggle {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.4);
  color: #60a5fa;
}

.incident-match-toggle:hover {
  background: rgba(96, 165, 250, 0.25);
}

.incident-matches {
  margin-top: 12px;
  padding: 12px;
  background: rgba(96, 165, 250, 0.05);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 8px;
}

.incident-matches.hidden {
  display: none;
}

.incident-matches-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.incident-match {
  display: flex;
  align-items: center;
  padding: 8px 0;
  gap: 10px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

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

.incident-match-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.incident-match-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.incident-match-time {
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  min-width: 62px;
}

.incident-match-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.incident-match-play {
  flex-shrink: 0;
  min-width: 70px;
  order: -1;
}

.call-item {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-alt);
  padding: 14px 16px;
  margin-bottom: 12px;
}

/* Archive page uses different layout - removed .call-row, .call-time, .call-main */

.call-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f8fafc;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto !important;
  gap: 20px;
  align-items: baseline;
  width: 100%;
  padding-right: 12px;
}

.call-title-name {
  grid-column: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.call-title-timestamp {
  grid-column: 2;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.call-title-duration {
  grid-column: 3;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.call-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.call-flag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: #dbeafe;
}

.call-transcript {
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.4;
}

.transcript {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.transcript-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  padding: 0;
  cursor: pointer;
}

.transcript-toggle:hover {
  text-decoration: underline;
}

/* Download icon styling for archive */
.download-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--muted);
  background: rgba(30, 41, 59, 0.5);
  transition: all 0.15s ease;
  text-decoration: none;
}

.download-icon:hover {
  background: rgba(30, 41, 59, 0.8);
  color: var(--accent);
}

.download-icon svg {
  width: 16px;
  height: 16px;
}

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

/* Archive results list specific overrides */
.archive-results-list .call-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: default;
}

.archive-results-list .call-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.archive-results-list .call-flags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.archive-results-list .call-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: calc(5ch + 40px);
}

.archive-results-list .call-actions .call-title-duration {
  display: inline-block;
  width: 5ch;
  text-align: right;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.archive-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.archive-toggle input {
  width: auto;
}

.list li {
  padding: 10px 8px 10px 12px;
  border-bottom: 1px solid #233244;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: rgba(96, 165, 250, 0.2);
  transition: all 0.2s ease;
}

/* Clip the left border line to respect parent rounded corners */
.list li:first-child::before {
  border-top-left-radius: 14px; /* Match parent panel-card border-radius */
}

.list li:last-child::before {
  border-bottom-left-radius: 14px; /* Match parent panel-card border-radius */
}

.list li:hover {
  background: rgba(96, 165, 250, 0.05);
  border-bottom-color: rgba(96, 165, 250, 0.2);
}

.list li:hover::before {
  background: rgba(96, 165, 250, 0.4);
}

#admin-calls-list li {
  cursor: default;
  align-items: flex-start;
}

#admin-calls-list li.has-audio {
  cursor: pointer;
}

#admin-calls-list .call-actions {
  flex-wrap: wrap;
}

#admin-calls-list .call-meta {
  white-space: normal;
  line-height: 1.4;
}

#admin-calls-list .call-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

#admin-calls-list .call-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

#admin-calls-list .call-badge-ai {
  background: rgba(20, 184, 166, 0.2);
  color: #5eead4;
  border-color: rgba(20, 184, 166, 0.35);
}

#admin-calls-list .call-badge-auto {
  background: rgba(59, 130, 246, 0.2);
  color: #bfdbfe;
  border-color: rgba(59, 130, 246, 0.4);
}

#admin-calls-list .call-badge-manual {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.4);
}

/* Call item status variants */
.call-item.has-transcription::before {
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.5), rgba(16, 185, 129, 0.5));
}

.call-item.has-cad-match::before {
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.6), rgba(245, 158, 11, 0.6));
}

.call-item.is-priority::before {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.6), rgba(220, 38, 38, 0.6));
}

.archive-results-list .incident-item {
  display: block;
  cursor: default;
  border-bottom: none;
}

/* Removed duplicate - now using flex layout defined above */

.busy-list li {
  padding: 6px 4px;
}

.busy-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.9rem;
  text-align: left;
}

.busy-btn:hover {
  border-color: rgba(96, 165, 250, 0.6);
}

.busy-btn.active {
  border-color: rgba(96, 165, 250, 0.8);
  background: rgba(30, 58, 95, 0.6);
}

.busy-btn.active .busy-count {
  color: var(--accent);
}

.busy-count {
  font-size: 0.8rem;
  color: var(--muted);
}

.busy-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 10px 8px;
}

.list li .call-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.list li .call-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.list li .call-text {
  color: var(--text);
  font-size: 0.9rem;
}

.play-btn {
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.play-btn:hover {
  border-color: rgba(96, 165, 250, 0.6);
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.nav-btn:visited {
  color: inherit;
  text-decoration: none;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-btn.active {
  border-color: rgba(96, 165, 250, 0.6);
  color: #dbe7ff;
}

.cad-page .app-header {
  align-items: stretch;
}

.cad-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1800px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  min-height: 0;
  padding: 16px;
}

.cad-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--panel);
  border-radius: 8px;
}

/* Compact single-row control bar for incidents */
.cad-controls-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.cad-controls-compact .cad-tabs {
  margin: 0;
  gap: 4px;
}

.cad-controls-compact .cad-tab {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.cad-controls-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cad-view-toggle {
  display: none;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
}

.cad-view-btn {
  border: none;
  border-radius: 999px;
  padding: 5px 12px;
  color: var(--muted);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.cad-view-btn.active {
  background: var(--accent-strong);
  color: #0b1220;
}

.cad-view-btn:active {
  transform: scale(0.98);
}

.cad-updated-text {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.cad-controls-compact .cad-filter-toggle {
  padding: 5px 10px;
  font-size: 0.8rem;
  gap: 4px;
}

.cad-header-row {
  justify-content: space-between;
  align-items: center;
}

.cad-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.cad-title-row .panel-note {
  margin: 0;
}

.cad-title-row h2 {
  margin: 0;
}

.cad-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

.cad-map.panel-card {
  padding: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cad-map-canvas {
  width: 100%;
  height: 100%;
  min-height: 0;
  flex: 1;
  position: relative;
}

.cad-map-empty {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(12, 18, 26, 0.7);
  color: var(--muted);
  font-size: 0.85rem;
  z-index: 400;
}
.cad-map-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  z-index: 450;
}

.cad-map-tools .ghost-btn {
  font-size: 0.75rem;
  padding: 6px 10px;
}

.cad-map-note {
  background: rgba(15, 23, 42, 0.85);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.75rem;
  max-width: 200px;
  text-align: right;
}



.cad-list-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 0;
  overflow: visible;
}

.cad-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cad-match-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cad-match-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.cad-match-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cad-page .cad-list {
  max-height: none;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.cad-incident-modal-card {
  width: min(520px, 100%);
  gap: 12px;
  overflow: hidden;
}

.cad-incident-modal-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.1;
  color: var(--muted);
}

.sr-only,
.cad-incident-title-sr {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.cad-incident-back-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 999px;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
}

.cad-incident-map-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.4);
  border-color: rgba(148, 163, 184, 0.45);
  color: #dbeafe;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cad-incident-map-pin {
  width: 17px;
  height: 17px;
  display: block;
  fill: currentColor;
}

.cad-incident-map-btn:hover:not(:disabled) {
  background: rgba(30, 41, 59, 0.62);
  border-color: rgba(96, 165, 250, 0.65);
}

.cad-incident-map-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cad-incident-modal-body {
  border-top: none;
  padding-top: 6px;
  max-height: min(58vh, 620px);
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
}

.cad-detail-map-shell {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(12, 18, 26, 0.45);
  position: relative;
}

.cad-detail-map {
  width: 100%;
  height: clamp(165px, 22vh, 210px);
}

.cad-detail-map .leaflet-control-attribution {
  font-size: 0.62rem;
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
}

.cad-detail-hero {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.72), rgba(12, 18, 26, 0.42));
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cad-detail-type {
  font-size: 1.36rem;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #e2e8f0;
}

.cad-detail-type.cad-detail-type-fire {
  color: #fb923c;
}

.cad-detail-type.cad-detail-type-ems {
  color: #38bdf8;
}

.cad-detail-type.cad-detail-type-traffic {
  color: #facc15;
}

.cad-detail-location {
  color: var(--text);
  font-size: 1.08rem;
  line-height: 1.26;
  font-weight: 700;
  word-break: break-word;
}

.cad-detail-municipality {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.22;
  letter-spacing: 0.01em;
}

.cad-detail-facts {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.cad-detail-fact {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(12, 18, 26, 0.45);
  padding: 8px 9px;
  min-height: 52px;
}

.cad-detail-fact-label {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cad-detail-fact-value {
  margin-top: 2px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.25;
  word-break: break-word;
  font-weight: 600;
}

.cad-detail-map-note {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.28;
}

.cad-incident-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.cad-incident-modal-actions .ghost-btn {
  text-decoration: none;
  cursor: pointer;
}

.cad-incident-modal-actions .ghost-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#cad-incident-modal .cad-incident-modal-card {
  opacity: 0;
  transform: translateY(16px);
  transition: transform 0.22s ease, opacity 0.22s ease;
}

#cad-incident-modal.open .cad-incident-modal-card {
  opacity: 1;
  transform: translateY(0);
}

.cad-detail-sections {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cad-detail-section {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(12, 18, 26, 0.45);
  padding: 10px 12px;
}

.cad-detail-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.cad-detail-empty {
  color: var(--muted);
  font-size: 0.85rem;
}

.cad-detail-matches-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cad-detail-match-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  font-size: 0.86rem;
}

.cad-detail-match-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cad-detail-match-label {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

@media (prefers-reduced-motion: reduce) {
  #cad-incident-modal .cad-incident-modal-card {
    transition: none;
  }

  .cad-page .cad-list .cad-item {
    animation: none;
  }
}

/* Hide filter toggle on desktop, show only on mobile */
.cad-filter-toggle {
  display: none;
}

@media (max-width: 980px) {
  .cad-page {
    height: auto;
    min-height: 100vh;
  }

  .cad-content {
    flex: 0 0 auto;
    min-height: auto;
    padding: 10px;
    gap: 10px;
  }

  .cad-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    height: auto;
  }

  /* Sticky mobile chips/toggles */
  .cad-controls-compact {
    position: sticky;
    top: max(0px, env(safe-area-inset-top));
    z-index: 120;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    gap: 8px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(8px);
  }

  .cad-controls-compact .cad-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin: 0;
  }

  .cad-controls-compact .cad-tabs::-webkit-scrollbar {
    display: none;
  }

  .cad-controls-right {
    margin-left: auto;
    gap: 6px;
  }

  .cad-updated-text {
    display: none;
  }

  /* Show filter toggle button for mobile */
  .cad-filter-toggle {
    display: none !important;
  }

  .cad-view-toggle {
    display: inline-flex;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(132px + env(safe-area-inset-bottom));
    z-index: 1105;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.5);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 24px rgba(2, 8, 23, 0.35);
    padding: 3px;
  }

  .app-content.player-hidden #view-incidents .cad-view-toggle {
    bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .cad-view-btn {
    min-width: 72px;
    min-height: 30px;
    font-size: 0.83rem;
    color: #d1d9e6;
  }

  .cad-view-btn.active {
    background: rgba(59, 130, 246, 0.82);
    color: #f8fafc;
  }

  body.cad-incident-modal-open .cad-view-toggle {
    opacity: 0;
    pointer-events: none;
  }

  /* Map/list sizing and spacing */
  .cad-map.panel-card {
    position: relative;
    top: auto;
    z-index: 1;
    max-height: 34vh;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 0;
  }

  .cad-map-canvas {
    min-height: 34vh;
    height: 34vh;
  }

  .cad-list-panel {
    height: auto;
    border-radius: 12px;
    overflow: visible;
  }

  .cad-page .cad-list {
    max-height: none;
    overflow: visible;
  }

  .cad-layout[data-mobile-view="map"] .cad-map.panel-card {
    display: flex;
  }

  .cad-layout[data-mobile-view="map"] .cad-list-panel {
    display: flex;
  }

  .cad-layout[data-mobile-view="list"] .cad-map.panel-card {
    display: none;
  }

  .cad-layout[data-mobile-view="list"] .cad-list-panel {
    display: flex;
  }

  #cad-incident-modal {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: var(--bg);
  }

  .cad-incident-modal-card {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
    gap: 0;
    padding: 0;
    background: var(--bg);
  }

  .cad-incident-modal-card .modal-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: max(6px, env(safe-area-inset-top)) 8px 6px;
    margin: 0;
    align-items: center;
    justify-content: space-between;
  }

  .cad-detail-type {
    font-size: 1.18rem;
  }

  .cad-detail-location {
    font-size: 0.98rem;
  }

  .cad-detail-municipality {
    font-size: 0.88rem;
  }

  .cad-detail-map {
    height: min(30vh, 188px);
  }

  .cad-detail-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .cad-detail-fact {
    padding: 7px 8px;
    min-height: 48px;
  }

  .cad-detail-fact-label {
    font-size: 0.63rem;
  }

  .cad-detail-fact-value {
    font-size: 0.84rem;
  }

  .cad-incident-modal-actions {
    position: static;
    background: var(--panel);
    margin-top: 0;
    padding: 8px 12px 10px;
    justify-content: stretch;
    border-bottom: 1px solid var(--border);
  }

  .cad-incident-modal-actions .ghost-btn {
    flex: 1 1 auto;
    text-align: center;
    font-weight: 700;
  }

  .cad-incident-modal-body {
    padding-top: 8px;
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    max-height: none;
    flex: 1 1 auto;
  }
}

.list li:last-child {
  border-bottom: none;
}

.list li.active {
  background: rgba(96, 165, 250, 0.12);
  border-radius: 8px;
}

.list li span {
  color: var(--muted);
  font-size: 0.85rem;
}

/* Session device badge styling */
.session-device-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(30, 41, 59, 0.75));
  color: var(--text);
  font-size: 0.82rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: help;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.session-device-badge:hover {
  border-color: rgba(96, 165, 250, 0.75);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.35), 0 6px 16px rgba(15, 23, 42, 0.6);
  transform: translateY(-1px);
}

/* Session status badge */
.session-status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.7em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.session-status-new {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.15));
  color: rgba(34, 197, 94, 1);
  border: 1px solid rgba(34, 197, 94, 0.4);
  box-shadow: 0 2px 4px rgba(34, 197, 94, 0.1);
}

.session-status-returning {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(96, 165, 250, 0.15));
  color: rgba(96, 165, 250, 1);
  border: 1px solid rgba(96, 165, 250, 0.4);
  box-shadow: 0 2px 4px rgba(96, 165, 250, 0.1);
}

.session-status-success {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.15));
  color: rgba(34, 197, 94, 1);
  border: 1px solid rgba(34, 197, 94, 0.45);
  box-shadow: 0 2px 4px rgba(34, 197, 94, 0.1);
}

.session-status-failed {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.2), rgba(248, 113, 113, 0.15));
  color: rgba(248, 113, 113, 1);
  border: 1px solid rgba(248, 113, 113, 0.45);
  box-shadow: 0 2px 4px rgba(248, 113, 113, 0.1);
}

/* Session username styling */
.session-username {
  font-weight: 600;
  color: rgba(96, 165, 250, 1);
}

.session-authenticated {
  background: rgba(96, 165, 250, 0.05);
}

/* Online badge for users */
.online-badge {
  display: inline-block;
  padding: 2px 8px;
  margin-left: 6px;
  border-radius: 10px;
  font-size: 0.65em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.25), rgba(34, 197, 94, 0.15));
  color: rgba(34, 197, 94, 1);
  border: 1px solid rgba(34, 197, 94, 0.4);
  animation: onlinePulse 2s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Panel actions row with right-aligned items */
.panel-actions-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.panel-actions-right button {
  white-space: nowrap;
}

.panel-actions-right input,
.panel-actions-right select {
  height: 36px;
}

.panel-actions-right input {
  min-width: 220px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
}

.login-attempt-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.login-attempt-reason,
.login-attempt-time {
  color: var(--muted);
  font-size: 0.82rem;
}

.active-sessions-table-container {
  overflow-x: auto;
}

/* Active sessions table specific column widths */
#listener-session-table th:nth-child(1),
#listener-session-table td:nth-child(1) {
  width: 180px; /* Client */
}

#listener-session-table th:nth-child(2),
#listener-session-table td:nth-child(2) {
  width: 140px; /* IP Address */
}

#listener-session-table th:nth-child(3),
#listener-session-table td:nth-child(3) {
  width: 100px; /* Location */
}

#listener-session-table th:nth-child(4),
#listener-session-table td:nth-child(4) {
  width: 150px; /* Started */
  white-space: nowrap;
}

#listener-session-table th:nth-child(5),
#listener-session-table td:nth-child(5) {
  width: 90px; /* Duration */
  white-space: nowrap;
}

#listener-session-table th:nth-child(6),
#listener-session-table td:nth-child(6) {
  width: 150px; /* Last Seen */
  white-space: nowrap;
}

#listener-session-table th:nth-child(7),
#listener-session-table td:nth-child(7) {
  width: 110px; /* Status */
  text-align: center;
}

/* Session log toggle button */
.session-log-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.6);
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.session-log-toggle.is-active {
  border-color: rgba(96, 165, 250, 0.7);
  color: rgba(96, 165, 250, 0.95);
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.3), rgba(30, 64, 175, 0.25));
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.3) inset, 0 0 8px rgba(96, 165, 250, 0.15);
  font-weight: 500;
}

/* Session Log Table Styles */
.session-log-table-container {
  overflow-x: auto;
  max-height: 600px;
  overflow-y: auto;
}

.session-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.session-log-table.hidden {
  display: none;
}

.session-log-table thead {
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.95);
  z-index: 10;
  border-bottom: 2px solid rgba(96, 165, 250, 0.3);
}

.session-log-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: rgba(148, 163, 184, 0.9);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.session-log-table tbody tr {
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  transition: background-color 0.15s ease;
}

.session-log-table tbody tr:not(.session-group-details):hover {
  background: rgba(30, 41, 59, 0.5);
}

.session-log-table td {
  padding: 12px 16px;
  color: var(--text);
  vertical-align: middle;
}

/* Client Cell */
.session-log-table .client-cell {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.session-log-table .client-id {
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 0.85em;
  color: var(--muted);
  font-weight: 500;
}

/* IP Cell */
.session-log-table .ip-cell {
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
  font-size: 0.9em;
}

.session-log-table .ip-source {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  background: rgba(96, 165, 250, 0.15);
  border-radius: 4px;
  font-size: 0.75em;
  color: rgba(96, 165, 250, 0.8);
}

.session-log-table .ip-source-small {
  font-size: 0.7em;
  color: rgba(148, 163, 184, 0.7);
}

/* Location Cell */
.session-log-table .location-cell {
  color: var(--muted);
}

.session-log-table .location {
  cursor: help;
}

/* Status Cell */
.session-log-table .status-ended {
  color: rgba(148, 163, 184, 0.7);
}

.session-log-table .status-active {
  color: rgba(34, 197, 94, 0.8);
}

/* Expandable Group Row */
.session-log-table .session-group-row {
  cursor: pointer;
  font-weight: 500;
}

.session-log-table .session-group-row:hover {
  background: rgba(30, 41, 59, 0.7) !important;
}

.session-log-table .session-group-row.expanded {
  background: rgba(30, 41, 59, 0.6);
  border-bottom-color: transparent;
}

/* Group Details Row */
.session-log-table .session-group-details {
  background: rgba(15, 23, 42, 0.4);
}

.session-log-table .session-group-details.hidden {
  display: none;
}

.session-log-table .session-detail-table {
  padding: 16px;
  font-size: 0.85em;
  color: var(--muted);
  display: grid;
  gap: 12px;
}

.session-log-table .session-detail-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  padding: 12px;
  background: rgba(8, 12, 18, 0.6);
  border-radius: 8px;
  border: 1px solid rgba(37, 48, 68, 0.5);
}

.session-log-table .session-detail-field {
  font-size: 0.85rem;
  line-height: 1.4;
}

.session-log-table .session-detail-field strong {
  color: rgba(148, 163, 184, 0.9);
  font-weight: 600;
  margin-right: 6px;
}

/* Empty State */
.session-log-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.session-log-empty.hidden {
  display: none;
}

/* Column Widths - Grouped Mode */
.session-log-table[data-mode="grouped"] th:nth-child(1),
.session-log-table[data-mode="grouped"] td:nth-child(1) {
  width: 200px; /* Client column */
  max-width: 200px;
}

.session-log-table[data-mode="grouped"] th:nth-child(2),
.session-log-table[data-mode="grouped"] td:nth-child(2) {
  width: 80px; /* Sessions count */
  text-align: center;
}

.session-log-table[data-mode="grouped"] th:nth-child(3),
.session-log-table[data-mode="grouped"] td:nth-child(3) {
  width: 200px; /* IPs Used */
}

.session-log-table[data-mode="grouped"] th:nth-child(4),
.session-log-table[data-mode="grouped"] td:nth-child(4) {
  width: 120px; /* Location */
}

.session-log-table[data-mode="grouped"] th:nth-child(5),
.session-log-table[data-mode="grouped"] td:nth-child(5) {
  width: 150px; /* First Seen */
  white-space: nowrap;
}

.session-log-table[data-mode="grouped"] th:nth-child(6),
.session-log-table[data-mode="grouped"] td:nth-child(6) {
  width: 150px; /* Last Seen */
  white-space: nowrap;
}

.session-log-table[data-mode="grouped"] th:nth-child(7),
.session-log-table[data-mode="grouped"] td:nth-child(7) {
  width: 90px; /* Total Time */
  white-space: nowrap;
}

/* Column Widths - Ungrouped Mode (6 columns) */
.session-log-table[data-mode="ungrouped"] th:nth-child(1),
.session-log-table[data-mode="ungrouped"] td:nth-child(1) {
  width: 150px; /* Started */
  white-space: nowrap;
}

.session-log-table[data-mode="ungrouped"] th:nth-child(2),
.session-log-table[data-mode="ungrouped"] td:nth-child(2) {
  width: 200px; /* Client */
  max-width: 200px;
}

.session-log-table[data-mode="ungrouped"] th:nth-child(3),
.session-log-table[data-mode="ungrouped"] td:nth-child(3) {
  width: 180px; /* IP Address */
}

.session-log-table[data-mode="ungrouped"] th:nth-child(4),
.session-log-table[data-mode="ungrouped"] td:nth-child(4) {
  width: 140px; /* Location */
}

.session-log-table[data-mode="ungrouped"] th:nth-child(5),
.session-log-table[data-mode="ungrouped"] td:nth-child(5) {
  width: 100px; /* Duration */
  white-space: nowrap;
}

.session-log-table[data-mode="ungrouped"] th:nth-child(6),
.session-log-table[data-mode="ungrouped"] td:nth-child(6) {
  width: 180px; /* Status */
  white-space: nowrap;
}

/* Device Badge in Table - smaller and inline */
.session-log-table .session-device-badge {
  padding: 3px 8px;
  font-size: 0.7em;
  display: inline-flex;
  width: fit-content;
  white-space: nowrap;
}

/* Mobile Responsive */
@media (max-width: 1200px) {
  /* Grouped mode - hide Total Time */
  .session-log-table[data-mode="grouped"] th:nth-child(7),
  .session-log-table[data-mode="grouped"] td:nth-child(7) {
    display: none;
  }

  /* Active sessions table - hide Status on medium screens */
  #listener-session-table th:nth-child(7),
  #listener-session-table td:nth-child(7) {
    display: none;
  }
}

@media (max-width: 900px) {
  /* Grouped mode - hide Location and Last Seen */
  .session-log-table[data-mode="grouped"] th:nth-child(4),
  .session-log-table[data-mode="grouped"] td:nth-child(4),
  .session-log-table[data-mode="grouped"] th:nth-child(6),
  .session-log-table[data-mode="grouped"] td:nth-child(6) {
    display: none;
  }

  /* Ungrouped mode - hide Location and Status */
  .session-log-table[data-mode="ungrouped"] th:nth-child(4),
  .session-log-table[data-mode="ungrouped"] td:nth-child(4),
  .session-log-table[data-mode="ungrouped"] th:nth-child(6),
  .session-log-table[data-mode="ungrouped"] td:nth-child(6) {
    display: none;
  }

  /* Active sessions table - hide Location and Last Seen on mobile */
  #listener-session-table th:nth-child(3),
  #listener-session-table td:nth-child(3),
  #listener-session-table th:nth-child(6),
  #listener-session-table td:nth-child(6) {
    display: none;
  }
}

@media (max-width: 600px) {
  /* Ungrouped mode - hide Started timestamp on very small screens */
  .session-log-table[data-mode="ungrouped"] th:nth-child(1),
  .session-log-table[data-mode="ungrouped"] td:nth-child(1) {
    display: none;
  }

  /* Active sessions table - minimal mobile view */
  #listener-session-table th:nth-child(4),
  #listener-session-table td:nth-child(4) {
    display: none; /* Hide Started on very small screens */
  }
}



.active-sessions-card .sessions-list {
  max-height: 520px;
  overflow-y: auto;
}

/* Custom scrollbar for sessions lists */
.sessions-list::-webkit-scrollbar {
  width: 8px;
}

.sessions-list::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.3);
  border-radius: 4px;
}

.sessions-list::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.3);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.sessions-list::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 165, 250, 0.5);
}

.session-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  background: rgba(15, 23, 42, 0.8);
  color: var(--muted);
  font-size: 0.85rem;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.1) inset;
}

.session-count span {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}
.session-log-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.session-log-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.session-log-controls input {
  min-width: 220px;
  width: 100%;
}

.session-log-header {
  justify-content: space-between;
}

@media (max-width: 720px) {
  .session-log-controls {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .session-log-actions {
    width: 100%;
    justify-content: space-between;
  }

  .session-log-controls input {
    flex: 1 1 200px;
  }
}

.sessions-list .location {
  cursor: help;
}

.admin-log-table .login-attempt-reason {
  margin-left: 6px;
  white-space: nowrap;
}

.admin-log-table td.admin-status-cell {
  white-space: nowrap;
}

#admin-session-table th:nth-child(1),
#admin-session-table td:nth-child(1) {
  width: 180px;
}

#admin-session-table th:nth-child(2),
#admin-session-table td:nth-child(2) {
  min-width: 200px;
}

#admin-session-table th:nth-child(3),
#admin-session-table td:nth-child(3) {
  width: 160px;
}

#admin-session-table th:nth-child(4),
#admin-session-table td:nth-child(4) {
  width: 160px;
}

#admin-session-table th:nth-child(5),
#admin-session-table td:nth-child(5) {
  width: 120px;
}

#admin-login-attempts-table th:nth-child(1),
#admin-login-attempts-table td:nth-child(1) {
  width: 180px;
}

#admin-login-attempts-table th:nth-child(2),
#admin-login-attempts-table td:nth-child(2) {
  width: 140px;
}

#admin-login-attempts-table th:nth-child(3),
#admin-login-attempts-table td:nth-child(3) {
  width: 160px;
}

#admin-login-attempts-table th:nth-child(4),
#admin-login-attempts-table td:nth-child(4) {
  min-width: 200px;
}

#admin-login-attempts-table th:nth-child(5),
#admin-login-attempts-table td:nth-child(5) {
  width: 160px;
}

#admin-login-attempts-table th:nth-child(6),
#admin-login-attempts-table td:nth-child(6) {
  width: 240px;
}

button {
  background: var(--accent);
  border: 1px solid transparent;
  color: #0b1220;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button:active {
  transform: scale(0.98);
}

.toggle {
  background: var(--panel-alt);
  color: var(--muted);
}

.toggle.active {
  background: var(--accent-strong);
  color: #0b1220;
}

/* START LIVE button status indicator states */
#toggle-live {
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
}

/* Paused state - red/inactive */
#toggle-live.scanner-paused {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}

#toggle-live.scanner-paused:hover {
  background: rgba(239, 68, 68, 0.25);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.3);
}

/* Waiting state - yellow/pulsing */
#toggle-live.scanner-waiting {
  background: rgba(234, 179, 8, 0.15);
  color: #EAB308;
  border-color: rgba(234, 179, 8, 0.4);
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.2);
  animation: statusPulse 2s ease-in-out infinite;
}

#toggle-live.scanner-waiting:hover {
  background: rgba(234, 179, 8, 0.25);
}

/* Active/Receiving state - green/pulsing */
#toggle-live.scanner-active {
  background: rgba(34, 197, 94, 0.15);
  color: #22C55E;
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.3);
  animation: statusPulse 2s ease-in-out infinite;
}

#toggle-live.scanner-active:hover {
  background: rgba(34, 197, 94, 0.25);
}

@keyframes statusPulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 16px currentColor;
  }
  50% {
    opacity: 0.85;
    box-shadow: 0 0 24px currentColor;
  }
}

.scanner {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

/* Override panel-card padding for scanner specifically - scoped to home view */
#view-home .scanner.panel-card {
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  margin: 0 auto; /* Center it */
}

/* Desktop (above 1100px): Fixed width and normal position with rounded corners */
@media (min-width: 1101px) {
  #view-home .scanner.panel-card {
    width: 650px; /* Fixed width - slightly narrower for better proportions */
    position: relative;
  }
}

.scanner.scanner-active {
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.25), 0 18px 40px rgba(15, 23, 42, 0.45);
}

.scanner.scanner-active .scanner-display {
  border-color: rgba(106, 196, 255, 0.35);
  background: radial-gradient(circle at top left, rgba(32, 67, 94, 0.6), #0d141c 55%);
}

/* Modern compact scanner header */
.scanner-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

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

/* Mobile: Stack buttons vertically on very small screens to prevent wrapping */
@media (max-width: 700px) {
  .scanner-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .scanner-actions-left,
  .scanner-actions-right {
    width: 100%;
  }

  .scanner-actions-left button,
  .scanner-actions-right button {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
  }
}

/* Desktop: Maintain left-right split */
@media (min-width: 701px) {
  .scanner-header {
    flex-direction: row;
  }
}

.hidden {
  display: none;
}

.scanner-display {
  padding: 20px 24px 36px 24px; /* Extra bottom padding for duration bar */
  border-radius: 0;
  background: rgba(13, 20, 28, 0.6);
  border: none;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

/* Two-column grid layout for desktop */
.scanner-content-grid {
  display: none; /* Hidden on mobile, use scanner-call-meta instead */
}

@media (min-width: 701px) {
  .scanner-content-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: start;
  }
}

.scanner-info-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scanner-info-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.scanner-call-title {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  color: var(--text);
}

.scanner-tg-number {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
}

.scanner-timestamp {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 400;
}

/* Compact inline metadata row - mobile only */
.scanner-call-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (min-width: 701px) {
  .scanner-call-meta {
    display: none; /* Hide on desktop, use grid layout */
  }
}

.scanner-call-meta .meta-separator {
  opacity: 0.4;
}

.scanner-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
}

.scanner-field-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(148, 163, 184, 0.7);
  font-weight: 600;
}

.scanner-field-value {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

/* Desktop: show inline badges, hide mobile meta and fields */
@media (min-width: 701px) {
  .scanner-call-meta {
    display: none;
  }

  .scanner-badges-inline {
    display: flex;
  }

  .scanner-fields-desktop {
    display: none; /* Hide fields, use progress bar instead */
  }
}

/* Duration display in footer */
.scanner-duration-footer {
  font-weight: 600;
  color: var(--text);
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.02em;
}

.scanner-download {
  position: absolute;
  right: 14px;
  bottom: 12px;
}

.scanner-transcript {
  margin-top: 10px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(37, 48, 68, 0.6);
  border-radius: 10px;
  padding: 10px 12px;
}

.scanner-transcript-label {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.scanner-transcript-text {
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Scanner badge styling */
.scanner-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px; /* More compact */
  border-radius: 6px;
  font-size: 0.75rem; /* Smaller */
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.scanner-badge-tag {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.25), rgba(59, 130, 246, 0.2));
  color: rgba(96, 165, 250, 1);
  border: 1px solid rgba(96, 165, 250, 0.4);
}

.scanner-badge-desc {
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.2), rgba(148, 163, 184, 0.15));
  color: rgba(203, 213, 225, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Duration bar with progress animation */
.scanner-duration-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 22px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 12px;
}

.scanner-duration-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(203, 213, 225, 0.9);
  z-index: 2;
  position: relative;
}

/* Progress bar animation */
.scanner.scanner-active .scanner-duration-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.3), rgba(34, 197, 94, 0.5));
  animation: callProgress var(--call-duration, 10s) linear;
  z-index: 1;
}

@keyframes callProgress {
  from {
    width: 0%;
  }
  to {
    width: 100%;
  }
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #2b3b4d;
  background: #0c121a;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
}

.download-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.download-btn:hover {
  background: #121a24;
}

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

.stats-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stats-filters .filter-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.stats-filters .filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-btn {
  background: #1f2b3a;
  color: var(--muted);
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid #2b3b4d;
}

.filter-btn.active {
  background: var(--accent-strong);
  color: #04151d;
  border-color: rgba(96, 165, 250, 0.7);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.2);
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
}

.stat-small {
  font-size: 1rem;
  font-weight: 500;
}

/* Enhanced Stat Cards */
.stat-icon {
  font-size: 2rem;
  margin-bottom: 4px;
  opacity: 0.9;
}

.stat-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 4px;
}

.stat-value-medium {
  font-size: 1.4rem;
  font-weight: 700;
}

.stat-value-small {
  font-size: 0.95rem;
  font-weight: 600;
}

/* Stat Card Variants */
.stat-card-primary {
  border-color: rgba(96, 165, 250, 0.3);
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), rgba(96, 165, 250, 0.03));
}

.stat-card-accent {
  border-color: rgba(139, 92, 246, 0.3);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(139, 92, 246, 0.03));
}

.stat-card-success {
  border-color: rgba(52, 211, 153, 0.3);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.08), rgba(52, 211, 153, 0.03));
}

.stat-card-info {
  border-color: rgba(96, 165, 250, 0.25);
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.15), rgba(30, 64, 175, 0.05));
}

.stat-card-compact {
  padding: 12px;
  gap: 4px;
}

/* Secondary Stats Grid */
.stats-grid-secondary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

/* Chart Card */
.stats-chart-card {
  margin-top: 16px;
}

.stats-chart-card canvas {
  max-height: 300px;
}

.stats-time-filter {
  display: flex;
  gap: 4px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 8px;
  padding: 4px;
  border: 1px solid rgba(37, 48, 68, 0.5);
}

.stats-time-btn {
  padding: 6px 12px;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.stats-time-btn:hover {
  background: rgba(96, 165, 250, 0.1);
  color: var(--text);
}

.stats-time-btn.active {
  background: rgba(96, 165, 250, 0.15);
  color: var(--primary);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.3);
}

.stats-error-message {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  margin: 12px 0;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #fca5a5;
  font-size: 0.9rem;
}

.stats-error-message .error-icon {
  font-size: 1.1rem;
}

.stats-error-message.hidden {
  display: none;
}

/* System Breakdown */
.stats-systems-card {
  margin-top: 16px;
}

.stats-systems-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stats-system-row {
  display: grid;
  grid-template-columns: 120px 1fr 120px;
  gap: 12px;
  align-items: center;
}

.stats-system-name {
  font-weight: 600;
  color: var(--text);
  font-size: 0.9rem;
}

.stats-system-bar {
  height: 24px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(37, 48, 68, 0.5);
}

.stats-system-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.8), rgba(96, 165, 250, 0.5));
  border-radius: 12px;
  transition: width 0.3s ease;
}

.stats-system-count {
  text-align: right;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Overview Card */
.stats-overview-card {
  background: linear-gradient(135deg, var(--panel) 0%, rgba(17, 24, 39, 0.95) 100%);
  border-color: rgba(96, 165, 250, 0.15);
}

.stats-panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* Settings Section Enhancements */
.settings-section {
  margin-bottom: 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.settings-section-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.settings-section-icon {
  font-size: 2.2rem;
  line-height: 1;
  opacity: 0.9;
}

.settings-section-subtitle {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 4px;
  line-height: 1.4;
}

/* Settings Section Variants */
.settings-section-accent {
  border-color: rgba(139, 92, 246, 0.25);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(139, 92, 246, 0.02));
}

.settings-section-info {
  border-color: rgba(96, 165, 250, 0.25);
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.12), rgba(30, 64, 175, 0.04));
}

.settings-section-primary {
  border-color: rgba(96, 165, 250, 0.3);
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), rgba(96, 165, 250, 0.03));
}

.settings-section-warning {
  border-color: rgba(251, 191, 36, 0.3);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(251, 191, 36, 0.02));
}

.settings-section-success {
  border-color: rgba(52, 211, 153, 0.3);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.08), rgba(52, 211, 153, 0.03));
}

.sdrtrunk-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.sdrtrunk-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.sdrtrunk-stat-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.18);
  padding: 16px;
}

.sdrtrunk-stat-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.sdrtrunk-stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.sdrtrunk-stat-meta {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.sdrtrunk-stat-submeta {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-top: 10px;
  word-break: break-word;
}

.sdrtrunk-state-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.92rem;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  margin-bottom: 6px;
}

.sdrtrunk-state-badge.active {
  background: rgba(52, 211, 153, 0.16);
  color: #a7f3d0;
}

.sdrtrunk-state-badge.inactive,
.sdrtrunk-state-badge.failed {
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
}

.sdrtrunk-state-badge.activating,
.sdrtrunk-state-badge.deactivating,
.sdrtrunk-state-badge.reloading {
  background: rgba(251, 191, 36, 0.16);
  color: #fde68a;
}

.sdrtrunk-log-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.sdrtrunk-log-card {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.28);
  overflow: hidden;
}

.sdrtrunk-bias-options {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 18px 0 14px;
}

.sdrtrunk-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 0;
  flex-wrap: wrap;
}

.sdrtrunk-log-output {
  margin: 0;
  padding: 16px;
  min-height: 260px;
  max-height: 420px;
  overflow: auto;
  background: transparent;
  color: #dbeafe;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.sdrtrunk-process-output {
  min-height: 120px;
}

.sdrtrunk-inline-details {
  margin-top: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.18);
  overflow: hidden;
}

.sdrtrunk-inline-details summary {
  cursor: pointer;
  padding: 12px 16px;
  color: var(--muted);
  font-weight: 600;
  user-select: none;
}

.sdrtrunk-inline-details[open] summary {
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.sdrtrunk-inline-output {
  min-height: 80px;
  max-height: 280px;
  margin: 0;
}

/* Panel Section Variants for Dashboard */
.panel-section-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.calls-panel .panel-section-header {
  justify-content: space-between;
}

.calls-panel .panel-section-header button {
  margin-left: auto;
  align-self: center;
}

.panel-section-icon {
  font-size: 2.2rem;
  line-height: 1;
  opacity: 0.9;
}

.panel-section-subtitle {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 4px;
  line-height: 1.4;
}

.panel-section-accent {
  border-color: rgba(139, 92, 246, 0.25);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(139, 92, 246, 0.02));
}

.panel-section-info {
  border-color: rgba(96, 165, 250, 0.25);
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.12), rgba(30, 64, 175, 0.04));
}

.panel-section-primary {
  border-color: rgba(96, 165, 250, 0.3);
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), rgba(96, 165, 250, 0.03));
}

.panel-section-warning {
  border-color: rgba(251, 191, 36, 0.3);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(251, 191, 36, 0.02));
}

.panel-section-success {
  border-color: rgba(52, 211, 153, 0.3);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.08), rgba(52, 211, 153, 0.03));
}

/* Settings Grid Layouts */
.settings-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.settings-grid-2col {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.settings-grid-3col {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Settings Fields */
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-field-full {
  grid-column: 1 / -1;
}

/* Logo Upload Section */
.logo-upload-section {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.logo-preview-container {
  width: 120px;
  height: 80px;
  background: rgba(51, 65, 85, 0.3);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-preview {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.logo-preview.hidden {
  display: none;
}

.logo-placeholder {
  color: var(--muted);
  font-size: 0.8rem;
}

.logo-upload-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.logo-upload-controls .btn {
  padding: 8px 16px;
  font-size: 0.85rem;
}

.logo-url-toggle {
  margin-top: 4px;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted);
}

.checkbox-inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

#logo-url-field {
  margin-top: 4px;
}

#logo-url-field input {
  width: 100%;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.7);
}

.settings-label {
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.settings-unit {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.82rem;
  font-style: italic;
}

.required {
  color: #ef4444;
  font-weight: 400;
}

/* Settings Group */
.settings-group {
  margin-bottom: 24px;
}

.settings-group:last-child {
  margin-bottom: 0;
}

.settings-group-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(37, 48, 68, 0.5);
}

/* Settings Actions */
.settings-actions {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 20px;
  border-top: 1px solid rgba(37, 48, 68, 0.5);
}

.settings-save-btn {
  background: var(--accent);
  color: #0b1220;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.settings-save-btn:hover {
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.4);
}

.settings-save-btn:active {
  transform: scale(0.98);
}

/* Purge Operations */
.purge-operations {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.purge-operation {
  padding: 16px;
  background: rgba(15, 23, 42, 0.4);
  border-radius: 10px;
  border: 1px solid rgba(37, 48, 68, 0.6);
}

.purge-buttons {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.purge-buttons button {
  flex: 1;
  min-width: 140px;
}

/* Form Status with Animation */
.form-status {
  font-size: 0.88rem;
  padding: 8px 12px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.form-status:not(:empty) {
  opacity: 1;
}

.form-status.success {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.form-status.error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Mobile Responsive */
@media (max-width: 720px) {
  .settings-grid-2col,
  .settings-grid-3col {
    grid-template-columns: 1fr;
  }

  .settings-section-header {
    flex-direction: column;
    gap: 12px;
  }

  .settings-section-icon {
    font-size: 1.8rem;
  }

  .purge-buttons button {
    flex: 1 1 100%;
  }

  .admin-mobile-header {
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  }

  .admin-main {
    padding: 12px;
  }

  .tab-stack {
    gap: 12px;
  }

  .tab-panel[data-tab="sdrtrunk"] .settings-section-header {
    margin-bottom: 14px;
  }

  .tab-panel[data-tab="sdrtrunk"] .settings-section-subtitle {
    font-size: 0.82rem;
  }

  .tab-panel[data-tab="sdrtrunk"] .sdrtrunk-stat-label {
    font-size: 0.76rem;
    margin-bottom: 8px;
  }

  .tab-panel[data-tab="sdrtrunk"] .sdrtrunk-stat-value {
    font-size: 1.2rem;
  }

  .tab-panel[data-tab="sdrtrunk"] .sdrtrunk-state-badge {
    font-size: 0.86rem;
    padding: 7px 11px;
  }

  .tab-panel[data-tab="sdrtrunk"] .sdrtrunk-stat-meta,
  .tab-panel[data-tab="sdrtrunk"] .sdrtrunk-stat-submeta,
  .tab-panel[data-tab="sdrtrunk"] .form-hint,
  .tab-panel[data-tab="sdrtrunk"] .checkbox-inline {
    font-size: 0.82rem;
  }

  .tab-panel[data-tab="sdrtrunk"] .settings-actions > button {
    flex: 1 1 100%;
    font-size: 0.84rem;
  }

  .tab-panel[data-tab="sdrtrunk"] .sdrtrunk-log-output {
    padding: 14px;
    font-size: 0.78rem;
  }
}

.recent-search {
  margin-bottom: 12px;
}

.search-hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 6px;
}

.search-hint a {
  color: var(--accent);
  text-decoration: none;
}

.search-hint a:hover {
  text-decoration: underline;
}

.panel-note {
  color: var(--muted);
  font-size: 0.85rem;
}

.bar-chart {
  height: 160px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 6px 6px;
  border-radius: 12px;
  background: #0d141c;
  border: 1px solid #223041;
  position: relative;
}

.chart-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.75rem;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  flex: 1;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.75rem;
}

.chart-tooltip {
  position: absolute;
  background: rgba(12, 18, 26, 0.95);
  border: 1px solid #2b3b4d;
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.bar-chart .bar {
  flex: 1 1 auto;
  background: linear-gradient(180deg, rgba(106, 196, 255, 0.9), rgba(70, 130, 190, 0.4));
  border-radius: 6px 6px 0 0;
}

.bar-chart .chart-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.table-wrapper {
  overflow: auto;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.stats-table th,
.stats-table td {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 1px solid #223041;
}

.stats-table th {
  color: var(--muted);
  font-weight: 600;
}

.scanner-placeholder {
  color: var(--muted);
}

.scanner-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
  gap: 20px;
  padding: 14px 24px;
  background: rgba(15, 23, 42, 0.3);
}

/* Queue count on left */
.scanner-footer > div:first-child {
  font-weight: 500;
}

/* Inline volume bar in scanner footer - takes center space */
.scanner-footer .volume-compact {
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  gap: 12px;
  grid-template-columns: auto 1fr auto;
}

/* Filters summary on right */
.filter-summary {
  font-weight: 500;
  text-align: right;
}

.scanner-footer .volume-compact-info {
  min-width: 65px;
  gap: 1px;
}

.scanner-footer .volume-compact-rate {
  font-size: 0.9rem;
  line-height: 1;
}

.scanner-footer .volume-compact-level {
  font-size: 0.55rem;
  padding: 2px 6px;
}

.scanner-footer .volume-compact-bar {
  height: 6px;
}

.scanner-footer .volume-compact-listeners {
  font-size: 0.75rem;
  padding: 2px 8px;
}

.filter-summary {
  text-align: right;
  color: var(--muted);
  font-size: 0.85rem;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
}

input,
select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2b3b4d;
  background: #0c121a;
  color: var(--text);
}

.search-controls input {
  flex: 1 1 180px;
  width: auto;
}

.search-controls select {
  flex: 1 1 180px;
  width: auto;
}

select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2b3b4d;
  background: #0c121a;
  color: var(--text);
}

textarea {
  resize: vertical;
}

#lexicon-content {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.85rem;
  line-height: 1.4;
}

.form-hint {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

/* Built-in patterns collapsible list */
.builtin-patterns-details {
  margin-top: 10px;
  font-size: 0.82rem;
}

.builtin-patterns-details summary {
  cursor: pointer;
  color: var(--accent);
  user-select: none;
  padding: 4px 0;
}

.builtin-patterns-details summary:hover {
  text-decoration: underline;
}

.builtin-patterns-list {
  margin: 8px 0 0 0;
  padding: 10px 12px 10px 28px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.builtin-patterns-list li {
  margin: 2px 0;
}

[data-theme="light"] .builtin-patterns-list {
  background: rgba(0, 0, 0, 0.05);
}

/* Default prompt display */
.default-prompt-text {
  margin: 8px 0 0 0;
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
}

[data-theme="light"] .default-prompt-text {
  background: rgba(0, 0, 0, 0.05);
}

.form-divider {
  height: 1px;
  background: #1f2b3a;
  margin: 16px 0;
}

.tg-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.tg-toggle input[type="checkbox"] {
  accent-color: var(--accent);
}

.geo-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  cursor: help;
  color: var(--accent);
  font-size: 1.1em;
  filter: drop-shadow(0 0 3px rgba(96, 165, 250, 0.4));
}


@media (max-width: 1100px) {
  /* SPA: Mobile layout now handled per-view (see #view-home mobile styles) */

  /* Sticky scanner panel on mobile - only in #view-home */
  #view-home .scanner.panel-card {
    position: sticky;
    top: 0;
    z-index: 100;
    border-radius: 0;
    margin-left: -16px;  /* Match #view-home mobile padding */
    margin-right: -16px;
    margin-bottom: 0;
    padding: 0; /* Remove outer padding on mobile */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  /* Hide panel section header entirely on mobile */
  #view-home .scanner .panel-section-header {
    display: none;
  }

  /* Compact scanner header */
  #view-home .scanner-header {
    gap: 4px;
    padding: 6px 10px;
  }

  /* Hide LED indicator on mobile */
  #view-home .scanner-header .led {
    display: none;
  }

  /* Hide subtitle text entirely on mobile */
  #view-home .scanner-subtitle {
    display: none;
  }

  /* Smaller action buttons */
  #view-home .scanner-actions {
    gap: 4px;
  }

  #view-home .scanner-actions .toggle {
    padding: 4px 8px;
    font-size: 0.7rem;
  }

  /* Compact mobile scanner display */
  #view-home .scanner-display {
    padding: 8px 12px;
    min-height: auto;
    padding-bottom: 30px; /* Extra bottom padding for duration bar */
  }

  /* Center placeholder text on mobile when no call */
  #view-home .scanner-placeholder {
    text-align: center;
    padding: 16px 10px;
    font-size: 0.9rem;
  }

  /* Mobile: compact call title and inline meta */
  #view-home .scanner-call-title {
    font-size: 1.4rem;
    margin-bottom: 6px;
  }

  #view-home .scanner-call-meta {
    font-size: 0.8rem;
    gap: 6px;
  }

  /* Compact transcript */
  #view-home .scanner-transcript {
    margin-top: 4px;
    font-size: 0.8rem;
    line-height: 1.35;
  }

  #view-home .scanner-transcript-label {
    font-size: 0.65rem;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(148, 163, 184, 0.7);
  }

  #view-home .scanner-transcript-text {
    font-size: 0.8rem;
    line-height: 1.35;
  }

  /* Compact scanner footer */
  #view-home .scanner-footer {
    font-size: 0.7rem;
    padding: 4px 10px;
    gap: 10px;
  }

  /* Hide download button on mobile */
  #view-home .scanner-download {
    display: none;
  }

  /* Mobile-friendly panel headers */
  .panel-section-header {
    gap: 8px;
  }

  .panel-section-icon {
    font-size: 1.5rem;
  }

  .archive-content {
    display: flex;
    flex-direction: column;
  }

  .admin-content {
    display: flex;
    flex-direction: column;
  }

  .sessions-list .session-item {
    grid-template-columns: 1fr;
  }

  .archive-header {
    align-items: flex-start;
  }

  .archive-grid {
    grid-template-columns: 1fr;
  }

  .archive-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .incident-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .incident-time {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .incident-time-value {
    font-size: 0.8rem;
  }

  .incident-active-left,
  .incident-cleared-left {
    font-size: 0.7rem;
    padding: 2px 6px;
  }

  .incident-sub {
    gap: 6px 12px;
  }

  .incident-actions {
    justify-content: flex-start;
  }

  .incident-units-header,
  .incident-unit-row {
    grid-template-columns: 1fr;
  }

  /* Archive mobile layout - call-row no longer used */

  .archive-action-buttons {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .talkgroups-grid {
    display: flex;
    flex-direction: column;
  }

  .talkgroups-main {
    min-height: auto;
  }

  .talkgroups-main .list {
    max-height: 360px;
  }

  /* Mobile layout for recent calls - full width to match scanner */
  .calls-panel {
    position: relative;
    margin-left: -24px;
    margin-right: -24px;
    border-radius: 0;
  }

  /* Fixed width on desktop to match scanner */
  @media (min-width: 1101px) {
    #view-home .calls-panel {
      width: 650px;
      margin: 0 auto;
    }
  }

  .calls-panel .panel-section-header {
    margin-bottom: 8px;
  }

  .activity-panel {
    padding: 12px 14px;
  }

  .activity-panel .volume-compact {
    padding: 0;
    background: none;
    border: none;
    box-shadow: none;
  }

  .activity-panel .volume-compact-info {
    min-width: auto;
  }

  .activity-panel .volume-compact-rate {
    font-size: 0.95rem;
  }

  .activity-panel .volume-compact-listeners {
    font-size: 0.8rem;
  }

  .activity-panel .volume-compact button {
    font-size: 0.85rem;
    padding: 6px 12px;
  }

  .calls-panel .panel-actions {
    width: auto;
    justify-content: flex-start;
    margin-bottom: 0;
    align-self: center;
    margin-left: 0;
  }

  .calls-panel .recent-search {
    margin-top: 8px;
    margin-bottom: 8px;
  }

  .calls-panel .search-controls {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
  }

  .calls-panel .search-controls input {
    width: auto;
    flex: 1 1 auto;
    min-height: 34px;
  }

  .calls-panel .search-controls button {
    width: auto;
    padding: 4px 10px;
    font-size: 0.72rem;
    line-height: 1.2;
    border-radius: 10px;
    min-height: 34px;
  }

  .calls-panel .call-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }

  .calls-panel .call-details {
    min-width: 0;
    gap: 6px;
  }

  .calls-panel .call-title {
    display: flex !important;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: baseline;
    grid-template-columns: none !important;
  }

  .calls-panel .call-title-name {
    flex: 1 1 100%;
    font-size: 0.95rem;
  }

  .calls-panel .call-title-timestamp,
  .calls-panel .call-title-duration {
    font-size: 0.75rem;
    text-align: left;
  }

  .calls-panel .call-title-duration {
    margin-left: 0;
  }

  .calls-panel .play-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .calls-panel .play-btn::before {
    content: "";
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 9px solid currentColor;
    margin-left: 2px;
  }

  .tg-editor {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .scanner-header {
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    padding: 12px;
  }

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

  .scanner-actions .toggle {
    flex: 1 1 auto;
    min-width: 90px;
  }

  .scanner-meta {
    gap: 4px;
  }
}

@media (max-width: 520px) {
  .scanner-meta {
    grid-template-columns: 1fr;
  }

  .scanner-meta-item.right {
    align-items: flex-start;
    text-align: left;
  }
}

.cad-card .panel-actions {
  justify-content: space-between;
  align-items: center;
}

.cad-card .cad-list {
  max-height: 420px;
}

.cad-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.cad-tab {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
}

.cad-tab.active {
  background: var(--accent-strong);
  color: #0b1220;
  border-color: rgba(96, 165, 250, 0.6);
}

.cad-match-toggle,
.incident-toggle {
  touch-action: manipulation;
}

.cad-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.cad-item {
  padding: 10px 12px;
  border: 1px solid rgba(96, 165, 250, 0.15);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(12, 18, 26, 0.8), rgba(20, 30, 48, 0.6));
  display: block;
  cursor: default;
  border-bottom: none;
  position: relative;
  transition: all 0.2s ease;
}

.cad-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: rgba(96, 165, 250, 0.3);
  border-radius: 12px 0 0 12px;
}

.cad-list .cad-item {
  display: block;
  justify-content: initial;
  align-items: stretch;
  gap: 0;
}

.cad-page .cad-item {
  cursor: pointer;
  transition: all 0.2s ease;
}

.cad-page .cad-list .cad-item {
  animation: cadCardEnter 0.22s ease both;
}

.cad-page .cad-list .cad-item:nth-child(2) { animation-delay: 0.02s; }
.cad-page .cad-list .cad-item:nth-child(3) { animation-delay: 0.04s; }
.cad-page .cad-list .cad-item:nth-child(4) { animation-delay: 0.06s; }
.cad-page .cad-list .cad-item:nth-child(5) { animation-delay: 0.08s; }

.cad-page .cad-item:hover {
  border-color: rgba(96, 165, 250, 0.4);
  background: linear-gradient(135deg, rgba(12, 18, 26, 1), rgba(30, 50, 80, 0.7));
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.1);
  transform: translateY(-2px);
}

.cad-page .cad-item.selected {
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.3),
              0 0 0 2px rgba(96, 165, 250, 0.15),
              0 8px 24px rgba(96, 165, 250, 0.12);
  background: linear-gradient(135deg, rgba(30, 50, 90, 0.4), rgba(20, 30, 60, 0.5));
}

.cad-page .cad-item.selected::before {
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.8), rgba(96, 165, 250, 0.5));
  width: 4px;
}

.cad-page .cad-item.cad-units-alert,
.cad-card .cad-item.cad-units-alert {
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25), 0 0 18px rgba(239, 68, 68, 0.18);
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.3), rgba(15, 23, 42, 0.85));
}

.cad-page .cad-item.cad-units-alert.selected {
  border-color: rgba(239, 68, 68, 0.9);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35), 0 0 22px rgba(239, 68, 68, 0.25);
}

/* Highlight animation for incident from call link */
.cad-item.cad-item-highlight {
  animation: cadHighlight 2.8s ease-out;
}

@keyframes cadHighlight {
  0% {
    box-shadow:
      0 0 0 3px rgba(251, 191, 36, 0.45),
      0 0 28px rgba(251, 191, 36, 0.32);
  }
  55% {
    box-shadow:
      0 0 0 2px rgba(251, 191, 36, 0.2),
      0 0 14px rgba(251, 191, 36, 0.15);
  }
  100% {
    box-shadow: none;
  }
}

/* Color-coded incident type variants - REMOVED */

.cad-title {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 600;
  align-items: center;
  margin-bottom: 2px;
  padding-right: 70px; /* Space for type badge */
}

.cad-incident {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cad-incident-type {
  color: #ffffff !important;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) !important;
}

/* Generic type badge styling - positioned absolutely on right */
.cad-type {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid var(--border);
  color: var(--muted);
}

.cad-type::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

/* Fire type badge - orange/yellow */
.cad-type-fire .cad-type {
  border: 1px solid rgba(249, 115, 22, 0.5);
  background: rgba(249, 115, 22, 0.1);
  color: #fda029;
}

.cad-type-fire .cad-type::before {
  background: #f97316;
}

/* EMS type badge - red */
.cad-type-ems .cad-type {
  border: 1px solid rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.cad-type-ems .cad-type::before {
  background: #ef4444;
}

/* Traffic type badge - blue */
.cad-type-traffic .cad-type {
  border: 1px solid rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
}

.cad-type-traffic .cad-type::before {
  background: #3b82f6;
}

.cad-meta {
  color: var(--muted);
  font-size: 0.78rem;
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.cad-units {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.45);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.cad-location {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 500;
}

.cad-footer {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.75rem;
  gap: 6px;
  flex-wrap: wrap;
}

.cad-summary-chips {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.cad-summary-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.42);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.cad-footer a {
  color: var(--accent);
  text-decoration: none;
}

.cad-footer a:hover {
  text-decoration: underline;
}

/* ==================== Inline Summary Rows ==================== */
.cad-summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-top: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.4);
  transition: all 0.2s ease;
  user-select: none;
}

.cad-summary-row:hover {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(96, 165, 250, 0.4);
}

.cad-summary-row.expanded {
  background: rgba(30, 41, 59, 0.6);
  border-color: rgba(96, 165, 250, 0.5);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: 1px solid rgba(96, 165, 250, 0.3);
}

.cad-summary-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.cad-summary-label {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.cad-summary-chevron {
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.cad-summary-chevron.rotated {
  transform: rotate(180deg);
}

/* Connect expanded panel to summary row */
.cad-summary-row.expanded + .cad-units-details,
.cad-summary-row.expanded + .cad-matches,
.cad-summary-row.expanded + .incident-matches {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin-top: 0;
  border-top: none;
}

/* Adjust details panel when connected */
.cad-units-details:not(.hidden),
.cad-matches:not(.hidden),
.incident-matches:not(.hidden) {
  padding: 10px 12px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 8px;
  background: rgba(12, 18, 26, 0.55);
}

.cad-match-toggle {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  cursor: pointer;
}

.cad-match-toggle:hover {
  border-color: rgba(96, 165, 250, 0.6);
}

.cad-matches {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(12, 18, 26, 0.55);
}

.cad-matches.hidden {
  display: none;
}

.cad-matches-title {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.cad-match {
  font-size: 0.8rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.cad-match + .cad-match {
  margin-top: 6px;
}

.cad-match-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
  color: var(--text);
}

.cad-match-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cad-match-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cad-match-progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}

.cad-match-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(96, 165, 250, 0.85), rgba(59, 130, 246, 0.95));
  transition: width 0.15s linear;
}

.cad-match-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.cad-match-progress-state,
.cad-match-progress-time {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cad-match-progress-state {
  letter-spacing: 0.01em;
}

.cad-match.is-playing .cad-match-progress-state {
  color: #22c55e;
}

.cad-match.is-playing .cad-match-progress-fill {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.75), rgba(22, 163, 74, 0.95));
}

.cad-match.is-paused .cad-match-progress-state {
  color: var(--muted);
}

.cad-match-time {
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  min-width: 62px;
}

.cad-match-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cad-match-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cad-match-status {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
}

.cad-match-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  width: 12px;
  height: 10px;
}

.cad-match-eq span {
  width: 2px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.75;
}

.cad-match.is-playing .cad-match-status {
  color: #22c55e;
}

.cad-match.is-playing .cad-match-eq span:nth-child(1) {
  animation: cadEqPulse 0.65s ease-in-out infinite;
}

.cad-match.is-playing .cad-match-eq span:nth-child(2) {
  animation: cadEqPulse 0.65s ease-in-out 0.12s infinite;
}

.cad-match.is-playing .cad-match-eq span:nth-child(3) {
  animation: cadEqPulse 0.65s ease-in-out 0.24s infinite;
}

.cad-match.is-paused .cad-match-status {
  color: var(--muted);
}

.cad-match.is-paused .cad-match-eq span {
  height: 3px;
  animation: none;
}

@keyframes cadEqPulse {
  0%, 100% {
    height: 3px;
  }
  50% {
    height: 10px;
  }
}

.cad-match-play {
  padding: 6px 10px;
  font-size: 0.75rem;
  min-width: 70px;
  order: -1;
}

.cad-match-play.is-playing {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.45);
  color: #86efac;
}

.cad-match-play.is-paused {
  background: rgba(96, 165, 250, 0.18);
  border-color: rgba(96, 165, 250, 0.45);
  color: #bfdbfe;
}

/* Units Toggle and Details */
.cad-units-toggle {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.cad-units-toggle:hover {
  border-color: rgba(96, 165, 250, 0.6);
}

.cad-units-details {
  margin-top: 8px;
}

.cad-units-details.hidden {
  display: none;
}

.cad-units-card {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(12, 18, 26, 0.55);
}

.cad-units-title {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.cad-units-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cad-units-header,
.cad-unit-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.8rem;
}

.cad-units-header {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(37, 48, 68, 0.8);
}

.cad-unit-row {
  color: var(--text);
}

.cad-unit-row + .cad-unit-row {
  border-top: 1px solid rgba(37, 48, 68, 0.4);
}

.cad-units-empty {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
  padding: 4px 0;
}

/* Section headers for active/cleared groups */
.cad-units-section {
  margin-top: 12px;
}

.cad-units-section:first-child {
  margin-top: 0;
}

.cad-units-section-header {
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(30, 41, 59, 0.4);
  border-top: 1px solid rgba(51, 65, 85, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Cleared unit rows with reduced opacity */
.cad-unit-row.cad-unit-cleared {
  opacity: 0.5;
  font-style: italic;
}

.cad-status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.cad-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 6px 2px;
}


.cad-match {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.cad-match + .cad-match {
  margin-top: 6px;
}

.cad-match-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
  color: var(--text);
}

.cad-match-time {
  color: var(--muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  min-width: 62px;
}

.cad-match-play {
  padding: 6px 10px;
  font-size: 0.75rem;
  min-width: 70px;
  order: -1;
}

/* Units Toggle and Details */
.cad-units-toggle {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.cad-units-toggle:hover {
  border-color: rgba(96, 165, 250, 0.6);
}

.cad-units-details {
  margin-top: 8px;
}

.cad-units-details.hidden {
  display: none;
}

.cad-units-card {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(12, 18, 26, 0.55);
}

.cad-units-title {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.cad-units-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cad-units-header,
.cad-unit-row {
  display: grid;
  grid-template-columns: 140px 1fr 1fr;
  gap: 12px;
  padding: 6px 0;
  font-size: 0.8rem;
}

.cad-units-header {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(37, 48, 68, 0.8);
}

.cad-unit-row {
  color: var(--text);
}

.cad-unit-row + .cad-unit-row {
  border-top: 1px solid rgba(37, 48, 68, 0.4);
}

.cad-units-empty {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: italic;
  padding: 4px 0;
}

/* Section headers for active/cleared groups */
.cad-units-section {
  margin-top: 12px;
}

.cad-units-section:first-child {
  margin-top: 0;
}

.cad-units-section-header {
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(30, 41, 59, 0.4);
  border-top: 1px solid rgba(51, 65, 85, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Cleared unit rows with reduced opacity */
.cad-unit-row.cad-unit-cleared {
  opacity: 0.5;
  font-style: italic;
}

.cad-status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.cad-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 6px 2px;
}


/* Support widget in settings modal */
.settings-support-container {
  display: flex;
  justify-content: center;
  padding: 12px 0;
}

.settings-support-container .bmc-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.settings-support-container .bmc-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}


.support-widget .bmc-button,
.support-widget-preview .bmc-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.support-widget-preview {
  margin-top: 10px;
}

.support-widget-preview .preview-empty {
  color: var(--muted);
  font-size: 0.85rem;
}


.user-location-marker {
  background: transparent;
  border: none;
}

.user-location-marker .user-location-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #0f172a;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25);
}



.cad-marker {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(11, 18, 32, 0.95);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15),
    0 4px 10px rgba(6, 9, 18, 0.35);
}

.cad-marker svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: #ffffff;
}

.cad-marker-fire {
  background: #f97316;
}

.cad-marker-ems {
  background: #ef4444;
}

.cad-marker-traffic {
  background: #3b82f6;
}

.cad-marker-unknown {
  background: #94a3b8;
}


.cad-marker-icon {
  filter: drop-shadow(0 0 1px rgba(11, 18, 32, 0.95))
    drop-shadow(0 0 2px rgba(11, 18, 32, 0.85));
  -webkit-filter: drop-shadow(0 0 1px rgba(11, 18, 32, 0.95))
    drop-shadow(0 0 2px rgba(11, 18, 32, 0.85));
}

.cad-marker-icon.cad-marker-fire,
.cad-marker-icon.cad-marker-ems,
.cad-marker-icon.cad-marker-traffic {
  background: transparent;
}

.cad-location-icon {
  filter: drop-shadow(0 0 2px rgba(8, 15, 28, 0.6));
  -webkit-filter: drop-shadow(0 0 2px rgba(8, 15, 28, 0.6));
}

.page-title {
  margin-bottom: 16px;
  width: 100%;
}

.page-title h2 {
  margin: 0 0 6px;
  font-size: 1.6rem;
}

.page-title .subtitle {
  margin: 0;
}

/* ==================== SPA VIEW SYSTEM ==================== */

/* View container - holds all views */
.app-content {
  /* No special positioning needed */
}

/* Individual views - simple display toggle */
.view {
  display: none !important;
}

.view.active {
  display: block !important;
}

/* Specific view layouts only apply when active */
#view-home.active {
  display: block !important;
  overflow-x: hidden;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(15, 23, 42, 0.74);
  backdrop-filter: blur(16px) saturate(170%);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
  border-top: 1px solid rgba(51, 65, 85, 0.5);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
  padding: 0 8px;
  isolation: isolate;
}

.bottom-nav::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -16px;
  height: 16px;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.22), transparent);
  pointer-events: none;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  color: rgba(148, 163, 184, 0.9);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 8px;
  min-width: 60px;
  flex: 1;
  max-width: 80px;
}

.nav-item:hover {
  background: rgba(51, 65, 85, 0.5);
  color: rgba(96, 165, 250, 1);
}

.nav-item.active {
  color: rgba(96, 165, 250, 1);
  background: rgba(96, 165, 250, 0.1);
}

/* Radio button - special styling for player toggle (not a view switcher) */
.nav-item-radio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  color: rgba(203, 213, 225, 0.96);
  background: rgba(51, 65, 85, 0.42);
  border: 1px solid rgba(148, 163, 184, 0.34);
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 8px;
  min-width: 60px;
  flex: 1;
  max-width: 80px;
}

.nav-item-radio:hover {
  background: rgba(51, 65, 85, 0.62);
  border-color: rgba(96, 165, 250, 0.45);
  color: rgba(96, 165, 250, 1);
}

.nav-item-radio .nav-icon {
  width: 24px;
  height: 24px;
}

.nav-item-radio span {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.nav-item-radio.player-visible {
  color: #22c55e; /* Green when player is shown */
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.45);
}

.nav-item-radio.player-visible:hover {
  background: rgba(34, 197, 94, 0.25);
  color: #22c55e;
}

.nav-icon {
  width: 24px;
  height: 24px;
}

.nav-item span {
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Add padding to app-content to prevent bottom nav + compact player overlap */
/* Desktop: no bottom padding needed (no bottom nav) */
.app-content {
  padding-bottom: 0;
}

/* Mobile: Add padding for fixed bottom nav + compact player */
@media (max-width: 1100px) {
  .app-content {
    padding-bottom: 0;
  }

  /* When compact player is hidden, reduce padding to just bottom nav height */
  .app-content.player-hidden {
    padding-bottom: 0;
  }
}

/* On mobile, hide the nav links (we use bottom nav), but keep header-row visible for desktop */
@media (max-width: 1100px) {
  .app-header .header-row-bottom .nav-left {
    display: none;
  }
}

/* On desktop, show the full header row with nav links and volume meter */
@media (min-width: 1101px) {
  .app-header .header-row-bottom {
    display: flex;
  }
}

/* ==================== COMPACT PLAYER ==================== */

.compact-player {
  position: fixed;
  bottom: 64px; /* Above bottom nav */
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(15, 23, 42, 0.76);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-top: 1px solid rgba(51, 65, 85, 0.5);
  display: none; /* Hidden by default, shown via JS when audio available */
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  z-index: 500; /* Above page content but below bottom nav (1000) and modals (200+) */
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.compact-player-expand {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.compact-player-expand:hover {
  background: rgba(51, 65, 85, 0.5);
  color: var(--text);
}

.compact-player-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0; /* Allow flex children to shrink */
}

.compact-player-info {
  flex: 1;
  min-width: 0; /* Allow text truncation */
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.compact-player-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.compact-player-meta {
  font-size: 0.7rem;
  color: var(--muted);
  display: flex;
  gap: 4px;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Play/Pause Toggle Button with Integrated Status */
.compact-player-toggle-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(51, 65, 85, 0.6);
  border: 2px solid rgba(148, 163, 184, 0.5);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  position: relative;
}

.compact-player-toggle-btn:hover {
  background: rgba(51, 65, 85, 0.8);
  transform: scale(1.05);
}

.compact-player-toggle-btn:active {
  transform: scale(0.95);
}

/* Status integrated into button border */
.compact-player-toggle-btn.paused {
  border-color: #EF4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}

.compact-player-toggle-btn.waiting {
  border-color: #EAB308;
  box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.3);
  animation: statusBorderPulse 2s ease-in-out infinite;
}

.compact-player-toggle-btn.active {
  border-color: #22C55E;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
  animation: statusBorderPulse 2s ease-in-out infinite;
}

@keyframes statusBorderPulse {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
  }
}

.compact-player-toggle-btn.waiting {
  animation-name: statusBorderPulseYellow;
}

@keyframes statusBorderPulseYellow {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(234, 179, 8, 0.3);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(234, 179, 8, 0.15);
  }
}

/* Blocked state - audio blocked by browser, needs user tap to unblock */
.compact-player-toggle-btn.blocked {
  border-color: #F97316;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.3);
  animation: statusBorderPulseOrange 1s ease-in-out infinite;
}

@keyframes statusBorderPulseOrange {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.3);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.5);
  }
}

/* Play/Pause icons in toggle button */
.compact-player-toggle-btn .icon-play,
.compact-player-toggle-btn .icon-pause {
  transition: opacity 0.15s ease;
}

/* Skip and other controls (smaller) */
.compact-player-control {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(51, 65, 85, 0.4);
  border: 1px solid rgba(51, 65, 85, 0.6);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.compact-player-control:hover {
  background: rgba(51, 65, 85, 0.7);
  border-color: rgba(96, 165, 250, 0.5);
  color: var(--text);
}

.compact-player-control:active {
  transform: scale(0.95);
}

.compact-player-queue {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: rgba(51, 65, 85, 0.4);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--muted);
  flex-shrink: 0;
}

.compact-player-queue .queue-icon {
  opacity: 0.7;
}

.compact-player-queue #compact-player-queue-count {
  min-width: 12px;
  text-align: center;
  font-weight: 600;
}

/* Hide queue indicator when count is 0 */
.compact-player-queue.empty {
  display: none;
}

/* Legacy status element - hidden but kept for backwards compatibility */
.compact-player-status {
  display: none;
}

.compact-player-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(51, 65, 85, 0.5);
}

.compact-player-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}

/* Mobile spacing for fixed bottom UI lives in the mobile media block above. */

/* Desktop: Hide compact player (sidebar has full controls) */
@media (min-width: 1101px) {
  .compact-player {
    display: none !important;
  }
  .app-content {
    padding-bottom: 20px;
  }
}

/* ==================== PLAYER MODAL ==================== */

#player-modal {
  z-index: 1500; /* Above Leaflet map tiles (400-450) and bottom nav (1000) */
}

/* NOTE: Main .modal-card-player styles are defined later in the file
   under "NEW MINI PLAYER MODAL DESIGN" section */

/* Player Controls Section (top) */
.player-controls-section {
  flex-shrink: 0;
}

.player-controls-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.player-controls-row .toggle {
  flex-shrink: 0;
}

.filter-dropdown-select {
  flex: 1;
  min-width: 200px;
  max-height: 150px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow-y: auto;
}

.filter-dropdown-select option {
  padding: 6px 8px;
  border-radius: 4px;
}

.filter-dropdown-select option:checked {
  background: linear-gradient(0deg, rgba(96, 165, 250, 0.3) 0%, rgba(96, 165, 250, 0.3) 100%);
}

.filter-dropdown-select:hover {
  border-color: rgba(96, 165, 250, 0.4);
}

.filter-dropdown-select:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.6);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

/* Now Playing Section (middle) */
.now-playing-section {
  flex-shrink: 0;
}

.now-playing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.now-playing-header h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin: 0;
  font-weight: 600;
}

.now-playing-queue {
  font-size: 0.9rem;
  color: var(--muted);
}

.now-playing-display {
  background: rgba(13, 20, 28, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 12px;
  padding: 20px;
  min-height: 100px;
}

.now-playing-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.now-playing-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.now-playing-main {
  flex: 1;
  min-width: 0;
}

.now-playing-talkgroup {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.now-playing-tg-number {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.95rem;
}

.now-playing-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.now-playing-tag {
  color: rgba(96, 165, 250, 0.9);
}

.now-playing-desc {
  color: var(--muted);
}

.now-playing-separator {
  color: rgba(148, 163, 184, 0.4);
}

.now-playing-time-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.now-playing-time {
  font-size: 0.9rem;
  color: var(--muted);
}

.now-playing-duration {
  font-size: 0.85rem;
  color: var(--muted);
  opacity: 0.8;
}

.now-playing-transcription {
  padding-top: 12px;
  border-top: 1px solid rgba(51, 65, 85, 0.3);
}

.transcription-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.transcription-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
  opacity: 0.9;
}

/* Recent Calls Section (bottom - takes most space) */
.recent-calls-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.recent-calls-header {
  flex-shrink: 0;
  margin-bottom: 12px;
}

.recent-calls-header h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin: 0;
  font-weight: 600;
}

.recent-calls-table-wrapper {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 8px;
}

.recent-calls-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.recent-calls-table thead {
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.recent-calls-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid rgba(51, 65, 85, 0.6);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recent-calls-table tbody tr {
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
  transition: background-color 0.15s ease;
}

.recent-calls-table tbody tr:hover {
  background: rgba(51, 65, 85, 0.2);
}

.recent-calls-table tbody td {
  padding: 12px 16px;
  color: var(--text);
  vertical-align: middle;
}

.call-table-time {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.85rem;
}

.call-table-talkgroup {
  font-weight: 500;
  min-width: 150px;
}

.call-table-duration {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.85rem;
}

.call-table-transcription {
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.85rem;
}

.call-table-actions {
  text-align: center;
  width: 60px;
}

.call-play-btn-table {
  background: rgba(96, 165, 250, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.3);
  color: rgba(96, 165, 250, 0.9);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.call-play-btn-table:hover {
  background: rgba(96, 165, 250, 0.25);
  border-color: rgba(96, 165, 250, 0.5);
  transform: scale(1.05);
}

.call-play-btn-table:active {
  transform: scale(0.98);
}

.table-empty {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-style: italic;
}


/* Reuse scanner content styles for modal player */
.player-content-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  margin-bottom: 12px;
}

.player-info-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-call-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
}

.player-tg-number {
  font-size: 0.9rem;
  color: var(--muted);
}

.player-info-right {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.player-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.player-badge-tag {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.player-badge-desc {
  background: rgba(148, 163, 184, 0.1);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.player-timestamp {
  font-size: 0.85rem;
  color: var(--muted);
}

.player-call-time {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 10px 14px;
  background: rgba(13, 20, 28, 0.5);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: 8px;
}

.player-call-time-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.player-call-time-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.player-call-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.player-call-meta .meta-separator {
  opacity: 0.5;
}

.player-duration-bar {
  margin: 12px 0;
  padding: 8px 0;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
}

.player-duration-text {
  font-size: 0.9rem;
  color: var(--muted);
}

.player-transcript {
  margin-top: 16px;
  padding: 12px;
  background: rgba(51, 65, 85, 0.2);
  border-radius: 8px;
  border: 1px solid rgba(51, 65, 85, 0.3);
}

.player-transcript-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.player-transcript-text {
  color: var(--text);
  line-height: 1.6;
  font-size: 0.9rem;
}

.calls-section {
  flex: 1; /* Takes remaining space (about 60-65% of modal) */
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0; /* Allow scrolling */
  overflow: hidden; /* Container doesn't scroll, child does */
}

.calls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.calls-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
}

.calls-section .list {
  flex: 1;
  overflow-y: auto; /* Scrollable list */
  max-height: none; /* Remove max-height, let it fill available space */
  margin: 0;
  padding: 0;
  list-style: none;
}

/* NOTE: Old mobile modal adjustments removed - now handled in NEW MINI PLAYER section below */

/* ===========================================
   NEW MINI PLAYER MODAL DESIGN - MINIMAL
   Following reference app pattern: scroll on modal content itself
   =========================================== */

/* Modal Player Container - THE SCROLLING ELEMENT */
.modal-card-player {
  width: 95vw;
  max-width: 700px;
  max-height: 80vh;
  padding: 0;
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* GPU compositing for smooth scroll on iOS */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* Larger screens get wider modal */
@media (min-width: 768px) {
  .modal-card-player {
    width: 90vw;
    max-width: 800px;
    max-height: 85vh;
  }
}

@media (min-width: 1200px) {
  .modal-card-player {
    max-width: 900px;
  }
}

/* Settings Modal */
/* Settings Modal - Clean Design */
#settings-modal {
  z-index: 1500; /* Above Leaflet map tiles (400-450) and bottom nav (1000) */
}

.modal-card-settings {
  position: relative;
  width: 90%;
  max-width: 420px;
  max-height: 85vh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
  border-radius: 16px;
}

.settings-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(51, 65, 85, 0.6);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.settings-close-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(71, 85, 105, 0.8);
}

.settings-modal-content {
  padding: 28px 24px;
  overflow-x: hidden;
}

.settings-modal-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 20px 0;
}

.settings-divider {
  border: none;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
  margin: 0 0 24px 0;
}

.settings-section-new {
  margin-bottom: 28px;
}

.settings-section-new:last-child {
  margin-bottom: 0;
}

.settings-section-header-new {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.settings-section-icon-new {
  font-size: 1.25rem;
  opacity: 0.85;
}

.settings-section-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.settings-account-card {
  background: rgba(13, 20, 28, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: 10px;
  padding: 0;
  margin-bottom: 16px;
  overflow: hidden;
}

.settings-account-row-new {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.settings-account-row-new:last-child {
  border-bottom: none;
}

.settings-account-label-new {
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-account-value-new {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
}

.settings-account-row-email {
  align-items: flex-start;
}

.settings-account-row-status {
  border-bottom: none;
  padding-top: 8px;
  padding-bottom: 12px;
}

.settings-email-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.settings-email-controls input[type="email"] {
  min-width: 220px;
  width: 240px;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(51, 65, 85, 0.6);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  font-size: 0.9rem;
}

.settings-email-controls input[type="email"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

#settings-email-save {
  padding: 8px 12px;
}

#settings-email-save:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.settings-button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.settings-btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.settings-btn-primary {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

.settings-btn-primary:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.5);
}

.settings-btn-danger {
  background: transparent;
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
}

.settings-btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.6);
}

.settings-coming-soon {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
}

/* Theme Toggle Styles */
.settings-preference-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--panel-alt);
  border-radius: 10px;
  gap: 16px;
}

.settings-preference-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.settings-preference-label {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.settings-preference-desc {
  font-size: 0.8rem;
  color: var(--muted);
}

.theme-toggle-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  background: var(--bg);
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
  min-width: 0;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
}

.theme-toggle-btn:focus {
  outline: none;
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.55);
  outline-offset: 1px;
}

.theme-toggle-btn:hover {
  color: var(--text);
  background: rgba(96, 165, 250, 0.1);
}

.theme-toggle-btn.active {
  background: var(--accent);
  border-color: rgba(96, 165, 250, 0.4);
  color: white;
}

.theme-toggle-icon {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  font-size: 1rem;
}

/* Settings Disclaimer */
.settings-disclaimer-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(51, 65, 85, 0.4);
}

.settings-disclaimer-section.hidden {
  display: none;
}

.settings-disclaimer-text {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}

/* Legacy support - keep for backwards compatibility */
.modal-card-settings .modal-header {
  display: none;
}

.modal-card-settings .modal-body {
  padding: 0;
}

body.settings-modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

@media (max-width: 1100px) {
  #settings-modal {
    align-items: flex-start;
    padding: max(12px, env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .modal-card-settings {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    overflow: hidden;
  }

  .modal-card-settings .settings-modal-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    padding: 20px 16px;
  }

  .settings-modal-title {
    font-size: 1.55rem;
    margin-right: 56px;
  }

  .settings-preference-row {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-account-row-new {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .settings-email-controls {
    justify-content: flex-start;
  }

  .settings-email-controls input[type="email"] {
    width: 100%;
    min-width: 0;
  }

  .theme-toggle-group {
    width: 100%;
  }

  .theme-toggle-btn {
    flex: 1 1 0;
    justify-content: center;
  }

  .settings-button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .settings-btn {
    width: 100%;
    text-align: center;
  }

  .settings-account-row-new {
    gap: 12px;
  }
}

/* Close button - absolute positioned in top right */
.modal-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.9);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  line-height: 1;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 1);
}

/* Modal body - content container, NO scrolling here */
.modal-body-player {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  padding-top: 45px; /* Space for close button */
}

/* Header Row: Combo Button + Queue + Filter */
.player-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.player-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.player-queue-info {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Combo Status Button (scanner-paused / scanner-waiting / scanner-active) */
#toggle-live-modal {
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#toggle-live-modal.scanner-paused {
  background: rgba(239, 68, 68, 0.15);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
}

#toggle-live-modal.scanner-waiting {
  background: rgba(234, 179, 8, 0.15);
  color: #EAB308;
  border: 1px solid rgba(234, 179, 8, 0.4);
  animation: statusPulse 2s ease-in-out infinite;
}

#toggle-live-modal.scanner-active {
  background: rgba(34, 197, 94, 0.15);
  color: #22C55E;
  border: 1px solid rgba(34, 197, 94, 0.5);
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 12px currentColor; }
  50% { opacity: 0.85; box-shadow: 0 0 20px currentColor; }
}

/* Call Display Section - Full width layout */
.player-call-display {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 8px;
  padding: 12px;
}

.player-call-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.player-call-left {
  flex: 1;
  min-width: 0;
}

.player-call-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.player-call-tg {
  font-size: 0.85rem;
  color: var(--muted);
}

.player-call-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.player-call-badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.player-call-badge-tag {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.player-call-badge-desc {
  background: rgba(51, 65, 85, 0.5);
  border: 1px solid rgba(51, 65, 85, 0.8);
  color: var(--muted);
}

.player-call-timestamp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(13, 20, 28, 0.5);
  border: 1px solid rgba(51, 65, 85, 0.4);
  border-radius: 6px;
}

.player-call-timestamp-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.player-call-timestamp-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
}

.player-call-timestamp-row:empty,
.player-call-timestamp-value:empty {
  display: none;
}

.player-call-transcription {
  background: rgba(10, 15, 25, 0.5);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--text);
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.5;
}

.player-call-transcription:empty {
  display: none;
}

.player-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.player-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(51, 65, 85, 0.5);
  border-radius: 3px;
  overflow: hidden;
}

.player-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
}

.player-progress-time {
  font-size: 0.85rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Action Buttons Row */
.player-actions-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.player-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.player-action-btn:hover {
  background: rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.5);
}

.player-action-btn svg {
  flex-shrink: 0;
}

.player-action-stop {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.player-action-stop:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}

/* Recently Played Section */
.player-recent-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 0 4px 0;
}

.player-recent-table-wrap {
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 8px;
  overflow: hidden;
  /* No max-height - let the modal body scroll instead */
}

.player-recent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.player-recent-table thead {
  background: rgba(30, 30, 30, 0.98);
}

.player-recent-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.player-recent-table td {
  padding: 10px 12px;
  color: var(--text);
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.player-recent-table tbody tr {
  cursor: pointer;
  transition: background 0.1s ease;
}

.player-recent-table tbody tr:hover {
  background: rgba(51, 65, 85, 0.3);
}

.player-recent-table .time-col {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Channel Filter Checkbox Dropdown (kept for modal) */
.channel-filter-dropdown {
  position: relative;
}

.channel-filter-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-alt, rgba(30, 41, 59, 0.8));
  color: var(--text);
  border: 1px solid var(--border, rgba(51, 65, 85, 0.6));
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.channel-filter-btn .filter-icon {
  opacity: 0.7;
}

.channel-filter-btn .chevron-icon {
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.channel-filter-btn:hover {
  background: var(--panel, rgba(51, 65, 85, 0.5));
  border-color: var(--accent);
}

.channel-filter-btn:hover .filter-icon {
  opacity: 1;
  color: var(--accent);
}

.channel-filter-btn.active {
  background: rgba(96, 165, 250, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.channel-filter-btn.active .chevron-icon {
  transform: rotate(180deg);
}

.channel-filter-btn:disabled,
.channel-filter-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.busy-btn:disabled,
.busy-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.channel-filter-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--panel, #1e293b);
  border: 1px solid var(--border, rgba(51, 65, 85, 0.6));
  border-radius: 12px;
  min-width: 220px;
  max-height: 320px;
  overflow: hidden;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.channel-filter-menu.hidden {
  display: none;
}

.channel-filter-header {
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border, rgba(51, 65, 85, 0.5));
}

.channel-filter-all {
  background: rgba(96, 165, 250, 0.08);
}

.channel-filter-divider {
  height: 1px;
  background: var(--border, rgba(51, 65, 85, 0.5));
  margin: 0;
}

.channel-filter-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 0.9rem;
}

.channel-filter-item:hover {
  background: rgba(96, 165, 250, 0.1);
}

.channel-filter-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
  cursor: pointer;
  border-radius: 4px;
}

.channel-filter-item span {
  color: var(--text);
  flex: 1;
}

.channel-filter-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
}

/* Light theme overrides for channel filter */
[data-theme="light"] .channel-filter-btn {
  background: var(--panel-alt);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="light"] .channel-filter-btn:hover {
  background: var(--panel);
  border-color: var(--accent);
}

[data-theme="light"] .channel-filter-btn.active {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--accent);
  color: var(--accent);
}

[data-theme="light"] .channel-filter-menu {
  background: var(--panel);
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .channel-filter-header {
  background: var(--panel-alt);
  border-color: var(--border);
}

[data-theme="light"] .channel-filter-all {
  background: rgba(59, 130, 246, 0.08);
}

[data-theme="light"] .channel-filter-item:hover {
  background: rgba(59, 130, 246, 0.08);
}

[data-theme="light"] .channel-filter-divider {
  background: var(--border);
}

/* Player modal mobile layout tuning */
@media (max-width: 1100px) {
  #player-modal {
    align-items: flex-start;
    padding: max(12px, env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .modal-card-player {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    border-radius: 16px;
    overflow: hidden;
  }

  .modal-close-btn {
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    font-size: 22px;
  }

  .modal-body-player {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    padding: 12px 12px 16px;
    padding-top: 56px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .player-header-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #toggle-live-modal {
    width: 100%;
    text-align: center;
  }

  .player-header-right {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    gap: 8px;
  }

  .player-queue-info {
    font-size: 0.9rem;
  }

  .channel-filter-dropdown {
    flex: 1 1 0;
    min-width: 0;
  }

  .channel-filter-btn {
    width: 100%;
    justify-content: space-between;
    padding: 9px 12px;
  }

  .player-call-display {
    padding: 10px;
  }

  .player-call-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .player-call-name {
    font-size: 1rem;
  }

  .player-call-badges {
    width: 100%;
  }

  .player-call-timestamp-row {
    padding: 7px 10px;
  }

  .player-progress-row {
    gap: 8px;
  }

  .player-actions-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .player-action-btn {
    width: 100%;
    justify-content: center;
    padding: 9px 8px;
    font-size: 0.78rem;
    gap: 4px;
  }

  .player-action-btn svg {
    width: 14px;
    height: 14px;
  }

  .player-recent-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .player-recent-table th,
  .player-recent-table td {
    padding: 8px 10px;
  }

  .player-recent-table th:nth-child(2),
  .player-recent-table th:nth-child(3),
  .player-recent-table td:nth-child(2),
  .player-recent-table td:nth-child(3) {
    display: none;
  }

  .player-recent-table .channel-col {
    white-space: normal;
    min-width: 150px;
  }

  .player-recent-table .time-col {
    white-space: nowrap;
    text-align: right;
    font-size: 0.85rem;
  }

  .player-volume-section.hidden-desktop {
    display: block;
    margin-bottom: 6px;
  }

  .volume-meter-modal {
    gap: 10px;
  }

  .volume-stats {
    font-size: 0.92rem;
  }

  .volume-level {
    padding: 3px 9px;
    font-size: 0.72rem;
  }
}

/* Home view specific layout */
/* Single-column layout for transcribed feed */
#view-home.active {
  display: block !important;
  padding: 24px;
  overflow-x: hidden;
}

/* Mobile: Reduce padding and constrain width */
@media (max-width: 1100px) {
  #view-home.active {
    padding: 12px;
    padding-bottom: 0; /* Bottom padding handled by .app-content */
    max-width: 100vw;
    width: 100%;
    box-sizing: border-box;
  }
}

/* Mobile incidents: full-bleed map at top (under safe-area) */
@media (max-width: 1100px) {
  body.active-view-incidents .app-header {
    display: none;
  }

  body.active-view-incidents #view-incidents {
    padding-top: 0;
  }

  body.active-view-incidents #view-incidents .cad-map {
    top: 0;
  }

  body.active-view-incidents #view-incidents .cad-map .leaflet-top {
    top: calc(env(safe-area-inset-top) + 6px);
  }

  body.active-view-incidents #view-incidents .cad-map-tools {
    top: calc(env(safe-area-inset-top) + 12px);
  }
}

/* CAD view specific layout */
#view-incidents {
  padding: 0 24px;
}

/* Mobile: Map at top, scrollable list below */
@media (max-width: 1100px) {
  #view-incidents {
    padding: 0;
    padding-bottom: 130px; /* Space for compact player + bottom nav */
  }

  /* Compact control bar for mobile */
  #view-incidents .cad-controls-compact {
    padding: 6px 10px;
    gap: 8px;
  }

  #view-incidents .cad-controls-compact .cad-tabs {
    gap: 3px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  #view-incidents .cad-controls-compact .cad-tab {
    padding: 5px 10px;
    font-size: 0.75rem;
    white-space: nowrap;
  }

  #view-incidents .cad-controls-right {
    gap: 6px;
  }

  #view-incidents .cad-updated-text {
    display: none; /* Hide timestamp on mobile to save space */
  }

  #view-incidents .cad-controls-compact .cad-filter-toggle {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  #view-incidents .cad-layout {
    display: block; /* Simple block layout */
  }

  /* Map - sticky at top of screen */
  #view-incidents .cad-map {
    position: sticky;
    top: 0;
    z-index: 50;
    height: 35vh;
    min-height: 200px;
    max-height: 280px;
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 8px;
  }

  #view-incidents .cad-map-canvas {
    height: 100%;
  }

  /* List panel - natural flow, page scrolls */
  #view-incidents .cad-list-panel {
    border-radius: 0;
    padding: 8px 12px;
    padding-bottom: 80px; /* Extra padding for compact player + bottom nav */
  }

  #view-incidents .cad-list {
    /* No scroll here - let the page scroll */
  }
}

/* Desktop: Incidents view - explicit height calculation */
@media (min-width: 1101px) {
  /* Use explicit height - header ~80px, padding/gaps ~40px */
  #view-incidents.view.active {
    display: block !important;
    height: calc(100vh - 120px);
    padding: 0 24px;
    padding-bottom: 16px;
  }

  #view-incidents .cad-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 16px;
  }

  #view-incidents .cad-controls,
  #view-incidents .cad-controls-compact {
    flex-shrink: 0;
  }

  #view-incidents .cad-controls-compact {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel);
    margin-bottom: 16px;
  }

  #view-incidents .cad-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.1fr);
    grid-template-rows: 1fr;
    gap: 16px;
    height: 100%;
  }

  #view-incidents .cad-map,
  #view-incidents .cad-list-panel {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  #view-incidents .cad-map-canvas {
    flex: 1;
    min-height: 200px;
  }

  #view-incidents .cad-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
  }
}

/* ==================== ARCHIVE VIEW LAYOUT ==================== */

/* Desktop: 2-column layout (filters sidebar + results) */
#view-archive {
  padding: 0;
}

#view-archive .archive-content {
  display: grid;
  grid-template-columns: minmax(360px, 420px) 1fr;
  gap: 24px;
  align-items: stretch;
  padding: 24px;
}

#view-archive .page-title {
  grid-column: 1 / -1;
}

#view-archive .archive-filters-desktop {
  grid-column: 1;
}

#view-archive .archive-results {
  grid-column: 2;
  min-width: 0; /* Prevent grid blowout */
  overflow: hidden;
}

/* Prevent archive results list items from causing horizontal scroll */
#view-archive .archive-results-list {
  overflow-x: hidden;
}

#view-archive .archive-results-list .call-item {
  min-width: 0;
}

/* Clickable card styling for archive calls */
.call-item.clickable-card {
  cursor: pointer;
  transition: all 0.2s ease;
}

.call-item.clickable-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  background: rgba(96, 165, 250, 0.05);
}

#view-archive .archive-results-list .call-details {
  min-width: 0;
  overflow: hidden;
}

#view-archive .archive-results-list .call-title {
  min-width: 0;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 12px;
  padding-right: 0;
}

#view-archive .archive-results-list .call-title-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-archive .archive-results-list .call-transcript {
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  overflow: hidden;
}

/* Mobile: hide desktop sidebar, show filter button */
@media (max-width: 1100px) {
  #view-archive .archive-content {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }

  #view-archive .archive-filters-desktop {
    display: none;
  }

  #view-archive .archive-results {
    grid-column: 1;
    overflow: visible;
  }

  #view-archive .archive-results-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 10px;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--panel);
    padding: 8px 0 10px;
    border-bottom: 1px solid var(--border);
  }

  #view-archive .archive-filter-trigger {
    display: inline-flex;
    width: 100%;
    justify-content: center;
  }

  #view-archive .pagination {
    display: none;
  }

  #view-archive .archive-results-list .call-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px 12px 12px 14px;
  }

  #view-archive .archive-results-list .call-details {
    min-width: 0;
    gap: 6px;
  }

  #view-archive .archive-results-list .call-title {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-right: 0;
  }

  #view-archive .archive-results-list .call-title-name {
    grid-column: 1 / -1;
    white-space: normal;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1rem;
  }

  #view-archive .archive-results-list .call-title-timestamp {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
  }

  #view-archive .archive-results-list .call-title-duration {
    font-size: 0.8rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  #view-archive .archive-results-list .call-actions {
    align-self: center;
    min-width: calc(5ch + 40px);
  }

  #view-archive .archive-results-list {
    padding-bottom: calc(env(safe-area-inset-bottom) + 138px);
  }

  .app-content.player-hidden #view-archive .archive-results-list {
    padding-bottom: calc(env(safe-area-inset-bottom) + 92px);
  }
}

/* Archive filters modal styling */
.modal-card-scrollable {
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card-scrollable .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.archive-modal-content {
  padding: 8px 0;
}

body.archive-modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

@media (max-width: 1100px) {
  #archive-filter-modal {
    align-items: flex-start;
    padding: max(12px, env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
    overflow: hidden;
  }

  #archive-filter-modal .modal-card-scrollable {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    padding: 16px;
    border-radius: 14px;
  }

  #archive-filter-modal .modal-body {
    overflow-x: hidden;
  }

  #archive-filter-modal .archive-modal-content,
  #archive-filter-modal .archive-grid,
  #archive-filter-modal .field,
  #archive-filter-modal .archive-actions,
  #archive-filter-modal .archive-action-buttons,
  #archive-filter-modal .archive-tabs,
  #archive-filter-modal .archive-quick .filter-group,
  #archive-filter-modal .talkgroup-actions {
    min-width: 0;
    max-width: 100%;
  }

  #archive-filter-modal .archive-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #archive-filter-modal .archive-tab {
    width: 100%;
    text-align: center;
  }

  #archive-filter-modal .archive-quick .filter-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #archive-filter-modal .archive-quick .filter-group .filter-btn {
    width: 100%;
  }

  #archive-filter-modal .talkgroup-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #archive-filter-modal .talkgroup-actions .filter-btn {
    width: 100%;
    padding-left: 6px;
    padding-right: 6px;
  }

  #archive-filter-modal .archive-action-buttons {
    width: 100%;
    margin-left: 0;
  }

  #archive-filter-modal .archive-action-buttons .filter-btn,
  #archive-filter-modal .archive-action-buttons #archive-search-modal {
    flex: 1 1 0;
  }
}

/* Prevent iOS Safari focus zoom on small-form controls in mobile filter modals */
@media (hover: none) and (pointer: coarse) {
  #feed-search,
  .feed-search-input,
  #filter-modal input:not([type="checkbox"]):not([type="radio"]),
  #filter-modal select,
  #filter-modal textarea,
  #archive-filter-modal input:not([type="checkbox"]):not([type="radio"]),
  #archive-filter-modal select,
  #archive-filter-modal textarea {
    font-size: 16px;
  }
}

/* Settings placeholder styling */
#view-settings {
  padding: 24px;
  max-width: 800px;
  margin: 0 auto;
}

/* ==================== PHASE 3: TRANSCRIBED CALLS FEED ==================== */

.transcribed-feed {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
  overflow: hidden;
  min-width: 0;
  box-sizing: border-box;
}

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.feed-disclaimer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: var(--text-muted, var(--muted));
  font-size: 0.85rem;
  max-width: 460px;
}

.feed-disclaimer-icon {
  font-size: 0.95rem;
}

.feed-header .feed-disclaimer {
  margin-bottom: 0;
  margin-left: auto;
}

.feed-search-box {
  flex: 1;
  max-width: 400px;
  position: relative;
  display: flex;
  align-items: center;
}

.feed-search-icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
  pointer-events: none;
}

.feed-search-input {
  width: 100%;
  padding: 10px 36px 10px 40px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.feed-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.feed-search-input::placeholder {
  color: var(--muted);
}

.feed-search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.feed-search-clear:hover {
  color: var(--text);
}

.feed-search-clear.hidden {
  display: none;
}

.feed-status {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(51, 65, 85, 0.3);
  border: 1px solid rgba(51, 65, 85, 0.5);
  color: var(--muted);
  transition: all 0.2s ease;
}

.feed-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

/* Paused state */
.feed-status.feed-status-paused {
  color: var(--muted);
}
.feed-status.feed-status-paused .feed-status-dot {
  background: var(--muted);
  animation: none;
}

/* Waiting state */
.feed-status.feed-status-waiting {
  color: #eab308;
  border-color: rgba(234, 179, 8, 0.3);
  background: rgba(234, 179, 8, 0.1);
}
.feed-status.feed-status-waiting .feed-status-dot {
  background: #eab308;
  animation: pulse 2s infinite;
}

/* Active/Live state */
.feed-status.feed-status-active {
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.1);
}
.feed-status.feed-status-active .feed-status-dot {
  background: var(--success);
  animation: pulse 1s infinite;
}

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

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  list-style: none;
  padding: 0;
  overflow: hidden;
  min-width: 0;
  margin: 0;
}

.feed-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
  min-width: 0; /* Allow flex shrinking */
  max-width: 100%;
  box-sizing: border-box;
}

.feed-item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.feed-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.feed-item-tg {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.feed-item-time {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.feed-item-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.feed-item-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(96, 165, 250, 0.15);
  color: var(--accent);
}

.feed-item-headline {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 8px;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.feed-item-transcription {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: 8px;
  border-left: 3px solid var(--accent);
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  overflow: hidden;
}

.feed-item-transcription mark {
  background: rgba(251, 191, 36, 0.4);
  color: inherit;
  padding: 1px 2px;
  border-radius: 2px;
}

/* CAD incident link button on feed items */
.feed-item-cad-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 8px 0;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  text-align: left;
  width: 100%;
}

.feed-item-cad-link:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  transform: translateX(4px);
}

.cad-link-icon {
  flex-shrink: 0;
}

.cad-link-text {
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cad-link-location {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.cad-link-active {
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-left: auto;
  white-space: nowrap;
  line-height: 1.1;
  animation: pulse 2s infinite;
}

/* Feed empty state */
.feed-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.feed-empty.hidden {
  display: none;
}

.feed-empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.feed-empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.feed-empty-subtitle {
  font-size: 0.9rem;
}

/* Feed infinite scroll loader */
.feed-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--muted);
  font-size: 0.9rem;
}

.feed-loader.hidden {
  display: none;
}

.feed-loader-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(96, 165, 250, 0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: feedSpin 0.8s linear infinite;
}

@keyframes feedSpin {
  to {
    transform: rotate(360deg);
  }
}

/* ==================== HOME LAYOUT WITH SIDEBAR (DESKTOP) ==================== */

.home-layout {
  display: flex;
  gap: 24px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 16px;
}

.home-layout .transcribed-feed {
  flex: 1;
  min-width: 0;
  max-width: none;
  padding: 16px 0;
}

.home-sidebar {
  width: 420px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0;
  position: sticky;
  top: 0;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

/* ==================== UNIFIED SCANNER CARD ==================== */

.sidebar-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.sidebar-scanner-card {
  display: flex;
  flex-direction: column;
}

/* Scanner Header with Status */
.sidebar-scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(51, 65, 85, 0.3);
  border-bottom: 1px solid var(--border);
}

.sidebar-scanner-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sidebar-scanner-icon {
  font-size: 1rem;
}

.sidebar-scanner-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.sidebar-scanner-status.waiting {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
}

.sidebar-scanner-status.active {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.sidebar-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.sidebar-scanner-status.waiting .sidebar-status-dot,
.sidebar-scanner-status.active .sidebar-status-dot {
  animation: statusPulse 2s ease-in-out infinite;
}

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

/* Player Controls Row */
.sidebar-player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.sidebar-play-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(59, 130, 246, 0.3));
  border: 2px solid rgba(96, 165, 250, 0.5);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.sidebar-play-btn:hover {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.3), rgba(59, 130, 246, 0.4));
  border-color: var(--accent);
  transform: scale(1.05);
}

.sidebar-play-btn.active {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.3));
  border-color: #22c55e;
  color: #22c55e;
}

.sidebar-play-btn.waiting {
  border-color: #eab308;
  color: #eab308;
}

.sidebar-player-info {
  flex: 1;
  min-width: 0;
}

.sidebar-player-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-player-meta {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.sidebar-skip-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(51, 65, 85, 0.4);
  border: 1px solid rgba(51, 65, 85, 0.6);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.sidebar-skip-btn:hover {
  background: rgba(51, 65, 85, 0.6);
  color: var(--text);
}

/* Progress Row */
.sidebar-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(13, 20, 28, 0.4);
}

.sidebar-progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(51, 65, 85, 0.5);
  border-radius: 2px;
  overflow: hidden;
}

.sidebar-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}

.sidebar-progress-time {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  min-width: 35px;
  text-align: right;
}

/* Call Display */
.sidebar-call-display {
  padding: 0 16px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease, padding 0.2s ease;
}

.sidebar-call-display:not(:empty) {
  padding: 12px 16px;
  max-height: 220px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.sidebar-call-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-call-tg {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text);
}

.sidebar-call-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.sidebar-call-transcript {
  font-size: 0.8rem;
  color: var(--text);
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 10px;
  border-radius: 6px;
  border-left: 2px solid var(--accent);
  line-height: 1.4;
  margin-top: 6px;
  max-height: 120px;
  overflow: auto;
}

/* Stats Row */
.sidebar-stats-row {
  display: flex;
  padding: 12px 16px;
  gap: 8px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
}

.sidebar-stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  background: rgba(51, 65, 85, 0.2);
  border-radius: 6px;
}

.sidebar-stat-item .sidebar-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.sidebar-stat-item .sidebar-stat-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.sidebar-stat-volume {
  gap: 4px;
}

.sidebar-volume-bar {
  width: 100%;
  height: 5px;
  background: rgba(51, 65, 85, 0.5);
  border-radius: 999px;
  overflow: hidden;
}

.sidebar-volume-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  transition: width 0.3s ease;
}

.sidebar-stat-volume .sidebar-stat-value[data-level="low"] {
  color: #22c55e;
}

.sidebar-stat-volume .sidebar-stat-value[data-level="medium"] {
  color: #eab308;
}

.sidebar-stat-volume .sidebar-stat-value[data-level="high"] {
  color: #ef4444;
}

.sidebar-stat-clickable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-stat-clickable:hover {
  background: rgba(96, 165, 250, 0.2);
}

.sidebar-stat-clickable:hover .sidebar-stat-value {
  color: var(--accent);
}

/* Busy Section */
.sidebar-busy-section {
  padding: 0;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: rgba(51, 65, 85, 0.2);
}

/* Sidebar Busy Talkgroups */
.sidebar-busy-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: none; /* No max-height limit - show all talkgroups */
  overflow-y: visible;
}

.sidebar-busy-empty {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.sidebar-busy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.sidebar-busy-item:hover {
  background: rgba(51, 65, 85, 0.3);
}

.sidebar-busy-name {
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.sidebar-busy-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.sidebar-busy-btn:hover {
  background: rgba(51, 65, 85, 0.3);
  border-color: rgba(51, 65, 85, 0.5);
}

.sidebar-busy-btn.active {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.4);
}

.sidebar-busy-label {
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.sidebar-busy-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  padding: 2px 8px;
  background: rgba(96, 165, 250, 0.15);
  border-radius: 4px;
  flex-shrink: 0;
}

.sidebar-busy-hold {
  padding: 4px 8px;
  font-size: 0.7rem;
  background: transparent;
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: var(--accent);
  border-radius: 4px;
  cursor: pointer;
  margin-left: 8px;
  transition: all 0.15s ease;
}

.sidebar-busy-hold:hover {
  background: rgba(96, 165, 250, 0.2);
}

.sidebar-busy-hold.held {
  background: rgba(96, 165, 250, 0.3);
  border-color: var(--accent);
}

/* Mobile: Hide sidebar */
@media (max-width: 1100px) {
  .home-layout {
    display: block;
    padding: 0;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
  }

  .home-layout .transcribed-feed {
    padding: 8px;
    max-width: 100%;
    width: 100%;
  }

  .home-sidebar {
    display: none !important;
    width: 0;
  }
}

/* ==================== VOLUME METER - HEADER (DESKTOP) ==================== */

.volume-meter-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: rgba(51, 65, 85, 0.4);
  border-radius: 8px;
  margin-right: 12px;
}

.volume-bar-small {
  width: 100px;
  height: 8px;
  background: rgba(51, 65, 85, 0.5);
  border-radius: 4px;
  overflow: hidden;
}

.volume-fill-small {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  width: 0%;
  transition: width 0.3s ease;
}

.volume-rate-small {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

/* ==================== VOLUME METER - MOBILE HEADER ==================== */

.volume-meter-mobile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(51, 65, 85, 0.4);
  border-radius: 8px;
}

.volume-bar-mobile {
  width: 50px;
  height: 6px;
  background: rgba(51, 65, 85, 0.5);
  border-radius: 3px;
  overflow: hidden;
}

.volume-fill-mobile {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  width: 0%;
  transition: width 0.3s ease;
}

.volume-rate-mobile {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  min-width: 38px;
}

/* ==================== VOLUME METER - MODAL (MOBILE) ==================== */

.player-volume-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
}

.player-volume-section.hidden-desktop {
  display: block;
}

.player-section-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.volume-meter-modal {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(51, 65, 85, 0.28);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.2);
}

.volume-bar {
  height: 8px;
  background: rgba(51, 65, 85, 0.5);
  border-radius: 4px;
  overflow: hidden;
}

.volume-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  width: 0%;
  transition: width 0.3s ease;
}

.volume-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
  gap: 10px;
}

.volume-rate-readout {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  min-width: 0;
}

.volume-rate-unit {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.volume-level {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

.volume-level[data-level="low"] {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.volume-level[data-level="medium"] {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
}

.volume-level[data-level="high"] {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* ==================== BUSY TALKGROUPS - MODAL ==================== */

.player-busy-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
}

.modal-busy-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.modal-busy-list .busy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(51, 65, 85, 0.3);
  border: 1px solid rgba(51, 65, 85, 0.5);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-busy-list .busy-btn:hover {
  background: rgba(51, 65, 85, 0.5);
  border-color: var(--accent);
}

.modal-busy-list .busy-btn.active {
  background: rgba(96, 165, 250, 0.2);
  border-color: var(--accent);
  color: var(--accent);
}

.modal-busy-list .busy-count {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.busy-empty {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.busy-empty.hidden {
  display: none;
}

/* Hold Indicator */
.hold-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  background: rgba(96, 165, 250, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-radius: 8px;
  color: var(--accent);
  font-size: 0.85rem;
}

.hold-indicator.hidden {
  display: none;
}

.hold-indicator-icon {
  font-size: 1rem;
}

.hold-indicator-text {
  flex: 1;
}

.hold-indicator-text #hold-indicator-tg {
  font-weight: 600;
}

.hold-indicator-clear {
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.hold-indicator-clear:hover {
  background: rgba(239, 68, 68, 0.4);
}

/* ==================== RESPONSIVE VISIBILITY ==================== */

.hidden-mobile {
  display: flex;
}

.hidden-desktop {
  display: flex;
}

@media (max-width: 1100px) {
  body.active-view-home .app-header {
    padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
    gap: 6px;
  }

  body.active-view-home .header-row {
    gap: 8px;
  }

  body.active-view-home .header-row-top {
    flex-wrap: nowrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
  }

  body.active-view-home .header-row-top h1 {
    flex: 1 1 auto;
    min-width: 0;
    font-size: clamp(2.1rem, 9.8vw, 2.9rem);
    line-height: 1;
  }

  body.active-view-home .header-subtitle {
    flex: 0 1 48%;
    max-width: 48%;
    font-size: 0.88rem;
    margin: 0 0 2px auto;
    text-align: right;
    line-height: 1.2;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    opacity: 0.85;
  }

  body.active-view-home .header-subtitle.subtitle-disconnected {
    display: block;
    color: var(--danger);
    opacity: 1;
    -webkit-line-clamp: 1;
  }

  body.active-view-home .header-row-bottom {
    display: none;
  }

  body.active-view-home #view-home.active {
    padding: 0;
  }

  body.active-view-home .home-layout {
    margin: 0;
    max-width: none;
    padding: 0 6px;
    gap: 0;
  }

  body.active-view-home .home-layout .transcribed-feed {
    padding: 6px 0 0;
  }

  body.active-view-home .feed-header {
    padding: 0 6px;
    margin-bottom: 8px;
    gap: 8px;
  }

  body.active-view-home .feed-list {
    gap: 8px;
  }

  body.active-view-home .feed-item {
    padding: 12px;
    border-radius: 10px;
  }

  .hidden-mobile {
    display: none !important;
  }

  .transcribed-feed {
    padding: 8px;
    max-width: 100%;
    width: 100%;
    overflow: hidden;
  }

  .feed-header {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
  }

  .feed-search-box {
    max-width: 100%;
    width: 100%;
  }

  .feed-search-input {
    padding: 8px 32px 8px 36px;
    font-size: 0.85rem;
  }

  .feed-item {
    padding: 12px;
    border-radius: 10px;
  }

  .feed-item-header {
    flex-wrap: wrap;
    gap: 4px;
  }

  .feed-item-tg {
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .feed-item-time {
    font-size: 0.75rem;
  }

  .feed-item-meta {
    gap: 6px;
  }

  .feed-item-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
  }

  .feed-item-headline {
    font-size: 0.9rem;
  }

  .feed-item-transcription {
    padding: 10px;
    font-size: 0.85rem;
    border-radius: 6px;
  }

  .feed-item-cad-link {
    font-size: 0.75rem;
    padding: 6px 10px;
    gap: 6px;
  }

  .cad-link-location {
    display: none;
  }

  .cad-link-active {
    font-size: 0.64rem;
    padding: 2px 5px;
  }
}

@media (min-width: 1101px) {
  .hidden-desktop {
    display: none !important;
  }
}

/* ==================== AUTH PAGES ==================== */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.app.auth-page {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-page:not(.auth-page-scroll) {
  align-items: center;
}

.auth-page.auth-page-scroll {
  align-items: center;
  padding-top: 32px;
  padding-bottom: 32px;
}

.auth-content {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.auth-content.auth-content-wide {
  max-width: 720px;
}

.auth-card {
  padding: 32px;
}

.auth-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-header h1 {
  font-size: 2rem;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.auth-header .subtitle {
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-logo {
  max-width: 280px;
  max-height: 120px;
  margin-bottom: 20px;
  object-fit: contain;
}

.auth-logo.hidden {
  display: none;
}

.auth-info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  line-height: 1.5;
  color: var(--text);
}

.auth-info strong {
  display: block;
  margin-bottom: 4px;
  color: #60a5fa;
}

.auth-status {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  display: none;
}

.auth-status.error {
  display: block;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.auth-status.success {
  display: block;
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: #4ade80;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 900px) {
  .auth-form-register {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px 20px;
    align-items: start;
  }

  .auth-form-register .field-full {
    grid-column: 1 / -1;
  }

  .auth-form-register .password-match {
    margin-top: -8px;
  }

  .auth-form-register .auth-submit {
    margin-top: 0;
  }
}

.auth-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form .field-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.auth-form .field-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px; /* Explicit 16px prevents iOS zoom on focus */
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.auth-form input[type="text"]:focus,
.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.auth-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  scroll-margin-bottom: 20px;
}

.auth-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
}

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--muted);
}

.auth-footer a {
  color: #60a5fa;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Login Message Popup */
.login-message-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.login-message-modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  animation: loginMessageSlideIn 0.3s ease-out;
}

@keyframes loginMessageSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

.login-message-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text);
}

.login-message-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.login-message-close:hover {
  color: var(--text);
}

.login-message-content {
  padding: 20px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
}

.login-message-ok {
  display: block;
  width: calc(100% - 40px);
  margin: 0 20px 20px;
  padding: 12px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-message-ok:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
}

.password-requirements {
  font-size: 0.8rem;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.5);
  border-radius: 8px;
  padding: 12px 16px;
}

.password-requirements ul {
  padding-left: 20px;
  margin: 0;
}

.password-requirements li {
  margin: 6px 0;
  transition: color 0.2s ease;
}

.password-requirements li.valid {
  color: #4ade80;
}

.password-requirements li.valid::marker {
  content: "✓ ";
}

.password-match {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
}

.password-match.valid {
  color: #4ade80;
}

.password-match.invalid {
  color: #f87171;
}

.cf-turnstile {
  margin: 8px 0;
}

#turnstile-container {
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

#turnstile-container:not(:empty) {
  min-height: 65px;
  margin: 8px 0;
}

#turnstile-container .cf-turnstile {
  max-width: 100%;
}

/* Auth Pages Mobile Responsive */
@media (max-width: 480px) {
  .auth-page.auth-page-scroll {
    align-items: flex-start;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .auth-content.auth-content-wide {
    max-width: 560px;
  }

  .auth-card {
    padding: 20px 16px;
  }

  .auth-header h1 {
    font-size: 1.5rem;
  }

  .auth-info {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .password-requirements {
    padding: 10px 12px;
  }

  .password-requirements ul {
    padding-left: 16px;
  }

  .auth-form input[type="text"],
  .auth-form input[type="email"],
  .auth-form input[type="password"] {
    padding: 10px 12px;
  }

  .auth-submit {
    padding: 12px;
  }
}

/* ==================== USER MANAGEMENT ==================== */

.users-card .panel-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.users-card .panel-actions-left {
  display: flex;
  gap: 12px;
  align-items: center;
}

.users-card .panel-actions-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.users-card .search-input {
  width: 200px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
}

.users-card .search-input:focus {
  outline: none;
  border-color: #3b82f6;
}

.user-count {
  color: var(--muted);
  font-size: 0.85rem;
}

.users-table-container {
  overflow-x: auto;
  margin-bottom: 16px;
}

.users-table {
  width: 100%;
}

.users-table th {
  text-align: left;
  white-space: nowrap;
}

.user-row {
  cursor: pointer;
  transition: background 0.2s ease;
}

.user-row:hover {
  background: rgba(59, 130, 246, 0.1);
}

.user-row.user-disabled {
  opacity: 0.6;
}

.user-username {
  font-weight: 500;
}

.user-role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.user-role-badge.role-user {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

.user-role-badge.role-admin {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

.user-role-badge.role-userstats {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

.user-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.user-status-badge.status-active {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.user-status-badge.status-disabled {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.user-status-badge.status-locked {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  animation: lockoutPulse 1.5s ease-in-out infinite;
}

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

.user-row.user-locked {
  background: rgba(245, 158, 11, 0.05);
}

.view-user-btn {
  padding: 4px 12px;
  font-size: 0.8rem;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-user-btn:hover {
  background: rgba(59, 130, 246, 0.3);
}

.users-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(51, 65, 85, 0.3);
}

.users-pagination button {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.users-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#users-page-info {
  color: var(--muted);
  font-size: 0.85rem;
}

/* User Details Modal */
.user-details-modal-card {
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}

.user-details-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Legacy User Details Panel - no longer used but kept for reference */
.user-details-card {
  margin-top: 20px;
}

.user-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .user-details-grid {
    grid-template-columns: 1fr;
  }

  .user-detail-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .user-detail-email-controls {
    justify-content: flex-start;
  }

  .user-detail-email-controls input[type="email"] {
    width: 100%;
  }

  .user-detail-row-inline .user-detail-value {
    text-align: left;
  }
}

.user-details-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 6px;
}

.user-detail-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.user-detail-value {
  font-weight: 500;
  font-size: 0.9rem;
}

.user-detail-email-controls {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.user-detail-email-controls input[type="email"] {
  min-width: 220px;
  width: 280px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(51, 65, 85, 0.7);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
}

.user-detail-email-controls input[type="email"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.user-detail-row-inline {
  background: transparent;
  padding-top: 0;
}

.user-detail-row-inline .user-detail-value {
  width: 100%;
  text-align: right;
}

#save-user-email:disabled,
#send-user-reset:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.user-detail-value.status-active {
  color: #4ade80;
}

.user-detail-value.status-disabled {
  color: #f87171;
}

.user-detail-value.status-locked {
  color: #fbbf24;
  animation: lockoutPulse 1.5s ease-in-out infinite;
}

.info-btn {
  padding: 8px 16px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.info-btn:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.6);
}

.user-details-notes textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  resize: vertical;
}

.user-details-notes textarea:focus {
  outline: none;
  border-color: #3b82f6;
}

.user-details-notes button {
  margin-top: 8px;
}

.user-details-actions {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid rgba(51, 65, 85, 0.3);
  border-bottom: 1px solid rgba(51, 65, 85, 0.3);
  margin-bottom: 20px;
}

.warning-btn {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.warning-btn:hover {
  background: rgba(245, 158, 11, 0.3);
}

.success-btn {
  background: rgba(74, 222, 128, 0.2);
  border: 1px solid rgba(74, 222, 128, 0.4);
  color: #4ade80;
}

.success-btn:hover {
  background: rgba(74, 222, 128, 0.3);
}

/* User History Section with Tabs */
.user-history-section {
  margin-top: 16px;
}

.user-history-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  margin-bottom: 12px;
}

.user-history-tab {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s ease;
}

.user-history-tab:hover {
  color: var(--text);
  background: rgba(51, 65, 85, 0.3);
}

.user-history-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.user-history-panel {
  display: none;
}

.user-history-panel.active {
  display: block;
}

.user-session-table {
  font-size: 0.85rem;
}

.user-session-table .session-duration {
  white-space: nowrap;
}

.user-login-history {
  margin-top: 16px;
}

.user-login-history h3 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--text);
}

.user-login-table {
  font-size: 0.85rem;
}

.user-login-table .login-failed {
  opacity: 0.7;
}

.user-agent-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
}

.login-status-badge.login-success {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.login-status-badge.login-failed {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}


/* ==================== SETTINGS VIEW ==================== */

.settings-view-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-panel {
  padding: 20px;
}

.settings-account-info {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(51, 65, 85, 0.3);
  border-radius: 6px;
}

.settings-account-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.settings-account-value {
  font-weight: 500;
  color: var(--text);
}

.settings-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
}

.settings-placeholder {
  padding: 2rem;
  text-align: center;
  opacity: 0.7;
}

.danger-btn {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.danger-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.6);
}


/* User role selector */
.user-role-select {
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(51, 65, 85, 0.5);
  border: 1px solid rgba(51, 65, 85, 0.8);
  color: var(--text);
  font-size: 0.85rem;
  margin-right: 8px;
}

.save-role-btn {
  padding: 4px 12px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.save-role-btn:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.6);
}


/* ==================== STATS PAGE ==================== */

.stats-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.stats-page .app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.header-link {
  color: var(--accent);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.1);
  transition: all 0.2s ease;
}

.header-link:hover {
  background: rgba(59, 130, 246, 0.2);
}

.stats-content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  font-size: 2rem;
  opacity: 0.8;
}

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

.stat-detail {
  font-size: 0.75rem;
  color: var(--accent);
  margin-top: 4px;
}

.stats-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.refresh-btn {
  padding: 10px 20px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.refresh-btn:hover {
  background: rgba(59, 130, 246, 0.3);
}

.stats-updated {
  font-size: 0.85rem;
  color: var(--muted);
}


/* Stats link in settings */
.stats-link {
  padding: 10px 20px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.stats-link:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: rgba(59, 130, 246, 0.6);
}


/* ==================== ADMIN PORTAL - SIDEBAR LAYOUT ==================== */

.admin-app {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* Sidebar Navigation */
.admin-sidebar {
  width: 220px;
  background: rgba(15, 23, 42, 0.95);
  border-right: 1px solid rgba(51, 65, 85, 0.5);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.admin-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.admin-sidebar-header h1 {
  font-size: 1.25rem;
  color: var(--text);
  margin: 0;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.admin-back-link {
  color: var(--muted);
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.admin-back-link:hover {
  color: var(--accent);
  background: rgba(96, 165, 250, 0.1);
}

/* Navigation Items */
.admin-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-nav-item:hover {
  color: var(--text);
  background: rgba(51, 65, 85, 0.3);
}

.admin-nav-item.active {
  color: var(--accent);
  background: rgba(96, 165, 250, 0.1);
  border-left: 3px solid var(--accent);
  padding-left: 17px;
}

.admin-nav-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

/* Sidebar Footer */
.admin-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(51, 65, 85, 0.5);
}

.admin-logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  color: #f87171;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

/* Mobile Header */
.admin-mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  position: sticky;
  top: 0;
  z-index: 90;
}

.admin-mobile-header h1 {
  font-size: 1.1rem;
  margin: 0;
  color: var(--text);
}

.admin-menu-toggle {
  background: none;
  border: none;
  color: var(--text);
  padding: 8px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-menu-toggle:hover {
  background: rgba(51, 65, 85, 0.3);
}

/* Main Content Area */
.admin-main {
  flex: 1;
  margin-left: 220px;
  padding: 24px;
  overflow-y: auto;
  min-height: 100vh;
}

/* Tab Panels */
.admin-main .tab-panel {
  display: none;
}

.admin-main .tab-panel.active {
  display: block;
}

.admin-panel-header {
  margin-bottom: 20px;
}

.admin-panel-header h2 {
  font-size: 1.5rem;
  margin: 0;
  color: var(--text);
}

/* Tab Stack - Vertical layout for cards */
.tab-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==================== COLLAPSIBLE SETTINGS CARDS ==================== */

.settings-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.settings-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 18px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.settings-card-header:hover {
  background: rgba(51, 65, 85, 0.2);
}

.settings-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-card-chevron {
  color: var(--muted);
  transition: transform 0.3s ease;
}

.settings-card-header[aria-expanded="false"] .settings-card-chevron {
  transform: rotate(-90deg);
}

.settings-card-body {
  padding: 0 18px 18px;
  display: block;
}

.settings-card[data-collapsible] .settings-card-body.collapsed {
  display: none;
}

/* Compact Settings Grid */
.settings-grid {
  display: grid;
  gap: 14px;
}

.settings-grid-2col {
  grid-template-columns: repeat(2, 1fr);
}

.settings-grid-3col {
  grid-template-columns: repeat(3, 1fr);
}

.settings-field-full {
  grid-column: 1 / -1;
}

/* Compact Field Styling */
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
}

.settings-unit {
  color: var(--muted);
  font-weight: 400;
}

.settings-field input,
.settings-field select,
.settings-field textarea {
  padding: 8px 10px;
  font-size: 0.85rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(51, 65, 85, 0.6);
  border-radius: 6px;
  color: var(--text);
  transition: border-color 0.2s ease;
}

.settings-field input:focus,
.settings-field select:focus,
.settings-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Settings Group - Subsection within a card */
.settings-group {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(51, 65, 85, 0.4);
}

.settings-group-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* Save Actions Row */
.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(51, 65, 85, 0.4);
}

.settings-save-btn {
  padding: 10px 24px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.settings-save-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
}

/* Logo Upload Section - Compact */
.logo-upload-section {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.logo-preview-container {
  width: 100px;
  height: 60px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px dashed rgba(51, 65, 85, 0.8);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-preview {
  max-width: 90%;
  max-height: 50px;
  object-fit: contain;
}

.logo-placeholder {
  font-size: 0.75rem;
  color: var(--muted);
}

.logo-upload-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.logo-upload-controls .btn {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.logo-url-toggle {
  margin-top: 4px;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
}

.checkbox-inline input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

/* Purge Operations - Compact */
.purge-operations {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.purge-operation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.purge-operation .settings-field {
  flex: 0 0 200px;
}

.purge-buttons {
  display: flex;
  gap: 8px;
}

.purge-buttons button {
  padding: 8px 14px;
  font-size: 0.85rem;
}

/* Mobile Responsive - Admin */
@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
  }

  .admin-mobile-header {
    display: flex;
  }

  .admin-main {
    margin-left: 0;
    padding: 16px;
  }

  .tab-panel[data-tab="sdrtrunk"] .settings-section {
    margin-bottom: 14px;
  }

  .tab-panel[data-tab="sdrtrunk"] .panel-card {
    padding: 14px;
  }

  .tab-panel[data-tab="sdrtrunk"] .sdrtrunk-meta-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .tab-panel[data-tab="sdrtrunk"] .sdrtrunk-summary-grid {
    grid-template-columns: 1fr;
  }

  .tab-panel[data-tab="sdrtrunk"] .sdrtrunk-stat-card {
    padding: 14px;
  }

  .tab-panel[data-tab="sdrtrunk"] .sdrtrunk-bias-options {
    flex-direction: column;
    gap: 12px;
  }

  .tab-panel[data-tab="sdrtrunk"] .checkbox-inline {
    align-items: flex-start;
  }

  .tab-panel[data-tab="sdrtrunk"] .checkbox-inline input[type="checkbox"] {
    margin-top: 2px;
  }

  .tab-panel[data-tab="sdrtrunk"] .settings-actions {
    flex-wrap: wrap;
    gap: 10px;
  }

  .tab-panel[data-tab="sdrtrunk"] .settings-actions > button {
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    padding: 10px 12px;
  }

  .tab-panel[data-tab="sdrtrunk"] .settings-actions > .form-status {
    flex: 1 1 100%;
    min-width: 0;
    margin-top: 2px;
  }

  .tab-panel[data-tab="sdrtrunk"] .sdrtrunk-inline-details summary {
    padding: 12px 14px;
  }

  .settings-grid-2col,
  .settings-grid-3col {
    grid-template-columns: 1fr;
  }

  .logo-upload-section {
    flex-direction: column;
  }

  .logo-preview-container {
    width: 100%;
    height: 80px;
  }

  .purge-operation {
    flex-direction: column;
    align-items: stretch;
  }

  .purge-operation .settings-field {
    flex: 1 1 auto;
  }

  .purge-buttons {
    flex-wrap: wrap;
  }
}

/* Admin sidebar overlay for mobile */
.admin-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

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

/* Talkgroups grid layout */
.talkgroups-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.talkgroups-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.talkgroups-main {
  min-height: 400px;
}

@media (max-width: 900px) {
  .talkgroups-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== Notification UI Styles ==================== */

/* Toggle switch for enable/disable */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(148, 163, 184, 0.3);
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Truncate long URLs */
.truncate-url {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Notification status colors */
.status-success {
  color: var(--success);
}

.status-failed {
  color: var(--danger);
}

/* Settings hint paragraph */
.settings-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

.settings-hint a {
  color: var(--accent);
  text-decoration: none;
}

.settings-hint a:hover {
  text-decoration: underline;
}

/* ==================== LIGHT THEME OVERRIDES ==================== */
/* Override hardcoded dark colors for light mode */

[data-theme="light"] body {
  background: var(--bg);
}

[data-theme="light"] .app-header {
  background: var(--panel);
  border-color: var(--border);
}

[data-theme="light"] .bottom-nav {
  background: rgba(255, 255, 255, 0.74);
  border-color: var(--border);
}

[data-theme="light"] .compact-player {
  background: rgba(255, 255, 255, 0.78);
  border-color: var(--border);
}

[data-theme="light"] .bottom-nav::before {
  background: linear-gradient(to top, rgba(255, 255, 255, 0.3), transparent);
}

[data-theme="light"] .nav-item-radio {
  color: #475569;
  background: rgba(148, 163, 184, 0.22);
  border-color: rgba(100, 116, 139, 0.35);
}

[data-theme="light"] .nav-item-radio:hover {
  background: rgba(148, 163, 184, 0.32);
  border-color: rgba(59, 130, 246, 0.5);
  color: #2563eb;
}

[data-theme="light"] .nav-item-radio.player-visible {
  color: #16a34a;
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(22, 163, 74, 0.42);
}

[data-theme="light"] .compact-player-toggle-btn {
  background: rgba(226, 232, 240, 0.9);
  border-color: rgba(100, 116, 139, 0.5);
  color: #1e293b;
}

[data-theme="light"] .compact-player-toggle-btn:hover {
  background: rgba(203, 213, 225, 1);
}

[data-theme="light"] .compact-player-toggle-btn .icon-play,
[data-theme="light"] .compact-player-toggle-btn .icon-pause {
  fill: #1e293b;
  stroke: #1e293b;
}

[data-theme="light"] .compact-player-control {
  background: rgba(226, 232, 240, 0.8);
  border-color: rgba(148, 163, 184, 0.5);
  color: #334155;
}

[data-theme="light"] .compact-player-control:hover {
  background: rgba(203, 213, 225, 1);
  border-color: rgba(100, 116, 139, 0.6);
}

[data-theme="light"] .volume-meter-modal {
  background: rgba(241, 245, 249, 0.85);
  border-color: rgba(148, 163, 184, 0.35);
}

[data-theme="light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .modal-card {
  background: var(--panel);
  border-color: var(--border);
}

[data-theme="light"] .panel-card,
[data-theme="light"] .sidebar-card {
  background: var(--panel);
  border-color: var(--border);
}

[data-theme="light"] .feed-item {
  background: var(--panel);
  border-color: var(--border);
}

[data-theme="light"] .feed-item:hover {
  border-color: var(--accent);
}

[data-theme="light"] .feed-item-transcription {
  background: var(--panel-alt);
}

[data-theme="light"] .sidebar-scanner-header {
  background: var(--panel-alt);
  border-color: var(--border);
}

[data-theme="light"] .sidebar-player-display {
  background: var(--panel-alt);
  border-color: var(--border);
}

[data-theme="light"] .sidebar-stats-row {
  background: transparent;
}

[data-theme="light"] .sidebar-stat-item {
  background: var(--panel-alt);
}

[data-theme="light"] .sidebar-busy-item {
  background: var(--panel-alt);
}

[data-theme="light"] .sidebar-busy-item:hover {
  background: rgba(59, 130, 246, 0.1);
}

[data-theme="light"] .connection-status {
  background: var(--panel-alt);
}

[data-theme="light"] .filter-list {
  background: var(--panel-alt);
  border-color: var(--border);
}

[data-theme="light"] .filter-btn {
  background: var(--panel-alt);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="light"] .filter-btn:hover {
  background: var(--panel);
  border-color: var(--accent);
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea {
  background: var(--panel-alt);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="light"] .auth-form input[type="text"],
[data-theme="light"] .auth-form input[type="email"],
[data-theme="light"] .auth-form input[type="password"] {
  background: var(--panel-alt);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="light"] .auth-form input[type="text"]::placeholder,
[data-theme="light"] .auth-form input[type="email"]::placeholder,
[data-theme="light"] .auth-form input[type="password"]::placeholder {
  color: var(--muted);
}

[data-theme="light"] .password-requirements {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  color: #334155;
}

[data-theme="light"] .password-requirements li {
  color: #475569;
}

[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
  border-color: var(--accent);
}

[data-theme="light"] .auth-page {
  background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
}

[data-theme="light"] .auth-card {
  background: var(--panel);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .icon-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .icon-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

[data-theme="light"] .incident-item {
  background: var(--panel);
  border-color: var(--border);
}

[data-theme="light"] .incident-active-left {
  color: #14532d;
  border-color: rgba(22, 163, 74, 0.45);
  background: rgba(187, 247, 208, 0.8);
}

[data-theme="light"] .incident-cleared-left {
  color: #92400e;
  border-color: rgba(217, 119, 6, 0.45);
  background: rgba(254, 215, 170, 0.85);
}

[data-theme="light"] .cad-summary-row {
  background: var(--panel-alt);
}

[data-theme="light"] .cad-summary-row:hover {
  background: rgba(59, 130, 246, 0.1);
}

/* Archive/search results */
[data-theme="light"] .archive-results {
  background: var(--panel);
}

[data-theme="light"] .archive-item {
  border-color: var(--border);
}

[data-theme="light"] .download-icon {
  background: rgba(148, 163, 184, 0.3);
  border: 1px solid rgba(100, 116, 139, 0.35);
  color: #64748b;
}

[data-theme="light"] .download-icon:hover {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(59, 130, 246, 0.5);
  color: #2563eb;
}

/* Volume meter */
[data-theme="light"] .volume-bar,
[data-theme="light"] .volume-bar-small {
  background: var(--panel-alt);
}

/* Player modal */
[data-theme="light"] .player-display {
  background: var(--panel-alt);
  border-color: var(--border);
}

[data-theme="light"] .player-transcript {
  background: var(--panel-alt);
}

/* Busy talkgroups in modal */
[data-theme="light"] .player-busy-item {
  background: var(--panel-alt);
}

/* Settings modal */
[data-theme="light"] .settings-account-card {
  background: var(--panel-alt);
}

[data-theme="light"] .settings-preference-row {
  background: var(--panel-alt);
}

[data-theme="light"] .settings-email-controls input[type="email"] {
  background: #eef3fa;
  border-color: #c8d5e8;
  color: #1e293b;
}

[data-theme="light"] .settings-email-controls input[type="email"]::placeholder {
  color: #64748b;
}

[data-theme="light"] .settings-close-btn {
  background: var(--panel-alt);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="light"] .settings-close-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #dc2626;
}

[data-theme="light"] .theme-toggle-group {
  background: var(--panel);
  border: 1px solid var(--border);
}

/* Nav items */
[data-theme="light"] .nav-item {
  color: var(--muted);
}

[data-theme="light"] .nav-item:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
}

[data-theme="light"] .nav-item.active {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.15);
}

/* Sidebar player - correct class names */
[data-theme="light"] .sidebar-progress-bar {
  background: #cbd5e1;
}

[data-theme="light"] .sidebar-progress-fill {
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

[data-theme="light"] .sidebar-call-display {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

[data-theme="light"] .sidebar-player-title {
  color: var(--text);
}

[data-theme="light"] .sidebar-player-meta {
  color: var(--muted);
}

[data-theme="light"] .sidebar-play-btn {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: var(--text);
}

[data-theme="light"] .sidebar-play-btn:hover {
  background: #cbd5e1;
  border-color: var(--accent);
}

[data-theme="light"] .sidebar-play-btn.active {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #16a34a;
}

[data-theme="light"] .sidebar-play-btn.waiting {
  background: rgba(234, 179, 8, 0.15);
  border-color: rgba(234, 179, 8, 0.4);
  color: #ca8a04;
}

[data-theme="light"] .sidebar-skip-btn {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: var(--muted);
}

[data-theme="light"] .sidebar-skip-btn:hover {
  background: #cbd5e1;
  color: var(--text);
}

[data-theme="light"] .sidebar-scanner-header {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .sidebar-scanner-status {
  background: rgba(100, 116, 139, 0.15);
}

[data-theme="light"] .sidebar-scanner-status.active {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

[data-theme="light"] .sidebar-scanner-status.waiting {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
}

[data-theme="light"] .sidebar-progress-row {
  background: #f8fafc;
}

[data-theme="light"] .sidebar-stats-row {
  background: #f8fafc;
}

/* Player modal - comprehensive overrides */
[data-theme="light"] .modal-card-player {
  background: var(--panel);
}

[data-theme="light"] .player-status-badge {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
}

[data-theme="light"] .player-status-badge.playing {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

[data-theme="light"] .player-status-badge.waiting {
  background: rgba(234, 179, 8, 0.15);
  color: #ca8a04;
}

/* Player modal call display - the main call card area */
[data-theme="light"] .player-call-display {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

[data-theme="light"] .player-call-info {
  background: transparent;
}

[data-theme="light"] .player-call-name {
  color: var(--text);
}

[data-theme="light"] .player-call-tg {
  color: var(--muted);
}

[data-theme="light"] .player-call-badge {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
}

[data-theme="light"] .player-call-badge-tag {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

[data-theme="light"] .player-call-badge-desc {
  background: rgba(100, 116, 139, 0.1);
  color: var(--muted);
}

[data-theme="light"] .player-call-timestamp-row {
  background: #e2e8f0;
  color: var(--text);
}

[data-theme="light"] .player-call-timestamp-label {
  color: var(--muted);
}

[data-theme="light"] .player-call-timestamp-value {
  color: var(--text);
}

[data-theme="light"] .player-call-transcription {
  background: #e2e8f0;
  color: var(--text);
  border-left-color: var(--accent);
}

[data-theme="light"] .player-progress-bar {
  background: #e2e8f0;
}

[data-theme="light"] .player-progress-fill {
  background: linear-gradient(90deg, #22c55e, #4ade80);
}

[data-theme="light"] .player-action-btn {
  background: var(--panel-alt);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="light"] .player-action-btn:hover {
  background: var(--panel);
  border-color: var(--accent);
  color: var(--accent);
}

[data-theme="light"] .player-action-btn.stop-btn {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}

[data-theme="light"] .player-action-btn.stop-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

[data-theme="light"] .player-busy-chip {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: var(--text);
}

[data-theme="light"] .player-busy-chip:hover {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--accent);
}

[data-theme="light"] .modal-busy-list .busy-btn {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #1e293b;
}

[data-theme="light"] .modal-busy-list .busy-btn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

[data-theme="light"] .modal-busy-list .busy-btn.active {
  background: rgba(59, 130, 246, 0.18);
  border-color: #3b82f6;
  color: #1d4ed8;
}

[data-theme="light"] .modal-busy-list .busy-count {
  background: #475569;
  color: #f8fafc;
}

[data-theme="light"] .player-recent-table th {
  background: #f1f5f9;
  color: var(--muted);
}

[data-theme="light"] .player-recent-table td {
  border-color: #e2e8f0;
}

[data-theme="light"] .player-recent-table tr:hover td {
  background: rgba(59, 130, 246, 0.05);
}

[data-theme="light"] .player-section-header {
  color: var(--muted);
  background: #f8fafc;
}

/* CAD/Incidents page light mode */
[data-theme="light"] .cad-controls {
  background: var(--panel);
  border-color: var(--border);
}

[data-theme="light"] .cad-controls-compact {
  background: var(--panel);
  border-color: var(--border);
}

[data-theme="light"] .cad-view-toggle {
  background: rgba(248, 250, 252, 0.7);
  border-color: rgba(148, 163, 184, 0.45);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.2);
}

[data-theme="light"] .cad-view-btn {
  color: #475569;
}

[data-theme="light"] .cad-view-btn.active {
  background: rgba(59, 130, 246, 0.9);
  color: #ffffff;
}

[data-theme="light"] .cad-tab {
  background: var(--panel-alt);
  color: var(--muted);
}

[data-theme="light"] .cad-tab:hover {
  background: var(--panel);
}

[data-theme="light"] .cad-tab.active {
  background: var(--accent);
  color: white;
}

[data-theme="light"] .incident-card {
  background: var(--panel);
  border-color: var(--border);
}

/* CAD incident cards (the main incident list items) */
[data-theme="light"] .cad-item {
  background: var(--panel);
  border-color: var(--border);
}

[data-theme="light"] .cad-page .cad-item:hover {
  background: #f8fafc;
  border-color: var(--accent);
}

[data-theme="light"] .cad-page .cad-item.selected {
  background: rgba(59, 130, 246, 0.08);
  border-color: var(--accent);
}

[data-theme="light"] .cad-page .cad-item.cad-units-alert,
[data-theme="light"] .cad-card .cad-item.cad-units-alert {
  border-color: rgba(239, 68, 68, 0.42);
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.15), 0 6px 14px rgba(239, 68, 68, 0.1);
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.95), rgba(248, 250, 252, 0.96));
}

[data-theme="light"] .cad-page .cad-item.cad-units-alert::before,
[data-theme="light"] .cad-card .cad-item.cad-units-alert::before {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.55), rgba(248, 113, 113, 0.35));
}

[data-theme="light"] .cad-page .cad-item.cad-units-alert:hover {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.2), 0 8px 16px rgba(239, 68, 68, 0.12);
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.9), rgba(248, 250, 252, 0.96));
}

[data-theme="light"] .cad-page .cad-item.cad-units-alert.selected {
  border-color: rgba(239, 68, 68, 0.62);
  box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.22),
              0 0 0 2px rgba(239, 68, 68, 0.12),
              0 8px 18px rgba(239, 68, 68, 0.14);
  background: linear-gradient(135deg, rgba(254, 226, 226, 0.92), rgba(248, 250, 252, 0.96));
}

[data-theme="light"] .cad-title {
  color: var(--text);
}

[data-theme="light"] .cad-incident-type {
  color: #1e40af !important; /* Strong blue for visibility */
  text-shadow: none !important;
}

[data-theme="light"] .cad-meta {
  color: var(--muted);
}

[data-theme="light"] .cad-location {
  color: var(--text);
}

[data-theme="light"] .cad-location a {
  color: var(--accent);
}

[data-theme="light"] .cad-footer {
  color: var(--muted);
  border-color: var(--border);
}

[data-theme="light"] .cad-summary-chip {
  background: #f8fafc;
  border-color: #dbe4f0;
  color: #475569;
}

[data-theme="light"] .cad-footer a {
  color: var(--accent);
}

/* CAD map panel */
[data-theme="light"] .cad-map.panel-card {
  background: var(--panel);
  border-color: var(--border);
}

/* CAD list panel */
[data-theme="light"] .cad-list-panel {
  background: var(--panel);
  border-color: var(--border);
}

[data-theme="light"] .cad-list {
  background: transparent;
}

[data-theme="light"] .incident-type-badge {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
}

[data-theme="light"] .incident-type-badge.ems {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

[data-theme="light"] .incident-type-badge.fire {
  background: rgba(249, 115, 22, 0.15);
  color: #ea580c;
}

[data-theme="light"] .cad-units-row,
[data-theme="light"] .cad-matches-row {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .cad-units-row:hover,
[data-theme="light"] .cad-matches-row:hover {
  background: #f1f5f9;
}

[data-theme="light"] .cad-units-details,
[data-theme="light"] .incident-matches {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .cad-units-header {
  background: #f1f5f9;
  color: var(--muted);
}

[data-theme="light"] .cad-unit-row {
  border-color: #e2e8f0;
}

[data-theme="light"] .incident-match {
  background: var(--panel);
  border-color: #e2e8f0;
}

[data-theme="light"] .incident-match-info {
  color: var(--text);
}

[data-theme="light"] .incident-match-time {
  color: var(--muted);
}

[data-theme="light"] .cad-matches {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .cad-match {
  background: var(--panel);
  border-color: #e2e8f0;
}

[data-theme="light"] .cad-detail-section {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .cad-detail-hero {
  background: linear-gradient(165deg, rgba(248, 250, 252, 1), rgba(241, 245, 249, 0.9));
  border-color: #d6deea;
}

[data-theme="light"] .cad-detail-map-shell {
  background: #f8fafc;
  border-color: #d6deea;
}

[data-theme="light"] .cad-detail-map .leaflet-control-attribution {
  background: rgba(248, 250, 252, 0.9);
  color: #64748b;
}

[data-theme="light"] .cad-incident-map-btn {
  background: rgba(248, 250, 252, 0.92);
  border-color: rgba(148, 163, 184, 0.65);
  color: #1e293b;
}

[data-theme="light"] .cad-incident-map-btn:hover:not(:disabled) {
  background: rgba(239, 246, 255, 0.98);
  border-color: rgba(59, 130, 246, 0.6);
  color: #1d4ed8;
}

[data-theme="light"] .cad-detail-location {
  color: #0f172a;
}

[data-theme="light"] .cad-detail-municipality {
  color: #475569;
}

[data-theme="light"] .cad-detail-fact {
  background: #f8fafc;
  border-color: #e2e8f0;
}

[data-theme="light"] .cad-detail-fact-value {
  color: #0f172a;
}

[data-theme="light"] .cad-detail-type {
  color: #1e293b;
}

[data-theme="light"] .cad-detail-type.cad-detail-type-fire {
  color: #c2410c;
}

[data-theme="light"] .cad-detail-type.cad-detail-type-ems {
  color: #075985;
}

[data-theme="light"] .cad-detail-type.cad-detail-type-traffic {
  color: #a16207;
}

[data-theme="light"] .cad-detail-match-time,
[data-theme="light"] .cad-detail-empty {
  color: #64748b;
}

[data-theme="light"] .cad-detail-match-label {
  color: #1e293b;
}

[data-theme="light"] .cad-match-info {
  color: var(--text);
}

[data-theme="light"] .cad-match-info span {
  color: var(--text);
}

[data-theme="light"] .cad-match-time {
  color: var(--muted);
}

[data-theme="light"] .cad-match-progress-track {
  background: rgba(148, 163, 184, 0.28);
}

[data-theme="light"] .cad-match-progress-fill {
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
}

[data-theme="light"] .cad-match.is-playing .cad-match-status {
  color: #15803d;
}

[data-theme="light"] .cad-match.is-paused .cad-match-status {
  color: #64748b;
}

[data-theme="light"] .cad-match-play.is-playing {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.45);
  color: #166534;
}

[data-theme="light"] .cad-match-play.is-paused {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.45);
  color: #1d4ed8;
}

/* Leaflet map controls */
[data-theme="light"] .leaflet-control-zoom a {
  background: var(--panel);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="light"] .leaflet-control-zoom a:hover {
  background: var(--panel-alt);
}

/* Queue count dropdown */
[data-theme="light"] .queue-dropdown,
[data-theme="light"] .filter-dropdown {
  background: var(--panel);
  border-color: var(--border);
}

/* Tag badges */
[data-theme="light"] .tag-badge {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
  border-color: rgba(59, 130, 246, 0.25);
}

/* Archive view */
[data-theme="light"] .archive-filters {
  background: var(--panel);
  border-color: var(--border);
}

[data-theme="light"] .archive-item {
  background: var(--panel);
}

[data-theme="light"] .archive-item:hover {
  background: #f8fafc;
}
