/* ==========================================================================
   KMD DRAINAGE FIELD INSPECTOR & ALIGNMENT TRACKER (PWA)
   Corporate Slate & High-Contrast Engineering Theme
   ========================================================================== */

:root {
  --bg-dark: #0F172A;
  --bg-card: #1E293B;
  --bg-card-hover: #334155;
  --bg-panel: #182234;
  --border-color: #334155;
  --border-light: #475569;
  
  --text-primary: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  
  --accent-blue: #3B82F6;
  --accent-blue-dark: #1D4ED8;
  --accent-green: #10B981;
  --accent-emerald: #059669;
  --accent-amber: #F59E0B;
  --accent-orange: #EA580C;
  --accent-red: #EF4444;
  --accent-purple: #8B5CF6;
  --accent-slate: #64748B;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
  --shadow-drawer: 0 -8px 24px rgba(0, 0, 0, 0.6);
  
  --drawer-height-collapsed: 64px;
  --drawer-height-mid: 280px;
  --drawer-height-expanded: min(520px, 80vh);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   TOP APP HEADER & HUD
   ========================================================================== */

/* ==========================================================================
   SLIM TOP APP BAR (SINGLE ROW, 48PX) & MOBILE NAVIGATION
   ========================================================================== */

.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  padding: 0 12px;
  z-index: 1000;
  display: flex;
  align-items: center;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.header-main-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 8px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  display: flex;
  align-items: center;
}

.brand-text {
  display: flex;
  align-items: center;
}

.brand-title {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #F8FAFC;
  white-space: nowrap;
}

/* Compact Section Dropdown Pill */
.section-pill-wrapper {
  position: relative;
}

.btn-section-pill {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38BDF8;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-section-pill:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: #38BDF8;
}

.section-dropdown-menu {
  position: absolute;
  top: 34px;
  left: 0;
  background: #0F172A;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 1200;
  min-width: 250px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.btn-sec-option {
  text-align: left;
  padding: 9px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.btn-sec-option:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #FFFFFF;
}

.btn-sec-option.active {
  background: var(--accent-blue);
  color: #FFFFFF;
}

/* Desktop Primary Nav Tabs */
.primary-nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-panel);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.btn-nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-nav-tab.active {
  background: var(--accent-blue);
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Clean Header Quick Actions */
.header-quick-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-header-action {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  color: #E2E8F0;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.btn-header-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  color: #FFFFFF;
}

.btn-header-action.active {
  background: var(--accent-blue-dark);
  border-color: var(--accent-blue);
  color: #FFFFFF;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* ==========================================================================
   FIXED MOBILE BOTTOM NAVIGATION BAR
   ========================================================================== */

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 54px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 2000;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-tab {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #94A3B8;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 4px 0;
}

.bottom-nav-tab svg {
  transition: transform 0.15s ease, stroke 0.15s ease;
}

.bottom-nav-tab:hover {
  color: #E2E8F0;
}

.bottom-nav-tab.active {
  color: #38BDF8;
}

.bottom-nav-tab.active svg {
  stroke: #38BDF8;
  transform: translateY(-1px);
}

/* ==========================================================================
   STRAIGHT-LINE DIAGRAM (SLD) VIEWPORT & FLOATING CONTROLS
   ========================================================================== */

.sld-viewport-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: #0B0F19;
  overflow: hidden;
  flex: 1;
}

.sld-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.sld-floating-hud {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 20;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 20px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #F1F5F9;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  pointer-events: none;
}

.hud-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748B;
}

.hud-status-dot.active {
  background: #10B981;
  box-shadow: 0 0 6px #10B981;
}

.hud-gps-live {
  color: #38BDF8;
  font-weight: 700;
}

.sld-floating-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sld-ctrl-btn {
  min-width: 34px;
  height: 30px;
  padding: 0 7px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 6px;
  color: #F8FAFC;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sld-ctrl-btn:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: #38BDF8;
  color: #38BDF8;
}

.sld-layers-menu-wrap {
  position: relative;
}

.sld-layers-dropdown {
  position: absolute;
  right: 0;
  top: 34px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 175px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 30;
}

.sld-layers-dropdown label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #E2E8F0;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* ==========================================================================
   SLIDE-UP ACTION SHEETS (QUICK JUMP & CORRIDOR TOOLS)
   ========================================================================== */

.slide-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.slide-sheet {
  background: #0F172A;
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border: 1px solid var(--border-color);
  border-bottom: none;
  width: 100%;
  max-width: 480px;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideSheetUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideSheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

.sheet-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-title-wrap h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #F8FAFC;
  margin: 0;
}

.sheet-close {
  background: transparent;
  border: none;
  color: #94A3B8;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.sheet-close:hover {
  color: #FFFFFF;
}

.sheet-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.jump-input-row {
  display: flex;
  gap: 8px;
}

.jump-input-row input {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  color: #FFFFFF;
  font-size: 0.88rem;
  outline: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.jump-input-row input:focus {
  border-color: #38BDF8;
}

.btn-jump-action {
  background: var(--accent-blue);
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.quick-hop-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quick-hop-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chip-hop {
  text-align: left;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  color: #E2E8F0;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-hop:hover {
  background: var(--bg-card-hover);
  border-color: #38BDF8;
  color: #FFFFFF;
}

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

.sheet-section-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.toggle-mode-group {
  display: flex;
  gap: 6px;
  background: var(--bg-panel);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.btn-mode-pill, .btn-mode {
  flex: 1;
  padding: 8px 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-mode.active, .btn-mode-pill.active {
  background: var(--accent-blue);
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.filter-select-sheet, .filter-select {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 9px 12px;
  color: #FFFFFF;
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.sheet-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-sheet-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: #E2E8F0;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sheet-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  color: #FFFFFF;
}

/* 2.5. Birds-Eye Progress KPI Bar */
.progress-kpi-bar {
  background: #0C1220;
  border-bottom: 1px solid var(--border-color);
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  z-index: 998;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.progress-kpi-bar::-webkit-scrollbar {
  display: none;
}

.kpi-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.kpi-chip:hover {
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
}

.kpi-chip.active {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.15);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.kpi-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.kpi-chip.active .kpi-label {
  color: var(--text-primary);
}

.kpi-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 800;
  font-size: 0.75rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
}

.kpi-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot-not-started {
  background: #64748B;
}

.dot-ongoing {
  background: #F59E0B;
  box-shadow: 0 0 6px #F59E0B;
}

.dot-completed {
  background: #10B981;
  box-shadow: 0 0 6px #10B981;
}

.dot-defects {
  background: #EF4444;
  box-shadow: 0 0 6px #EF4444;
}

/* Status-specific pin glow & badge colors */
.custom-pin.status-ongoing {
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 10px #F59E0B, inset 0 0 4px rgba(0,0,0,0.5);
}

.custom-pin.status-completed {
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 10px #10B981, inset 0 0 4px rgba(0,0,0,0.5);
}

.custom-pin.status-defect {
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 12px #EF4444, inset 0 0 4px rgba(0,0,0,0.5);
  animation: defectGlow 1.4s infinite alternate;
}

@keyframes defectGlow {
  from { box-shadow: 0 0 6px #EF4444; transform: scale(1); }
  to { box-shadow: 0 0 14px #EF4444; transform: scale(1.1); }
}

/* HUD Banner (Live GPS Status) */
.hud-banner {
  background: #090D16;
  border-bottom: 1px solid var(--border-color);
  padding: 4px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-secondary);
  z-index: 999;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-slate);
}

.status-dot.active {
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.hud-val {
  font-weight: 700;
  color: var(--text-primary);
}

/* ==========================================================================
   MODULAR VIEWPORT & STAGE
   ========================================================================== */

.main-stage {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  display: flex;
}

.view-panel {
  flex: 1;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  background: #0B0F19;
  overflow: hidden;
}

.view-panel.active {
  display: flex;
  flex-direction: column;
}

#map {
  flex: 1;
  width: 100%;
  height: 100%;
  background: #0B0F19;
  z-index: 10;
}

/* Custom Leaflet Dark UI Overrides */
.leaflet-bar {
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: 6px !important;
  overflow: hidden;
}

.leaflet-bar a {
  background-color: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.leaflet-bar a:hover {
  background-color: var(--bg-card-hover) !important;
}

.leaflet-control-layers {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: 6px !important;
  font-size: 0.75rem !important;
}

/* Centerline Chainage Tick Markers */
.chainage-label-icon {
  background: transparent;
  border: none;
}

.chainage-pill {
  background: rgba(15, 23, 42, 0.85);
  color: #F8FAFC;
  border: 1px solid #475569;
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.chainage-pill.major {
  background: #1D4ED8;
  color: #FFFFFF;
  border-color: #60A5FA;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Custom Marker Pins */
.custom-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  box-shadow: var(--shadow-md);
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.custom-pin:hover {
  transform: scale(1.25);
  z-index: 1000 !important;
}

/* ==========================================================================
   BOTTOM INSPECTION DRAWER (MOBILE-FIRST)
   ========================================================================== */

.drawer-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1500;
  background: var(--bg-card);
  border-top: 2px solid var(--border-light);
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow-drawer);
  height: var(--drawer-height-expanded);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none !important;
  will-change: transform;
}

.drawer-container.expanded {
  transform: translateY(0);
}

.drawer-container.mid {
  transform: translateY(calc(var(--drawer-height-expanded) - var(--drawer-height-mid)));
}

.drawer-container.collapsed {
  transform: translateY(calc(var(--drawer-height-expanded) - var(--drawer-height-collapsed)));
}

.drawer-container.hidden {
  transform: translateY(100%);
}

.drawer-container.dragging {
  transition: none !important;
}

.drawer-handle-bar {
  width: 100%;
  padding: 12px 0 8px;
  min-height: 38px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: grab;
  touch-action: none !important;
  -webkit-user-select: none;
  user-select: none;
}

.drawer-handle-bar:active {
  cursor: grabbing;
}

.drawer-handle {
  width: 52px;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  transition: background 0.15s ease;
  pointer-events: none;
}

.drawer-handle-bar:hover .drawer-handle,
.drawer-handle-bar:active .drawer-handle {
  background: var(--accent-cyan);
}

.drawer-mini-bar {
  padding: 6px 16px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  touch-action: none !important;
  -webkit-user-select: none;
  user-select: none;
}

.mini-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-drawer-toggle {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-drawer-toggle:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.drawer-chevron-icon {
  transition: transform 0.25s ease;
}

.drawer-container.expanded .drawer-chevron-icon {
  transform: rotate(180deg);
}

.drawer-container.mid .drawer-chevron-icon {
  transform: rotate(90deg);
}

.drawer-container.collapsed .drawer-chevron-icon {
  transform: rotate(0deg);
}

.mini-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.mini-chainage {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.mini-status {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}

.drawer-content {
  padding: 10px 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: var(--bg-panel);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.spec-item {
  display: flex;
  flex-direction: column;
}

.spec-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.spec-value {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
}

/* Milestone Progress Pill Selector */
.progress-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.milestone-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.btn-milestone {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-milestone.selected {
  background: var(--accent-blue-dark);
  border-color: var(--accent-blue);
  color: #FFFFFF;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.btn-milestone.approved {
  background: var(--accent-emerald);
  border-color: #34D399;
  color: #FFFFFF;
}

/* Punchlist / Notes Section */
.notes-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notes-section textarea {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 8px;
  font-size: 0.8rem;
  resize: vertical;
  min-height: 54px;
  outline: none;
}

.notes-section textarea:focus {
  border-color: var(--accent-blue);
}

/* Photo Attachment Area */
.photo-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-photo {
  background: var(--bg-panel);
  border: 1px dashed var(--border-light);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.photo-preview-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.photo-thumb {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

/* Drawer Action Buttons */
.drawer-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.btn-primary {
  flex: 2;
  background: var(--accent-blue);
  color: #FFFFFF;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--accent-blue-dark);
}

.btn-secondary {
  flex: 1;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
}

/* Toast Notifications */
.toast {
  position: fixed;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  background: #1E293B;
  color: #F8FAFC;
  border: 1px solid var(--border-light);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 3000;
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Cloud Sync Status Pill & Actions */
.btn-sync-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sync-pill:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10B981;
  display: inline-block;
}

.status-synced .sync-dot { background-color: #10B981; }
.status-pending .sync-dot { background-color: #F59E0B; }
.status-syncing .sync-dot { background-color: #38BDF8; }
.status-syncing svg { animation: spin 1s linear infinite; }
.status-offline .sync-dot { background-color: #94A3B8; }
.status-error .sync-dot { background-color: #EF4444; }

.btn-icon-only {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-icon-only:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  color: var(--text-primary);
}

/* Modal Dialog: Cloud Settings */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
}

.modal-title-block {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-title-block h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

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

.modal-close:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.08);
}

.modal-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-group input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-group input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.cloud-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-card);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.cloud-info-grid strong {
  color: var(--text-primary);
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ==========================================================================
   PRIMARY NAVIGATION TABS (CAD VIEW, GIS MAP, DASHBOARD, REPORTS, DATA)
   ========================================================================== */

.primary-nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #0C1220;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  overflow-x: auto;
}

.btn-nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.btn-nav-tab.active {
  background: var(--accent-blue);
  color: #FFFFFF;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   CAD/GIS VECTOR FIELD VIEWER & FLOATING CONTROLS
   ========================================================================== */

.cad-viewport-container {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: #0B0F19;
}

.cad-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.cad-canvas:active {
  cursor: grabbing;
}

.cad-floating-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 200;
}

.cad-ctrl-btn {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cad-ctrl-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-blue);
  color: #FFFFFF;
}

.cad-layers-menu-wrap {
  position: relative;
}

.cad-layers-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 190px;
  z-index: 300;
}

.cad-layers-dropdown label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.cad-layers-dropdown input[type="checkbox"] {
  accent-color: var(--accent-blue);
  cursor: pointer;
}

/* ==========================================================================
   CHAINAGE SCRUBBER & PROXIMITY INSPECTOR
   ========================================================================== */

.scrubber-mount {
  background: #090D16;
  border-top: 1px solid var(--border-color);
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 10px 12px;
  gap: 6px;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.45);
}

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

.scrubber-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scrubber-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scrubber-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.scrubber-active-pk {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  font-weight: 800;
  color: #38BDF8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 1px 8px;
  border-radius: 4px;
}

.scrubber-step-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-step {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-step:hover {
  background: var(--bg-card-hover);
  color: #FFFFFF;
  border-color: var(--accent-blue);
}

.scrubber-track-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scrubber-bound-label {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.scrubber-slider-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.scrubber-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #1E293B;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.scrubber-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #38BDF8;
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 8px #38BDF8;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.scrubber-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* "Wagwan?" Live Proximity Strip */
.wagwan-strip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}

.wagwan-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.wagwan-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.wagwan-count {
  font-size: 0.68rem;
  color: #38BDF8;
  font-weight: 600;
}

.wagwan-cards {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.wagwan-cards::-webkit-scrollbar {
  height: 4px;
}

.wagwan-cards::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 2px;
}

.wagwan-empty {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
}

.wagwan-card {
  flex: 0 0 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wagwan-card:hover {
  background: var(--bg-card-hover);
  border-color: #38BDF8;
  transform: translateY(-1px);
}

.wagwan-card-top {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wagwan-badge-code {
  color: #FFFFFF;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

.wagwan-badge-side {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
}

.side-l { background: #1D4ED8; color: #FFFFFF; }
.side-r { background: #059669; color: #FFFFFF; }
.side-c { background: #64748B; color: #FFFFFF; }

.wagwan-badge-status {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
}

.badge-status-completed { background: rgba(16, 185, 129, 0.2); color: #10B981; border: 1px solid #10B981; }
.badge-status-ongoing { background: rgba(245, 158, 11, 0.2); color: #F59E0B; border: 1px solid #F59E0B; }
.badge-status-not-started { background: rgba(148, 163, 184, 0.2); color: #94A3B8; }
.badge-status-defect { background: rgba(239, 68, 68, 0.2); color: #EF4444; border: 1px solid #EF4444; }

.wagwan-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wagwan-card-ch {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.68rem;
  color: var(--text-secondary);
}

.wagwan-card-bot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.65rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 3px;
}

/* ==========================================================================
   DASHBOARD, REPORTS, AND DATA PORTABILITY VIEW PANELS
   ========================================================================== */

.dashboard-mount, .reports-mount, .data-exchange-mount {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #0B0F19;
}

/* Dashboard Styles */
.dashboard-wrap {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dash-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
}

.dash-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.dash-sec-code {
  background: var(--accent-blue);
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.dash-sec-type {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.dash-sec-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dash-sec-span {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.8rem;
  color: #38BDF8;
}

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

.dash-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-kpi-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.dash-kpi-num {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.val-total { color: #F8FAFC; }
.val-completed { color: #10B981; }
.val-ongoing { color: #F59E0B; }
.val-not-started { color: #94A3B8; }
.val-defects { color: #EF4444; }

.dash-kpi-sub {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.dash-section-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 18px;
}

.dash-panel-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.typology-progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.typology-progress-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.typo-row-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
}

.typo-name {
  font-weight: 600;
  color: var(--text-primary);
}

.typo-counts {
  color: var(--text-secondary);
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
}

.typo-m {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.typo-bar-track {
  height: 8px;
  background: #0F172A;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.typo-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284C7, #10B981);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.dash-table th, .dash-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.dash-table th {
  background: #0F172A;
  color: var(--text-muted);
  font-weight: 700;
}

.text-defect {
  color: #EF4444;
  font-weight: 600;
}

.dash-empty-notice {
  font-size: 0.8rem;
  color: var(--accent-green);
  font-style: italic;
  padding: 6px 0;
}

/* Reports View Styles */
.report-panel-wrap {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.report-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

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

.report-control-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.report-select, .report-date-input {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 4px;
  outline: none;
}

.btn-primary-sm, .btn-secondary-sm {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  border: none;
}

.btn-primary-sm { background: var(--accent-blue); color: #FFFFFF; }
.btn-secondary-sm { background: var(--bg-panel); border: 1px solid var(--border-color); color: var(--text-primary); }

.report-preview-box {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 18px;
  overflow-y: auto;
}

.report-markdown-raw {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  color: #E2E8F0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Data Portability Styles */
.data-exchange-wrap {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.exchange-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.exchange-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.exchange-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exchange-card .ex-icon {
  font-size: 1.6rem;
}

.exchange-card h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.exchange-card p {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.btn-ex-action {
  margin-top: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  color: #38BDF8;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-ex-action:hover {
  background: var(--accent-blue);
  color: #FFFFFF;
  border-color: var(--accent-blue);
}

.btn-ex-upload {
  display: block;
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES (MOBILE FIRST REALIGNMENT)
   ========================================================================== */

@media (max-width: 768px) {
  /* Hide desktop top tabs on mobile */
  .primary-nav-tabs {
    display: none !important;
  }

  /* Show fixed bottom navigation bar on mobile */
  .mobile-bottom-nav {
    display: flex !important;
  }

  /* Drawer sits directly above the mobile bottom nav bar */
  .drawer-container {
    bottom: 54px !important;
  }

  /* Scrubber positioning above the bottom nav and drawer */
  .scrubber-mount {
    margin-bottom: calc(54px + var(--drawer-height-collapsed)) !important;
  }

  .scrubber-panel {
    padding: 6px 10px !important;
  }

  .scrubber-header {
    margin-bottom: 4px !important;
  }

  .scrubber-title-wrap {
    gap: 4px !important;
  }

  .scrubber-step-tools {
    gap: 3px !important;
  }

  .btn-step {
    padding: 3px 6px !important;
    font-size: 0.68rem !important;
  }

  .wagwan-strip {
    margin-top: 4px !important;
  }

  .wagwan-card {
    min-width: 170px !important;
    max-width: 190px !important;
    padding: 6px 8px !important;
  }
}

@media (min-width: 769px) {
  /* Hide mobile bottom nav on desktop */
  .mobile-bottom-nav {
    display: none !important;
  }

  /* Show desktop primary nav tabs in header */
  .primary-nav-tabs {
    display: flex !important;
  }

  /* Drawer sits at very bottom on desktop */
  .drawer-container {
    bottom: 0 !important;
  }

  .scrubber-mount {
    margin-bottom: 0;
  }
}

/* ==========================================================================
   DW-10003 STANDARD DETAIL MODAL & AUDIT WORKBOOK CALLOUT
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 16px;
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg), 0 0 30px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

.dw-modal-title-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dw-badge-approved {
  align-self: flex-start;
  background: rgba(16, 185, 129, 0.15);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #F8FAFC;
  margin: 0;
}

.dw-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

.dw-subtitle code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #38BDF8;
  background: rgba(56, 189, 248, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.76rem;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-modal-close:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.1);
}

.modal-body.dw-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dw-schematic-wrap {
  background: #0B0F19;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.dw-schematic-header {
  background: #182234;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #94A3B8;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dw-svg-diagram {
  display: block;
  width: 100%;
  height: auto;
  background: #0B0F19;
}

.dw-specs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 640px) {
  .dw-specs-grid {
    grid-template-columns: 1fr;
  }
}

.dw-spec-card {
  background: #182234;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 14px;
}

.dw-spec-card h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: #38BDF8;
  margin-bottom: 6px;
}

.dw-spec-card p {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0;
}

.dw-spec-card strong {
  color: #FFFFFF;
}

.dw-audit-callout {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid #38BDF8;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.12);
}

@media (max-width: 640px) {
  .dw-audit-callout {
    flex-direction: column;
    align-items: flex-start;
  }
}

.dw-audit-info strong {
  font-size: 0.85rem;
  color: #F8FAFC;
  display: block;
  margin-bottom: 4px;
}

.dw-audit-info p {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0;
}

.btn-download-workbook {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0284C7;
  color: #FFFFFF;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.btn-download-workbook:hover {
  background: #0369A1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.5);
}

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

.btn-secondary {
  background: #334155;
  color: #FFFFFF;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: #475569;
}

/* Quick DW-10003 Detail trigger button inside drawer spec grid */
.btn-xs-dw10003 {
  background: rgba(56, 189, 248, 0.15);
  color: #38BDF8;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  transition: all 0.15s ease;
}

.btn-xs-dw10003:hover {
  background: #38BDF8;
  color: #0F172A;
}



