.v3d-cesium-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Standalone Cesium viewer : le conteneur doit rester visible (cesium-ground.css le masque par défaut pour Potree). */
.v3d-cesium-viewport #cesiumContainer,
#cesiumContainer.v3d-cesium-full {
  visibility: visible !important;
  pointer-events: auto !important;
  z-index: 0;
}

.v3d-cesium-full {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  visibility: visible;
  pointer-events: auto;
}

.v3d-cesium-full .cesium-viewer,
.v3d-cesium-full .cesium-widget {
  width: 100%;
  height: 100%;
}

.v3d-tree-group {
  margin: 0.1rem 0;
}

.v3d-tree-group.is-collapsed > .v3d-tree-children {
  display: none;
}

.v3d-tree-row {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.v3d-tree-twist,
.v3d-tree-twist-spacer {
  flex: 0 0 1.1rem;
  width: 1.1rem;
  height: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.v3d-tree-twist {
  padding: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}

.v3d-tree-twist:hover {
  background: rgba(148, 163, 184, 0.15);
  color: #e2e8f0;
}

.v3d-tree-children {
  margin-left: 1.25rem;
  padding-left: 0.35rem;
  border-left: 1px solid rgba(148, 163, 184, 0.2);
}

.v3d-tree-actions {
  display: flex;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem 0.35rem;
}

.v3d-tree-action {
  padding: 0.15rem 0.45rem;
  border: 1px solid #334155;
  border-radius: 4px;
  background: #1e293b;
  color: #cbd5e1;
  font-size: 0.6875rem;
  cursor: pointer;
}

.v3d-tree-action:hover {
  background: #334155;
}

.v3d-tree-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}

.v3d-tree-item--nested {
  padding: 0.2rem 0.45rem;
}

.v3d-tree-item:hover {
  background: rgba(148, 163, 184, 0.12);
}

.v3d-tree-item.is-selected {
  background: rgba(99, 102, 241, 0.2);
}

.v3d-tree-item input {
  margin: 0;
  accent-color: #6366f1;
}

.v3d-tree-item__label {
  flex: 1;
  font-size: 0.8125rem;
  color: #e2e8f0;
  min-width: 0;
}

.v3d-tree-item--nested .v3d-tree-item__label {
  font-size: 0.75rem;
}

.v3d-tree-item__code {
  color: #64748b;
}

.v3d-tree-item .v3d-class-swatch {
  flex-shrink: 0;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.v3d-tree-item.is-globally-hidden {
  opacity: 0.45;
}

.v3d-tree-item.is-globally-hidden .v3d-tree-item__label {
  text-decoration: line-through;
}

.v3d-viewer-switch {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-left: 0.75rem;
}

.v3d-viewer-switch a {
  color: #a5b4fc;
}

/* Bas-droite : n’interfère pas avec la rail gauche ni l’aide centrée. */
.v3d-ground-status {
  position: absolute;
  left: auto;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 9990;
  box-sizing: border-box;
  width: min(18.5rem, calc(100vw - 76px - 1.5rem));
  margin: 0;
  padding: 0.55rem 0.7rem 0.6rem;
  border-radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.75rem;
  line-height: 1.35;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid #334155;
  backdrop-filter: blur(6px);
  pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.v3d-ground-status__head {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.v3d-ground-status__title {
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.v3d-ground-status__count {
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 600;
  color: #e2e8f0;
}

.v3d-ground-status__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.v3d-ground-status__close:hover {
  color: #f1f5f9;
  background: rgba(51, 65, 85, 0.7);
  border-color: #475569;
}

.v3d-ground-status__track {
  height: 0.35rem;
  margin: 0 0 0.4rem;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.85);
  overflow: hidden;
}

.v3d-ground-status__bar {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6366f1, #818cf8);
  transition: width 0.35s ease;
}

.v3d-ground-status--ready .v3d-ground-status__bar {
  background: linear-gradient(90deg, #16a34a, #4ade80);
}

.v3d-ground-status--pending .v3d-ground-status__bar {
  background: linear-gradient(90deg, #ca8a04, #fbbf24);
}

.v3d-ground-status__msg {
  margin: 0;
  color: inherit;
  font-size: 0.6875rem;
  line-height: 1.4;
}

.v3d-ground-status__tiles {
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  max-height: min(42vh, 14rem);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #475569 transparent;
  pointer-events: auto;
}

.v3d-ground-status__tile {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.4rem;
  padding: 0.22rem 0.35rem;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(51, 65, 85, 0.8);
  font-size: 0.6875rem;
}

.v3d-ground-status__dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}

.v3d-ground-status__tile-id {
  font-weight: 600;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}

.v3d-ground-status__tile-detail {
  grid-column: 2 / -1;
  color: #94a3b8;
  font-size: 0.625rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v3d-ground-status__tile-pct {
  font-variant-numeric: tabular-nums;
  color: #a5b4fc;
  font-weight: 600;
}

.v3d-ground-status__tile.is-ready .v3d-ground-status__dot { background: #4ade80; }
.v3d-ground-status__tile.is-ready .v3d-ground-status__tile-pct { color: #86efac; }
.v3d-ground-status__tile.is-busy .v3d-ground-status__dot {
  background: #818cf8;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}
.v3d-ground-status__tile.is-queued .v3d-ground-status__dot { background: #fbbf24; }
.v3d-ground-status__tile.is-error .v3d-ground-status__dot { background: #f87171; }
.v3d-ground-status__tile.is-error .v3d-ground-status__tile-pct { color: #fca5a5; }
.v3d-ground-status__tile.is-pending .v3d-ground-status__dot { background: #64748b; }

.v3d-ground-status--ready {
  border-color: rgba(74, 222, 128, 0.45);
  color: #bbf7d0;
}

.v3d-ground-status--busy {
  border-color: rgba(99, 102, 241, 0.45);
  color: #c7d2fe;
}

.v3d-ground-status--pending {
  border-color: rgba(251, 191, 36, 0.35);
  color: #fde68a;
}

.v3d-ground-status--error {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

body.convoy-playback-active .v3d-ground-status {
  display: none !important;
}

@media (max-width: 720px) {
  .v3d-ground-status {
    bottom: 3.25rem;
    right: 0.5rem;
    width: min(16.5rem, calc(100vw - 76px - 1rem));
  }
}

.v3d-perf-overlay {
  position: absolute;
  top: 3.25rem;
  right: 0.75rem;
  z-index: 10010;
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: min(70vh, 28rem);
  overflow: auto;
  padding: 0.55rem 0.65rem 0.65rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid #475569;
  color: #e2e8f0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.6875rem;
  line-height: 1.4;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.v3d-perf-overlay__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
}

.v3d-perf-overlay__badge {
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
  color: #86efac;
  font-size: 0.625rem;
}

.v3d-perf-overlay__body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #cbd5e1;
}
