:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-soft: #f0fdfa;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --indigo: #4f46e5;
  --indigo-soft: #eef2ff;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 24px -4px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 45px -10px rgba(15, 23, 42, 0.22);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 24px 24px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Top Executive Bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f8fafc;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.16);
}

.topbar-inner {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0d9488, #2563eb);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.35);
}

.brand-mark svg {
  width: 24px;
  height: 24px;
  color: #ffffff;
}

.brand-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}

.pill-live {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #5eead4;
  background: rgba(13, 148, 136, 0.18);
  border: 1px solid rgba(94, 234, 212, 0.32);
  padding: 0.14rem 0.52rem;
  border-radius: 999px;
}

.pill-live .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2dd4bf;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(1.3); }
}

.meta-chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.14rem 0.5rem;
  border-radius: 6px;
}

.brand-text h1 {
  margin: 0;
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.brand-sub {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.52rem 0.88rem;
  border-radius: 10px;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn:active {
  transform: translateY(1px);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f1f5f9;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn-primary {
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* Main Container */
.container {
  max-width: 1480px;
  margin: 0 auto;
  padding: 1.25rem;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: fadeSlideUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  animation-delay: var(--delay, 0ms);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
}

.kpi-blue::before { background: var(--blue); }
.kpi-teal::before { background: var(--teal); }
.kpi-indigo::before { background: var(--indigo); }
.kpi-amber::before { background: var(--amber); }

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.kpi-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.14rem 0.48rem;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--ink-2);
  border: 1px solid var(--border);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 2.5vw, 2.35rem);
  font-weight: 700;
  margin: 0.35rem 0 0.15rem;
  letter-spacing: -0.02em;
}

.kpi-blue .kpi-value { color: var(--blue); }
.kpi-teal .kpi-value { color: var(--teal-dark); }
.kpi-indigo .kpi-value { color: var(--indigo); }
.kpi-amber .kpi-value { color: var(--amber); }

.kpi-foot {
  font-size: 0.78rem;
  color: var(--muted);
}

/* Workspace Layout */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.85fr);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

.blueprint-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-toolbar {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.shift-switcher {
  display: inline-flex;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}

.shift-btn {
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.42rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.18s ease;
}

.shift-btn .count-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.08rem 0.38rem;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.08);
}

.shift-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.shift-btn.active .count-tag {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.36rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-chip input {
  accent-color: var(--teal);
  cursor: pointer;
}

.compass-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.55rem 1.1rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 0.76rem;
  color: var(--ink-2);
}

.compass-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
}

.compass-chip strong {
  color: var(--teal-dark);
  font-family: var(--font-mono);
}

/* Interactive Map Viewport */
.map-viewport {
  position: relative;
  height: min(76vh, 860px);
  min-height: 460px;
  background: #e9eef5;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  outline: none;
}

.map-viewport:active {
  cursor: grabbing;
}

.map-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  will-change: transform;
}

.blueprint-canvas {
  position: relative;
  height: 94%;
  aspect-ratio: 2223 / 3300;
  max-width: 96%;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  border: 1px solid var(--border-strong);
  overflow: hidden;
}

.base-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  user-select: none;
  transition: opacity 0.15s ease;
}

.zone-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.zone-svg.hidden {
  opacity: 0;
}

.arch-zone rect {
  fill: rgba(37, 99, 235, 0.07);
  stroke: rgba(37, 99, 235, 0.45);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  transition: fill 0.2s ease, stroke 0.2s ease;
  pointer-events: all;
  cursor: pointer;
}

.arch-zone.zone-hall-a rect {
  fill: rgba(13, 148, 136, 0.06);
  stroke: rgba(13, 148, 136, 0.42);
}

.arch-zone.zone-hall-b rect {
  fill: rgba(79, 70, 229, 0.06);
  stroke: rgba(79, 70, 229, 0.42);
}

.arch-zone:hover rect {
  fill: rgba(13, 148, 136, 0.16);
  stroke-width: 3;
}

.arch-zone text {
  fill: rgba(15, 23, 42, 0.72);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 4px;
}

/* Pins Layer */
.pins-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gate-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
  z-index: 5;
  border: none;
  background: transparent;
  padding: 0;
  font-family: var(--font-sans);
  animation: pinDrop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  animation-delay: var(--pin-delay, 0ms);
}

@keyframes pinDrop {
  from { opacity: 0; transform: translate(-50%, -80%) scale(0.5); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.pin-core {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--teal);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2.5px solid #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.28);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background-color 0.2s ease, opacity 0.2s ease;
}

.gate-pin.day-only .pin-core {
  background: var(--amber);
}

.pin-pulse {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--teal);
  opacity: 0;
  animation: radarPulse 2.6s ease-out infinite;
  animation-delay: var(--pin-delay, 0ms);
}

.gate-pin.day-only .pin-pulse {
  border-color: var(--amber);
}

@keyframes radarPulse {
  0% { transform: scale(0.8); opacity: 0.75; }
  100% { transform: scale(1.75); opacity: 0; }
}

.gate-pin:hover .pin-core,
.gate-pin.selected .pin-core {
  transform: scale(1.24);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.25), 0 8px 20px rgba(15, 23, 42, 0.35);
}

.gate-pin.day-only:hover .pin-core,
.gate-pin.day-only.selected .pin-core {
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.28), 0 8px 20px rgba(15, 23, 42, 0.35);
}

.gate-pin.selected {
  z-index: 20;
}

.gate-pin.dimmed {
  opacity: 0.28;
  filter: grayscale(0.75);
}

.gate-pin.dimmed .pin-pulse {
  animation: none;
}

.gate-pin.filtered-out {
  opacity: 0.14;
  pointer-events: none;
}

/* Compact Callout Pill next to Pin */
.pin-tag {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  border: 1.5px solid var(--border-strong);
  border-radius: 7px;
  padding: 2px 7px;
  white-space: nowrap;
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.12);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.pin-tag.right {
  left: 34px;
}

.pin-tag.left {
  right: 34px;
}

.pin-tag .tag-shift {
  font-family: var(--font-mono);
  color: var(--teal-dark);
  margin-left: 4px;
}

.gate-pin.day-only .pin-tag .tag-shift {
  color: var(--amber);
}

.pins-layer.hide-labels .pin-tag {
  opacity: 0;
  transform: translateY(-50%) scale(0.9);
}

.gate-pin:hover .pin-tag,
.gate-pin.selected .pin-tag {
  opacity: 1 !important;
  border-color: var(--teal);
  z-index: 25;
}

/* Floating Map Controls */
.zoom-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.zoom-controls button {
  width: 38px;
  height: 34px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.zoom-controls button:hover {
  background: #f1f5f9;
}

.zoom-readout {
  padding: 4px 2px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
}

.opacity-control {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0.38rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-2);
  box-shadow: var(--shadow-sm);
}

.opacity-control input {
  width: 72px;
  accent-color: var(--teal);
  cursor: pointer;
}

/* Hover Detail Popover */
.hover-popover {
  position: absolute;
  z-index: 35;
  width: 270px;
  background: rgba(15, 23, 42, 0.96);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(0.97);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.hover-popover.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.pop-id {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #5eead4;
}

.pop-status {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: rgba(13, 148, 136, 0.24);
  color: #99f6e4;
}

.pop-status.day-only {
  background: rgba(217, 119, 6, 0.25);
  color: #fde68a;
}

.pop-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
}

.pop-zone {
  font-size: 0.76rem;
  color: #94a3b8;
  margin-bottom: 0.55rem;
}

.pop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}

.pop-stat {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.38rem 0.45rem;
  text-align: center;
}

.pop-stat span {
  display: block;
  font-size: 0.64rem;
  color: #94a3b8;
  text-transform: uppercase;
}

.pop-stat strong {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #ffffff;
}

.pop-note {
  margin: 0;
  font-size: 0.75rem;
  color: #cbd5e1;
  line-height: 1.4;
}

/* Tour Banner */
.tour-banner {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: min(92%, 440px);
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;
  border: 1px solid rgba(94, 234, 212, 0.35);
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
}

.tour-banner[hidden] {
  display: none;
}

.tour-status {
  display: flex;
  flex-direction: column;
}

.tour-step {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #5eead4;
}

.tour-btns {
  display: flex;
  gap: 0.35rem;
}

.btn-mini {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-radius: 7px;
  padding: 0.32rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-mini.primary {
  background: var(--teal);
  border-color: var(--teal);
}

/* Legend Strip */
.legend-strip {
  padding: 0.75rem 1.1rem;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  font-size: 0.79rem;
  color: var(--ink-2);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.swatch-teal { background: var(--teal); box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2); }
.swatch-amber { background: var(--amber); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2); }

.code-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  background: #e2e8f0;
  color: var(--ink);
  padding: 0.1rem 0.38rem;
  border-radius: 5px;
}

/* Sidebar Panel */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card,
.inspector-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.inspector-card {
  border-left: 4px solid var(--teal);
}

.inspector-empty {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.empty-icon svg {
  width: 22px;
  height: 22px;
}

.inspector-empty h3 {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
}

.inspector-empty p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.insp-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.insp-code {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--teal-dark);
}

.insp-title {
  margin: 0.1rem 0 0;
  font-size: 1.12rem;
  font-weight: 700;
}

.insp-zone {
  font-size: 0.8rem;
  color: var(--muted);
}

.insp-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.insp-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  text-align: center;
}

.insp-box small {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.insp-box strong {
  font-family: var(--font-mono);
  font-size: 1.25rem;
}

.insp-note {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--ink-2);
  background: #f8fafc;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.insp-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.insp-nav button {
  flex: 1;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.42rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
}

.insp-nav button:hover {
  background: var(--surface-alt);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.card-header h2 {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
}

.card-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 0.14rem 0.5rem;
  border-radius: 999px;
}

/* Zone Distribution Bars */
.zone-bars {
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
}

.zone-bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.zone-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
}

.zone-bar-meta span:last-child {
  font-family: var(--font-mono);
  color: var(--muted);
}

.bar-track {
  height: 9px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}

.bar-day {
  background: var(--teal);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.bar-night {
  background: var(--indigo);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Search & Filter */
.search-wrap {
  position: relative;
  margin-bottom: 0.65rem;
}

.search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.search-wrap input {
  width: 100%;
  padding: 0.52rem 0.75rem 0.52rem 2.15rem;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-wrap input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.14);
}

.filter-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.filter-pill {
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-pill.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.checkpoint-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 2px;
}

.cp-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 0.6rem 0.72rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.16s ease;
}

.cp-item:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
  transform: translateX(2px);
}

.cp-item.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.18);
}

.cp-item-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.cp-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--teal);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.cp-item.day-only .cp-num {
  background: var(--amber);
}

.cp-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-zone-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

.cp-shifts {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.badge-day,
.badge-night,
.badge-off {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.16rem 0.45rem;
  border-radius: 6px;
}

.badge-day {
  background: var(--teal-soft);
  color: var(--teal-dark);
  border: 1px solid rgba(13, 148, 136, 0.25);
}

.badge-night {
  background: var(--indigo-soft);
  color: var(--indigo);
  border: 1px solid rgba(79, 70, 229, 0.24);
}

.badge-off {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid rgba(217, 119, 6, 0.28);
}

/* Full Matrix Table */
.matrix-section {
  margin-bottom: 1.5rem;
}

.matrix-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.matrix-header h2 {
  margin: 0 0 0.2rem;
  font-size: 1.12rem;
}

.matrix-header p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.site-meta-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
}

.site-meta-pills span {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
}

.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.allocation-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 0.85rem;
}

.allocation-table th {
  background: var(--ink);
  color: #ffffff;
  text-align: left;
  padding: 0.75rem 0.85rem;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.allocation-table th.num,
.allocation-table td.num {
  text-align: center;
}

.allocation-table td {
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.allocation-table tbody tr {
  cursor: pointer;
  transition: background-color 0.14s ease;
}

.allocation-table tbody tr:hover {
  background: var(--teal-soft);
}

.allocation-table tbody tr.selected-row {
  background: #ccfbf1;
}

.allocation-table tfoot td {
  background: #f1f5f9;
  padding: 0.85rem;
  border-top: 2px solid var(--border-strong);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
}

.status-pill.active-247 {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.status-pill.day-only {
  background: var(--amber-soft);
  color: var(--amber);
}

/* Mobile Bottom Sheet */
.mobile-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  pointer-events: none;
}

.mobile-sheet.open {
  pointer-events: auto;
}

.mobile-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.mobile-sheet.open .mobile-sheet-backdrop {
  opacity: 1;
}

.mobile-sheet-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 0.65rem 1.1rem 1.35rem;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.25);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.mobile-sheet.open .mobile-sheet-body {
  transform: translateY(0);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  border-radius: 999px;
  background: #cbd5e1;
  margin: 0 auto 0.75rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Responsive Breakpoints */
@media (max-width: 1120px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .map-viewport {
    height: min(68vh, 720px);
  }
}

@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hide-sm {
    display: none;
  }

  .map-viewport {
    height: 62vh;
    min-height: 390px;
  }

  .pin-core {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
  }

  .pin-tag {
    display: none;
  }

  .inspector-card {
    display: none;
  }

  .mobile-sheet {
    display: block;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0.85rem;
  }

  .hide-xs {
    display: none;
  }

  .opacity-control {
    display: none;
  }

  .shift-btn {
    font-size: 0.74rem;
    padding: 0.38rem 0.52rem;
  }
}

@media print {
  .topbar,
  .panel-toolbar,
  .zoom-controls,
  .opacity-control,
  .sidebar-panel,
  .mobile-sheet {
    display: none !important;
  }

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

  .map-viewport {
    height: auto;
    border: none;
  }
}

