* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: #000000;
  color: #ffffff;
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ===== TIER 1: App Bar (Top Tier) ===== */
#tier1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #000000;
  border-bottom: 1px solid #1c1c1e;
  padding: 0 16px;
  height: 44px;
  flex-shrink: 0;
  z-index: 200;
}

.t1-left, .t1-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-size: 11px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.8px;
  margin-right: 16px;
}
.logo sup.badge {
  background: #3a3a3c;
  color: #8e8e93;
  font-size: 7px;
  padding: 2px 4px;
  border-radius: 2px;
  font-weight: 800;
  vertical-align: super;
  margin-left: 4px;
}

/* Corporate Top Buttons */
.corp-btn {
  background: #1c1c1e;
  border: 1px solid #2c2c2e;
  color: #eaeaea;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease-in-out;
}
.corp-btn:hover {
  background: #2c2c2e;
  border-color: #48484a;
  color: #ffffff;
}

/* Pulsing Teal Highlight for Load P1 */
.btn-load {
  border-color: #00d2ff !important;
  background: rgba(0, 210, 255, 0.08) !important;
  color: #00d2ff !important;
  animation: pulse-glow 2s infinite;
}
.btn-load:hover {
  background: rgba(0, 210, 255, 0.18) !important;
}

.btn-licensing {
  border-color: #af52de !important;
  background: rgba(175, 82, 222, 0.08) !important;
  color: #af52de !important;
}
.btn-licensing:hover {
  background: rgba(175, 82, 222, 0.18) !important;
}

.corp-sep {
  width: 1px;
  height: 16px;
  background: #2c2c2e;
  margin: 0 4px;
  flex-shrink: 0;
}

/* Corporate Top Navigation Tab Buttons */
.corp-nav-btn {
  background: transparent;
  border: none;
  color: #8e8e93;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 6px 10px;
  transition: color 0.15s;
}
.corp-nav-btn:hover {
  color: #ffffff;
}
.corp-nav-btn.active {
  color: #00d2ff;
}

.t1-status {
  font-size: 10px;
  color: #8e8e93;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dot-green {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #30d158;
  display: inline-block;
  box-shadow: 0 0 5px #30d158;
}

.t1-icon {
  width: 28px; height: 28px;
  border: 1px solid #2c2c2e;
  border-radius: 4px;
  background: #1c1c1e;
  color: #8e8e93;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.t1-icon:hover {
  background: #2c2c2e;
  color: #ffffff;
  border-color: #48484a;
}

/* ===== TIER 2: Toolbar (Bottom Tier) ===== */
#tier2 {
  display: flex;
  align-items: center;
  background: #000000;
  border-bottom: 1px solid #1c1c1e;
  padding: 0 16px;
  height: 38px;
  flex-shrink: 0;
  z-index: 200;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
}
#tier2::-webkit-scrollbar { height: 0; }

.t2-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #1c1c1e;
  border: 1px solid #2c2c2e;
  color: #aeaeb2;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: all 0.15s;
}
.t2-btn:hover {
  background: #2c2c2e;
  border-color: #48484a;
  color: #ffffff;
}

/* Highlighted orange Start Pt button */
.btn-startpt {
  border-color: #ff9f0a !important;
  background: rgba(255, 159, 10, 0.08) !important;
  color: #ff9f0a !important;
  animation: startpt-glow 2s infinite;
}
.btn-startpt:hover {
  background: rgba(255, 159, 10, 0.18) !important;
}

.t2-spacer { flex: 1; }

.val {
  background: rgba(255,255,255,0.08);
  border: 1px solid #2c2c2e;
  color: #ffffff;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 9px;
  margin-left: 4px;
}

/* Plan Survey Tab */
.corp-tab {
  background: transparent;
  border: none;
  color: #8e8e93;
  padding: 0 16px;
  height: 100%;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.corp-tab:hover {
  color: #ffffff;
}
.corp-tab.active {
  color: #00d2ff;
  border-bottom-color: #00d2ff;
}

/* Bottom Nav Map/Survey View Buttons */
.corp-view-btn {
  background: #1c1c1e;
  border: 1px solid #2c2c2e;
  color: #8e8e93;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.corp-view-btn:hover {
  background: #2c2c2e;
  color: #ffffff;
}
.corp-view-btn.active {
  background: rgba(0, 210, 255, 0.08);
  border-color: #00d2ff;
  color: #00d2ff;
}

/* ===== MAIN AREA ===== */
#main {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* Cesium globe */
#cesium-globe {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2;
}

/* Survey list panel (floating) */
#survey-list-panel {
  position: absolute;
  top: 0; left: 0; width: 220px; height: 100%;
  background: #000000; border-right: 1px solid #222222;
  z-index: 5; overflow-y: auto;
}
#survey-list-header {
  padding: 8px 12px; font-size: 11px; color: #ffffff;
  background: #111111; position: sticky; top: 0;
  font-weight: 600; border-bottom: 1px solid #222222;
}
#survey-list { font-size: 11px; }
.survey-line-item {
  display: flex; justify-content: space-between;
  padding: 4px 12px; border-bottom: 1px solid #222222;
  cursor: pointer; transition: background 0.1s;
}
.survey-line-item:hover { background: #222222; }
.survey-line-item.active { background: #333333; color: #fff; }
.line-name { color: #9aefb0; font-weight: 500; }
.line-coords { color: #5050a0; font-size: 10px; }

/* Route stats */
#route-stats {
  display: flex;
  gap: 6px;
  font-size: 10px;
  color: #9aefb0;
  flex-wrap: nowrap;
  white-space: nowrap;
  align-items: center;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}

@keyframes startpt-glow {
  0% { box-shadow: 0 0 0 0 rgba(211, 84, 0, 0.8); }
  70% { box-shadow: 0 0 0 7px rgba(211, 84, 0, 0); }
  100% { box-shadow: 0 0 0 0 rgba(211, 84, 0, 0); }
}

#route-stats span {
  background: #1e2e1e;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #2a5a2a;
}

#route-stats #stat-skipped {
  background: #2e1e1e;
  border-color: #5a2a2a;
  color: #ef9a9a;
}

/* Map */
#map {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1;
}

/* No survey overlay */
#no-survey-overlay {
  position: absolute;
  top: 40px; left: 0; right: 0; bottom: 0;
  background: rgba(20,20,40,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

#no-survey-card {
  background: #1e1e3a;
  border: 1px solid #3a3a60;
  border-radius: 10px;
  padding: 28px 32px;
  text-align: center;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

#no-survey-icon { font-size: 36px; margin-bottom: 10px; }
#no-survey-title { font-size: 16px; font-weight: 600; color: #c8c8e8; margin-bottom: 6px; }
#no-survey-sub { font-size: 12px; color: #6060a0; margin-bottom: 18px; line-height: 1.5; }

#no-survey-actions { display: flex; gap: 10px; justify-content: center; }

.btn-primary {
  background: #2980b9;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.btn-primary:hover { background: #3498db; }

.btn-secondary {
  background: #2a2a50;
  color: #9090c0;
  border: 1px solid #3a3a60;
  padding: 8px 16px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
}

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

/* Bottom bar */
#bottom-bar {
  position: absolute;
  bottom: 6px;
  left: 10px;
  display: flex;
  gap: 16px;
  font-size: 10px;
  color: #6060a0;
  z-index: 10;
  pointer-events: none;
  background: rgba(20,20,40,0.6);
  padding: 3px 8px;
  border-radius: 4px;
}

/* Right controls */
#right-controls {
  position: absolute;
  right: 10px;
  top: 50px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 100;
}

.map-ctrl-btn {
  width: 30px; height: 30px;
  background: #1e1e3a;
  border: 1px solid #3a3a60;
  color: #c0c0e0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}

.map-ctrl-btn:hover { background: #252550; }
.ctrl-divider { height: 1px; background: #3a3a60; margin: 2px 0; }

/* ===== SETTINGS PANELS ===== */
.settings-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #000000;
  border: 1px solid #222222;
  border-radius: 8px;
  padding: 20px 24px;
  z-index: 200;
  min-width: 260px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8);
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 14px;
  border-bottom: 1px solid #222222;
  padding-bottom: 8px;
}

.panel-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
}

.panel-row label { color: #ffffff; width: 70px; }
.panel-row input {
  flex: 1;
  background: #111111;
  border: 1px solid #222222;
  color: #ffffff;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.panel-row input[type=number] {
  padding-right: 4px;
}

.panel-row span { color: #888888; font-size: 11px; }

.panel-ok {
  background: #1abc9c;
  color: #fff;
  border: none;
  padding: 7px 18px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  margin-right: 6px;
}

.panel-cancel {
  background: #111111;
  color: #ffffff;
  border: 1px solid #222222;
  padding: 7px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

/* Planning progress */
#planning-overlay {
  display: none;
  position: absolute;
  top: 40px; left: 0; right: 0; bottom: 0;
  background: rgba(20,20,40,0.7);
  z-index: 60;
  align-items: center;
  justify-content: center;
}

#planning-overlay.visible {
  display: flex;
}

#planning-card {
  background: #000000;
  border: 1px solid #222222;
  border-radius: 8px;
  padding: 24px 32px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.8);
}

#planning-card h3 { color: #1abc9c; margin-bottom: 8px; font-size: 15px; }
#planning-card p  { color: #ffffff; font-size: 12px; margin-bottom: 16px; }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid #2a2a50;
  border-top-color: #1abc9c;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

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

/* Cesium globe overrides */
#cesium-globe { background: #0a0a1a; }
#cesium-globe .cesium-viewer-toolbar,
#cesium-globe .cesium-viewer-bottom { display: none !important; }
.cesium-widget-credits { display: none !important; }

/* Leaflet overrides */
.leaflet-container { background: #2a2a4a; }
.leaflet-control-zoom { display: none; }
.leaflet-control-attribution { background: rgba(20,20,40,0.7) !important; color: #404060 !important; font-size: 9px; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #191932; }
::-webkit-scrollbar-thumb { background: #3a3a60; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4a4a80; }
