/* ============================================================
   ALKARA FleetFMS — Command Center CSS
   Stage 3/4: Map-Dominant Layout + Floating Toolbar
   OFALabs UI/UX guidelines: flat, minimal, data-dense
   ============================================================ */

/* header__live hidden on Live Map — works via :has() in modern browsers
   and via .fc-live-hidden class applied by JS for Firefox compatibility */
body:has(.fc-command) .header__live { display: none; }
.fc-live-hidden { display: none !important; }

/* ==========================================================
   DESIGN TOKENS
   ========================================================== */
.fc-command {
  --canvas:       #f8fafc;
  --surface:      #ffffff;
  --border:       #e2e8f0;
  --border-soft:  #f1f5f9;
  --accent:       #2563eb;
  --accent-soft:  #eff6ff;
  --text:         #0f172a;
  --muted:        #64748b;
  --muted-light:  #94a3b8;

  /* Semantic status colours */
  --c-hauling:   #0369a1; --bg-hauling:   #e0f2fe;
  --c-loading:   #15803d; --bg-loading:   #dcfce7;
  --c-active:    #15803d; --bg-active:    #dcfce7;
  --c-queuing:   #854d0e; --bg-queuing:   #fef9c3;
  --c-dumping:   #854d0e; --bg-dumping:   #fef9c3;
  --c-returning: #475569; --bg-returning: #f1f5f9;
  --c-standby:   #475569; --bg-standby:   #f1f5f9;
  --c-breakdown: #b91c1c; --bg-breakdown: #fee2e2;
  --c-offline:   #64748b; --bg-offline:   #f1f5f9;

  display:        flex !important;
  flex-direction: column;
  height:         100%;
  overflow:       hidden;
  background:     var(--canvas);
  color:          var(--text);
  font:           12px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.01em;
  /* isolation:isolate removed — was creating stacking context that blocked MapLibre popup z-index */
  position:       relative;
}
.fc-command * { box-sizing: border-box; }

.fc-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-feature-settings: "tnum" 1;
}

/* ==========================================================
   BASE ELEMENTS
   ========================================================== */
.fc-command button,
.fc-command input,
.fc-command select,
.fc-command summary { font: inherit; color: inherit; }

.fc-command button {
  border:       1px solid var(--border);
  background:   var(--surface);
  color:        var(--text);
  padding:      5px 10px;
  cursor:       pointer;
  border-radius: 8px;
  line-height:  1.35;
  white-space:  nowrap;
  font-weight:  500;
  transition:   background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.fc-command button:hover:not(:disabled) { background: var(--canvas); border-color: #cbd5e1; }
.fc-command button[aria-pressed="true"] {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600;
}
.fc-command button:disabled { opacity: 0.4; cursor: not-allowed; }
.fc-command :focus-visible  { outline: 2px solid var(--accent); outline-offset: 2px; }

.fc-command input,
.fc-command select {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 9px; max-width: 100%; min-width: 0;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.fc-command input:focus,
.fc-command select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--accent-soft); }

/* ==========================================================
   STATUS PILLS
   ========================================================== */
.fc-pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 9999px;
  font-size: 10px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.fc-pill-hauling   { background: var(--bg-hauling);   color: var(--c-hauling); }
.fc-pill-loading   { background: var(--bg-loading);   color: var(--c-loading); }
.fc-pill-active    { background: var(--bg-active);    color: var(--c-active); }
.fc-pill-queuing   { background: var(--bg-queuing);   color: var(--c-queuing); }
.fc-pill-dumping   { background: var(--bg-dumping);   color: var(--c-dumping); }
.fc-pill-returning { background: var(--bg-returning); color: var(--c-returning); }
.fc-pill-standby   { background: var(--bg-standby);   color: var(--c-standby); }
.fc-pill-breakdown { background: var(--bg-breakdown); color: var(--c-breakdown); }
.fc-pill-offline, .fc-pill-unknown, .fc-pill-default {
  background: var(--bg-offline); color: var(--c-offline);
}

/* ==========================================================
   GLOBAL HEADER  (40px, slim)
   ========================================================== */
/* ==========================================================
   OPERATIONAL STATUS BAR (38px, flat, data-dense industrial)
   ========================================================== */
.fc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  height: 38px;
  min-height: 38px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  user-select: none;
  z-index: 10;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.fc-header::-webkit-scrollbar {
  display: none;
}

.fc-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fc-site-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--canvas);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.fc-site-icon {
  width: 12px;
  height: 12px;
  color: var(--accent);
  flex-shrink: 0;
}

.fc-site-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.fc-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}

/* Status metric pill bar */
.fc-header-counts {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 1; /* Allow shrinking on medium screens to prevent overflow */
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.fc-header-counts::-webkit-scrollbar { display: none; }

.fc-cnt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 9999px;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  cursor: default;
  transition: transform 0.1s ease;
}

.fc-cnt strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 700;
}

.fc-cnt-lbl {
  font-size: 11px;
  font-weight: 500;
}

.fc-cnt-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Strict semantic status colors per OFALabs guidelines */
.fc-cnt-active {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid rgba(21, 128, 61, 0.2);
}

.fc-cnt-hauling {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid rgba(3, 105, 161, 0.2);
}

.fc-cnt-loading {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid rgba(21, 128, 61, 0.2);
}

.fc-cnt-queuing {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid rgba(133, 77, 14, 0.2);
}

.fc-cnt-breakdown {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid rgba(185, 28, 28, 0.2);
}

.fc-cnt-offline {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

/* Header Right Area */
.fc-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fc-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
  white-space: nowrap;
}

.fc-live-pill.is-live {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid rgba(21, 128, 61, 0.25);
}

.fc-live-pill.is-stale {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid rgba(185, 28, 28, 0.25);
}

.fc-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.fc-live-pill.is-live .fc-live-dot {
  animation: fc-pulse 1.8s infinite;
}

.fc-btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.3;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.fc-btn-reset:hover {
  background: var(--canvas);
  border-color: #cbd5e1;
  color: var(--text);
}

.fc-btn-reset svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
}

.fc-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  transition: all 0.12s ease;
}

.fc-btn-icon:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.fc-btn-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

@keyframes fc-pulse { 0%,100% { opacity:1; } 50% { opacity:.35; } }
@keyframes fc-popover-in {
  from { opacity:0; transform: scale(.96) translateY(-4px); }
  to   { opacity:1; transform: scale(1) translateY(0); }
}

/* GPU hint for animated popover elements */
.fc-search-panel,
.fc-layers-popover,
.fc-follow-overlay {
  will-change: transform, opacity;
}

/* Mobile-only scrim: explicitly inert on desktop (base rule outside media query) */
.fc-panel-scrim { display: none; }

@media (max-width: 1200px) {
  .fc-site-name { display: none; }
}

@media (max-width: 900px) {
  .fc-cnt-lbl { display: none; }
  .fc-site-badge { display: none; }
  .fc-btn-reset-lbl { display: none; }
}

/* ==========================================================
   WORKSPACE  (map fills 100%)
   ========================================================== */
.fc-workspace,
.fc-body { display: flex; flex: 1; min-height: 0; position: relative; width: 100%; height: 100%; }

.fc-map,
.fc-map-stage { flex: 1; position: relative; min-width: 0; min-height: 0; background: #eef0f3; overflow: hidden; width: 100%; height: 100%; }

/* Map cursor modes: Pan (grab/grabbing) vs Select (default/pointer) */
.fc-map-stage.is-mode-pan .maplibregl-canvas,
.fc-map-stage.is-mode-pan canvas {
  cursor: grab !important;
}
.fc-map-stage.is-mode-pan .maplibregl-canvas:active,
.fc-map-stage.is-mode-pan canvas:active {
  cursor: grabbing !important;
}
.fc-map-stage.is-mode-select .maplibregl-canvas,
.fc-map-stage.is-mode-select canvas {
  cursor: default !important;
}

/* ==========================================================
   FLOATING MAP TOOLBAR  (left vertical strip)
   ========================================================== */
.fc-float-toolbar {
  position: absolute; left: 12px; top: 12px; z-index: 1000;
  display: flex; flex-direction: column; gap: 4px;
  pointer-events: auto;
}
.fc-float-toolbar .fc-tb-btn {
  width: 36px; height: 36px; padding: 0; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(255,255,255,.96);
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  cursor: pointer; position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.fc-float-toolbar .fc-tb-btn:hover:not(:disabled) {
  background: var(--surface); border-color: #cbd5e1; color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.fc-float-toolbar .fc-tb-btn.is-active,
.fc-float-toolbar .fc-tb-btn[aria-pressed="true"] {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}
.fc-float-toolbar .fc-tb-btn svg {
  width: 16px; height: 16px; stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}
.fc-float-toolbar .fc-tb-sep { height: 1px; background: var(--border-soft); margin: 2px 4px; }

/* Tooltip */
.fc-float-toolbar .fc-tb-btn::after {
  content: attr(data-tip);
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  background: var(--text); color: #fff; font-size: 10px; font-weight: 500;
  padding: 3px 8px; border-radius: 6px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 100;
}
.fc-float-toolbar .fc-tb-btn:hover::after { opacity: 1; }

/* Badge on alert button */
.fc-tb-alert-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--c-breakdown); color: #fff;
  border-radius: 9999px; font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
}

/* ==========================================================
   FLOATING SEARCH PANEL
   ========================================================== */
.fc-search-panel {
  position: absolute; left: 56px; top: 12px; z-index: 1000;
  width: 320px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px -4px rgba(0,0,0,.12), 0 4px 8px -4px rgba(0,0,0,.06);
  display: flex; flex-direction: column; overflow: hidden;
  max-height: calc(100% - 24px);
  animation: fc-popover-in .16s cubic-bezier(.16,1,.3,1) forwards;
}

.fc-search-box {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px; border-bottom: 1px solid var(--border-soft); flex-shrink: 0;
}
.fc-search-box svg { width: 14px; height: 14px; stroke: var(--muted-light); fill: none; stroke-width: 1.75; flex-shrink: 0; }
.fc-search-box input {
  flex: 1; border: 0 !important; background: transparent !important;
  padding: 0 !important; font-size: 12px; color: var(--text); box-shadow: none !important; min-width: 0;
}
.fc-search-box input::placeholder { color: var(--muted-light); }
.fc-search-box button {
  border: 0; background: transparent; padding: 2px;
  color: var(--muted-light); box-shadow: none !important; font-size: 14px;
}
.fc-search-box button:hover { color: var(--text); background: transparent; }
.fc-search-filters {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--border-soft);
  background: var(--canvas);
}
.fc-filters-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.fc-filters-grid .fc-field { margin: 0; }
.fc-filters-grid .fc-field-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted);
}
.fc-filters-grid select {
  font-size: 11px; padding: 5px 6px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); width: 100%; outline: none;
}
.fc-filters-grid select:focus {
  border-color: var(--accent);
}
.fc-filters-toggles {
  display: flex; align-items: center; gap: 14px; padding: 2px 0;
}
.fc-filter-check {
  display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500;
  color: var(--text); cursor: pointer; user-select: none;
}
.fc-filter-check input[type="checkbox"] {
  accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; margin: 0;
}
.fc-filters-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 6px; border-top: 1px solid var(--border-soft);
}
.fc-filter-reset-btn {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  cursor: pointer; transition: all 0.15s;
}
.fc-filter-reset-btn:hover {
  background: var(--canvas); color: var(--text); border-color: var(--border-soft);
}
.fc-filter-summary {
  font-size: 10px; font-weight: 600; color: var(--muted-light);
}

/* ==========================================================
   UNIT LIST  (inside search panel)
   ========================================================== */
.fc-unit-list { flex: 1; min-height: 0; overflow-y: auto; }
.fc-list-heading {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--border-soft);
  gap: 6px; font-size: 10px; font-weight: 600; background: var(--canvas); color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.fc-list-heading strong { color: var(--text); }

.fc-unit-row {
  display: flex !important; align-items: center; justify-content: space-between;
  gap: 10px; width: 100%; padding: 8px 12px !important;
  border: 0 !important; border-bottom: 1px solid var(--border-soft) !important;
  border-radius: 0 !important; text-align: left; background: var(--surface);
  box-shadow: none !important; transform: none !important;
  transition: background 0.15s ease;
  content-visibility: auto; contain-intrinsic-size: 0 48px; /* 48px: safer estimate to avoid layout shift on multi-line rows */
}
.fc-unit-row:hover { background: var(--canvas) !important; }
.fc-unit-row[aria-pressed="true"] { background: var(--accent-soft) !important; border-left: 3px solid var(--accent) !important; }

.fc-unit-row-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fc-unit-badge {
  width: 26px; height: 26px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: #fff; font-size: 10px; font-weight: 700;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.fc-unit-badge svg { width: 14px; height: 14px; stroke: currentColor; fill: none; }

.fc-unit-row span:last-child { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.fc-unit-row b, .fc-unit-row small { display: block; overflow: hidden; text-overflow: ellipsis; }
.fc-unit-row b     { font-size: 12px; color: var(--text); font-weight: 600; }
.fc-unit-row small { font-size: 10px; color: var(--muted); margin-top: 1px; max-width: 120px; }

.fc-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; font-size: 11px; color: var(--muted);
  border-top: 1px solid var(--border-soft); background: var(--surface);
}
.fc-pagination button { font-size: 10px; padding: 4px 10px; border-radius: 6px; }

/* ==========================================================
   LAYERS POPOVER
   ========================================================== */
.fc-layers-wrapper { position: relative; }
.fc-layers-popover {
  position: absolute; left: 56px; top: 12px; z-index: 1000;
  width: 290px; max-height: calc(100% - 24px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.04);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 12px;
  animation: fc-popover-in .16s cubic-bezier(.16,1,.3,1) forwards;
  transform-origin: top left;
}
.fc-layers-popover header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 0;
}
.fc-layers-popover header strong { font-size: 13px; font-weight: 700; color: var(--text); }
.fc-layers-popover header button {
  width: 24px; height: 24px; border-radius: 6px; border: 0; background: transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; color: var(--muted); cursor: pointer;
  transition: all 0.15s ease; box-shadow: none !important;
}
.fc-layers-popover header button:hover { color: var(--text); background: var(--border-soft); }

.fc-layer-group {
  display: flex; flex-direction: column; gap: 3px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border-soft);
}
.fc-layer-group:last-child {
  border-bottom: 0; padding-bottom: 0;
}
.fc-group-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--muted); margin-bottom: 4px; padding-left: 2px;
}

.fc-layer-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 7px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 500; color: var(--text);
  cursor: pointer; transition: all 0.15s ease;
  background: var(--surface); border: 1px solid transparent;
  user-select: none;
}
.fc-layer-item:hover {
  background: var(--canvas); border-color: var(--border-soft);
}
.fc-layer-item-content {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
}
.fc-layer-item-icon {
  width: 16px; height: 16px; flex-shrink: 0; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.fc-layer-item input[type="checkbox"] {
  accent-color: var(--accent); width: 16px; height: 16px;
  cursor: pointer; margin: 0; flex-shrink: 0;
}

.fc-command fieldset { border: 0; border-bottom: 1px solid var(--border-soft); padding: 6px 0 10px; margin: 0; }
.fc-command legend  { font-size: 10px; letter-spacing: .5px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }

.fc-checkbox { display: flex; align-items: center; gap: 7px; padding: 4px 0; color: var(--text); font-size: 11px; cursor: pointer; }

.fc-radio-group { display: flex; flex-direction: column; gap: 2px; padding: 4px 0; }
.fc-radio-group label { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--text); cursor: pointer; padding: 3px 0; }

.fc-field { display: flex; flex-direction: column; gap: 4px; margin: 4px 0; }
.fc-field > span, .fc-field-label { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.fc-field select {
  font-size: 11px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); outline: none; transition: border-color 0.15s;
}
.fc-field select:focus { border-color: var(--accent); }

/* ==========================================================
   RIGHT DETAIL PANEL  (340px)
   ========================================================== */
.fc-context {
  width: 0; opacity: 0; border-left: 1px solid transparent; flex-shrink: 0;
  background: var(--surface);
  transition: width .24s cubic-bezier(.16,1,.3,1), opacity .2s ease, border-color .2s ease;
  overflow: hidden; position: relative; z-index: 1000;
}
.fc-context.is-open { width: 390px; opacity: 1; border-left-color: var(--border-soft); }
.fc-context-inner   { width: 390px; min-width: 390px; height: 100%; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); }

/* Panel wrapper */
.fc-panel { padding: 0; display: flex; flex-direction: column; height: 100%; }

.fc-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0; background: var(--surface); position: sticky; top: 0; z-index: 5;
}
.fc-panel-header strong { font-size: 13px; color: var(--text); font-weight: 700; }
.fc-panel-header button {
  border: 0; background: transparent; font-size: 17px; padding: 0 3px;
  color: var(--muted); cursor: pointer; box-shadow: none !important;
}
.fc-panel-header button:hover { color: var(--text); background: transparent; }

/* Inspector unit identity block */
.fc-insp-id { padding: 10px 14px 8px; border-bottom: 1px solid var(--border-soft); flex-shrink: 0; }
.fc-insp-id-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.fc-insp-id-top .fc-unit-badge { width: 28px; height: 28px; border-radius: 8px; }
.fc-insp-id-top .fc-unit-badge svg { width: 15px; height: 15px; }
.fc-insp-unit-id { font-size: 14px; font-weight: 700; color: var(--text); font-family: ui-monospace, monospace; }
.fc-insp-model   { font-size: 11px; color: var(--muted); margin-top: 1px; }
.fc-insp-status-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.fc-insp-source  { font-size: 10px; color: var(--muted-light); font-weight: 500; }

/* Tabs */
.fc-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border-soft); flex-shrink: 0;
  overflow-x: auto; scrollbar-width: none;
}
.fc-tabs::-webkit-scrollbar { display: none; }
.fc-tab {
  padding: 8px 14px; border: 0; border-radius: 0;
  border-bottom: 2px solid transparent; background: transparent;
  font-size: 11px; font-weight: 500; color: var(--muted); cursor: pointer;
  white-space: nowrap; transition: color .12s, border-color .12s; box-shadow: none !important;
}
.fc-tab:hover  { color: var(--text); }
.fc-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.fc-tab-body { flex: 1; overflow-y: auto; padding: 12px 14px; }

/* Data grid */
.fc-command dl { display: grid; grid-template-columns: 110px 1fr; gap: 0; margin: 0; }
.fc-command dt, .fc-command dd {
  padding: 6px 0; border-bottom: 1px solid var(--border-soft);
  font-size: 11px; margin: 0; overflow-wrap: anywhere;
}
.fc-command dt { color: var(--muted); font-weight: 500; }
.fc-command dd { text-align: right; font-weight: 600; color: var(--text); }

.fc-actions { display: flex; gap: 5px; flex-wrap: wrap; padding: 10px 0 4px; }
.fc-actions button { font-size: 11px; padding: 5px 9px; }

/* FC Inspector Redesign (Matching Reference Images 2 and 3) */
.fc-inspector { display: flex; flex-direction: column; height: 100%; min-height: 100%; background: #ffffff; }
.fc-inspector-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid #f1f5f9; background: #ffffff; flex-shrink: 0; }
.fc-inspector-close { width: 28px; height: 28px; border-radius: 6px; border: 1px solid #e2e8f0; background: #ffffff; display: flex; align-items: center; justify-content: center; color: #64748b; cursor: pointer; flex-shrink: 0; padding: 0; transition: all 0.15s; }
.fc-inspector-close:hover { background: #f8fafc; color: #0f172a; border-color: #cbd5e1; }
.fc-inspector-header-text h2 { font-size: 15px; font-weight: 700; color: #0f172a; margin: 0; line-height: 1.2; }
.fc-inspector-header-text p { font-size: 11px; color: #94a3b8; margin: 2px 0 0; }
.fc-inspector-layout { display: flex; flex: 1; min-height: 0; }
.fc-inspector-rail { width: 46px; flex-shrink: 0; border-right: 1px solid #f1f5f9; background: #ffffff; padding: 10px 4px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.fc-rail-btn { width: 36px; height: 36px; border-radius: 8px; border: none; background: transparent; color: #64748b; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.15s; padding: 0; }
.fc-rail-btn:hover { background: #f8fafc; color: #0f172a; }
.fc-rail-btn.is-active { background: #eff6ff; color: #2563eb; }
.fc-inspector-main { flex: 1; min-width: 0; overflow-y: auto; padding: 12px 14px 24px; background: #ffffff; }

/* Fleet Setting Form Controls */
.fc-fleet-form { display: flex; flex-direction: column; gap: 10px; }
.fc-fleet-field { display: flex; flex-direction: column; gap: 4px; }
.fc-fleet-label { font-size: 11px; color: #64748b; font-weight: 500; }
.fc-fleet-input, .fc-fleet-select { width: 100%; height: 34px; padding: 6px 10px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 12px; color: #0f172a; background: #ffffff; font-family: inherit; }
.fc-fleet-input:focus, .fc-fleet-select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 1px #2563eb; }
.fc-btn-primary { background: #2563eb; color: #ffffff; font-size: 12.5px; font-weight: 600; padding: 10px 14px; border-radius: 8px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; transition: background 0.15s; }
.fc-btn-primary:hover { background: #1d4ed8; }

.fc-legacy-panel > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.fc-map-warning { position: absolute; top: 12px; right: 12px; max-width: min(330px, 70%); padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; font-size: 11px; z-index: 5; }
.fc-command button:focus-visible, .fc-command input:focus-visible, .fc-command select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fc-tb-btn.is-active { color: var(--accent); background: var(--accent-soft); }
.fc-tb-badge { position: absolute; top: 0; right: 0; border-radius: 8px; background: #b91c1c; color: white; font-size: 9px; padding: 1px 3px; }

.fc-section-title {
  font-size: 10px; letter-spacing: .5px; font-weight: 700;
  color: var(--muted); margin: 10px 0 4px; text-transform: uppercase;
}
.fc-section-title:first-child { margin-top: 0; }

.fc-inline-alert {
  color: var(--c-breakdown); background: var(--bg-breakdown);
  border: 1px solid #fecaca; border-radius: 7px;
  padding: 5px 10px; margin-bottom: 6px; font-size: 11px; font-weight: 600;
}
.fc-note  { font-size: 11px; color: var(--muted); line-height: 1.5; }
.fc-empty { padding: 24px 8px; color: var(--muted); font-size: 12px; text-align: center; }

/* Stale/offline badges in panel */
.fc-stale-badge   { font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: #fef9c3; color: #854d0e; }
.fc-offline-badge { font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: #fee2e2; color: #b91c1c; }

/* Compare block */
.fc-compare { border-top: 1px solid var(--border-soft); padding-top: 10px; margin-top: 10px; }
.fc-compare strong { display: block; font-size: 11px; margin-bottom: 6px; }
.fc-compare p { font-size: 11px; color: #475569; margin: 3px 0; }

/* ==========================================================
   ALERT PANEL
   ========================================================== */
.fc-alert {
  display: flex; flex-direction: column; text-align: left; width: 100%; gap: 3px;
  margin: 5px 0; padding: 7px 10px !important; border-radius: 7px !important;
  border: 1px solid #fee2e2 !important; border-left: 3px solid var(--c-breakdown) !important;
  background: var(--surface) !important; box-shadow: none !important;
}
.fc-alert b    { color: var(--c-breakdown); font-size: 11px; }
.fc-alert span { font-size: 10px; color: var(--muted); }

/* ==========================================================
   FOLLOW OVERLAY  (bottom-left floating badge)
   ========================================================== */
.fc-follow-overlay {
  position: absolute; bottom: 40px; left: 56px; z-index: 1000;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 12px; font-size: 11px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 4px 12px -2px rgba(0,0,0,.1);
  animation: fc-popover-in .16s cubic-bezier(.16,1,.3,1); max-width: 280px;
}
.fc-follow-overlay.paused { background: #fefce8; border-color: #fde047; }
.fc-follow-overlay-label { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-follow-overlay-label span { color: var(--muted); font-weight: 500; }
.fc-follow-overlay button { font-size: 10px; padding: 3px 8px; flex-shrink: 0; }

/* ==========================================================
   MAP FOOTER / ERRORS / REPLAY
   ========================================================== */
.fc-map-footer {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; gap: 6px; align-items: center; padding: 5px 10px;
  pointer-events: none; font-size: 10px; letter-spacing: .4px; color: var(--muted);
}
.fc-map-footer span {
  background: rgba(255,255,255,.92); border: 1px solid var(--border-soft);
  border-radius: 5px; padding: 2px 7px; font-weight: 500;
}
.fc-map-footer button { pointer-events: auto; font-size: 10px; padding: 2px 7px; }

.fc-map-error {
  position: absolute; bottom: 40px; left: 56px; right: 50px;
  background: #fffbeb; border: 1px solid #fef3c7; border-left: 3px solid #854d0e;
  border-radius: 8px; padding: 7px 12px; font-size: 11px; color: #854d0e; z-index: 10;
}
.fc-replay-label {
  position: absolute; top: 12px; right: 12px; z-index: 1000;
  background: var(--text); color: #fff; padding: 5px 12px;
  font-size: 11px; border-radius: 8px; font-weight: 600; letter-spacing: .03em;
}

/* ==========================================================
   MAP MOBILITY & DIRECTIONAL NAVIGATION PAD (OFALabs)
   ========================================================== */
.fc-mobility-pad,
.fc-mobility-pad * {
  box-sizing: border-box;
}

.fc-mobility-pad {
  position: absolute;
  left: 14px;
  bottom: 34px;
  z-index: 995;
  width: 140px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  pointer-events: auto;
  user-select: none;
  font-family: inherit;
  overflow: hidden;
}

.fc-mobility-header {
  width: 100%;
}

.fc-mobility-modes {
  width: 100%;
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.fc-mode-btn {
  flex: 1 1 50%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.12s ease;
  white-space: nowrap;
}

.fc-mode-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
  stroke: currentColor;
  flex-shrink: 0;
}

.fc-mode-btn:hover:not(.is-active) {
  background: #ffffff;
  color: #0f172a;
}

.fc-mode-btn.is-active {
  background: #2563eb !important;
  color: #ffffff !important;
}

.fc-dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  grid-template-rows: repeat(3, 34px);
  gap: 3px;
  justify-content: center;
  margin: 3px auto;
}

.fc-dpad-cell {
  width: 34px;
  height: 34px;
}

.fc-dpad-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #1e293b;
  cursor: pointer;
  padding: 0;
  transition: all 0.12s ease;
}

.fc-dpad-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.2;
  stroke: currentColor;
  flex-shrink: 0;
}

.fc-dpad-btn:hover {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.fc-dpad-btn:active {
  background: #1d4ed8 !important;
  border-color: #1d4ed8 !important;
  color: #ffffff !important;
  transform: scale(0.94);
}

.fc-dpad-center {
  background: #ffffff;
  color: #475569;
  border-color: #cbd5e1;
}

.fc-dpad-center:hover {
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #ffffff !important;
}

.fc-mobility-zoom-row {
  display: flex;
  gap: 4px;
  border-top: 1px solid #f1f5f9;
  padding-top: 6px;
  width: 100%;
}

.fc-mob-zoom-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  padding: 0;
  transition: all 0.12s ease;
}

.fc-mob-zoom-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
  flex-shrink: 0;
}

.fc-mob-zoom-btn:hover {
  background: #ffffff;
  border-color: #2563eb;
  color: #2563eb;
}

.fc-mob-zoom-btn:active {
  background: #e0f2fe;
  color: #0369a1;
  transform: scale(0.94);
}

.fc-mob-fit-btn {
  color: #2563eb;
}

.fc-mobility-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 8.5px;
  color: #94a3b8;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding-top: 1px;
  text-transform: uppercase;
}

/* ==========================================================
   CHIPS  (active filter bar)
   ========================================================== */
.fc-chips {
  display: flex; gap: 5px; padding: 5px 10px; flex-wrap: wrap;
  background: var(--surface); border-bottom: 1px solid var(--border-soft);
  align-items: center; flex-shrink: 0;
}
.fc-chips button {
  font-size: 10px; padding: 2px 8px;
  border-radius: 9999px !important; background: var(--surface);
  border: 1px solid var(--border); color: var(--text);
}

/* ==========================================================
   LEGACY PANEL WRAPPER  (filters / dispatch / weather reuse)
   ========================================================== */
.fc-legacy-panel { padding: 14px 16px; }
.fc-legacy-panel > header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border-soft);
}
.fc-legacy-panel > header strong { font-size: 13px; font-weight: 700; }
.fc-legacy-panel > header button {
  border: 0; background: transparent; font-size: 17px; padding: 0 3px;
  color: var(--muted); cursor: pointer; box-shadow: none !important;
}
.fc-legacy-panel > header button:hover { color: var(--text); background: transparent; }
.fc-select-field { margin: 8px 0; }
.fc-select-field > span { display: block; font-size: 11px; color: var(--muted); font-weight: 500; margin-bottom: 3px; }
.fc-select-field select { width: 100%; }
.fc-local {
  font-size: 11px; color: var(--c-queuing); background: var(--bg-queuing);
  border: 1px solid #fde68a; border-radius: 7px; padding: 6px 10px;
  line-height: 1.5; font-weight: 500; margin-bottom: 8px;
}

/* ==========================================================
   SCHEMATIC & MAP CONTROLS
   ========================================================== */
.fc-schematic     { height: 100%; width: 100%; position: relative; background: #eef0f3; }
.fc-schematic svg { height: 100%; width: 100%; }
.fc-schematic g   { cursor: pointer; }
.fc-map-note {
  position: absolute; left: 56px; bottom: 32px; font-size: 10px; color: var(--muted);
  background: rgba(255,255,255,.92); padding: 2px 7px; border-radius: 5px; border: 1px solid var(--border-soft);
}
.fc-command .maplibregl-ctrl-bottom-right { bottom: 28px; }
.fc-command .maplibregl-ctrl-attrib       { font-size: 9px; background: rgba(255,255,255,.85); }

/* ==========================================================
   STAGE 5: PLAYBACK BANNER, SEARCH TAGS & STATUS PILLS
   ========================================================== */
.fc-playback-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  font-size: 11px;
}
.fc-playback-badge {
  background: #fef3c7;
  color: #b45309;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 10px;
}
.fc-playback-info {
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 4px;
}
.fc-playback-exit-btn {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
}
.fc-playback-exit-btn:hover {
  background: #1d4ed8;
}

.fc-search-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-block;
  margin-right: 6px;
}
.fc-search-tag-road { background: #f1f5f9; color: #475569; }
.fc-search-tag-lf   { background: #dcfce7; color: #15803d; }
.fc-search-tag-disp { background: #e0f2fe; color: #0369a1; }
.fc-search-tag-area { background: #fef9c3; color: #854d0e; }

.fc-status-pill {
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 1200px) {
  .fc-context.is-open { width: 300px; }
  .fc-context-inner   { width: 300px; min-width: 300px; }
}
@media (max-width: 900px) {
  /* Context panel becomes an overlay — z-index raised to 300 to appear above map toolbar (z:1000 is float-toolbar, panel is sibling) */
  .fc-context { position: absolute; right: 0; top: 0; bottom: 0; z-index: 300; }
  .fc-context.is-open { width: 280px; box-shadow: -4px 0 16px rgba(0,0,0,.1); }
  .fc-context-inner   { width: 280px; min-width: 280px; }
  .fc-search-panel    { width: 280px; }
}
@media (max-width: 640px) {
  .fc-command button, .fc-command select { min-height: 44px; }
  .fc-float-toolbar { max-width: calc(100vw - 16px); overflow-x: auto; }
  .fc-float-toolbar .fc-tb-btn { min-width: 40px; flex-shrink: 0; }
  .fc-context.is-open { width: min(340px, 100vw); }
  .fc-context-inner { width: min(340px, 100vw); min-width: 0; }

  /* Bottom sheet panels with scrim backdrop */
  .fc-search-panel, .fc-layers-popover {
    left: 0; right: 0; top: auto; bottom: 0; width: auto;
    border-radius: 12px 12px 0 0; max-height: 65vh;
    box-shadow: 0 -4px 24px rgba(0,0,0,.18);
  }

  /* Mobile scrim backdrop for bottom sheet panels */
  .fc-panel-scrim {
    display: block;
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, 0.32);
    z-index: 999;
    animation: fc-scrim-in .18s ease;
  }

  /* Float toolbar moves to bottom center, above the mobility pad */
  .fc-float-toolbar {
    flex-direction: row; left: 50%; top: auto; bottom: 108px; /* raised from 50px to 108px to clear mobility pad */
    transform: translateX(-50%);
    background: rgba(255,255,255,.96); border-radius: 12px; padding: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,.14); border: 1px solid var(--border);
  }
  .fc-float-toolbar .fc-tb-btn::after { display: none; }
  .fc-float-toolbar .fc-tb-sep { width: 1px; height: auto; margin: 4px 0; }
  .fc-site-badge { display: none; }

  /* Mobility pad stays at bottom-left, clear of toolbar */
  .fc-mobility-pad { bottom: 16px; left: 8px; }
}

@keyframes fc-scrim-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .fc-command * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
