/* ============================================================
   Foot Traffic Analytics — iViu Insights
   app.css  (matches partner portal visual language)
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  --header-height: 0px;
  --footer-height: 44px;
  --selector-height: 56px;
  --tab-height: 44px;
  --ink: #0f172a;
  --ink-muted: #475569;
  --brand: #2189D0;
  --brand-dark: #1a72b8;
  --surface: #f8fafc;
  --card: #ffffff;
  --accent: #F07F21;
  --input-bg: #ffffff;
  --input-border: #b8d8f0;
}

body[data-theme="dark"] {
  --ink: #e2e8f0;
  --ink-muted: #94a3b8;
  --surface: #0b1220;
  --card: #111827;
  --input-bg: #0b1220;
  --input-border: #1f2937;
}

/* ── Base ──────────────────────────────────────────────────── */
html {
  min-width: 1024px;
}

body {
  background: var(--surface);
  color: var(--ink);
  font-family: "Roboto", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 0.88rem;
  min-height: 100vh;
  padding-top: calc(var(--header-height) + var(--selector-height) + var(--tab-height));
  padding-bottom: calc(var(--footer-height) + 1.5rem);
}

/* ── Selector bar brand ────────────────────────────────────── */
.fta-selector-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.fta-selector-divider {
  width: 1px;
  height: 28px;
  background: rgba(33, 137, 208, 0.25);
  flex-shrink: 0;
}

.header-logo {
  height: 30px;
  width: auto;
}

.header-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

/* ── Footer ────────────────────────────────────────────────── */
.page-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, 0.85);
  color: var(--ink-muted);
  font-size: 0.85rem;
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  z-index: 1070;
  min-height: var(--footer-height);
}

.page-footer .theme-toggle {
  position: absolute;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
}

.page-footer .site-version {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

body[data-theme="dark"] .page-footer {
  background: rgba(15, 23, 42, 0.85);
  border-top-color: rgba(148, 163, 184, 0.2);
}

body[data-theme="dark"] .page-footer .theme-toggle {
  border-color: rgba(152, 160, 169, 0.6);
  color: #98a0a9;
}

/* ── Selector bar ──────────────────────────────────────────── */
.fta-selector-bar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: var(--selector-height);
  z-index: 1080;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.5rem;
  background: var(--card);
  border-top: 2px solid var(--brand);
  border-bottom: 1px solid rgba(33, 137, 208, 0.18);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

body[data-theme="dark"] .fta-selector-bar {
  background: #0f172a;
  border-bottom-color: rgba(33, 137, 208, 0.22);
}

.fta-select {
  height: 32px;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--input-border);
  border-radius: 0.375rem;
  background: var(--input-bg);
  color: var(--ink);
  font-family: "Roboto", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 0.82rem;
  max-width: 220px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}

.fta-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(33, 137, 208, 0.18);
}

.fta-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Location search typeahead ─────────────────────────────── */
.fta-loc-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 260px;
  max-width: 360px;
  flex: 1 1 260px;
  margin-left: auto;
}

.fta-loc-search-icon {
  position: absolute;
  left: 8px;
  color: var(--ink-muted);
  font-size: 13px;
  pointer-events: none;
}

.fta-loc-search-input {
  height: 32px;
  width: 100%;
  padding: 0.25rem 2rem 0.25rem 1.8rem;
  border: 1px solid var(--input-border);
  border-radius: 0.375rem;
  background: var(--input-bg);
  color: var(--ink);
  font-family: "Roboto", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.fta-loc-search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(33, 137, 208, 0.18);
}

.fta-loc-search-input.has-value {
  border-color: var(--brand);
  font-weight: 500;
}

body[data-theme="dark"] .fta-loc-search-input {
  background: var(--input-bg);
  color: var(--ink);
}

.fta-loc-clear-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  font-size: 12px;
}
.fta-loc-clear-btn:hover { color: var(--ink); }

.fta-loc-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 2000;
  background: var(--card);
  border: 1px solid var(--input-border);
  border-radius: 0.375rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.fta-loc-dropdown.open { display: block; }

body[data-theme="dark"] .fta-loc-dropdown {
  background: #1e293b;
  border-color: rgba(33, 137, 208, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.fta-loc-option {
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--ink);
  border-bottom: 1px solid rgba(33, 137, 208, 0.06);
}

.fta-loc-option:last-child { border-bottom: none; }

.fta-loc-option:hover,
.fta-loc-option[aria-selected="true"] {
  background: rgba(33, 137, 208, 0.1);
}

body[data-theme="dark"] .fta-loc-option:hover,
body[data-theme="dark"] .fta-loc-option[aria-selected="true"] {
  background: rgba(33, 137, 208, 0.2);
}

.fta-loc-option-name {
  font-weight: 500;
  color: var(--ink);
}

.fta-loc-option-customer {
  font-size: 0.76rem;
  color: var(--ink-muted);
  margin-top: 1px;
}

.fta-loc-id {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--ink-muted);
  margin-left: 0.35rem;
}

.fta-loc-clientid {
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-left: 0.2rem;
}

.fta-loc-option-hint {
  font-size: 0.76rem;
  color: var(--ink-muted);
  font-style: italic;
  padding: 6px 12px;
}

mark.fta-match {
  background: transparent;
  color: var(--brand);
  font-weight: 600;
  padding: 0;
}

.fta-date-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.fta-date-input {
  height: 32px;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--input-border);
  border-radius: 0.375rem;
  background: var(--input-bg);
  color: var(--ink);
  font-family: "Roboto", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s;
}

.fta-date-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(33, 137, 208, 0.18);
}

.fta-date-sep {
  color: var(--ink-muted);
  font-weight: 600;
}

.fta-apply-btn {
  white-space: nowrap;
}

/* ── Tab bar ───────────────────────────────────────────────── */
.fta-tab-bar {
  position: fixed;
  top: calc(var(--header-height) + var(--selector-height));
  left: 0;
  right: 0;
  height: var(--tab-height);
  z-index: 1070;
  display: flex;
  align-items: stretch;
  padding: 0 1rem;
  background: var(--card);
  border-bottom: 2px solid var(--brand);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
  overflow-x: auto;
}

body[data-theme="dark"] .fta-tab-bar {
  background: #111827;
}

.fta-tabs {
  display: flex;
  align-items: stretch;
  height: 100%;
  gap: 1px;
}

.fta-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: 100%;
  padding: 0 1rem;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  background: transparent;
  font-family: "Roboto", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
  transition: color 0.15s, border-bottom-color 0.15s, background 0.15s;
  white-space: nowrap;
  border-radius: 4px 4px 0 0;
}

.fta-tab:hover {
  color: var(--ink);
  background: rgba(33, 137, 208, 0.07);
}

.fta-tab.active {
  color: var(--brand);
  font-weight: 600;
  background: rgba(33, 137, 208, 0.06);
  border-bottom-color: var(--brand);
}

/* ── Content area ──────────────────────────────────────────── */
.fta-content {
  padding: 1.25rem 1.5rem;
}

.fta-view {
  /* views are shown/hidden by js */
}

/* ── Alert ─────────────────────────────────────────────────── */
.fta-alert {
  margin-bottom: 1rem;
  border-radius: 0.5rem;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  color: var(--ink);
}

body[data-theme="dark"] .card {
  border-color: rgba(148, 163, 184, 0.12);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.fta-card-kpi {
  border-left: 4px solid var(--brand);
}

.fta-card-header {
  background: transparent;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
  padding: 0.65rem 1rem;
}

body[data-theme="dark"] .fta-card-header {
  border-bottom-color: rgba(148, 163, 184, 0.1);
}

.fta-header-sub {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.card-body {
  color: var(--ink);
}

/* ── KPI values ────────────────────────────────────────────── */
.fta-kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}

.fta-kpi-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.fta-kpi-delta {
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.fta-kpi-delta .positive { color: #22c55e; }
.fta-kpi-delta .negative { color: #ef4444; }

/* delta spans emitted by fmtDelta() */
span.positive { color: #22c55e; }
span.negative { color: #ef4444; }

/* ── Tables ────────────────────────────────────────────────── */
.fta-table thead th {
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  border: none;
  padding: 0.4rem 0.65rem;
}

body[data-theme="dark"] .fta-table thead th {
  background: #1a6caa;
  color: #e2f0fb;
}

.fta-table tbody td {
  white-space: nowrap;
  vertical-align: middle;
  color: var(--ink);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  padding: 0.35rem 0.65rem;
}

body[data-theme="dark"] .fta-table tbody td {
  border-bottom-color: rgba(148, 163, 184, 0.1);
}

.fta-table tbody tr:hover td {
  background: rgba(33, 137, 208, 0.06);
}

body[data-theme="dark"] .fta-table tbody tr:hover td {
  background: rgba(33, 137, 208, 0.1);
}

/* Bootstrap table dark mode overrides */
body[data-theme="dark"] .table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: rgba(33, 137, 208, 0.1);
  --bs-table-color: var(--ink);
  color: var(--ink);
}

/* ── Form controls (dark mode) ────────────────────────────── */
.form-control,
.form-select {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--ink);
  font-family: "Roboto", "Gill Sans", "Trebuchet MS", sans-serif;
  font-size: 0.88rem;
}

.form-control:focus,
.form-select:focus {
  background: var(--input-bg);
  border-color: var(--brand);
  color: var(--ink);
  box-shadow: 0 0 0 0.2rem rgba(33, 137, 208, 0.25);
}

body[data-theme="dark"] .form-control,
body[data-theme="dark"] .form-control:focus,
body[data-theme="dark"] .form-select,
body[data-theme="dark"] .form-select:focus {
  background-color: var(--input-bg);
  color: var(--ink);
  border-color: var(--input-border);
}

body[data-theme="dark"] .text-muted {
  color: var(--ink-muted) !important;
}

/* ── Brand button ──────────────────────────────────────────── */
.btn-brand {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-brand:hover,
.btn-brand:focus {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

/* ── Heatmap bar ───────────────────────────────────────────── */
.heat-bar {
  height: 14px;
  border-radius: 3px;
  background: linear-gradient(to right, #fff5f0, #d73027);
  min-width: 30px;
}

body[data-theme="dark"] .heat-bar {
  background: linear-gradient(to right, #1e2d3d, #ef4444);
}

/* ── Journey ───────────────────────────────────────────────── */
.fta-journey-list {
  max-height: 480px;
  overflow-y: auto;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 6px;
  padding: 0.5rem;
  background: var(--card);
}

body[data-theme="dark"] .fta-journey-list {
  border-color: rgba(148, 163, 184, 0.15);
}

.fta-journey-list .device-item {
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  border-radius: 5px;
  margin-bottom: 2px;
  font-size: 0.82rem;
  color: var(--ink);
  transition: background 0.12s;
}

.fta-journey-list .device-item:hover,
.fta-journey-list .device-item.active {
  background: rgba(33, 137, 208, 0.1);
}

.fta-journey-timeline {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 6px;
  min-height: 340px;
  padding: 0.75rem;
  overflow-y: auto;
  max-height: 480px;
  background: var(--card);
}

body[data-theme="dark"] .fta-journey-timeline {
  border-color: rgba(148, 163, 184, 0.15);
}

.fta-journey-step {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  color: var(--ink);
}

.fta-journey-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  margin-top: 4px;
  flex-shrink: 0;
}

.fta-journey-line {
  width: 2px;
  height: 22px;
  background: rgba(33, 137, 208, 0.25);
  margin-left: 4px;
  flex-shrink: 0;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge-customer  { background: var(--brand);  color: #fff; border-radius: 4px; padding: 2px 6px; font-size: 0.75rem; }
.badge-employee  { background: #6f42c1; color: #fff; border-radius: 4px; padding: 2px 6px; font-size: 0.75rem; }
.badge-passerby  { background: #6c757d; color: #fff; border-radius: 4px; padding: 2px 6px; font-size: 0.75rem; }
.badge-poi       { background: var(--accent);  color: #fff; border-radius: 4px; padding: 2px 6px; font-size: 0.75rem; }
.badge-excluded  { background: #dc3545; color: #fff; border-radius: 4px; padding: 2px 6px; font-size: 0.75rem; }

/* ── Spinner ───────────────────────────────────────────────── */
.fta-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: fta-spin 0.6s linear infinite;
}

@keyframes fta-spin {
  to { transform: rotate(360deg); }
}

/* ── Theme toggle ──────────────────────────────────────────── */
.theme-toggle {
  border-radius: 999px;
}

/* ── Utility ───────────────────────────────────────────────── */
.cursor-pointer { cursor: pointer; }

/* ══════════════════════════════════════════════════════════
   Live View — Canvas Radar / Pings / Topo
   ══════════════════════════════════════════════════════════ */

.fta-live-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  max-width: 700px;
  margin: 0 auto;
}

/* Canvas panel (inside split layout, max-width constraint overridden) */
.fta-live-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: none;
  aspect-ratio: 1 / 1;
  background: #dce8f0;
  overflow: hidden;
  border-radius: 4px;
  font-family: 'Courier New', Courier, monospace;
}
body[data-theme="dark"] .fta-live-canvas-wrap {
  background: #0b1a28;
}

/* Canvas fills the wrapper */
.fta-live-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Scan overlay title */
.fta-live-title {
  position: absolute;
  top: 10px;
  left: 14px;
  font-size: 9px;
  letter-spacing: .08em;
  color: #4a6e84;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 2;
}
body[data-theme="dark"] .fta-live-title {
  color: #4c7fa0;
}

/* Compass — top-right */
.fta-live-compass {
  position: absolute;
  top: 8px;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #4a6e84;
  pointer-events: none;
  z-index: 2;
}
body[data-theme="dark"] .fta-live-compass {
  color: #4c7fa0;
}
.fta-live-compass-n {
  font-size: 9px;
  letter-spacing: .1em;
  line-height: 1.2;
  text-transform: uppercase;
}
.fta-live-compass-ring {
  color: inherit;
}

/* Corner brackets (targeting reticle) */
.fta-live-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: #F07F21;
  border-style: solid;
  border-width: 0;
  pointer-events: none;
  z-index: 3;
}
.fta-live-corner-tl { top: 6px;  left: 6px;  border-top-width: 2px;  border-left-width: 2px; }
.fta-live-corner-tr { top: 6px;  right: 6px; border-top-width: 2px;  border-right-width: 2px; }
.fta-live-corner-bl { bottom: 6px; left: 6px;  border-bottom-width: 2px; border-left-width: 2px; }
.fta-live-corner-br { bottom: 6px; right: 6px; border-bottom-width: 2px; border-right-width: 2px; }

/* Info panel — bottom-left */
.fta-live-info {
  position: absolute;
  bottom: 32px;
  left: 12px;
  font-size: 9px;
  line-height: 1.6;
  color: #2c4a60;
  pointer-events: none;
  z-index: 2;
}
body[data-theme="dark"] .fta-live-info {
  color: #7aadca;
}
.fta-live-loc-name {
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 2px;
}
.fta-live-counts {
  margin-bottom: 4px;
}

/* Legend rows */
.fta-live-legend { margin-top: 2px; }
.fta-live-legend-row { display: flex; align-items: center; gap: 5px; }
.fta-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.fta-live-dot.dot-alert  { background: #F07F21; }
.fta-live-dot.dot-breach { background: #FF4444; }

/* Status bar — bottom */
.fta-live-statusbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: rgba(33,137,208,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: #2189D0;
  pointer-events: none;
  z-index: 2;
}
body[data-theme="dark"] .fta-live-statusbar {
  background: rgba(33,137,208,.18);
  color: #5ab0d8;
}

/* Tooltip */
.fta-live-tooltip {
  position: absolute;
  background: rgba(0,0,0,.75);
  color: #fff;
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 3px;
  pointer-events: none;
  display: none;
  z-index: 10;
}

/* Controls row */
.fta-live-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 640px;
  padding: 4px 0;
}

.fta-live-toggle-label {
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-muted);
}

/* Mode buttons */
.fta-live-mode-btns {
  display: flex;
  gap: 0;
}
.fta-live-mode-btn {
  background: transparent;
  border: 1px solid var(--brand);
  color: var(--brand);
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  letter-spacing: .05em;
  padding: 4px 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.fta-live-mode-btn:first-child { border-radius: 3px 0 0 3px; }
.fta-live-mode-btn:last-child  { border-radius: 0 3px 3px 0; }
.fta-live-mode-btn + .fta-live-mode-btn { border-left: none; }
.fta-live-mode-btn:hover  { background: var(--brand); color: #fff; }
.fta-live-mode-btn.active { background: var(--brand); color: #fff; }

body[data-theme="dark"] .fta-live-mode-btn {
  border-color: var(--brand);
  color: var(--brand);
}
body[data-theme="dark"] .fta-live-mode-btn:hover,
body[data-theme="dark"] .fta-live-mode-btn.active {
  background: var(--brand);
  color: #fff;
}

.fta-live-mode-btn:first-child { border-radius: 3px 0 0 3px; }
.fta-live-mode-btn:last-child  { border-radius: 0 3px 3px 0; }
.fta-live-mode-btn + .fta-live-mode-btn { border-left: none; }
.fta-live-mode-btn:hover  { background: var(--brand); color: #fff; }
.fta-live-mode-btn.active { background: var(--brand); color: #fff; }

body[data-theme="dark"] .fta-live-mode-btn {
  border-color: var(--brand);
  color: var(--brand);
}
body[data-theme="dark"] .fta-live-mode-btn:hover,
body[data-theme="dark"] .fta-live-mode-btn.active {
  background: var(--brand);
  color: #fff;
}

.fta-live-device-count {
  font-size: 12px;
  color: var(--ink-muted);
}

/* ============================================================
   Live view split layout
   ============================================================ */
.fta-live-split {
  display: flex;
  flex-direction: row;
  gap: 12px;
  height: calc(100vh - 120px);
  min-height: 480px;
}

/* Canvas side takes remaining space */
.fta-live-split .fta-live-canvas-wrap {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Right metrics panel */
.fta-live-metrics {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-y: auto;
}

.live-metrics-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--brand);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 2px;
}

.live-metric-card {
  background: var(--surface-alt, rgba(0,0,0,0.04));
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 8px 10px;
}
body[data-theme="dark"] .live-metric-card {
  background: rgba(255,255,255,0.04);
}

.live-metric-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.live-metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.1;
}

.live-metric-card--zones .live-metric-value {
  font-size: 13px;
}

/* Zone breakdown list */
.live-zone-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.live-zone-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}
.live-zone-name {
  flex: 0 0 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 10px;
}
.live-zone-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.live-zone-bar span {
  display: block;
  height: 100%;
  background: var(--brand);
  border-radius: 3px;
  transition: width 0.3s;
}
.live-zone-count {
  flex: 0 0 24px;
  text-align: right;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
}

/* Auto-refresh badge */
.live-updated-ago {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #00be96;
  text-transform: uppercase;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}
.live-pulsing {
  animation: livePulse 2s ease-in-out infinite;
}

/* Gear button in selector bar */
.fta-gear-btn {
  flex-shrink: 0;
  margin-left: 6px;
}

/* ============================================================
   Heatmap canvas panel
   ============================================================ */
.heatmap-canvas-wrap {
  width: 100%;
  height: 340px;
  background: #090f18;
  border-radius: 6px;
  margin-bottom: 14px;
  overflow: hidden;
  position: relative;
}
.heatmap-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ============================================================
   Preferences modal
   ============================================================ */
.fta-modal-content {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}
.fta-modal-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
}
.fta-modal-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
}
.fta-pref-tabs {
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
}
.fta-pref-tabs .nav-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  border-radius: 4px 4px 0 0;
  padding: 7px 14px;
}
.fta-pref-tabs .nav-link.active {
  color: var(--brand);
  border-color: var(--border) var(--border) var(--surface);
  background: var(--surface);
}
.fta-pref-tab-content {
  padding: 18px 20px;
  min-height: 200px;
}
.fta-pref-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.fta-pref-label {
  flex: 0 0 180px;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 0;
}
.fta-pref-range {
  flex: 1;
}
.fta-pref-val {
  flex: 0 0 52px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  text-align: right;
}
.fta-pref-select {
  flex: 1;
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}
.fta-pref-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 8px;
  margin-top: 0;
}
.fta-pref-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
}

/* Dark mode adjustments for modal */
body[data-theme="dark"] .fta-modal-content {
  background: #0d1e30;
  color: #d0e8f8;
  border-color: #1e3a56;
}
body[data-theme="dark"] .fta-modal-header,
body[data-theme="dark"] .fta-modal-footer {
  background: #0d1e30;
  border-color: #1e3a56;
}
body[data-theme="dark"] .fta-pref-tabs .nav-link.active {
  background: #0d1e30;
  border-color: #1e3a56 #1e3a56 #0d1e30;
}
body[data-theme="dark"] .fta-pref-select {
  background: #101e2e;
  color: #d0e8f8;
  border-color: #1e3a56;
}
body[data-theme="dark"] .live-metric-card {
  border-color: #1e3a56;
}
body[data-theme="dark"] .fta-live-metrics {
  background: #0d1e30;
  border-color: #1e3a56;
}

