
/* Almacén 3D — capa de interfaz sobre el lienzo WebGL */
html, body { height: 100%; margin: 0; padding: 0; overflow: hidden; }
#controlAddIn, .wh3d-host { height: 100%; width: 100%; margin: 0; padding: 0; overflow: hidden; }

.wh3d {
  --ink: #15212C;
  --muted: #566573;
  --paper: rgba(248, 250, 251, 0.94);
  --paper-solid: #F8FAFB;
  --line: rgba(21, 33, 44, 0.13);
  --accent: #F5B800;
  --accent-ink: #2B2100;
  --blue: #2E6BB8;
  --ok: #23946A;
  --warn: #D3363A;
  --da: #6B4CDB;
  --cyan: #1689BD;
  --font: Barlow, "Segoe UI", system-ui, sans-serif;
  --font-c: "Barlow Condensed", "Segoe UI", "Arial Narrow", sans-serif;
  position: relative; height: 100%; width: 100%; overflow: hidden;
  font: 400 14px/1.4 var(--font); color: var(--ink);
  background: #0D1828; user-select: none; -webkit-user-select: none;
}
.wh3d *, .wh3d *::before, .wh3d *::after { box-sizing: border-box; }
.wh3d [hidden] { display: none !important; }
.wh3d-stage { position: absolute; inset: 0; }
.wh3d-stage canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.wh3d button { font: inherit; color: inherit; cursor: pointer; }
.wh3d button:focus-visible, .wh3d input:focus-visible, .wh3d select:focus-visible, .wh3d [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.wh3d svg { width: 18px; height: 18px; flex: none; }

/* Barra superior */
.wh3d-top {
  position: absolute; top: 12px; left: 12px; right: 12px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 10px 8px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(8, 18, 30, 0.18);
}
.wh3d-brand { display: flex; flex-direction: column; min-width: 150px; padding-left: 10px; border-left: 4px solid var(--accent); }
.wh3d-brand-name { font: 700 22px/1.05 var(--font-c); letter-spacing: 0.01em; }
.wh3d-brand-meta { font-size: 12px; color: var(--muted); border: 0; background: none; padding: 0; text-align: left; text-decoration: underline dotted; text-underline-offset: 3px; }
.wh3d-brand-meta:hover { color: var(--ink); }
.wh3d.is-asof .wh3d-brand-meta { color: #8A5A00; font-weight: 600; }

.wh3d-seg { display: inline-flex; padding: 3px; background: rgba(21, 33, 44, 0.07); border-radius: 7px; gap: 2px; }
.wh3d-seg button, .wh3d-modes button {
  border: 0; background: transparent; padding: 5px 12px; border-radius: 5px; font-weight: 600; font-size: 13px; color: var(--muted);
}
.wh3d-seg button[aria-checked="true"], .wh3d-modes button[aria-selected="true"] {
  background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(8, 18, 30, 0.2);
}
.wh3d-seg button:hover, .wh3d-modes button:hover { color: var(--ink); }

.wh3d-search {
  display: flex; align-items: center; gap: 8px; flex: 1 1 150px; max-width: 280px;
  padding: 0 10px; height: 36px; background: #fff; border: 1px solid var(--line); border-radius: 7px; color: var(--muted);
}
.wh3d-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(46, 107, 184, 0.15); }
.wh3d-search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: 500 14px var(--font); color: var(--ink); }

.wh3d-kpis { display: flex; gap: 14px; margin-left: auto; }
.wh3d-kpi { display: flex; flex-direction: column; line-height: 1.1; }
.wh3d-kpi b { font: 700 22px/1 var(--font-c); font-variant-numeric: tabular-nums; }
.wh3d-kpi span { font-size: 12px; color: var(--muted); }
.wh3d-kpi[data-act] { cursor: pointer; padding: 2px 8px; margin: -2px -8px; border-radius: 6px; }
.wh3d-kpi.is-warn b { color: var(--warn); }
.wh3d-kpi.is-alert b { color: #B0249A; }
.wh3d-kpi[data-act]:hover { background: rgba(21, 33, 44, 0.06); }

.wh3d-icon {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 7px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.wh3d-icon:hover { background: #EEF2F5; }

/* Vistas */
.wh3d-views { position: absolute; top: var(--top, 84px); left: 12px; display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 420px); }
.wh3d-views button {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 4px 12px;
  font-weight: 600; font-size: 13px; backdrop-filter: blur(8px);
}
.wh3d-views button:hover { background: #fff; }

/* Resultados de búsqueda */
.wh3d-results {
  position: absolute; top: var(--top, 84px); left: 50%; transform: translateX(-50%); width: min(460px, calc(100% - 24px));
  max-height: min(380px, 50%); overflow: auto; background: var(--paper-solid); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(8, 18, 30, 0.25); z-index: 5;
}
.wh3d-r-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; background: var(--paper-solid); border-bottom: 1px solid var(--line); font-weight: 600; }
.wh3d-results ul { list-style: none; margin: 0; padding: 4px; }
.wh3d-results li button { display: grid; grid-template-columns: 84px 1fr auto; gap: 10px; align-items: baseline; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 6px; }
.wh3d-results li button:hover { background: #EAF1F8; }
.wh3d-results b { font: 700 16px var(--font-c); }
.wh3d-results span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.wh3d-results em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
.wh3d-link { border: 0; background: none; padding: 4px 6px; color: var(--blue); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; }
.wh3d-link:hover { background: rgba(46, 107, 184, 0.08); }

/* Ficha de ubicación */
.wh3d-detail {
  position: absolute; top: var(--top, 84px); right: 12px; bottom: 12px; width: 370px; overflow: auto;
  background: var(--paper-solid); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px 18px;
  box-shadow: 0 12px 36px rgba(8, 18, 30, 0.28); user-select: text; -webkit-user-select: text; z-index: 4;
}
.wh3d-d-head { display: flex; justify-content: space-between; gap: 12px; }
.wh3d-d-head h2 { margin: 0; font: 700 36px/1 var(--font-c); letter-spacing: 0.01em; }
.wh3d-d-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.wh3d-d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.wh3d-pill { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #E9EDF1; color: var(--ink); }
.wh3d-pill.is-occ { background: #F1E4D1; color: #6B4A1E; }
.wh3d-pill.is-empty { background: #D7F2E5; color: #0C5B39; }
.wh3d-pill.is-pending { background: #D6EFFB; color: #0A4C6B; }
.wh3d-pill.is-anom { background: #FBE0F5; color: #8A136F; }
.wh3d-pill.is-loc { background: #E3ECF7; color: #1D4F8C; font-family: var(--font-c); font-size: 13px; }
.wh3d-pill.is-da { background: #ECE6FF; color: var(--da); }
.wh3d-d-weight { margin-top: 14px; }
.wh3d-d-big { font: 700 30px/1 var(--font-c); font-variant-numeric: tabular-nums; }
.wh3d-d-cap { color: var(--muted); font-size: 13px; margin: 2px 0 8px; }
.wh3d-bar { height: 6px; border-radius: 3px; background: rgba(21, 33, 44, 0.1); overflow: hidden; }
.wh3d-bar i { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.wh3d-bar.is-warn i { background: var(--warn); }
.wh3d-d-group { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: #EEF2F5; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 13px; }
.wh3d-d-group .wh3d-bar { grid-column: 1 / -1; }
.wh3d-d-group p { grid-column: 1 / -1; margin: 4px 0 0; }
.wh3d-d-group.is-warn { background: #FDE7E7; color: #7A1012; }
.wh3d h3 { margin: 18px 0 6px; font: 600 15px var(--font); color: var(--muted); }
.wh3d-d-lines { list-style: none; margin: 0; padding: 0; }
.wh3d-d-lines li { padding: 9px 0; border-top: 1px solid var(--line); }
.wh3d-d-l1 { display: flex; align-items: baseline; gap: 8px; }
.wh3d-d-l1 b { font: 700 16px var(--font-c); }
.wh3d-d-kg { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.wh3d-d-desc { font-size: 13px; }
.wh3d-d-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.wh3d-d-pend { display: flex; gap: 16px; margin-top: 12px; font-size: 13px; color: var(--cyan); }
.wh3d-d-moves { font-size: 13px; color: var(--muted); }
.wh3d-d-moves table { width: 100%; border-collapse: collapse; color: var(--ink); }
.wh3d-d-moves td { padding: 6px 4px 6px 0; border-top: 1px solid var(--line); vertical-align: top; }
.wh3d-d-moves td:last-child { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wh3d-d-moves small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.wh3d-d-moves .is-neg { color: var(--warn); }
.wh3d-d-moves .is-pos { color: var(--ok); }
.wh3d-d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.wh3d-d-actions button, .wh3d-editbar button {
  border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 7px 12px; font-weight: 600;
}
.wh3d-d-actions button:first-child, .wh3d-primary { background: var(--blue) !important; border-color: var(--blue) !important; color: #fff !important; }
.wh3d-d-actions button:hover, .wh3d-editbar button:hover { filter: brightness(0.96); }

/* Panel inferior: modos, leyenda y filtros */
.wh3d-dock {
  position: absolute; left: 12px; bottom: 12px; max-width: min(640px, calc(100% - 270px));
  display: flex; flex-direction: column; gap: 10px; padding: 10px 12px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px; backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(8, 18, 30, 0.18);
}
.wh3d-modes { display: inline-flex; align-self: flex-start; padding: 3px; background: rgba(21, 33, 44, 0.07); border-radius: 7px; gap: 2px; }
.wh3d-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 13px; min-height: 22px; }
.wh3d-sw { display: inline-flex; align-items: center; gap: 6px; }
.wh3d-sw i { width: 14px; height: 14px; border-radius: 3px; background: var(--c); }
.wh3d-sw.is-ghost i { background: transparent; border: 2px solid var(--c); box-shadow: inset 0 0 0 10px color-mix(in srgb, var(--c) 18%, transparent); }
.wh3d-grad { display: grid; grid-template-columns: 1fr 1fr; width: 260px; font-size: 12px; color: var(--muted); }
.wh3d-grad i { grid-column: 1 / -1; height: 10px; border-radius: 5px; background: var(--g); margin-bottom: 3px; }
.wh3d-grad span:last-child { text-align: right; }
.wh3d-legend-note { margin: 0; color: var(--muted); }
.wh3d-toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13px; padding-top: 8px; border-top: 1px solid var(--line); }
.wh3d-toggles label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.wh3d-toggles input { accent-color: var(--blue); width: 15px; height: 15px; margin: 0; }
.wh3d-toggles select { font: 500 13px var(--font); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: #fff; color: var(--ink); }
.wh3d-toggles .wh3d-link { margin-left: auto; }

/* Modo pasillo */
.wh3d-aisle {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 5;
  width: min(780px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 8px; padding: 10px 14px 12px;
  background: var(--paper-solid); border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(8, 18, 30, 0.28);
}
.wh3d-a-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.wh3d-a-head b { display: block; font: 700 22px/1.1 var(--font-c); }
.wh3d-a-head span { font-size: 13px; color: var(--muted); }
.wh3d-a-head button { border-radius: 7px; padding: 7px 12px; font-weight: 600; border: 1px solid; }
.wh3d-a-range { width: 100%; margin: 2px 0; accent-color: var(--blue); }
.wh3d-a-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.wh3d-a-row > span { color: var(--muted); font-weight: 600; margin-right: 2px; }
.wh3d-a-row > i { width: 14px; }
.wh3d-a-row button { min-width: 34px; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 10px; font-weight: 600; font-size: 13px; }
.wh3d-a-row button:hover { background: #EEF2F5; }
.wh3d-a-row button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.wh3d-a-keys { margin: 0 0 0 auto; font-size: 12px; color: var(--muted); }
.wh3d.is-aisle .wh3d-dock { display: none; }
.wh3d.is-aisle:has(.wh3d-detail:not([hidden])) .wh3d-aisle { left: 12px; transform: none; width: min(720px, calc(100% - 406px)); }
.wh3d-aisle-select {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 4px 10px;
  font: 600 13px var(--font); color: var(--ink); backdrop-filter: blur(8px); max-width: 220px;
}

/* Pedidos */
.wh3d-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 7px; white-space: nowrap;
  border: 1px solid var(--line); background: #fff; font-weight: 600;
}
.wh3d-btn:hover { background: #EEF2F5; }
.wh3d-btn span:not(:empty) { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 12px; text-align: center; }
.wh3d-orders {
  position: absolute; top: calc(var(--top, 84px) + 40px); left: 12px; bottom: 12px; width: 380px; overflow: auto; z-index: 4;
  background: var(--paper-solid); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  box-shadow: 0 12px 36px rgba(8, 18, 30, 0.28); user-select: text; -webkit-user-select: text;
}
.wh3d.is-orders .wh3d-dock { display: none; }
.wh3d-o-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.wh3d-o-head b { font: 700 20px var(--font-c); }
.wh3d-o-sub { margin: 6px 0 10px; font-size: 13px; color: var(--muted); }
.wh3d-o-sub .wh3d-link { padding: 0 2px; }
.wh3d-o-filter { max-width: none; margin-bottom: 8px; }
.wh3d-o-list { list-style: none; margin: 0; padding: 0; }
.wh3d-o-list button { display: grid; gap: 1px; width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: transparent; padding: 9px 6px; }
.wh3d-o-list button:hover, .wh3d-o-list button[aria-current="true"] { background: #EAF1F8; }
.wh3d-o-l1 { display: flex; align-items: center; gap: 8px; }
.wh3d-o-l1 b { font: 700 16px var(--font-c); }
.wh3d-o-l1 em { font-style: normal; font-size: 11.5px; font-weight: 600; color: #fff; background: var(--warn); border-radius: 999px; padding: 0 7px; }
.wh3d-o-l2 { font-size: 13px; }
.wh3d-o-l3 { font-size: 12px; color: var(--muted); }
.wh3d-o-msg { color: var(--muted); padding: 10px 0; list-style: none; }
.wh3d-o-title { margin: 8px 0 0; font: 700 30px/1 var(--font-c); }
.wh3d-o-actions { display: flex; gap: 8px; margin-bottom: 6px; }
.wh3d-o-actions button { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 6px 11px; font-weight: 600; }
.wh3d-o-actions button:first-child { background: var(--blue); border-color: var(--blue); color: #fff; }
.wh3d-o-lines { list-style: none; margin: 0; padding: 0; }
.wh3d-o-lines > li { border-top: 1px solid var(--line); padding: 10px 0 10px 12px; border-left: 4px solid var(--c); margin-top: 6px; }
.wh3d-o-ll { display: flex; align-items: baseline; gap: 8px; }
.wh3d-o-ll i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); align-self: center; }
.wh3d-o-ll b { font: 700 16px var(--font-c); }
.wh3d-o-ll span { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.wh3d-o-desc { font-size: 13px; }
.wh3d-o-cov { margin: 4px 0 6px; font-size: 12.5px; color: var(--muted); }
.wh3d-o-cov.is-short { color: var(--warn); font-weight: 600; }
.wh3d-o-lines details { margin-top: 6px; font-size: 12.5px; }
.wh3d-o-lines summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.wh3d-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wh3d-chip { display: grid; text-align: left; gap: 0; border: 1px solid var(--line); border-left: 4px solid var(--c); background: #fff; border-radius: 6px; padding: 4px 8px; font-size: 12px; line-height: 1.25; }
.wh3d-chip b { font: 700 14px var(--font-c); }
.wh3d-chip span { color: var(--muted); }
.wh3d-chip em { font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
.wh3d-chip:hover { background: #EEF2F5; }

/* Mover material */
.wh3d-mini { margin-left: 6px; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 1px 8px; font-size: 12px; font-weight: 600; color: var(--blue); }
.wh3d-mini:hover { background: #EAF1F8; }
.wh3d-move {
  position: absolute; top: var(--top, 84px); right: 12px; width: min(400px, calc(100% - 24px)); z-index: 6;
  padding: 12px 14px 14px; border-radius: 10px; background: var(--paper-solid); border: 1px solid var(--line); border-left: 5px solid #1FB5FF;
  box-shadow: 0 12px 36px rgba(8, 18, 30, 0.3);
}
.wh3d-m-head { display: flex; justify-content: space-between; align-items: center; }
.wh3d-m-head b { font: 700 20px var(--font-c); }
.wh3d-m-what { margin: 6px 0 10px; font-size: 13px; }
.wh3d-m-what b { font: 700 15px var(--font-c); }
.wh3d-m-what span { color: var(--muted); }
.wh3d-m-qty { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 600; }
.wh3d-m-qty input, .wh3d-m-row input { font: 600 15px var(--font); border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; width: 110px; color: var(--ink); }
.wh3d-m-qty span { color: var(--muted); font-weight: 500; }
.wh3d-m-hint { margin: 10px 0 6px; font-size: 13px; color: #0B6E9C; font-weight: 600; }
.wh3d-m-row { display: flex; gap: 8px; }
.wh3d-m-row input { flex: 1; width: auto; text-transform: uppercase; }
.wh3d-m-row button, .wh3d-m-quick button, .wh3d-m-actions button { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 6px 11px; font-weight: 600; }
.wh3d-m-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wh3d-m-quick button { font-family: var(--font-c); font-size: 13px; }
.wh3d-m-sum { margin: 4px 0; font-size: 14px; }
.wh3d-m-route { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.wh3d-m-route span { font: 700 26px/1 var(--font-c); }
.wh3d-m-route span.is-to { color: #0B6E9C; }
.wh3d-m-route svg { width: 30px; height: 16px; color: var(--muted); }
.wh3d-m-warn { margin: 4px 0; padding: 6px 9px; border-radius: 7px; background: #FFF4D6; color: #6A4A00; font-size: 12.5px; }
.wh3d-m-warn.is-err { background: #FDE7E7; color: #7A1012; font-weight: 600; }
.wh3d-m-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.wh3d-m-actions button[disabled] { opacity: 0.7; cursor: progress; }
.wh3d.is-moving .wh3d-stage canvas { cursor: crosshair; }

/* Paneles: incidencias, stock por días */
.wh3d-panels { display: flex; gap: 6px; }
.wh3d-btn.is-alert span:not(:empty) { background: var(--warn); }
.wh3d-orders.is-wide { width: min(780px, calc(100% - 24px)); }
.wh3d-inc { margin-top: 10px; border: 1px solid var(--line); border-left: 4px solid #8FA3B8; border-radius: 8px; padding: 8px 10px; }
.wh3d-inc.is-red { border-left-color: var(--warn); }
.wh3d-inc.is-amber { border-left-color: #E8A400; }
.wh3d-inc header { display: flex; align-items: center; gap: 8px; }
.wh3d-inc header b { font-size: 14px; }
.wh3d-inc header span { min-width: 22px; text-align: center; padding: 0 7px; border-radius: 999px; background: #E9EDF1; font-weight: 700; font-size: 12px; }
.wh3d-inc.is-red header span { background: #FDE2E2; color: #8A1518; }
.wh3d-inc.is-amber header span { background: #FFF1CC; color: #6A4A00; }
.wh3d-inc header .wh3d-link { margin-left: auto; font-size: 12.5px; }
.wh3d-inc ul { list-style: none; margin: 6px 0 0; padding: 0; }
.wh3d-inc li button { display: grid; grid-template-columns: 78px 1fr; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; padding: 5px 4px; border-radius: 6px; font-size: 12.5px; }
.wh3d-inc li button:hover { background: #EEF2F5; }
.wh3d-inc li b { font: 700 14px var(--font-c); }
.wh3d-inc-ok { margin: 4px 0 0; font-size: 12.5px; color: var(--ok); }
.wh3d-tabs { display: flex; gap: 4px; margin: 8px 0; border-bottom: 1px solid var(--line); }
.wh3d-tabs button { border: 0; background: none; padding: 6px 10px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.wh3d-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.wh3d-buckets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 8px 0; }
.wh3d-buckets button { display: grid; gap: 2px; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 8px; font-size: 12px; }
.wh3d-buckets button[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.wh3d-buckets i { display: block; height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--blue) var(--w), #E3E8ED var(--w)); }
.wh3d-buckets b { font: 700 15px var(--font-c); }
.wh3d-buckets em { font-style: normal; color: var(--muted); }
.wh3d-buckets span { color: var(--muted); }
.wh3d-aging-f { display: flex; gap: 8px; align-items: center; }
.wh3d-aging-f .wh3d-search { max-width: none; }
.wh3d-aging-f select, .wh3d-seg-sm { font: 500 13px var(--font); border: 1px solid var(--line); border-radius: 7px; padding: 7px 8px; background: #fff; color: var(--ink); }
.wh3d-seg-sm { padding: 3px; margin: 4px 0 8px; }
.wh3d-aging-tot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 8px 0 4px; font-size: 13px; font-weight: 600; }
.wh3d-aging-tot span { margin-left: auto; display: flex; gap: 4px; }
.wh3d-table-wrap { overflow-x: auto; }
.wh3d-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.wh3d-table th { position: sticky; top: 0; background: var(--paper-solid); text-align: left; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); padding: 4px; white-space: nowrap; }
.wh3d-table th button { border: 0; background: none; padding: 0; font: inherit; color: inherit; }
.wh3d-table td { border-bottom: 1px solid var(--line); padding: 5px 4px; vertical-align: top; }
.wh3d-table td small { display: block; color: var(--muted); font-size: 11.5px; }
.wh3d-table .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wh3d-table .is-warn { color: #9A6400; font-weight: 600; }
.wh3d-table .is-bad { color: var(--warn); font-weight: 700; }
.wh3d-table tr.is-tot td { background: #EEF2F5; font-weight: 700; }
.wh3d-cell-link { border: 0; background: none; padding: 0; color: var(--blue); font: 700 14px var(--font-c); text-align: left; }
.wh3d-d-meta .is-warn { color: #9A6400; font-weight: 600; }
.wh3d-d-meta .is-bad { color: var(--warn); font-weight: 700; }
.wh3d-d-cost { margin-top: 8px; font-size: 13px; font-weight: 600; color: #2B4A6E; }
.wh3d-a-tot { display: block; font-size: 12px; color: var(--muted); }
.wh3d-m-sugg { display: grid; gap: 4px; }
.wh3d-m-sugg button { display: flex; align-items: baseline; gap: 8px; text-align: left; border: 1px solid #BFE6F7; background: #F1FAFE; border-radius: 7px; padding: 5px 9px; }
.wh3d-m-sugg b { font: 700 15px var(--font-c); color: #0B6E9C; }
.wh3d-m-sugg span { font-size: 12px; color: var(--muted); }
.wh3d-route { margin: 8px 0; padding: 8px 10px; border-radius: 8px; background: #FFF4EA; border: 1px solid #FFD2AE; font-size: 13px; }
.wh3d-route p { margin: 0 0 6px; }
.wh3d-route ol { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 3px; }
.wh3d-route li { border-left: 4px solid var(--c); padding-left: 6px; }
.wh3d-asof { position: absolute; top: 72px; left: 24px; z-index: 9; width: 300px; padding: 12px 14px; background: var(--paper-solid); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 36px rgba(8, 18, 30, 0.3); font-size: 13px; }
.wh3d-asof label { display: grid; gap: 4px; font-weight: 600; }
.wh3d-asof input { font: 500 14px var(--font); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; }
.wh3d-asof div { display: flex; gap: 8px; margin: 10px 0 6px; }
.wh3d-asof button { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 6px 12px; font-weight: 600; }
.wh3d-asof p { margin: 0; color: var(--muted); font-size: 12px; }
.wh3d-asof-banner { position: absolute; top: calc(var(--top, 84px) + 40px); left: 50%; transform: translateX(-50%); z-index: 5; display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 14px; border-radius: 999px; background: #FFF1CC; border: 1px solid #E8C35A; color: #5A3E00; font-size: 13px; box-shadow: 0 6px 18px rgba(8, 18, 30, 0.2); }
.wh3d-asof-banner button { border: 0; background: #5A3E00; color: #fff; border-radius: 999px; padding: 5px 12px; font-weight: 600; }
.wh3d-print { display: none; }
@media print {
  .wh3d > *:not(.wh3d-print) { display: none !important; }
  .wh3d { background: #fff; height: auto; overflow: visible; }
  .wh3d-print { display: block; color: #000; font: 11pt Barlow, Arial, sans-serif; }
  .wh3d-print h1 { font-size: 16pt; margin: 0 0 6pt; }
  .wh3d-print table { width: 100%; border-collapse: collapse; }
  .wh3d-print th, .wh3d-print td { border: 1px solid #999; padding: 4pt 6pt; text-align: left; }
}

/* Recorrido guiado */
.wh3d-tour {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 7; width: min(600px, calc(100% - 24px));
  padding: 12px 14px 14px; border-radius: 12px; background: var(--paper-solid); border: 1px solid var(--line); border-top: 5px solid #FF7A00;
  box-shadow: 0 14px 40px rgba(8, 18, 30, 0.32); max-height: 60%; overflow: auto;
}
.wh3d.is-orders .wh3d-tour { left: calc(50% + 196px); width: min(560px, calc(100% - 420px)); }
.wh3d.is-tour .wh3d-aisle, .wh3d.is-tour .wh3d-dock { display: none; }
.wh3d-t-head { display: flex; align-items: center; gap: 10px; }
.wh3d-t-head b { font: 700 18px var(--font-c); white-space: nowrap; }
.wh3d-t-dots { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.wh3d-t-dots i { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font: 700 12px var(--font-c); font-style: normal; background: #E9EDF1; color: var(--muted); }
.wh3d-t-dots i.is-done { background: #23946A; color: #fff; }
.wh3d-t-dots i.is-cur { box-shadow: 0 0 0 2px #FF7A00; color: var(--ink); }
.wh3d-t-go { margin: 10px 0 6px; font-size: 15px; }
.wh3d-t-stop { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0 12px; margin: 8px 0 4px; }
.wh3d-t-stop span { grid-row: 1; font-size: 12px; color: var(--muted); font-weight: 600; }
.wh3d-t-stop b { grid-row: 2; font: 700 34px/1 var(--font-c); color: #C25700; }
.wh3d-t-stop em { grid-row: 2; font-style: normal; color: var(--muted); font-size: 13px; }
.wh3d-t-items { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.wh3d-t-items li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 8px 10px; border-radius: 8px; background: #F3F5F7; border-left: 5px solid var(--c); }
.wh3d-t-what { font-size: 13px; }
.wh3d-t-what b { font: 700 16px var(--font-c); }
.wh3d-t-what span { display: block; color: var(--muted); font-size: 12px; }
.wh3d-t-items strong { font: 700 20px var(--font-c); text-align: right; }
.wh3d-t-items strong small { display: block; font: 500 12px var(--font); color: var(--muted); }
.wh3d-t-items button { grid-column: 1 / -1; justify-self: start; border: 1px solid var(--line); border-radius: 7px; padding: 6px 12px; font-weight: 600; background: #fff; }
.wh3d-t-items .wh3d-m-warn { grid-column: 1 / -1; }
.wh3d-t-ok { grid-column: 1 / -1; margin: 0; color: #1C7A55; font-weight: 700; font-size: 13px; }
.wh3d-t-wait { grid-column: 1 / -1; margin: 0; color: var(--muted); font-weight: 600; font-size: 13px; }
.wh3d-t-actions .wh3d-t-ok { margin-right: auto; align-self: center; }
.wh3d-t-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.wh3d-t-actions button { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 7px 14px; font-weight: 600; }
.wh3d-o-cov.is-ok { color: #1C7A55; font-weight: 600; }

/* Minimapa */
.wh3d-minimap {
  position: absolute; right: 12px; bottom: 12px; width: 220px; height: 140px; cursor: crosshair;
  background: rgba(244, 246, 248, 0.92); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 6px 24px rgba(8, 18, 30, 0.18);
}
.wh3d:has(.wh3d-detail:not([hidden])) .wh3d-minimap, .wh3d:has(.wh3d-move:not([hidden])) .wh3d-minimap { right: 394px; }

/* Tooltip, aviso, edición y carga */
.wh3d-tip {
  position: absolute; left: 0; top: 0; pointer-events: none; z-index: 6;
  display: flex; flex-direction: column; padding: 6px 10px; border-radius: 7px;
  background: rgba(16, 26, 38, 0.92); color: #fff; font-size: 13px; white-space: nowrap;
}
.wh3d-tip b { font: 700 17px/1.1 var(--font-c); }
.wh3d-tip span { color: #C6D3E1; }
.wh3d-toast {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 8;
  padding: 10px 16px; border-radius: 8px; background: #15212C; color: #fff; font-weight: 500; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.wh3d-editbar {
  position: absolute; top: var(--top, 84px); left: 50%; transform: translateX(-50%); z-index: 6; width: min(640px, calc(100% - 24px));
  padding: 12px 14px; border-radius: 10px; background: var(--paper-solid); border: 1px solid var(--line); border-left: 5px solid var(--accent);
  box-shadow: 0 10px 30px rgba(8, 18, 30, 0.25);
}
.wh3d-editbar p { margin: 0 0 10px; }
.wh3d-editbar div { display: flex; flex-wrap: wrap; gap: 8px; }
.wh3d.is-edit .wh3d-dock, .wh3d.is-edit .wh3d-views { opacity: 0.45; pointer-events: none; }
.wh3d-busy {
  position: absolute; inset: 0; display: none; place-content: center; justify-items: center; gap: 14px; z-index: 10;
  background: rgba(13, 24, 40, 0.86); color: #E6EEF7; font: 600 20px var(--font-c); letter-spacing: 0.02em; text-align: center; padding: 24px;
}
.wh3d-busy.is-on { display: grid; }
.wh3d-busy-bar { width: 220px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); overflow: hidden; position: relative; }
.wh3d-busy-bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent); animation: wh3d-load 1.1s ease-in-out infinite; }
@keyframes wh3d-load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

@media (max-width: 1100px) {
  .wh3d-kpis { gap: 12px; }
  .wh3d-kpi span { font-size: 11px; }
  .wh3d-views { max-width: calc(100% - 24px); }
}
@media (max-width: 820px) {
  .wh3d-kpis, .wh3d-minimap { display: none; }
  .wh3d-detail { left: 12px; width: auto; top: auto; max-height: 60%; }
  .wh3d-dock { max-width: calc(100% - 24px); }
}
@media (prefers-reduced-motion: reduce) {
  .wh3d-busy-bar::after { animation: none; width: 100%; }
}
