:root {
  --bg: #0b0f17;
  --panel: #131a26;
  --panel-2: #1b2433;
  --line: #263349;
  --text: #e7edf5;
  --muted: #8da2bd;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  /* ---- Tokens estéticos del dashboard (no afectan el modal 3D) ---- */
  --sb-bg: radial-gradient(1200px 600px at -10% -10%, #16202f 0%, #0d1320 55%, #0a0f18 100%);
  --sb-surface: rgba(20, 28, 42, 0.72);
  --sb-surface-2: rgba(28, 38, 56, 0.6);
  --sb-line: rgba(96, 124, 168, 0.16);
  --sb-line-strong: rgba(120, 152, 200, 0.28);
  --grad: linear-gradient(110deg, var(--accent) 0%, var(--accent-2) 100%);
  --glow: 0 0 0 1px rgba(45, 212, 191, 0.35), 0 8px 24px -8px rgba(45, 212, 191, 0.35);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", "Roboto Mono", monospace;
  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  transition: grid-template-columns 0.25s ease;
}
.layout.collapsed {
  grid-template-columns: 0 1fr;
}
.layout.collapsed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: relative;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.4), 18px 0 50px -30px rgba(0, 0, 0, 0.8);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}
/* hairline de acento en el borde derecho del rail */
.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(45, 212, 191, 0.35) 18%,
    rgba(56, 189, 248, 0.25) 55%,
    transparent 100%
  );
  pointer-events: none;
}

.brand {
  position: relative;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--sb-line);
}
.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.brand-glyph {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 18px;
  color: #04121a;
  background: var(--grad);
  box-shadow: 0 6px 16px -6px rgba(45, 212, 191, 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.brand-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1.2px;
  background: linear-gradient(90deg, #f3f8ff, #b9cbe6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.brand-tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 1.5px;
  color: var(--accent);
  opacity: 0.85;
}
.brand-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-line);
}
.brand-status-text {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.2px;
}
.status-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  position: relative;
}
.status-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.18;
  animation: pulse 2.2s ease-out infinite;
}
.status-dot.ok {
  background: #34d399;
  color: #34d399;
}
.status-dot.load {
  background: #fbbf24;
  color: #fbbf24;
}
.status-dot.err {
  background: #f87171;
  color: #f87171;
}
.status-dot.warn {
  background: #64748b;
  color: #64748b;
}
@keyframes pulse {
  0% { transform: scale(0.7); opacity: 0.35; }
  70% { transform: scale(1.6); opacity: 0; }
  100% { opacity: 0; }
}

.scroll-area {
  flex: 1 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--sb-line-strong) transparent;
}
.scroll-area::-webkit-scrollbar {
  width: 8px;
}
.scroll-area::-webkit-scrollbar-thumb {
  background: var(--sb-line-strong);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}

/* ---- Grupos / rieles del menú ---- */
.rail-group {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--sb-line);
}
.rail-group.list-group {
  flex: 1 1;
  min-height: 0;
  border-bottom: none;
  padding-bottom: 8px;
}
.rail-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
}
.rail-icon {
  color: var(--accent);
  font-size: 12px;
  opacity: 0.9;
}
.rail-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.28);
  border-radius: 999px;
  padding: 1px 8px;
  letter-spacing: 0.5px;
}

.icon-btn {
  flex: none;
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-line);
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all 0.16s ease;
}
.icon-btn:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(45, 212, 191, 0.08);
}

.coord-box,
.group-box {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--sb-surface);
  border: 1px solid var(--sb-line);
}
.coord-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.coord-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 8px;
  gap: 8px;
}

input,
textarea {
  background: rgba(11, 16, 24, 0.55);
  border: 1px solid var(--sb-line);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: 13px;
  width: 100%;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.coord-row input {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2px;
}
input::placeholder,
textarea::placeholder {
  color: rgba(141, 162, 189, 0.55);
}
input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(45, 212, 191, 0.65);
  background: rgba(11, 16, 24, 0.85);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.12);
}

.btn-primary {
  position: relative;
  background: var(--grad);
  color: #04121a;
  border: none;
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 6px 16px -8px rgba(45, 212, 191, 0.65);
  transition: transform 0.12s ease, box-shadow 0.16s ease, filter 0.16s ease;
}
.btn-primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 10px 22px -8px rgba(45, 212, 191, 0.75);
}
.btn-primary:active {
  transform: translateY(1px);
}
.btn-primary.sm {
  padding: 8px 12px;
  font-size: 12px;
}
.btn-ghost {
  background: var(--sb-surface-2);
  border: 1px solid var(--sb-line-strong);
  color: var(--muted);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.16s ease;
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(45, 212, 191, 0.08);
}

.group-actions {
  display: flex;
  gap: 8px;
}
.group-msg {
  margin: 1px 0 0;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}

/* ---- Command-palette style search ---- */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--sb-surface);
  border: 1px solid var(--sb-line-strong);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.search-box:focus-within {
  border-color: rgba(45, 212, 191, 0.6);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.1);
}
.search-icon {
  flex: none;
  font-size: 15px;
  color: var(--muted);
  line-height: 1;
}
.search-box:focus-within .search-icon {
  color: var(--accent);
}
.search-box input {
  flex: 1 1;
  background: transparent;
  border: none;
  padding: 0;
  font-size: 13px;
}
.search-box input:focus {
  box-shadow: none;
  background: transparent;
}
.count {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid rgba(45, 212, 191, 0.24);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
  min-width: 22px;
  text-align: center;
}

.site-list {
  list-style: none;
  margin: 0;
  padding: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.site-list li {
  position: relative;
  display: grid;
  grid-template-columns: auto auto 1fr;
  grid-template-areas: "dot code name" "dot region region";
  align-items: center;
  grid-gap: 1px 9px;
  gap: 1px 9px;
  padding: 9px 11px 9px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 1px solid transparent;
  background: var(--sb-surface);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.site-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 0;
  border-radius: 2px;
  background: var(--grad);
  transition: height 0.18s ease;
}
.site-list li:hover {
  background: var(--sb-surface-2);
  border-color: var(--sb-line);
}
.site-list li:hover::before {
  height: 42%;
}
.site-list li.active {
  background: rgba(45, 212, 191, 0.09);
  border-color: rgba(45, 212, 191, 0.4);
}
.site-list li.active::before {
  height: 64%;
}
.site-list li.grouped:not(.active) {
  border-color: rgba(251, 146, 60, 0.32);
}
.site-dot {
  grid-area: dot;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
  opacity: 0.7;
}
.site-dot.on {
  background: #facc15;
  box-shadow: 0 0 8px 1px rgba(250, 204, 21, 0.55);
  opacity: 1;
}
.site-dot.grp {
  background: #fb923c;
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.16);
  opacity: 1;
}
.site-code {
  grid-area: code;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--accent);
}
.site-name {
  grid-area: name;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-region {
  grid-area: region;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.brand-footer {
  border-top: 1px solid var(--sb-line);
  padding: 11px 16px 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(8, 12, 20, 0.4);
}
.brand-footer-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-footer-top strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}
.brand-footer-pill {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: 5px;
  padding: 1px 5px;
  letter-spacing: 0.5px;
}
.brand-footer-sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.2px;
}
.brand-footer sup {
  font-size: 7px;
}

/* ---------- Stage / Globe ---------- */
.stage {
  position: relative;
  min-width: 0;
}
.globe-loading {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
}

.reopen-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 12;
  background: rgba(16, 22, 34, 0.82);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid var(--sb-line-strong);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 6px 20px -10px rgba(0, 0, 0, 0.8);
  transition: border-color 0.16s ease, background 0.16s ease;
}
.reopen-btn:hover {
  border-color: var(--accent);
  background: rgba(45, 212, 191, 0.1);
}

.stage-toolbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toggle-btn {
  background: rgba(16, 22, 34, 0.78);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid var(--sb-line-strong);
  color: var(--text);
  padding: 8px 13px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 6px 20px -10px rgba(0, 0, 0, 0.8);
  transition: border-color 0.16s ease, background 0.16s ease;
}
.toggle-btn:hover {
  border-color: var(--accent);
  background: rgba(45, 212, 191, 0.1);
}
.toggle-btn.on {
  border-color: var(--accent);
  color: var(--accent);
}
.badge {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 6px 11px;
  border-radius: 999px;
  border: 1px solid var(--sb-line-strong);
  background: rgba(16, 22, 34, 0.82);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  white-space: nowrap;
  box-shadow: 0 6px 20px -12px rgba(0, 0, 0, 0.8);
}
.badge.ok {
  color: #34d399;
  border-color: #1e5b46;
}
.badge.load {
  color: #fbbf24;
  border-color: #5b4a1e;
}
.badge.err {
  color: #f87171;
  border-color: #5b1e1e;
}
.badge.warn {
  color: var(--muted);
}

.panel-3d-btn {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #04121a;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  margin-bottom: 8px;
}
.panel-3d-btn:hover {
  filter: brightness(1.08);
}

.modal3d {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 8, 13, 0.92);
  display: flex;
  flex-direction: column;
}
.modal3d-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.m3d-code {
  color: var(--accent);
  font-weight: 700;
  margin-right: 10px;
}
.m3d-name {
  font-size: 16px;
}
.m3d-sub {
  color: var(--muted);
  font-size: 12px;
  margin-left: 12px;
}
.m3d-close {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.m3d-close:hover {
  border-color: var(--accent);
}
.modal3d-canvas {
  flex: 1 1;
  min-height: 0;
}
.modal3d-foot {
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.modal3d-canvas { position: relative; }
.m3d-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(8, 12, 20, 0.78);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  pointer-events: none;
  max-width: 220px;
}
.m3d-hud b { color: var(--accent); }
.m3d-watermark {
  position: absolute;
  right: 16px;
  bottom: 54px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.16);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  z-index: 5;
}
.m3d-hud a, .m3d-hud .m3d-op { pointer-events: auto; cursor: pointer; }
.m3d-hud a:hover { filter: brightness(1.15); }
.m3d-hud .m3d-hint { color: var(--muted); font-size: 11px; margin-top: 4px; display: block; }
.m3d-info {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 264px;
  background: rgba(8, 12, 20, 0.92);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 14px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.m3d-info h4 { margin: 0 0 4px; font-size: 14px; }
.m3d-info .m3d-info-sub { color: var(--muted); font-size: 11px; margin-bottom: 10px; }
.m3d-info dl { display: grid; grid-template-columns: auto 1fr; grid-gap: 4px 10px; gap: 4px 10px; margin: 0; }
.m3d-info dt { color: var(--muted); }
.m3d-info dd { margin: 0; text-align: right; font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.m3d-info-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.m3d-info-close:hover { color: var(--text); }
.m3d-layers {
  position: absolute;
  bottom: 14px;
  left: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 60%;
}
.m3d-layer-btn {
  background: rgba(8, 12, 20, 0.8);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}
.m3d-layer-btn:hover { border-color: var(--accent); color: var(--text); }
.m3d-layer-btn.on {
  background: var(--accent);
  color: #0b0f17;
  border-color: var(--accent);
  font-weight: 700;
}
.m3d-op {
  cursor: pointer;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  transition: opacity 0.15s;
}
.m3d-op.off { opacity: 0.32; text-decoration: line-through; }

.error-banner {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  max-width: 60%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(91, 30, 30, 0.96);
  border: 1px solid #f87171;
  color: #fecaca;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
.error-banner button {
  background: none;
  border: none;
  color: #fecaca;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}

.alt-hud {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 13;
  background: rgba(8, 12, 20, 0.9);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.alt-hud strong {
  color: var(--accent);
}

.ctx-menu {
  position: absolute;
  z-index: 30;
  min-width: 210px;
  max-width: 300px;
  background: rgba(19, 26, 38, 0.97);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
}
.ctx-coords {
  font-size: 11px;
  color: var(--muted);
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  padding: 2px 2px 6px;
  border-bottom: 1px solid var(--line);
}
.ctx-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.ctx-btn:hover {
  border-color: var(--accent);
}
.ctx-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.ctx-place {
  font-size: 11px;
  color: var(--text);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 8px;
  line-height: 1.4;
}
.ctx-x {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  align-self: flex-end;
}

.debug-panel {
  position: absolute;
  top: 60px;
  left: 12px;
  z-index: 20;
  max-width: 420px;
  background: rgba(8, 12, 20, 0.95);
  border: 1px solid var(--accent);
  color: #d7e3f4;
  padding: 10px 12px;
  border-radius: 10px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.5;
  word-break: break-all;
}
.debug-panel b {
  color: var(--accent);
}
.debug-panel .dbg-url {
  color: #fbbf24;
  font-size: 10px;
}

/* ---------- Site panel ---------- */
.panel {
  position: absolute;
  top: 64px;
  right: 16px;
  width: 300px;
  max-height: calc(100dvh - 84px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: rgba(16, 22, 34, 0.82);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
          backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid var(--sb-line-strong);
  border-radius: var(--r-lg);
  padding: 15px;
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  z-index: 10;
}
/* Celular: el panel de detalles ocupa el ancho y scrollea para llegar al botón 3D */
@media (max-width: 640px) {
  .panel {
    top: auto;
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 62dvh;
  }
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--sb-line);
}
.panel-code {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--accent);
  background: rgba(45, 212, 191, 0.1);
  border: 1px solid rgba(45, 212, 191, 0.26);
  border-radius: 5px;
  padding: 1px 7px;
  margin-bottom: 4px;
}
.panel-name {
  font-size: 15px;
  font-weight: 600;
}
.panel-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.panel-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-gap: 6px 12px;
  gap: 6px 12px;
  margin: 14px 0;
  font-size: 13px;
}
.panel-grid dt {
  color: var(--muted);
}
.panel-grid dd {
  margin: 0;
  text-align: right;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.panel-future {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.panel-future-title {
  margin: 0 0 4px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.panel-future button:disabled {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  text-align: left;
  cursor: not-allowed;
  opacity: 0.7;
}
.panel-ext {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  color: var(--accent-2);
  text-decoration: none;
}
.panel-ext:hover {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: 46vh 54vh;
  }
  .layout.collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: 0 100vh;
  }
}

