/* ══════════════════════════════════════════════════════════════════════════════════════════════
   OPERACIONES 3D (js/ops3d.js + js/ops3d-escena.js)
   La página va a sangre (sin el padding de .page) y ocupa todo el alto debajo de la topbar. El
   tablero flota sobre la escena con los colores del panel; las etiquetas pegadas a la escena son
   claras a propósito: viven en el mundo 3D (pastel), no en el panel.
   ══════════════════════════════════════════════════════════════════════════════════════════════ */
#page-operaciones-3d.page.active { padding: 0; display: block; }
.o3-root {
  position: relative; overflow: hidden;
  height: calc(100vh - var(--topbar-sticky-h, var(--topbar-h, 64px)));
  min-height: 520px;
  --o3-panel: color-mix(in srgb, var(--bg-surface) 90%, transparent);
  --o3-gap: 16px;
  --o3-lista-w: 400px;
}
.o3-escena { position: absolute; inset: 0; background: #dde5f2; }
.o3-canvas-gl { display: block; width: 100%; height: 100%; touch-action: none; }
.o3-cargando {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  color: #475569; font-size: 13px; font-weight: 600;
}
.o3-cargando svg { width: 16px; height: 16px; }
.o3-sin3d { color: #64748b; padding: 24px; text-align: center; }
.o3-gira { animation: o3-gira 1s linear infinite; }
@keyframes o3-gira { to { transform: rotate(360deg); } }

/* ── Paneles flotantes ─────────────────────────────────────────────────────────────────────── */
.o3-panel, .o3-kpi, .o3-vivo, .o3-ctrl, .o3-leyenda {
  background: var(--o3-panel);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  color: var(--text-primary);
}
.o3-top {
  position: absolute; top: var(--o3-gap); left: var(--o3-gap); right: calc(var(--o3-gap) * 2 + 44px);
  display: flex; gap: 12px; align-items: flex-start; pointer-events: none; z-index: 2;
}
.o3-root:not(.sin-lista) .o3-top, .o3-root.con-det .o3-top { right: calc(var(--o3-lista-w) + var(--o3-gap) * 3 + 44px); }
.o3-kpis { display: flex; gap: 12px; flex-wrap: wrap; pointer-events: auto; }
.o3-kpi { display: flex; gap: 12px; align-items: center; padding: 12px 16px; min-width: 168px; }
.o3-kpi-ico {
  width: 36px; height: 36px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--accent-blue) 18%, transparent); color: var(--accent-blue);
}
.o3-kpi.rojo .o3-kpi-ico { background: color-mix(in srgb, var(--accent-red) 18%, transparent); color: var(--accent-red); }
.o3-kpi-ico svg { width: 18px; height: 18px; }
.o3-kpi-tit { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; color: var(--text-muted); }
.o3-kpi-val { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.o3-kpi.rojo .o3-kpi-val { color: var(--accent-red); }
.o3-kpi-sub { font-size: 11px; color: var(--text-secondary); }
/* Buscar orden por ID, al lado de "En vivo" */
.o3-buscar {
  pointer-events: auto; margin-left: auto; position: relative; display: flex; align-items: center; gap: 6px;
  width: 260px; padding: 0 12px; height: 34px; border-radius: 999px;
  background: var(--o3-panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18); color: var(--text-muted);
}
.o3-buscar:focus-within { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15); }
.o3-buscar svg { width: 14px; height: 14px; flex: none; }
.o3-buscar input {
  flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: 0;
  color: var(--text-primary); font-size: 12px; font-variant-numeric: tabular-nums;
}
.o3-res {
  position: absolute; top: calc(100% + 6px); right: 0; width: 380px; max-height: 360px; overflow-y: auto; z-index: 5;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 28px rgba(15, 23, 42, 0.3);
}
.o3-res-fila {
  width: 100%; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 8px 12px; border: 0; border-bottom: 1px solid var(--border-light); background: transparent; color: var(--text-primary);
  text-align: left; cursor: pointer; font: inherit;
}
.o3-res-fila:hover, .o3-res-fila.on { background: var(--bg-hover); }
.o3-res-id { display: flex; flex-direction: column; min-width: 0; font-size: 12px; }
.o3-res-id b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.o3-res-id small { font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o3-res-vacio { padding: 10px 12px; font-size: 12px; color: var(--text-muted); }
.o3-vivo {
  pointer-events: auto; padding: 8px 12px; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 6px; white-space: nowrap; border-radius: 999px;
}
.o3-punto { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.o3-vivo.ok .o3-punto { background: var(--accent-green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-green) 25%, transparent); }
.o3-vivo.error { color: var(--accent-red); }
.o3-vivo.error .o3-punto { background: var(--accent-red); }

/* ── La columna de la derecha: botones de cámara y, debajo, "En línea" ──────────────────────── */
.o3-der {
  position: absolute; top: var(--o3-gap); right: var(--o3-gap); z-index: 3; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  max-height: calc(100% - var(--o3-gap) * 2);
}
/* La columna de la derecha (lista, o la ficha de la orden elegida) va a la DERECHA de los botones, nunca debajo:
   en una pantalla de 720 px los botones y "En línea" se metían arriba de la lista (2026-10-13). */
.o3-root:not(.sin-lista) .o3-der, .o3-root.con-det .o3-der { right: calc(var(--o3-lista-w) + var(--o3-gap) * 2); }
.o3-ctrl {
  pointer-events: auto; flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 2px; padding: 4px; border-radius: var(--radius);
}
.o3-cbtn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer;
}
.o3-cbtn:hover { background: var(--bg-hover); color: var(--text-primary); }
.o3-cbtn svg { width: 16px; height: 16px; }
.o3-leyenda {
  position: absolute; top: var(--o3-gap); right: calc(var(--o3-gap) * 2 + 44px); z-index: 4;
  width: 320px; padding: 14px 16px; font-size: 12px; color: var(--text-secondary);
}
.o3-root:not(.sin-lista) .o3-leyenda, .o3-root.con-det .o3-leyenda { right: calc(var(--o3-lista-w) + var(--o3-gap) * 3 + 44px); }
.o3-ley-tit { font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.o3-leyenda p { margin: 0 0 10px; line-height: 1.45; }
.o3-ley-grupo { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 10px; }
.o3-ley-grupo > span { width: 100%; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; color: var(--text-muted); }
.o3-ley-grupo em { font-style: normal; display: inline-flex; align-items: center; gap: 5px; }
.o3-ley-grupo i, .o3-mp { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.o3-ley-grupo .o3-ley-ico, .o3-ley-grupo svg.o3-ley-ico { width: 13px; height: 13px; background: none; border-radius: 0; color: var(--accent-gold); }
.o3-ley-mouse { color: var(--text-muted); margin: 0 !important; }

/* ── Ficha de la orden (derecha) ──────────────────────────────────────────────────────────
   UNA columna, como el detalle de Ordenes (2026-10-13; antes la ficha arriba, el seguimiento suelto abajo a la
   izquierda y la lista apretada debajo): cabecera fija · estado · quién la trabaja · datos · seguimiento vertical ·
   acciones fijas abajo. Mientras hay una orden elegida la lista se corre (cerrar la ficha la vuelve a mostrar). */
.o3-det {
  position: absolute; top: var(--o3-gap); right: var(--o3-gap); bottom: var(--o3-gap); width: var(--o3-lista-w); z-index: 3;
  display: flex; flex-direction: column; overflow: hidden; padding: 0;
}
.o3-det[hidden] { display: none; }
.o3-root.con-det .o3-lista { display: none; }
.o3-det-cab { display: flex; gap: 10px; align-items: center; padding: 12px 12px 12px 14px; border-bottom: 1px solid var(--border-light); flex: none; }
.o3-det-ico { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.o3-det-ico svg { width: 18px; height: 18px; }
.o3-det-tit { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.o3-det-tit span { font-size: 10px; font-weight: 700; letter-spacing: .5px; }
.o3-det-tit span em { font-style: normal; color: var(--text-secondary); letter-spacing: 0; }
.o3-det-tit b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.o3-det-tit small { font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o3-det-cuerpo { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 14px 6px; }
.o3-det-estado { padding: 12px 0 4px; }
.o3-det-etapa { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.o3-det-hace { font-size: 11px; color: var(--text-secondary); }
.o3-barra { height: 6px; border-radius: 99px; background: var(--bg-elevated); margin: 10px 0 6px; overflow: hidden; }
.o3-barra i { display: block; height: 100%; border-radius: 99px; background: var(--accent-blue); }
.o3-barra i.aviso { background: var(--status-late, #fbbf24); }
.o3-barra i.atrasada { background: var(--accent-red); }
.o3-motivo { font-size: 11px; display: flex; gap: 6px; align-items: center; margin-top: 6px; color: var(--status-late, #fbbf24); }
.o3-motivo.atrasada { color: var(--accent-red); }
.o3-motivo svg { width: 13px; height: 13px; flex: none; }
.o3-sec-tit { display: block; font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted); margin: 0 0 8px; }
.o3-sec, .o3-trabajando, .o3-det-cuerpo > .o3-tl { padding: 12px 0; border-top: 1px solid var(--border-light); margin-top: 8px; }
.o3-trabajando + .o3-sec, .o3-sec + .o3-tl { margin-top: 0; }
/* Quién la tiene abierta ahora (se toca: lleva hasta esa persona en la escena) */
.o3-trab-lista { display: flex; flex-wrap: wrap; gap: 6px; }
.o3-trab {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 3px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent-orange) 45%, transparent); background: color-mix(in srgb, var(--accent-orange) 12%, transparent);
  color: var(--text-primary); font: inherit; font-size: 12px;
}
.o3-trab:hover { background: color-mix(in srgb, var(--accent-orange) 22%, transparent); }
.o3-trab.enc { border-color: #eab308; }
.o3-trab small { color: var(--text-muted); font-size: 10px; }
.o3-trab-cara {
  width: 24px; height: 24px; border-radius: 50%; overflow: hidden; flex: none; background: var(--accent-orange, #f97316);
  color: #fff; font-size: 9px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}
.o3-trab-cara img { width: 100%; height: 100%; object-fit: cover; }
/* Datos: celdas en dos columnas, etiqueta arriba y dato abajo (como "Datos de la orden" de Ordenes) */
.o3-campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.o3-campo { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 7px 9px; border-radius: var(--radius-sm); background: var(--bg-elevated); font-size: 12px; }
.o3-campo.ancha { grid-column: 1 / -1; }
.o3-campo span { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o3-campo b { font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.o3-det-pie { flex: none; display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border-light); }
.o3-det-pie .btn { flex: 1; justify-content: center; }

/* ── Seguimiento: línea de tiempo VERTICAL dentro de la ficha ─────────────────────────────── */
.o3-tl[hidden] { display: none; }
.o3-tl .o3-vacio { padding: 10px 0; justify-content: flex-start; }
.o3-pasos { display: flex; flex-direction: column; }
.o3-paso { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding-bottom: 14px; }
.o3-paso:last-child { padding-bottom: 0; }
.o3-paso-ico {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 1;
  background: var(--bg-elevated); color: var(--text-muted); border: 2px solid var(--border); box-sizing: border-box;
}
.o3-paso-ico svg { width: 13px; height: 13px; }
.o3-paso.hecho .o3-paso-ico { background: var(--c); border-color: var(--c); color: #fff; }
.o3-paso.actual .o3-paso-ico { background: var(--bg-surface); border-color: var(--c); color: var(--c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent); }
.o3-paso.salteado .o3-paso-ico { border-style: dashed; opacity: .6; }
.o3-paso-linea { position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--border); }
.o3-paso-linea.hecha { background: var(--accent-blue); }
.o3-paso-txt { min-width: 0; padding-top: 5px; }
.o3-paso-nom { font-size: 12px; font-weight: 600; }
.o3-paso.pendiente .o3-paso-nom, .o3-paso.salteado .o3-paso-nom { color: var(--text-muted); font-weight: 500; }
.o3-paso.actual .o3-paso-nom { color: var(--c); }
.o3-paso-act { font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o3-paso-sub { padding-top: 6px; font-size: 11px; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Lista (abajo a la derecha) ───────────────────────────────────────────────────────────── */
.o3-lista {
  position: absolute; right: var(--o3-gap); bottom: var(--o3-gap); width: var(--o3-lista-w); height: 340px; z-index: 2;
  display: flex; flex-direction: column; padding: 10px 0 0; overflow: hidden;
}
.o3-lista-cab { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 8px; border-bottom: 1px solid var(--border-light); }
.o3-lista-fila { display: flex; gap: 6px; align-items: center; }
.o3-lista-fila .o3-tabs { flex: 1; min-width: 0; }
.o3-root.sin-lista .o3-lista { display: none; }
.o3-root:not(.sin-lista) .o3-btn-lista { color: var(--accent-orange); }
.o3-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; background: var(--bg-elevated); padding: 3px; border-radius: var(--radius); }
.o3-tab {
  flex: 1; border: 0; background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 600;
  padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap;
}
.o3-tab b { margin-left: 4px; font-variant-numeric: tabular-nums; color: var(--text-muted); }
.o3-tab.on { background: var(--bg-surface); color: var(--text-primary); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.o3-tab.on b { color: var(--accent-orange); }
.o3-sel { height: 30px; padding: 4px 8px; font-size: 12px; }
.o3-filas { flex: 1; overflow-y: auto; }
.o3-fila {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto 64px; gap: 10px; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--border-light); cursor: pointer; font-size: 12px;
}
.o3-fila:hover { background: var(--bg-hover); }
.o3-fila.sel { background: color-mix(in srgb, var(--accent-blue) 16%, transparent); box-shadow: inset 3px 0 0 var(--accent-blue); }
.o3-logo {
  width: 30px; height: 30px; border-radius: 8px; overflow: hidden; display: block;
  background: var(--c); box-shadow: inset 0 0 0 2px var(--c);
}
.o3-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.o3-dia {
  position: sticky; top: 0; z-index: 1; padding: 5px 12px; font-size: 10px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--text-muted); background: var(--bg-elevated); border-bottom: 1px solid var(--border-light);
}
.o3-kpi.verde .o3-kpi-ico { background: color-mix(in srgb, var(--accent-green) 18%, transparent); color: var(--accent-green); }
.o3-det-ico img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.o3-det-ico { overflow: hidden; }
.o3-fila-id { display: flex; flex-direction: column; min-width: 0; }
.o3-fila-id b { font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o3-fila-id span { font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o3-badge {
  display: inline-block; padding: 3px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap;
  color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent);
}
.o3-t { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-secondary); white-space: nowrap; }
.o3-t.aviso { color: var(--status-late, #fbbf24); }
.o3-t.atrasada { color: var(--accent-red); font-weight: 700; }
.o3-pager { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border-top: 1px solid var(--border-light); font-size: 12px; color: var(--text-secondary); }
.o3-vacio { padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 12px; display: flex; gap: 8px; justify-content: center; align-items: center; }
.o3-vacio svg { width: 16px; height: 16px; }
.o3-aviso { padding: 6px 12px; font-size: 11px; color: var(--status-late, #fbbf24); border-top: 1px solid var(--border-light); }

/* ── Etiquetas pegadas a la escena ────────────────────────────────────────────────────────── */
.o3-etiquetas { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.o3-etq {
  position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform;
  background: #ffffff; color: #1e293b; border-radius: 8px; padding: 4px 8px; font-size: 11px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.16); display: flex; align-items: center; gap: 6px;
}
.o3-etq i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.o3-etq b { font-variant-numeric: tabular-nums; background: #f1f5f9; border-radius: 6px; padding: 0 6px; }
.o3-etq-rojo { color: #dc2626; font-weight: 700; }
.o3-etq-puerta { font-size: 10px; padding: 3px 7px; }
.o3-etq-cli { padding: 4px 9px; }
.o3-etq-cli.sel { background: #2563eb; color: #ffffff; }
.o3-etq-cli.sel .o3-etq-sub { color: #dbeafe; }
.o3-etq-cli.sel b { background: rgba(255, 255, 255, 0.2); color: #ffffff; }
.o3-etq-sub { font-weight: 500; color: #64748b; }
.o3-etq-edif { flex-direction: column; align-items: stretch; gap: 3px; padding: 8px 10px; transform-origin: left bottom; }
.o3-edif-tit { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: #64748b; margin-bottom: 2px; }
.o3-edif-fila { display: grid; grid-template-columns: 8px auto auto 1fr; gap: 6px; align-items: center; font-weight: 500; }
.o3-edif-fila i { border-radius: 2px; }
.o3-edif-fila b { background: none; padding: 0; text-align: right; }
.o3-edif-fila em { font-style: normal; color: #94a3b8; font-size: 10px; }
/* La bocina de un auto que tuvo que frenar */
.o3-bocina { font-size: 11px; font-weight: 900; color: #78350f; background: #fde047; border: 2px solid #f59e0b; border-radius: 10px; padding: 3px 8px; }
.o3-bocina::after { content: ''; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: #f59e0b; border-bottom: 0; }
.o3-bocina.pop { animation: o3-pop .3s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes o3-pop { from { opacity: 0; scale: .4; } to { opacity: 1; scale: 1; } }
/* Nombre del staff fichado (detrás de los mostradores) y del encargado que da vueltas */
.o3-etq-staff { font-size: 10px; padding: 2px 7px; background: #fff7ed; color: #9a3412; border: 1px solid #fdba74; }
.o3-etq-staff.enc { background: #fef9c3; color: #713f12; border-color: #eab308; font-weight: 800; }
/* La gente de la ciudad: nombre + lo que está haciendo */
.o3-etq-gente { flex-direction: column; align-items: flex-start; gap: 0; padding: 3px 8px; max-width: 300px; background: #fff7ed; border: 1px solid #fdba74; }
.o3-etq-gente b { background: none; padding: 0; font-size: 10px; color: #9a3412; }
/* El texto va ENTERO (pedido del dueño, 2026-10-05): baja de línea en vez de cortarse con "…". */
.o3-etq-gente span { font-size: 10px; font-weight: 500; color: #475569; white-space: normal; overflow-wrap: anywhere; max-width: 284px; line-height: 1.3; }
/* Una etiqueta corrida para no pisar a otra (despejar() en js/ops3d-escena.js): un borde que la distingue. */
.o3-etq.corrida { box-shadow: 0 2px 8px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(100, 116, 139, 0.45); }
.o3-etq-gente span.o3-va { color: #c2410c; font-weight: 700; }
.o3-etq-gente.enc { background: #fef9c3; border-color: #eab308; }
.o3-etq-gente.enc b { color: #713f12; }
.o3-etq-gente.off { opacity: .6; background: #f1f5f9; border-color: #cbd5e1; }
.o3-etq-gente.off b { color: #475569; }
/* El cambio de precio sobre la torre de Pricing */
.o3-precio { font-size: 11px; font-weight: 800; color: #064e3b; background: #d1fae5; border: 2px solid #10b981; border-radius: 10px; padding: 4px 9px; }
.o3-precio.pop { animation: o3-pop .3s cubic-bezier(.2, 1.6, .4, 1); }
.o3-vista.on { color: var(--accent-orange); }
/* Sectores de la plaza de Entregadas (uno por marketplace) */
.o3-etq-sector { border: 2px solid #e2e8f0; padding: 4px 9px; }
.o3-etq-sector img { width: 18px; height: 18px; border-radius: 5px; object-fit: contain; }
/* Edificios de la ciudad: quién está adentro (sus caras) */
.o3-etq-est.hover { outline: 2px solid var(--accent-orange, #f97316); }
.o3-dentro { display: inline-flex; align-items: center; margin-left: 2px; }
.o3-cara {
  width: 20px; height: 20px; border-radius: 50%; margin-left: -5px; border: 2px solid #ffffff; overflow: hidden;
  background: #f97316; color: #ffffff; font-size: 8px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}
.o3-cara:first-child { margin-left: 0; }
.o3-cara img { width: 100%; height: 100%; object-fit: cover; }
.o3-cara.enc { border-color: #eab308; }
.o3-cara.off { opacity: .55; filter: grayscale(1); }
.o3-dentro em { font-style: normal; font-size: 10px; color: #64748b; margin-left: 3px; }
/* Mirando un edificio por dentro: sólo sus carteles (salas y la gente de adentro) */
.o3-etiquetas.interior > .o3-etq:not(.int) { display: none; }
.o3-miga {
  order: -1; pointer-events: auto; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 4px;
  border-radius: 999px; background: var(--o3-panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18); color: var(--text-muted); font-size: 13px;
}
.o3-miga[hidden] { display: none; }   /* el display:flex de arriba le ganaba al atributo hidden */
.o3-miga b { color: var(--text-primary); }
.o3-miga-salir {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 999px; border: none; cursor: pointer;
  background: var(--accent-orange, #f97316); color: #ffffff; font-size: 12px; font-weight: 700;
}
.o3-miga-salir svg { width: 14px; height: 14px; }
.o3-etq-pt { width: 7px; height: 7px; border-radius: 50%; }
.o3-etq-pt.rojo { background: #ef4444; }
.o3-etq-pt.ambar { background: #f59e0b; }

/* ── Pantallas chicas: todo apilado, la escena queda arriba ───────────────────────────────── */
@media (max-width: 1100px) {
  .o3-root { --o3-lista-w: 340px; }
  .o3-kpi { min-width: 140px; padding: 10px 12px; }
  .o3-kpi-val { font-size: 18px; }
}
@media (max-width: 768px) {
  /* Celular (2026-10-13): arriba la búsqueda; debajo, UNA fila con los botones de cámara y "En línea" (antes una
     columna a la derecha que tapaba la ficha y la lista); abajo la lista, o la ficha como hoja que sube. */
  .o3-root { --o3-gap: 8px; --o3-fila-h: 42px; }
  .o3-top, .o3-root:not(.sin-lista) .o3-top, .o3-root.con-det .o3-top { right: var(--o3-gap); }
  .o3-kpis { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  .o3-kpi { min-width: 130px; }
  .o3-buscar { width: auto; flex: 1 1 0; min-width: 0; margin-left: 0; }
  .o3-vivo { padding: 8px 10px; font-size: 11px; }
  .o3-res { width: calc(100vw - 32px); max-width: 380px; left: 0; right: auto; }
  .o3-der, .o3-root:not(.sin-lista) .o3-der, .o3-root.con-det .o3-der {
    top: calc(var(--o3-gap) * 2 + 34px); left: var(--o3-gap); right: var(--o3-gap);
    flex-direction: row; align-items: stretch; max-height: none; height: var(--o3-fila-h);
  }
  .o3-ctrl { flex-direction: row; align-items: center; overflow-x: auto; scrollbar-width: none; flex: 0 1 auto; min-width: 0; padding: 3px; }
  .o3-ctrl::-webkit-scrollbar { display: none; }
  .o3-cbtn { width: 32px; height: 34px; flex: none; }
  /* .o3-root delante: la regla base de "En línea" está más abajo en el archivo y le ganaba a ésta */
  .o3-root .o3-online { flex-direction: row; width: auto; flex: 1 1 0; min-width: 60px; padding: 0 8px; overflow-x: auto; overflow-y: hidden; }
  .o3-root .o3-online-u { width: 28px; height: 28px; }
  .o3-leyenda, .o3-root:not(.sin-lista) .o3-leyenda, .o3-root.con-det .o3-leyenda {
    top: calc(var(--o3-gap) * 3 + 34px + var(--o3-fila-h)); left: var(--o3-gap); right: var(--o3-gap); width: auto;
    max-height: calc(100% - 34px - var(--o3-fila-h) - var(--o3-gap) * 5); overflow-y: auto;
  }
  .o3-lista { left: var(--o3-gap); right: var(--o3-gap); width: auto; height: min(300px, 42%); }
  /* La ficha: una hoja que sube desde abajo, con su manija; deja ver la escena arriba */
  .o3-det {
    left: 0; right: 0; bottom: 0; top: auto; width: auto; height: 72%;
    border-radius: 16px 16px 0 0; border-bottom: 0; box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.35);
  }
  .o3-det::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 99px; background: var(--border); margin: 8px auto 0; flex: none; }
  .o3-det-cab { padding: 8px 10px 10px 14px; }
  .o3-det-pie { padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .o3-campo { padding: 8px 10px; }
}
@media (max-width: 360px) {
  .o3-campos { grid-template-columns: minmax(0, 1fr); }
}

/* ── Operaciones 3D INMERSIVA (pedido del dueño, 2026-10-03) ─────────────────────────────────────
   Mirando la pestaña no se ve ningún aviso del panel: toasts (órdenes, mensajes, notas, auditorías), el botón
   flotante y el widget de Mensajería, ni el de la ventana de la orden. La clase la pone navigate() (index.html);
   al salir de la pestaña vuelven solos, como estaban. Los sonidos los corta playSoundPreset. */
body.ops3d-inmersivo .toast-container,
body.ops3d-inmersivo #order-toast-container,
body.ops3d-inmersivo #notes-toast-container,
body.ops3d-inmersivo #macros-toast-host,
body.ops3d-inmersivo #msg-blob,
body.ops3d-inmersivo #msg-widget,
body.ops3d-inmersivo #ows-floating-btn { display: none !important; }

/* ── "En línea" (debajo de los botones de la derecha): tocar una cara lleva hasta esa persona ──────── */
.o3-online {
  pointer-events: auto; flex: 0 1 auto; min-height: 0; width: 44px; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0;
  border-radius: var(--radius); background: var(--o3-panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  overflow-y: auto; scrollbar-width: none;
}
.o3-online::-webkit-scrollbar { display: none; }
.o3-online-tit { display: flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; color: var(--text-secondary); }
.o3-online-tit i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }
.o3-online-u {
  position: relative; flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 2px solid var(--accent-orange, #f97316); background: #f97316; overflow: visible; display: inline-flex;
  align-items: center; justify-content: center; color: #ffffff; font-size: 10px; font-weight: 800; transition: transform .12s;
}
.o3-online-u:hover { transform: scale(1.12); }
.o3-online-u img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.o3-online-u.enc { border-color: #eab308; }
.o3-online-u i { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: #22c55e; border: 2px solid var(--bg-surface, #ffffff); }
.o3-online-u.otra i { background: #f59e0b; }
/* la persona a la que se fue: su globito resaltado */
.o3-etq-gente.foco { border: 2px solid #f97316; box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.25); z-index: 2; }

/* ── Teclado: el edificio / la sala elegida con las flechas ── */
.o3-etq-est.foco { outline: 3px solid #f97316; outline-offset: 2px; box-shadow: 0 0 0 7px rgba(249, 115, 22, 0.22); z-index: 3; }

/* ── La PIZARRA de una oficina de Ordenes (HISTORIAL ORDEN / CLIENTE) ── */
.o3-piz { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; }
.o3-piz[hidden] { display: none; }
.o3-pz-fondo { position: absolute; inset: 0; background: rgba(2, 6, 23, 0.45); backdrop-filter: blur(2px); animation: o3pzAparece .3s ease both; }
.o3-piz.sale .o3-pz-fondo { animation: o3pzDesaparece .25s ease both; }
.o3-pz-marco {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  width: min(800px, calc(100% - 32px)); height: min(600px, calc(100% - 40px));
  padding: 14px 18px 36px; border-radius: 14px;
  background: linear-gradient(135deg, #a46b31, #7a4a1c 45%, #8f5a26 70%, #6f4118);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 0 0 3px rgba(255, 255, 255, 0.08), inset 0 -6px 0 rgba(0, 0, 0, 0.25);
  animation: o3pzEntra .6s cubic-bezier(.2, .9, .25, 1.12) both;
}
.o3-piz.sale .o3-pz-marco { animation: o3pzSale .25s ease-in both; }
@keyframes o3pzEntra { from { transform: translate(var(--ox, 0), var(--oy, 0)) scale(.1) rotate(-8deg); opacity: 0; } 55% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes o3pzSale { to { transform: translate(var(--ox, 0), var(--oy, 0)) scale(.1) rotate(6deg); opacity: 0; } }
@keyframes o3pzAparece { from { opacity: 0; } to { opacity: 1; } }
@keyframes o3pzDesaparece { to { opacity: 0; } }
.o3-pz-cab { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.o3-pz-tabs { display: flex; gap: 6px; }
.o3-pz-tab, .o3-pz-btn {
  font: 700 13px/1 inherit; color: #fde7c7; background: rgba(0, 0, 0, 0.25); border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 8px 12px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.o3-pz-tab:hover, .o3-pz-btn:hover { background: rgba(0, 0, 0, 0.38); color: #ffffff; }
.o3-pz-tab.on { background: #1f4030; color: #ffffff; box-shadow: inset 0 -3px 0 #fde68a; }
.o3-pz-btn svg { width: 15px; height: 15px; }
.o3-pz-acc { margin-left: auto; display: flex; gap: 6px; }
.o3-pz-x { padding: 8px; }
.o3-pz-tabla {
  position: relative; flex: 1; min-height: 0; border-radius: 6px; overflow: hidden; color: #eef7f0;
  font-family: 'Segoe Print', 'Bradley Hand', 'Comic Sans MS', cursive;
  background:
    radial-gradient(ellipse at 28% 18%, rgba(255, 255, 255, 0.08), transparent 55%),
    radial-gradient(ellipse at 82% 86%, rgba(255, 255, 255, 0.05), transparent 50%),
    #1f4030;
  box-shadow: inset 0 0 44px rgba(0, 0, 0, 0.6);
}
/* lo borrado de antes: manchas de tiza */
.o3-pz-tabla::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.025) 0 46px, transparent 46px 110px),
              radial-gradient(ellipse 40% 12% at 70% 30%, rgba(255, 255, 255, 0.05), transparent 70%); }
.o3-pz-scroll { position: absolute; inset: 0; overflow: auto; padding: 22px 30px 26px; scrollbar-color: rgba(255, 255, 255, 0.3) transparent; }
.o3-pz-tit { font-size: 30px; font-weight: 700; letter-spacing: .4px; line-height: 1.25; }
.o3-pz-escribe { display: inline-block; clip-path: inset(0 100% 0 0); animation: o3pzEscribe .9s steps(22) .35s forwards; text-shadow: 0 0 1px rgba(255, 255, 255, 0.7), 0 0 8px rgba(255, 255, 255, 0.15); }
@keyframes o3pzEscribe { to { clip-path: inset(0 0 0 0); } }
.o3-pz-sub { display: block; width: min(60%, 420px); height: 14px; margin: 2px 0 8px; }
.o3-pz-sub path { fill: none; stroke: #fde68a; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 440; stroke-dashoffset: 440; animation: o3pzTrazo .55s ease 1.15s forwards; }
@keyframes o3pzTrazo { to { stroke-dashoffset: 0; } }
.o3-pz-meta { font-size: 14px; color: #cfe8d6; margin-bottom: 16px; opacity: 0; animation: o3pzAparece .5s ease 1.2s forwards; }
.o3-pz-meta .rojo { color: #fca5a5; }
.o3-pz-tl { list-style: none; margin: 0; padding: 0 0 0 28px; position: relative; }
.o3-pz-tl::before { content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px;
  background: rgba(255, 255, 255, 0.7); transform-origin: top; transform: scaleY(0);
  animation: o3pzLinea calc(var(--n, 5) * .14s + .3s) ease-out var(--d0, 1.25s) forwards; }
.o3-pz-tl.ya::before { animation: none; transform: none; }
.o3-pz-tl.vacia::before { display: none; }
@keyframes o3pzLinea { to { transform: scaleY(1); } }
.o3-pz-it { position: relative; display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; padding: 6px 0; font-size: 15px; line-height: 1.35; }
.o3-pz-pt { position: absolute; left: -25px; top: 12px; width: 11px; height: 11px; border-radius: 50%; background: #ffffff;
  box-shadow: 0 0 7px rgba(255, 255, 255, 0.55); transform: scale(0);
  animation: o3pzPunto .35s cubic-bezier(.3, 1.6, .5, 1) calc(var(--d0, 1.25s) + var(--i, 0) * .14s) forwards; }
@keyframes o3pzPunto { to { transform: scale(1); } }
.o3-pz-it > span { clip-path: inset(0 100% 0 0); animation: o3pzEscribe .5s steps(14) calc(var(--d0, 1.25s) + var(--i, 0) * .14s + .08s) forwards; }
.o3-pz-it.ya .o3-pz-pt, .o3-pz-it.ya > span { animation: none; transform: none; clip-path: none; }
.o3-pz-h { color: #a7c4b2; font-size: 13px; white-space: nowrap; }
.o3-pz-tx { overflow-wrap: anywhere; }
.o3-pz-tx small { color: #a7c4b2; font-size: 12px; }
.o3-pz-q { color: #fde68a; font-size: 13px; white-space: nowrap; }
.o3-pz-it.rojo .o3-pz-tx, .o3-pz-it.rojo .o3-pz-q { color: #fca5a5; }
.o3-pz-it.rojo .o3-pz-pt { background: #fca5a5; }
.o3-pz-it.verde .o3-pz-tx { color: #bbf7d0; }
.o3-pz-it.verde .o3-pz-q { color: #86efac; }
.o3-pz-it.verde .o3-pz-pt { background: #86efac; }
.o3-pz-it.amar .o3-pz-pt { background: #fde68a; }
.o3-pz-nota { color: #a7c4b2; font-size: 16px; padding: 8px 0; opacity: 0; animation: o3pzAparece .4s ease 1.2s forwards; }
/* cambiar de solapa: pasa el borrador */
.o3-pz-goma { position: absolute; top: 0; bottom: 0; left: -120px; width: 110px; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); }
.o3-pz-tabla.borrando .o3-pz-goma { animation: o3pzGoma .42s ease-in forwards; }
.o3-pz-tabla.borrando .o3-pz-scroll { animation: o3pzBorra .42s ease forwards; }
@keyframes o3pzGoma { to { left: 100%; } }
@keyframes o3pzBorra { to { opacity: 0; filter: blur(3px); transform: translateX(18px); } }
/* la bandeja de abajo, con tizas y el borrador */
.o3-pz-bandeja { position: absolute; left: 26px; right: 26px; bottom: 9px; height: 17px; border-radius: 4px;
  background: linear-gradient(#6b3f17, #4e2c0f); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35); display: flex; align-items: center; gap: 14px; padding: 0 18px; }
.o3-pz-tiza { width: 34px; height: 8px; border-radius: 4px; background: #f8fafc; }
.o3-pz-tiza.c2 { width: 24px; background: #fde68a; }
.o3-pz-tiza.c3 { width: 18px; background: #fca5a5; }
.o3-pz-borrador { margin-left: auto; width: 64px; height: 14px; border-radius: 3px; background: linear-gradient(#2563eb 0 45%, #e5e7eb 45%); }
@media (max-width: 640px) {
  .o3-pz-marco { padding: 12px 10px 32px; }
  .o3-pz-scroll { padding: 16px 16px 20px; }
  .o3-pz-tit { font-size: 22px; }
  .o3-pz-it { grid-template-columns: minmax(0, 1fr) auto; }
  .o3-pz-h { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .o3-pz-marco, .o3-pz-escribe, .o3-pz-sub path, .o3-pz-meta, .o3-pz-tl::before, .o3-pz-pt, .o3-pz-it > span, .o3-pz-nota { animation: none !important; clip-path: none !important; transform: none !important; opacity: 1 !important; stroke-dashoffset: 0 !important; }
}
