/* =========================================================
  DigiWorks Planner – Stylesheet
   ========================================================= */

/* ----- Reset / Base ----- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 13px;
  background: #1a1a2e;
  color: #e0e0e0;
}

body {
  --toolbar-height: 84px;
  --status-bar-height: 26px;
  --toolbar-content-height: 68px;
  --status-bar-top: var(--toolbar-height);
  --range-bar-top: calc(var(--toolbar-height) + var(--status-bar-height));
  --content-top-offset: calc(var(--toolbar-height) + var(--status-bar-height));
  --milepost-top-offset: calc(var(--toolbar-height) + var(--status-bar-height));
}

body.app-locked #toolbar,
body.app-locked #status-bar,
body.app-locked #range-bar,
body.app-locked #cesiumContainer,
body.app-locked #loaded-elr-panel,
body.app-locked #machine-panel,
body.app-locked #info-panel,
body.app-locked #mp-panel,
body.app-locked #deliverables-panel {
  filter: blur(2px) saturate(0.7);
  opacity: 0.42;
}

#auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(0, 191, 255, 0.18), transparent 34%),
    linear-gradient(135deg, rgba(4, 8, 18, 0.96), rgba(10, 18, 34, 0.94));
  backdrop-filter: blur(12px);
}

#auth-overlay[hidden] {
  display: none !important;
}

.auth-brand {
  position: absolute;
  top: 24px;
  left: 24px;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.auth-brand img {
  display: block;
  width: clamp(140px, 18vw, 220px);
  height: auto;
}

.auth-shell {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid rgba(0, 191, 255, 0.22);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(16, 24, 45, 0.96), rgba(9, 15, 30, 0.96));
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.42);
}

.auth-kicker {
  margin-bottom: 10px;
  color: #7fdfff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#auth-title {
  color: #f5fbff;
  font-size: clamp(28px, 4vw, 34px);
  line-height: 1.05;
}

#auth-subtitle,
#auth-managed-note {
  color: #a9c6dd;
  line-height: 1.55;
}

#auth-subtitle {
  margin-top: 12px;
}

#auth-managed-note {
  margin-top: 14px;
  font-size: 11px;
}

#auth-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.auth-field {
  display: grid;
  gap: 7px;
}

.auth-field span {
  color: #d7e7f5;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.auth-field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(0, 191, 255, 0.22);
  border-radius: 10px;
  color: #f5fbff;
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.auth-field input:focus {
  border-color: rgba(0, 191, 255, 0.72);
  background: rgba(255, 255, 255, 0.1);
}

#auth-submit-btn {
  min-height: 46px;
  margin-top: 4px;
  background: linear-gradient(135deg, #00bfff, #0d7ea8);
  border: none;
  border-radius: 10px;
  color: #06111f;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

#auth-submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(0, 191, 255, 0.28);
}

#auth-submit-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

#auth-feedback {
  min-height: 20px;
  margin-top: 14px;
  color: #7fdfff;
  line-height: 1.45;
}

#auth-feedback.is-error {
  color: #ffb4b4;
}

#auth-feedback.is-ready {
  color: #9dd7a5;
}

/* ----- Toolbar ----- */
#toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: auto;
  min-height: var(--toolbar-height);
  z-index: 100;
  background: rgba(15, 20, 40, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(0, 191, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  padding: 8px 16px;
  gap: 12px;
}

#toolbar-left {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-width: 0;
}

#toolbar-center {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-start;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: visible;
  scrollbar-width: thin;
}

.toolbar-column {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.toolbar-column-elr-import {
  align-self: stretch;
}

#toolbar-modes {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-width: 0;
}

#toolbar.toolbar-stack-right,
#toolbar.toolbar-stack-modes {
  flex-wrap: wrap;
  align-items: flex-start;
}

#toolbar.toolbar-stack-right #toolbar-right {
  order: 4;
  flex: 1 0 100%;
  width: 100%;
  justify-content: flex-end;
}

#toolbar.toolbar-stack-right .toolbar-utility-group {
  width: auto;
  margin-left: auto;
  justify-content: flex-end;
}

#toolbar.toolbar-stack-modes #toolbar-modes {
  order: 3;
  flex: 1 1 auto;
  min-width: 0;
}

#toolbar.toolbar-stack-modes .toolbar-pill-group-modes {
  width: auto;
  max-width: 100%;
}

#toolbar.toolbar-stack-modes #toolbar-right {
  order: 4;
  flex: 0 1 auto;
  width: auto;
  margin-left: auto;
  justify-content: flex-end;
}

#toolbar.toolbar-stack-modes .toolbar-utility-group {
  width: auto;
  margin-left: auto;
  justify-content: flex-end;
}

.toolbar-pill-group {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(0, 191, 255, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.toolbar-pill-title {
  color: #7fdfff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.toolbar-pill-items {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-pill-items-buttons {
  gap: 10px;
}

#toolbar-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

#toolbar-auth-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#auth-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(0, 191, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #d9f5ff;
}

.toolbar-auth-label {
  color: #7fdfff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#auth-user-email {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.toolbar-state-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  order: 2;
}

.toolbar-utility-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  order: 1;
}

.toolbar-logo-wrap {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: var(--toolbar-content-height);
}

.toolbar-logo-wrap-left {
  justify-content: flex-start;
}

.toolbar-logo {
  display: block;
  width: auto;
  height: var(--toolbar-content-height);
  max-width: min(28vw, 240px);
}

/* ----- Control Groups ----- */
.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-column-elr-import .control-group {
  min-height: 40px;
}

.control-group-button {
  flex: 0 0 auto;
}

.control-group label {
  color: #b0c4de;
  font-weight: 500;
  white-space: nowrap;
}

.toolbar-menu {
  position: relative;
  flex: 0 0 auto;
}

.toolbar-pill-group-import {
  align-items: center;
}

.toolbar-pill-group-import .toolbar-pill-items {
  align-items: center;
  width: auto;
}

.toolbar-pill-group-import .control-group {
  width: auto;
}

.control-group-import-inline {
  min-height: 34px;
}

.control-group-import-inline #elr-select {
  min-width: 140px;
}

.toolbar-pill-group-import .toolbar-menu {
  width: auto;
}

.toolbar-pill-group-import .toolbar-menu-trigger {
  width: auto;
}

.toolbar-pill-group-import .toolbar-menu-panel {
  right: auto;
  left: 0;
}

.toolbar-menu-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 34px;
  min-width: 92px;
  padding: 7px 14px;
  line-height: 1.2;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(0, 191, 255, 0.35);
  border-radius: 6px;
  color: #d9f5ff;
  cursor: pointer;
  user-select: none;
  font: inherit;
  text-align: center;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.toolbar-menu-trigger:hover,
.toolbar-menu.is-open .toolbar-menu-trigger {
  background: rgba(0, 191, 255, 0.18);
  border-color: rgba(0, 191, 255, 0.55);
  color: #ffffff;
}

.toolbar-menu-label {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.toolbar-menu-caret {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  line-height: 1;
  opacity: 0.85;
  transform: translateY(1px);
  transition: transform 0.2s ease;
}

.toolbar-menu.is-open .toolbar-menu-caret {
  transform: rotate(180deg) translateY(-1px);
}

.toolbar-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 250px;
  padding: 10px;
  background: rgba(12, 18, 38, 0.97);
  border: 1px solid rgba(0, 191, 255, 0.28);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toolbar-menu-panel[hidden] {
  display: none !important;
}

.toolbar-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-pill-item {
  display: flex;
  align-items: center;
}

.toolbar-pill-switch-row {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(0, 191, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}

.toolbar-menu-switch-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  align-items: center;
  column-gap: 18px;
  padding: 6px 0;
}

.toolbar-menu-button-row {
  width: 100%;
}

.toolbar-menu-button-row > button {
  width: 100%;
}

.toolbar-menu-button-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.toolbar-menu-panel [hidden] {
  display: none !important;
}

.toolbar-menu-button-pair.single-visible {
  grid-template-columns: 1fr;
}

.toolbar-pill-switch-row .switch-label {
  flex: 0 0 auto;
}

#elr-select {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(0, 191, 255, 0.35);
  border-radius: 5px;
  color: #e0e0e0;
  padding: 5px 10px;
  font-size: 13px;
  cursor: pointer;
  min-width: 110px;
  outline: none;
  transition: border-color 0.2s;
}

#elr-select:focus {
  border-color: #00bfff;
}

#elr-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#elr-select option {
  background: #1a1a2e;
  color: #e0e0e0;
}

/* ----- Toggle Switch ----- */
.switch-label {
  color: #b0c4de;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.45;
}

.toolbar-pill-group .mode-toggle-btn {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  white-space: nowrap;
  padding: 5px 8px;
  font-size: 11px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #444;
  border-radius: 22px;
  transition: 0.3s;
}

.slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.3s;
}

.switch input:checked + .slider {
  background: #00bfff;
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
}

#state-save-btn,
#state-load-btn,
.toolbar-auth-group button,
.toolbar-utility-group button,
.mode-toggle-btn {
  background: rgba(0, 191, 255, 0.12);
  border: 1px solid rgba(0, 191, 255, 0.35);
  border-radius: 5px;
  color: #d9f5ff;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#state-save-btn:hover,
#state-load-btn:hover,
.toolbar-auth-group button:hover,
.toolbar-utility-group button:hover,
.mode-toggle-btn:hover {
  background: rgba(0, 191, 255, 0.2);
  border-color: rgba(0, 191, 255, 0.55);
  color: #ffffff;
}

#state-save-btn:disabled,
#state-load-btn:disabled,
.toolbar-auth-group button:disabled,
.toolbar-utility-group button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toolbar-utility-group button.is-active,
.mode-toggle-btn.is-active {
  background: rgba(0, 191, 255, 0.28);
  border-color: rgba(0, 191, 255, 0.7);
  color: #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 191, 255, 0.18) inset;
}

#hazard-load-btn,
#hazard-clear-btn {
  background: rgba(220, 30, 30, 0.14);
  border: 1px solid rgba(220, 30, 30, 0.45);
  border-radius: 5px;
  color: #ffcccc;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#hazard-load-btn:hover,
#hazard-clear-btn:hover:not(:disabled) {
  background: rgba(220, 30, 30, 0.26);
  border-color: rgba(220, 30, 30, 0.7);
  color: #ffffff;
}

#hazard-clear-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#deliverables-load-btn,
#deliverables-clear-btn {
  background: rgba(30, 180, 90, 0.14);
  border: 1px solid rgba(30, 180, 90, 0.4);
  border-radius: 5px;
  color: #d5ffe7;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#deliverables-load-btn:hover,
#deliverables-clear-btn:hover:not(:disabled) {
  background: rgba(30, 180, 90, 0.24);
  border-color: rgba(30, 180, 90, 0.68);
  color: #ffffff;
}

#deliverables-clear-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#buried-services-load-btn,
#buried-services-clear-btn {
  background: rgba(214, 158, 46, 0.16);
  border: 1px solid rgba(214, 158, 46, 0.42);
  border-radius: 5px;
  color: #ffe8b3;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#buried-services-load-btn:hover,
#buried-services-clear-btn:hover:not(:disabled) {
  background: rgba(214, 158, 46, 0.28);
  border-color: rgba(214, 158, 46, 0.7);
  color: #ffffff;
}

#buried-services-clear-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.toolbar-menu-button-pair > #hazard-load-btn,
.toolbar-menu-button-pair > #hazard-clear-btn,
.toolbar-menu-button-pair > #deliverables-load-btn,
.toolbar-menu-button-pair > #deliverables-clear-btn,
.toolbar-menu-button-pair > #buried-services-load-btn,
.toolbar-menu-button-pair > #buried-services-clear-btn {
  width: 100%;
}

.legend-hazard-triangle {
  display: inline-block;
  color: #CC0000;
  font-size: 13px;
  line-height: 1;
  width: 22px;
  text-align: center;
}

/* ----- Legend ----- */
.legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: #b0c4de;
}

#hazard-legend-item {
  padding: 5px 10px;
  border: 1px solid rgba(255, 173, 173, 0.2);
  border-radius: 999px;
  background: rgba(220, 30, 30, 0.08);
}

.legend-swatch {
  display: inline-block;
  width: 22px;
  height: 4px;
  border-radius: 2px;
}

/* ----- Status Bar ----- */
#status-bar {
  position: absolute;
  top: var(--status-bar-top);
  left: 0;
  right: 0;
  height: 26px;
  z-index: 90;
  background: rgba(10, 15, 30, 0.82);
  border-bottom: 1px solid rgba(0, 191, 255, 0.12);
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
}

#status-msg {
  font-size: 12px;
  color: #7fa8cc;
}

/* ----- Loading Spinner ----- */
#spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 191, 255, 0.3);
  border-top-color: #00bfff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

@media (max-width: 640px) {
  #auth-overlay {
    align-items: stretch;
    padding: 14px;
  }

  .auth-shell {
    width: 100%;
    margin: auto 0;
    padding: 22px 18px;
  }

  #toolbar-auth-group {
    width: 100%;
    justify-content: flex-end;
  }

  #auth-user-email {
    max-width: 136px;
  }
}

/* ----- Cesium Container ----- */
#cesiumContainer {
  position: absolute;
  top: var(--content-top-offset);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
}

/* ----- Loaded ELR Panel ----- */
#loaded-elr-panel {
  position: absolute;
  top: var(--content-top-offset);
  left: 0;
  z-index: 200;
  width: 360px;
  min-width: 280px;
  min-height: 150px;
  max-height: 280px;
  background: rgba(12, 18, 38, 0.95);
  border-right: 1px solid rgba(0, 191, 255, 0.3);
  border-bottom: 1px solid rgba(0, 191, 255, 0.3);
  border-bottom-right-radius: 8px;
  box-shadow: 4px 4px 20px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#machine-panel {
  position: absolute;
  right: 14px;
  bottom: 28px;
  z-index: 200;
  width: 560px;
  min-width: 420px;
  min-height: 180px;
  max-height: min(420px, calc(100vh - 110px));
  background: rgba(12, 18, 38, 0.95);
  border: 1px solid rgba(0, 191, 255, 0.3);
  border-radius: 8px;
  box-shadow: -4px 4px 20px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.machine-popup-host {
  margin: 0;
  min-height: 100vh;
  padding: 12px;
  background: linear-gradient(180deg, rgba(8, 12, 24, 1) 0%, rgba(12, 18, 38, 1) 100%);
}

#machine-popup-root {
  min-height: calc(100vh - 24px);
}

body.machine-popup-host #machine-panel {
  position: static !important;
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  top: auto !important;
  width: 100% !important;
  min-width: 0;
  min-height: calc(100vh - 24px);
  height: calc(100vh - 24px);
  max-height: none;
  margin: 0;
}

body.machine-popup-host #machine-header,
body.machine-popup-host #machine-panel.is-dragging #machine-header {
  cursor: default;
}

body.machine-popup-host #machine-resize-handle {
  display: none !important;
}

#machine-panel.collapsed {
  min-height: 0;
  height: auto !important;
}

#machine-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: rgba(0, 191, 255, 0.12);
  border-bottom: 1px solid rgba(0, 191, 255, 0.2);
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
}

#machine-panel.is-dragging #machine-header { cursor: grabbing; }

#machine-title {
  font-weight: 700;
  color: #00bfff;
  font-size: 13px;
}

#machine-collapse {
  background: transparent;
  border: none;
  color: #7fa8cc;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: transform 0.15s ease, color 0.15s ease;
}

#machine-collapse:hover { color: #00bfff; }

#machine-panel.collapsed #machine-body { display: none; }

#machine-panel.collapsed #machine-collapse { transform: rotate(180deg); }

#machine-panel.collapsed #machine-resize-handle { display: none; }

#machine-body {
  overflow-y: auto;
  flex: 1;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#machine-schedule-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#machine-schedule-load-btn,
#machine-access-load-btn,
.machine-secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(0, 191, 255, 0.25);
  border-radius: 5px;
  color: #d0dce8;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 8px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

#machine-schedule-load-btn:hover,
#machine-access-load-btn:hover,
.machine-secondary-btn:hover {
  background: rgba(0, 191, 255, 0.14);
  border-color: rgba(0, 191, 255, 0.45);
  color: #ffffff;
}

.machine-secondary-btn.is-active {
  background: rgba(0, 191, 255, 0.24);
  border-color: rgba(0, 191, 255, 0.6);
  color: #ffffff;
}

#machine-schedule-status,
#machine-access-status {
  color: #9ac7dc;
  font-size: 11px;
  line-height: 1.4;
}

#machine-access-status {
  flex-basis: 100%;
}

#machine-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 191, 255, 0.14);
  align-self: flex-start;
}

.machine-mode-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #9ac7dc;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.machine-mode-btn:hover {
  color: #ffffff;
  background: rgba(0, 191, 255, 0.1);
}

.machine-mode-btn.is-active {
  color: #ffffff;
  background: rgba(0, 191, 255, 0.2);
  border-color: rgba(0, 191, 255, 0.35);
}

.machine-mode-panel.hidden {
  display: none;
}

.machine-common-grid {
  margin-bottom: 2px;
}

#machine-possession-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#machine-possession-summary {
  min-height: 18px;
  color: #9ac7dc;
  font-size: 12px;
  line-height: 1.45;
}

#machine-add-possession {
  align-self: flex-start;
}

#machine-possession-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  padding-right: 2px;
}

.machine-possession-item,
.machine-possession-empty {
  border: 1px solid rgba(0, 191, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.45;
}

.machine-possession-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  color: #dbe8ef;
}

.machine-possession-item strong {
  color: #ffffff;
}

.machine-possession-copy {
  min-width: 0;
}

.machine-possession-copy > div {
  overflow-wrap: anywhere;
}

.machine-possession-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.machine-possession-actions .machine-secondary-btn {
  min-width: 64px;
}

.machine-possession-empty {
  color: #7fa8cc;
  font-style: italic;
}

.machine-form-grid {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.machine-form-grid label {
  color: #7fa8cc;
  font-weight: 600;
  font-size: 12px;
}

#machine-discipline-select,
#machine-track-select,
#machine-task-select,
#machine-start-mileage,
#machine-end-mileage,
#machine-type-output,
#machine-size-output,
#machine-labour-output,
#machine-start-date,
#machine-start-time,
#machine-end-date,
#machine-possession-start-date,
#machine-possession-start-time,
#machine-possession-end-date,
#machine-possession-end-time,
#machine-end-time {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(0, 191, 255, 0.25);
  border-radius: 5px;
  color: #e0e0e0;
  padding: 6px 8px;
  font-size: 12px;
  outline: none;
}

#machine-discipline-select option,
#machine-track-select option,
#machine-task-select option,
#machine-start-time option,
#machine-end-time option,
#machine-possession-start-time option,
#machine-possession-end-time option {
  background: #1a1a2e;
  color: #e0e0e0;
}

#machine-type-output,
#machine-size-output,
#machine-labour-output {
  color: #b9d7ea;
}

.machine-inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.machine-date-time-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
  align-items: center;
}

#machine-add {
  align-self: flex-start;
  background: rgba(0, 191, 255, 0.18);
  border: 1px solid rgba(0, 191, 255, 0.4);
  border-radius: 5px;
  color: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
  transition: background 0.15s, border-color 0.15s;
}

#machine-add.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#machine-add:hover:not(:disabled) {
  background: rgba(0, 191, 255, 0.26);
  border-color: rgba(0, 191, 255, 0.55);
}

#machine-add.is-disabled:hover {
  background: rgba(0, 191, 255, 0.18);
  border-color: rgba(0, 191, 255, 0.4);
}

#machine-add:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#machine-feedback {
  min-height: 18px;
  color: #7fa8cc;
  font-size: 12px;
  line-height: 1.4;
}

#machine-feedback.is-error {
  color: #ffb4b4;
}

#machine-feedback.is-ready {
  color: #9dd7a5;
}

#machine-highlighted-status-panel,
#machine-weather-panel {
  border: 1px solid rgba(0, 191, 255, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#machine-highlighted-status-header,
#machine-weather-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

#machine-highlighted-status-title,
#machine-weather-title {
  color: #dbe8ef;
  font-size: 12px;
  font-weight: 700;
}

#machine-highlighted-status-time,
#machine-weather-time {
  color: #7fa8cc;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#machine-highlighted-status-body,
#machine-weather-body {
  color: #c7d6e4;
  font-size: 11px;
  line-height: 1.45;
}

.machine-weather-empty {
  color: #7fa8cc;
}

.machine-weather-list {
  display: grid;
  gap: 8px;
}

.machine-weather-card {
  border: 1px solid rgba(0, 191, 255, 0.14);
  border-radius: 6px;
  background: rgba(9, 15, 31, 0.55);
  padding: 8px 9px;
  display: grid;
  gap: 4px;
}

.machine-weather-card-title {
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

.machine-weather-card-meta,
.machine-weather-card-summary {
  color: #9ac7dc;
  font-size: 10px;
  line-height: 1.45;
}

.machine-weather-card-summary {
  color: #d0dce8;
}

.machine-status-card-phase {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 191, 255, 0.14);
  color: #8fdbff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#machine-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  table-layout: fixed;
}

#machine-table thead th {
  position: sticky;
  top: 0;
  background: rgba(15, 25, 55, 0.98);
  color: #7fa8cc;
  font-weight: 600;
  padding: 5px 7px;
  font-size: 10px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 191, 255, 0.2);
}

#machine-table td {
  padding: 5px 7px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: #d0dce8;
  vertical-align: middle;
  line-height: 1.35;
}

#machine-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

#machine-table tbody tr:hover td,
#machine-table tbody tr:focus-visible td {
  background: rgba(0, 191, 255, 0.12);
}

#machine-table tbody tr:focus-visible {
  outline: none;
}

#machine-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

#machine-table td:nth-child(4),
#machine-table td:nth-child(5),
#machine-table td:nth-child(6),
#machine-table td:nth-child(7) {
  white-space: nowrap;
}

#machine-table td:nth-child(3),
#machine-table td:nth-child(4) {
  max-width: 150px;
}

.machine-access-copy {
  display: grid;
  gap: 2px;
}

.machine-access-copy strong {
  color: #ffffff;
  font-size: 10px;
}

.machine-access-copy span {
  color: #9ac7dc;
  font-size: 10px;
  line-height: 1.35;
}

.machine-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.machine-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(0, 191, 255, 0.25);
  border-radius: 4px;
  color: #d0dce8;
  cursor: pointer;
  font-size: 10px;
  padding: 4px 6px;
}

.machine-action:hover {
  background: rgba(0, 191, 255, 0.14);
  border-color: rgba(0, 191, 255, 0.45);
  color: #ffffff;
}

.machine-action.danger:hover {
  background: rgba(255, 76, 76, 0.16);
  border-color: rgba(255, 76, 76, 0.45);
  color: #ffd2d2;
}

.machine-empty {
  color: #5a7a9a;
  text-align: center;
  padding: 16px 0 !important;
  font-style: italic;
}

#loaded-elr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: rgba(0, 191, 255, 0.12);
  border-bottom: 1px solid rgba(0, 191, 255, 0.2);
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

#loaded-elr-panel.is-dragging #loaded-elr-header { cursor: grabbing; }

#loaded-elr-title {
  font-weight: 700;
  color: #00bfff;
  font-size: 13px;
}

#loaded-elr-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

#loaded-elr-panel.is-dragging,
#loaded-elr-panel.is-resizing,
#mp-panel.is-dragging,
#mp-panel.is-resizing,
#machine-panel.is-dragging,
#machine-panel.is-resizing {
  user-select: none;
}

.floating-panel-resize-handle {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  cursor: nwse-resize;
  touch-action: none;
  opacity: 0.8;
  background:
    linear-gradient(135deg, transparent 0 42%, rgba(0, 191, 255, 0.42) 42% 52%, transparent 52% 62%, rgba(0, 191, 255, 0.78) 62% 72%, transparent 72% 100%);
}

.floating-panel-resize-handle:hover {
  opacity: 1;
}

#loaded-elr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

#loaded-elr-table thead th {
  position: sticky;
  top: 0;
  background: rgba(15, 25, 55, 0.98);
  color: #7fa8cc;
  font-weight: 600;
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 191, 255, 0.2);
  white-space: nowrap;
}

#loaded-elr-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

#loaded-elr-table tbody tr:hover td,
#loaded-elr-table tbody tr.loaded-elr-active td {
  background: rgba(0, 191, 255, 0.15);
}

#loaded-elr-table tbody tr.loaded-elr-active td {
  color: #00bfff;
}

#loaded-elr-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: #d0dce8;
  vertical-align: middle;
}

#loaded-elr-table td:first-child {
  font-weight: 700;
  color: #e0e0e0;
  white-space: nowrap;
}

.loaded-elr-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.loaded-elr-action {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(0, 191, 255, 0.25);
  border-radius: 4px;
  color: #d0dce8;
  cursor: pointer;
  font-size: 11px;
  padding: 4px 7px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.loaded-elr-action:hover {
  background: rgba(0, 191, 255, 0.14);
  border-color: rgba(0, 191, 255, 0.45);
  color: #ffffff;
}

.loaded-elr-action.danger:hover {
  background: rgba(255, 76, 76, 0.16);
  border-color: rgba(255, 76, 76, 0.45);
  color: #ffd2d2;
}

.loaded-elr-empty {
  color: #5a7a9a;
  text-align: center;
  padding: 16px 0 !important;
  font-style: italic;
}

/* ----- Info Panel ----- */
#info-panel {
  position: absolute;
  bottom: 28px;
  left: 14px;
  z-index: 200;
  width: 300px;
  max-height: 340px;
  background: rgba(12, 18, 38, 0.95);
  border: 1px solid rgba(0, 191, 255, 0.35);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s;
}

#info-panel.hidden {
  display: none;
}

#info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(0, 191, 255, 0.12);
  border-bottom: 1px solid rgba(0, 191, 255, 0.2);
  flex-shrink: 0;
}

#info-title {
  font-weight: 700;
  color: #00bfff;
  font-size: 13px;
}

#info-close {
  background: none;
  border: none;
  color: #7fa8cc;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.2s;
}

#info-close:hover {
  color: #ff4c4c;
}

#info-body {
  overflow-y: auto;
  padding: 10px 12px;
  flex: 1;
}

#info-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

#info-body tr:nth-child(even) td {
  background: rgba(255,255,255,0.035);
}

#info-body td {
  padding: 4px 6px;
  vertical-align: top;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

#info-body td:first-child {
  color: #7fa8cc;
  font-weight: 600;
  width: 45%;
  white-space: nowrap;
}

.diagnostic-pre {
  margin-top: 10px;
  max-height: 240px;
  overflow: auto;
  padding: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(0, 191, 255, 0.14);
  color: #d7e9f8;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

#info-body td:last-child {
  color: #e0e0e0;
  word-break: break-all;
}

.info-legend {
  display: grid;
  gap: 12px;
}

.info-legend-copy {
  color: #cbe5f4;
  font-size: 12px;
  line-height: 1.5;
}

.info-legend .legend {
  gap: 8px;
}

.info-legend .legend-item {
  font-size: 12px;
  color: #d7e9f8;
}

.info-legend .legend-swatch {
  width: 26px;
  height: 6px;
}

/* ----- Cesium Widget Overrides ----- */
.cesium-widget-credits {
  display: none !important;
}

/* Slim down default Cesium toolbar */
.cesium-viewer-toolbar {
  top: auto !important;
  bottom: 6px !important;
  right: 6px !important;
}

.cesium-viewer-toolbar .cesium-navigation-help {
  top: auto !important;
  right: 0 !important;
  bottom: calc(100% + 8px) !important;
  left: auto !important;
}

.cesium-geocoder-input {
  height: 30px !important;
}

.cesium-geocoder-searchButton {
  height: 30px !important;
}

/* ----- Utility ----- */
.hidden {
  display: none !important;
}

/* =========================================================
   Range Filter Bar
   ========================================================= */
#range-bar {
  position: absolute;
  top: var(--range-bar-top);
  left: 0;
  right: 0;
  height: 52px;
  z-index: 95;
  background: rgba(10, 15, 32, 0.94);
  border-bottom: 1px solid rgba(0, 191, 255, 0.18);
  display: none;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
}

body.range-editor-open #range-bar {
  display: flex;
}

#range-bar-title {
  font-size: 11px;
  font-weight: 600;
  color: #5a8aaa;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.range-side-input {
  font-size: 12px;
  font-weight: 600;
  color: #00bfff;
  white-space: nowrap;
  min-width: 168px;
  text-align: center;
  background: rgba(0,191,255,0.08);
  border: 1px solid rgba(0,191,255,0.2);
  border-radius: 4px;
  padding: 4px 8px;
  flex-shrink: 0;
  outline: none;
}

.range-side-input:focus {
  border-color: rgba(0, 191, 255, 0.7);
  background: rgba(0, 191, 255, 0.16);
}

.range-side-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#range-label-start { text-align: right; }
#range-label-end   { text-align: left;  }

#range-wrapper-outer {
  position: relative;
  flex: 1;
  height: 28px;
}

.range-track-bg {
  position: absolute;
  left: 0; right: 0;
  height: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.14);
  border-radius: 2px;
  pointer-events: none;
}

#range-track-fill {
  position: absolute;
  height: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: #00bfff;
  border-radius: 2px;
  pointer-events: none;
  transition: left 0.05s, width 0.05s;
}

#range-wrapper-outer input[type=range] {
  position: absolute;
  width: 100%;
  height: 4px;
  top: 50%;
  transform: translateY(-50%);
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0;
  padding: 0;
  outline: none;
}

#range-wrapper-outer input[type=range]:disabled {
  opacity: 0.4;
}

/* Webkit thumbs */
#range-wrapper-outer input[type=range]::-webkit-slider-runnable-track {
  background: transparent;
  height: 4px;
}
#range-wrapper-outer input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #00bfff;
  cursor: grab;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,0.55);
  pointer-events: all;
  margin-top: -8px;
  transition: background 0.15s;
}
#range-wrapper-outer input[type=range]:active::-webkit-slider-thumb {
  cursor: grabbing;
  background: #0095cc;
}
/* Firefox thumbs */
#range-wrapper-outer input[type=range]::-moz-range-track {
  background: transparent;
  height: 4px;
}
#range-wrapper-outer input[type=range]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #00bfff;
  cursor: grab;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,0.55);
  pointer-events: all;
}
#range-wrapper-outer #range-min { z-index: 3; }
#range-wrapper-outer #range-max { z-index: 4; }

/* =========================================================
   Milepost Panel
   ========================================================= */
#mp-panel {
  position: absolute;
  top: var(--milepost-top-offset);
  right: 0;
  z-index: 200;
  width: 270px;
  min-width: 230px;
  min-height: 150px;
  max-height: calc(100vh - 90px);
  background: rgba(12, 18, 38, 0.95);
  border-left: 1px solid rgba(0, 191, 255, 0.3);
  border-bottom: 1px solid rgba(0, 191, 255, 0.3);
  border-bottom-left-radius: 8px;
  box-shadow: -4px 4px 20px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#mp-panel.collapsed {
  min-height: 0;
  height: auto !important;
}

#mp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: rgba(0, 191, 255, 0.12);
  border-bottom: 1px solid rgba(0, 191, 255, 0.2);
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

#mp-panel.is-dragging #mp-header { cursor: grabbing; }

#mp-title {
  font-weight: 700;
  color: #00bfff;
  font-size: 13px;
}

#mp-collapse {
  background: none;
  border: none;
  color: #7fa8cc;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.2s, transform 0.2s;
}

#mp-collapse:hover { color: #00bfff; }

#mp-panel.collapsed #mp-body  { display: none; }
#mp-panel.collapsed #mp-collapse { transform: rotate(180deg); }
#mp-panel.collapsed #mp-resize-handle { display: none; }

#mp-body {
  overflow-y: auto;
  flex: 1;
  max-height: calc(100vh - 140px);
  min-height: 0;
}

#mp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

#mp-table thead th {
  position: sticky;
  top: 0;
  background: rgba(15, 25, 55, 0.98);
  color: #7fa8cc;
  font-weight: 600;
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 191, 255, 0.2);
  white-space: nowrap;
}

#mp-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

#mp-table tbody tr:hover td,
#mp-table tbody tr.mp-selected td {
  background: rgba(0, 191, 255, 0.15);
}

#mp-table tbody tr.mp-selected td {
  color: #00bfff;
}

#mp-table td {
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: #d0dce8;
  vertical-align: middle;
}

#mp-table td:first-child {
  font-weight: 700;
  color: #e0e0e0;
  white-space: nowrap;
}

.mp-empty {
  color: #5a7a9a;
  text-align: center;
  padding: 16px 0 !important;
  font-style: italic;
}

/* =========================================================
   Deliverables Panel
   ========================================================= */
#deliverables-panel {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 200;
  width: auto;
  min-height: 150px;
  height: min(280px, calc(100vh - 170px));
  max-height: calc(100vh - 170px);
  background: rgba(12, 18, 38, 0.95);
  border: 1px solid rgba(0, 191, 255, 0.3);
  border-bottom: 1px solid rgba(0, 191, 255, 0.3);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#deliverables-panel.is-resizing {
  user-select: none;
}

#deliverables-resize-handle {
  flex: 0 0 12px;
  cursor: ns-resize;
  position: relative;
  background: linear-gradient(180deg, rgba(0, 191, 255, 0.14), rgba(0, 191, 255, 0.04));
  touch-action: none;
}

#deliverables-resize-handle::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 3px;
  border-radius: 999px;
  background: rgba(122, 183, 213, 0.85);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}

#deliverables-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  background: rgba(0, 191, 255, 0.12);
  border-bottom: 1px solid rgba(0, 191, 255, 0.2);
  flex-shrink: 0;
}

#deliverables-header-left,
#deliverables-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#deliverables-header-right {
  min-width: 0;
}

#deliverables-title {
  font-weight: 700;
  color: #00bfff;
  font-size: 13px;
}

#deliverables-opacity-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #cbe5f4;
  font-size: 11px;
  white-space: nowrap;
}

#deliverables-opacity-range {
  width: 110px;
  accent-color: #00bfff;
}

#deliverables-opacity-value {
  min-width: 40px;
  text-align: right;
  color: #8ec6de;
  font-variant-numeric: tabular-nums;
}

#deliverables-collapse {
  background: none;
  border: none;
  color: #7fa8cc;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.2s, transform 0.2s;
}

#deliverables-collapse:hover { color: #00bfff; }

#deliverables-panel.collapsed #deliverables-body { display: none; }
#deliverables-panel.collapsed #deliverables-collapse { transform: rotate(180deg); }

#deliverables-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
}

#deliverables-summary {
  color: #9ac7dc;
  font-size: 12px;
  line-height: 1.45;
}

#deliverables-graph {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.deliverables-graph-axis {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #7fa8cc;
  font-size: 11px;
}

.deliverables-graph-axis-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(0,191,255,0.12), rgba(0,191,255,0.55), rgba(0,191,255,0.12));
}

.deliverables-graph-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.deliverables-graph-row {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  background: rgba(255,255,255,0.035);
  color: #dce9f5;
  cursor: pointer;
  padding: 8px;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}

.deliverables-graph-row:hover,
.deliverables-graph-row.is-selected {
  border-color: rgba(0, 191, 255, 0.45);
  background: rgba(0, 191, 255, 0.12);
}

.deliverables-graph-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.deliverables-graph-label {
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: #e6f5ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deliverables-graph-range {
  flex: 0 0 auto;
  color: #8eb6cb;
  font-size: 11px;
  white-space: nowrap;
}

.deliverables-bar-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}

.deliverables-bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  min-width: 4px;
}

.deliverables-rev-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #dce9f5;
}

.deliverables-rev-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

#deliverables-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

#deliverables-table thead th {
  position: sticky;
  top: 0;
  background: rgba(15, 25, 55, 0.98);
  color: #7fa8cc;
  font-weight: 600;
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(0, 191, 255, 0.2);
  white-space: nowrap;
}

#deliverables-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

#deliverables-table tbody tr:hover td,
#deliverables-table tbody tr.is-selected td {
  background: rgba(0, 191, 255, 0.15);
}

#deliverables-table tbody tr.is-selected td {
  color: #00bfff;
}

#deliverables-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: #d0dce8;
  vertical-align: middle;
}

#deliverables-table td:nth-child(2) {
  max-width: 180px;
}

.deliverables-name,
.deliverables-range-cell {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.deliverables-empty {
  color: #5a7a9a;
  text-align: center;
  padding: 16px 0 !important;
  font-style: italic;
}

@media (max-width: 1400px) {
  #loaded-elr-panel {
    width: 320px;
  }

  .auth-brand {
    top: 18px;
    left: 18px;
  }

  #machine-panel {
    width: 520px;
  }

  #mp-panel {
    width: 240px;
  }
}

@media (max-width: 1100px) {
  #toolbar {
    height: auto;
    min-height: 52px;
    padding: 10px 12px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  #toolbar-center {
    flex-wrap: wrap;
    justify-content: flex-start;
    overflow-x: visible;
  }

  #toolbar-modes {
    width: 100%;
  }

  #toolbar-right {
    width: 100%;
    justify-content: flex-end;
  }

  .toolbar-state-group {
    margin-left: auto;
  }

  .toolbar-utility-group {
    width: auto;
    margin-left: 0;
    justify-content: flex-end;
  }

  .toolbar-pill-group {
    width: 100%;
    justify-content: space-between;
  }

  .toolbar-column {
    width: 100%;
  }

  .toolbar-menu-panel {
    right: auto;
    left: 0;
  }
  #loaded-elr-panel,
  #mp-panel {
    width: 280px;
  }

  #deliverables-panel {
    bottom: 12px;
    min-height: 140px;
    height: min(240px, calc(100vh - 190px));
    max-height: calc(100vh - 190px);
  }

  #machine-panel {
    width: 440px;
    right: 12px;
    bottom: 12px;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  #loaded-elr-header,
  #machine-header,
  #mp-header {
    cursor: default;
  }

  .floating-panel-resize-handle {
    display: none;
  }

  #toolbar-right {
    width: 100%;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  #toolbar-modes {
    width: 100%;
  }

  #state-save-btn,
  #state-load-btn {
    width: 100%;
  }

  .toolbar-state-group {
    width: 100%;
    order: 2;
  }

  .toolbar-pill-group {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-pill-items {
    width: 100%;
  }

  .control-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .toolbar-menu {
    width: 100%;
  }

  .toolbar-menu-trigger {
    width: 100%;
    justify-content: center;
  }

  .toolbar-menu-panel {
    position: static;
    margin-top: 8px;
    min-width: 0;
    width: 100%;
  }

  .toolbar-utility-group {
    width: 100%;
    justify-content: stretch;
    order: 1;
  }

  .toolbar-logo-wrap {
    margin-left: auto;
  }

  .toolbar-logo-wrap-left {
    margin-left: 0;
  }

  .toolbar-utility-group button {
    flex: 1 1 0;
  }

  #range-bar {
    height: auto;
    min-height: 190px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    row-gap: 10px;
    padding: 8px 12px 12px;
  }

  body.range-editor-open #range-bar {
    display: grid;
  }

  #range-bar-title,
  .range-side-input,
  #range-wrapper-outer {
    width: 100%;
    min-width: 0;
  }

  #range-label-start,
  #range-label-end {
    text-align: left;
  }

  #range-wrapper-outer {
    height: 32px;
  }

  .range-side-label {
    min-width: 90px;
  }

  #cesiumContainer {
    bottom: 360px;
  }

  #loaded-elr-panel,
  #machine-panel,
  #mp-panel,
  #deliverables-panel {
    top: auto;
    left: auto;
    max-height: 170px;
    border-radius: 8px;
    border: 1px solid rgba(0, 191, 255, 0.3);
  }

  #loaded-elr-panel {
    width: calc(100% - 24px);
    left: 12px;
    right: 12px;
    bottom: 368px;
  }

  body.range-editor-open #loaded-elr-panel {
    bottom: 300px;
  }

  #machine-panel {
    width: calc(100% - 24px);
    right: 12px;
    bottom: 12px;
    max-height: 220px;
  }

  #mp-panel {
    width: calc(100% - 24px);
    left: 12px;
    right: 12px;
    bottom: 240px;
    max-height: 170px;
  }

  body.range-editor-open #mp-panel {
    bottom: 110px;
  }

  #deliverables-panel {
    left: 12px;
    right: 12px;
    bottom: 184px;
    min-height: 120px;
    height: auto;
    max-height: 150px;
  }

  #deliverables-resize-handle {
    display: none;
  }

  #deliverables-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  #deliverables-header-right {
    width: 100%;
    justify-content: space-between;
  }

  #info-panel {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 430px;
  }
}
