@layer legado {
/* estilos/09-shell-claro-inventario-y-modales.css · fichero 9/11 de la hoja HEREDADA (líneas 19842-20780 del antiguo styles.css).
   Shell claro, iteraciones del modal del parte, compras e inventario, modales unificados. Tramos internos, en este orden:
     · 29-shell-claro (19842-20040): Shell claro (menú lateral y topbar blancos), avisos, centro de mando SaaS
     · 30-parte-modal-iteraciones (20041-20216): Detalle del parte (modal): iteraciones 1-3 y panel de partes reordenado
     · 31-compras-e-inventario (20217-20411): Compras (cockpit y pedido en modal), respiración global, analítica y tabla de inventario, SGA
     · 32-modales-unificados (20412-20780): Unificación de modales (r151), borde del modal oscuro y carcasa de tablas anchas
   El orden ES la cascada: va tras 08-agenda-flat-y-look-saas.css y antes de 10-edicion-parte-y-proveedores.css; no se reordena. Índice: static/styles.css. */
/* ── tramo 29-shell-claro (líneas 19842-20040 del antiguo styles.css): Shell claro (menú lateral y topbar blancos), avisos, centro de mando SaaS ── */
/* ============================================================
   SHELL CLARO (maqueta SaaS): menú lateral y topbar blancos.
   El marco de la app es lo primero que se ve — antes seguía
   oscuro y hacía parecer que "nada había cambiado".
   ============================================================ */
.sidebar-nav.command-sidebar {
  background: #ffffff;
  border-right: 1px solid var(--hairline);
  box-shadow: none;
}
.sidebar-nav .sidebar-head,
.sidebar-nav .sync-mini {
  border: 1px solid var(--hairline);
  background: #f8fafc;
  box-shadow: none;
}
.sidebar-nav .sidebar-title strong,
.sidebar-nav .sync-mini strong { color: #111827; }
.sidebar-nav .sidebar-title span,
.sidebar-nav .sync-mini span:not(.status-dot) { color: #6b7280; }
.sidebar-nav .nav-collapse-toggle {
  border: 1px solid var(--hairline);
  background: #ffffff;
  color: #6b7280;
}
.sidebar-nav .nav-section-title { color: #9ca3af; }
.sidebar-nav .nav-item { color: #374151; background: transparent; }
.sidebar-nav .nav-item i { background: #f3f4f6; color: #6b7280; }
.sidebar-nav .nav-item span { color: inherit; }
.sidebar-nav .nav-item:hover { background: #f6f7f8; color: #111827; }
.sidebar-nav .nav-item.active { background: #ffedd5; color: #c2410c; }
.sidebar-nav .nav-item.active i { background: #f97316; color: #ffffff; }
.sidebar-nav .sidebar-logout {
  border: 1px solid var(--hairline);
  background: #ffffff;
  color: #374151;
}
.sidebar-nav .sidebar-logout:hover { border-color: #fdba74; color: #c2410c; }

/* Topbar blanca con separación fina */
.topbar.command-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--hairline);
  box-shadow: none;
}

/* Avisos: boton rojo cuando hay pendientes.
   DOS ARREGLOS, 27-ago, y el primero es grave.

   1. EL BOTON ERA INVISIBLE. Este selector es (0,2,0) igual que `.btn.ghost` de la capa cristal, que
      esta 2.259 lineas mas abajo y por tanto ganaba: dejaba `background-color: transparent` con el
      `color: #ffffff` de aqui intacto. Resultado medido: texto BLANCO SOBRE BLANCO, 1:1. Con 327
      avisos pendientes, la palabra "Avisos" no se veia y solo flotaba el numero. Desde agosto, y lo
      rompi yo con la capa cristal. Se arregla subiendo la especificidad a (0,3,0) con `.btn`, que es
      una clase que el boton ya lleva: nada de ‹important›.

   2. Y EL CONTRASTE. #ef4444 con blanco encima da 3,76:1 y AA pide 4,5. #c33022 da 5,58:1, y es
      ademas el rojo del sistema de diseno (--ty-peligro-tinta), asi que el arreglo acerca esto al
      sistema en vez de alejarlo. El contador invertido pasa del mismo modo a 5,58:1 sobre blanco. */
.btn.topbar-notifications:has(.nav-badge) {
  background-color: #c33022;   /* literal a proposito: `--ty-peligro-tinta` cambia con el tema
                                  del sistema y esta hoja no. Medido: en oscuro daba 3,45:1 */
  border-color: #c33022;
  color: #ffffff;
}
.btn.topbar-notifications:has(.nav-badge) .nav-badge {
  background: #ffffff;
  color: #c33022;   /* idem: literal, no token de tema */
}
.btn.topbar-notifications:has(.nav-badge):hover { background: #a81f18; border-color: #a81f18; }

/* La capa oscura usa .ops-shell .command-nav button (más específica): re-override claro */
.ops-shell .command-nav button {
  color: #374151;
  background: transparent;
}
.ops-shell .command-nav button i {
  color: #6b7280;
  background: #f3f4f6;
}
.ops-shell .command-nav button:hover {
  color: #111827;
  background: #f6f7f8;
}
.ops-shell .command-nav button.active {
  color: #c2410c;
  background: #ffedd5;
  border-color: transparent;
}
.ops-shell .command-nav button.active i {
  color: #ffffff;
  background: #f97316;
}
.ops-shell .nav-section-title { color: #9ca3af; }

/* ── Centro de mando (maqueta SaaS) ── */
.ops-warning-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid #ffe3c2;
  border-radius: 14px;
  background: #fff9f0;
}
.ops-warning-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #ffedd5;
  color: #a33800;   /* era #ea580c: 4,22:1 sobre este fondo, y AA pide 4,5 */
  font-size: 16px;
}
.ops-warning-banner > div { display: grid; gap: 2px; min-width: 0; flex: 1; }
.ops-warning-banner strong { color: #c2410c; font-size: 14px; }
.ops-warning-banner span:not(.ops-warning-icon) { color: #6b7280; font-size: 13px; font-weight: 600; }

.ops-action-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
}
.ops-action-header h3 { margin: 0; font-size: 15.5px; font-weight: 800; color: #111827; }
.ops-action-header p { margin: 2px 0 0; color: #6b7280; font-size: 12.5px; font-weight: 600; }

.kpi-cta-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.kpi-cta {
  display: grid;
  gap: 3px;
  padding: 14px 16px;
  text-align: left;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: #ffffff;
  font: inherit;
  cursor: default;
}
button.kpi-cta { cursor: pointer; }
.kpi-cta strong { font-size: 24px; font-weight: 800; line-height: 1.1; color: #111827; }
.kpi-cta span { font-size: 13px; font-weight: 800; color: #111827; }
.kpi-cta small { color: #6b7280; font-size: 12px; font-weight: 600; }
.kpi-cta em { margin-top: 4px; color: #a14900; font-style: normal; font-size: 12.5px; font-weight: 800;   /* era #ea580c: 3,5:1 */
}
.kpi-cta.tone-danger:not(.idle) { background: #fff5f4; border-color: #ffd3cd; }
.kpi-cta.tone-danger:not(.idle) strong { color: #e11d48; }
.kpi-cta.tone-warning:not(.idle) { background: #fff9f0; border-color: #ffe3c2; }
.kpi-cta.tone-warning:not(.idle) strong { color: #ea580c; }
.kpi-cta.tone-success:not(.idle) { background: #f6fcef; border-color: #dcefc7; }
.kpi-cta.tone-success:not(.idle) strong { color: #4d7c0f; }
.kpi-cta.tone-info:not(.idle) strong { color: #e11d48; }
.kpi-cta.idle strong { color: #746e67;   /* era #9ca3af: 2,54:1 */
}
button.kpi-cta:hover { border-color: #fdba74; }


/* Carga por técnico con avatar */
.load-row .load-person { min-width: 0; overflow: hidden; }
.load-row i {
  flex: 1;
  display: block;
  height: 8px;
  border-radius: 999px;
  background: #f3f4f6;
  overflow: hidden;
}
.load-row i em { display: block; height: 100%; border-radius: 999px; }

/* ── Bandeja: filas de acción más legibles ── */
.action-list .action-row { padding: 13px 16px; border: 1px solid var(--hairline); border-radius: 12px; margin-bottom: 8px; }
.action-list .action-row:hover { border-color: #fdba74; }
.action-list .action-row strong { font-size: 13.5px; font-weight: 800; color: #111827; }
.action-list .action-row .muted { font-size: 12px; }

/* Paneles embebidos en desplegables (Inventario: importar / reclasificar) */
.collapsible-embed > .panel { border: 0; box-shadow: none; padding-top: 4px; }

/* ── tramo 30-parte-modal-iteraciones (líneas 20041-20216 del antiguo styles.css): Detalle del parte (modal): iteraciones 1-3 y panel de partes reordenado ── */
/* ============================================================
   PARTE · Detalle (modal) — legibilidad de cabecera + más aire (4-jul-2026)
   El modal se monta DENTRO de .app-shell, cuya regla `.app-shell .detail-hero`
   pintaba la CABECERA de BLANCO con el texto también claro → número ilegible
   ("la cabecera clara no se ve"). Reafirmamos el tema oscuro con especificidad
   ganadora (0,3,0 > 0,2,0) y aplicamos el lenguaje visual de agenda/partes:
   más grande, menos denso, tarjetas aireadas y sin recortes.
   ============================================================ */
.workorder-detail-overlay .wo-modal .detail-hero {
  background:
    radial-gradient(130% 220% at 0% 0%, rgba(228,103,1,.22), transparent 58%),
    linear-gradient(150deg, #171c28 0%, #12151f 62%, #0e111a 100%);
  padding: 26px 34px 22px;
  gap: 22px;
}
.workorder-detail-overlay .wo-modal .detail-hero h2,
.workorder-detail-overlay .wo-hero-titlerow h2 { font-size: 26px; letter-spacing: -.2px; }
.workorder-detail-overlay .wo-hero-eyebrow { color: #ffb27a; font-size: 12px; letter-spacing: 1.4px; }
.workorder-detail-overlay .wo-hero-meta { color: #c8cfe0; font-size: 13.5px; }
.workorder-detail-overlay .wo-hero-icon { width: 52px; height: 52px; border-radius: 15px; }
.workorder-detail-overlay .wo-hero-facts { gap: 8px; margin-top: 11px; }
.workorder-detail-overlay .wo-hero-facts .status-pill { font-size: 12px; padding: 4px 11px; }

/* Resumen ejecutivo: tarjetas más grandes y aireadas, valores legibles, sin recortes.
   auto-fit refluye en móvil (iOS) en vez de apretar 3 columnas fijas → sin solapes. */
.workorder-detail-overlay .wo-modal-content .workorder-summary-grid {
  /* Tarjetas más anchas: hay espacio de sobra y así el email/cliente caben sin trocearse
     (Rubén 3-ago). auto-fit reparte el ancho disponible entre menos columnas más amplias. */
  grid-template-columns: repeat(auto-fit, minmax(264px, 1fr));
  gap: 16px; grid-auto-rows: minmax(122px, auto);
}
.workorder-detail-overlay .wo-modal-content .workorder-summary-card {
  padding: 18px 18px 16px; border-radius: 16px;
}
.workorder-detail-overlay .wo-modal-content .workorder-summary-card > span {
  font-size: 12px; letter-spacing: .7px; white-space: normal; line-height: 1.3;
}
.workorder-detail-overlay .wo-modal-content .workorder-summary-card strong {
  font-size: 17px; line-height: 1.28; overflow-wrap: anywhere;
}
.workorder-detail-overlay .wo-modal-content .workorder-summary-card small { font-size: 12px; line-height: 1.35; }

/* Cuerpo un poco más aireado (menos denso) */
.workorder-detail-overlay .wo-modal-content { padding: 26px 30px 32px; }

/* ============================================================
   PARTE · Detalle (modal) — iteración 2 (4-jul-2026): modal más grande,
   cabecera más ligera, columna derecha reordenada (feedback Rubén).
   ============================================================ */
.workorder-detail-overlay .wo-modal { max-width: 1520px; width: calc(1vw * 95); max-height: calc(1vh * 95); }

/* Cabecera MÁS LIGERA: menos alta, sin glow pesado, translúcida plana. */
.workorder-detail-overlay .wo-modal .detail-hero {
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
  padding: 18px 30px 16px; gap: 20px;
}
.workorder-detail-overlay .wo-modal .detail-hero::after { opacity: .55; }
.workorder-detail-overlay .wo-modal .detail-hero h2,
.workorder-detail-overlay .wo-hero-titlerow h2 { text-shadow: none; font-size: 24px; }
.workorder-detail-overlay .wo-hero-icon { width: 44px; height: 44px; border-radius: 13px; }
.workorder-detail-overlay .wo-hero-facts { margin-top: 9px; }

/* Columna derecha: más ancha y aireada, acción destructiva en CONTORNO (que no domine el rojo). */
.wo-flow-cols { grid-template-columns: minmax(0,1fr) 404px; }
/* Debajo de 1100px NO hay sitio para contenido (necesita ~560px) + barra lateral (404px): se
   apila a UNA columna con la barra de acciones debajo. Va DESPUÉS de la regla de arriba para
   ganarle (si no, la tabla de días se salía y se cortaba por la derecha — Rubén 21-jul). */
@media (max-width: 1100px) {
  .wo-flow-cols { grid-template-columns: 1fr; }
  .workorder-detail-overlay .wo-flow-side,
  .wo-flow-side { position: static; border-left: 0; border-top: 1px solid rgba(255,255,255,.07); }
}
.workorder-detail-overlay .wo-flow-side { padding: 22px 22px 26px; gap: 18px; }
.workorder-detail-overlay .wo-flow-side .workorder-action-rail {
  background: linear-gradient(160deg, rgba(255,255,255,.055), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.08); padding: 18px; gap: 14px;
}
.workorder-detail-overlay .wo-flow-side .workorder-action-context strong { font-size: 15px; line-height: 1.3; }
.workorder-detail-overlay .wo-flow-side .workorder-action-secondary {
  border-top: 1px solid rgba(255,255,255,.08); padding-top: 13px; margin-top: 3px;
  display: flex; flex-direction: column; gap: 9px;
}
.workorder-detail-overlay .wo-flow-side .btn.danger {
  background: transparent; color: #ff9d9d; border: 1px solid rgba(239,68,68,.42); box-shadow: none;
}
.workorder-detail-overlay .wo-flow-side .btn.danger:hover {
  background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.65); color: #ffbcbc;
}
.workorder-detail-overlay .wo-flow-side .wo-facts { background: rgba(255,255,255,.028); }

/* ============================================================
   PARTE · Detalle (modal) — iteración 3 (4-jul-2026): RITMO VERTICAL de la
   cabecera (feedback Rubén: "todo muy junto, sin separación entre líneas").
   Jerarquía con aire: rótulo → título → datos → estados, cada bloque con su
   respiración y line-height legible.
   ============================================================ */
.workorder-detail-overlay .wo-modal .detail-hero { padding: 24px 32px 22px; align-items: flex-start; }
.workorder-detail-overlay .wo-hero-id { gap: 16px; }
.workorder-detail-overlay .wo-hero-icon { align-self: flex-start; margin-top: 3px; }
.workorder-detail-overlay .wo-hero-idtext { display: flex; flex-direction: column; }
.workorder-detail-overlay .wo-hero-eyebrow { margin: 0 0 9px; font-size: 12px; letter-spacing: 1.7px; }
.workorder-detail-overlay .wo-hero-titlerow { gap: 12px; row-gap: 8px; margin: 0 0 11px; align-items: center; }
.workorder-detail-overlay .wo-hero-titlerow h2,
.workorder-detail-overlay .wo-modal .detail-hero h2 { font-size: 25px; line-height: 1.05; }
.workorder-detail-overlay .wo-hero-meta { margin: 0 0 15px; font-size: 13.5px; line-height: 1.55; color: #c8cfe0; }
.workorder-detail-overlay .wo-hero-facts { margin-top: 0; gap: 9px; }
.workorder-detail-overlay .wo-hero-facts .status-pill { padding: 5px 12px; font-size: 12px; line-height: 1.2; }
.workorder-detail-overlay .wo-hero-badge { padding: 4px 11px; }

/* ============================================================
   PARTES · Panel — reordenado + sin corte lateral + modal más ancho (4-jul-2026)
   Pedido Rubén: "Partes recientes arriba lo primero", "se corta en el lateral",
   "modal 30% más ancho". .workorders-view es grid → reordeno con `order` (la
   cabecera/filtros quedan arriba en order 0; la tabla de partes recientes sube).
   ============================================================ */
.workorders-view { min-width: 0; }
.workorders-view > .workorder-list-panel { order: 1; }
.workorders-view > .workorders-overview-grid { order: 2; }
.workorders-view > details.collapsible-list-card:not(.workorder-list-panel) { order: 3; }
.workorders-view > .new-workorder-panel,
.workorders-view > .warning-panel { order: 4; }

/* Sin corte lateral: la tabla ancha hace scroll DENTRO de su caja, no empuja la página. */
.workorders-view,
.workorders-overview-grid,
.workorders-focus-panel,
.workorder-list-panel { min-width: 0; max-width: 100%; }
.workorders-view .table-wrap,
.workorders-view .workorder-table-wrap { overflow-x: auto; max-width: 100%; }

/* Modal del parte un 30% más ancho (1520 → ~1975). */
.workorder-detail-overlay .wo-modal { max-width: 1975px; width: calc(1vw * 96); }

/* Búsqueda de la topbar convertida en lanzador de la paleta (⌘K): un solo buscador de texto por

/* Aviso en Partes: visitas planificadas en Agenda que coinciden con la búsqueda (no son partes). */
.agenda-search-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 0.9rem;
}
.agenda-search-hint .btn { flex: 0 0 auto; }

/* Facturación (petición de la financiera 6-jul): las ACCIONES del detalle de factura arriba, justo
   bajo la cabecera, no al final. Se reordena con flex `order` sin mover el DOM. */
.invoice-detail-panel { display: flex; flex-direction: column; }
.invoice-detail-panel > .detail-hero { order: -2; }
.invoice-detail-panel > .invoice-actions-section { order: -1; }
.invoice-detail-panel > .invoice-actions-section { border-bottom: 1px solid var(--border-soft, #e5e7eb); padding-bottom: 14px; margin-bottom: 4px; }

/* ── tramo 31-compras-e-inventario (líneas 20217-20411 del antiguo styles.css): Compras (cockpit y pedido en modal), respiración global, analítica y tabla de inventario, SGA ── */
/* ═══════════════════════════════════════════════════════════════
   Compras · Cockpit operativo (rediseño A, 2026-07)
   Lista de pedidos (izq) + detalle (der), con pestañas de sección.
   ═══════════════════════════════════════════════════════════════ */
.purchases-tabs { margin-bottom: 16px; }
@media (max-width: 900px) { .pc-cockpit { grid-template-columns: 1fr; } }
.pc-list { padding: 0; overflow: hidden; }
.pc-list-h { padding: 16px 18px; margin: 0; }
.pc-rows { display: flex; flex-direction: column; }
.pc-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; padding: 13px 18px;
  border-top: 1px solid var(--border-soft); cursor: pointer; align-items: center; transition: background .14s; }
.pc-row:hover { background: var(--surface-warm); }
.pc-row.sel { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.pc-row-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pc-code { font-weight: 700; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pc-sup { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-recline { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pc-prog { display: inline-block; width: 84px; height: 6px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.pc-prog i { display: block; height: 100%; border-radius: 999px; background: var(--info); }
.pc-prog i.full { background: var(--success); }
.pc-row-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pc-amt { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.chip-pc { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.chip-pc.pend { background: var(--warning-soft); color: var(--cr-t-warning-ink); }   /* #a86a08: 4,12:1 */
.chip-pc.recv { background: var(--success-soft); color: #137a45; }
/* Una oferta de proveedor sin decidir: ni pendiente de recibir ni recibida. Reusa los
   tokens de «info» para no meter color literal nuevo (la carraca de colores esta a cero). */
.chip-pc.offer { background-color: var(--info-soft); color: var(--cr-t-info-ink); }
.pc-detail { padding: 0; overflow: hidden; }
.pc-detail-h { padding: 16px 18px; margin: 0; display: flex; align-items: flex-start; gap: 12px; }
.pc-detail-h > div { flex: 1; }
.pc-kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border-soft); }
@media (max-width: 560px) { .pc-kv { grid-template-columns: repeat(2, 1fr); } }
.pc-kv > div { background: var(--panel-solid); padding: 11px 16px; display: flex; flex-direction: column; gap: 3px; }
.pc-kv .k { font-size: 12px; text-transform: none; color: var(--text-muted); font-weight: 700; }
.pc-kv .v { font-size: 13.5px; font-weight: 650; }
.pc-lines-wrap { border-top: 1px solid var(--border-soft); }
.pc-lines .pc-ref { display: block; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pc-lines td.r, .pc-lines th.r { text-align: right; font-variant-numeric: tabular-nums; }
.pc-notes { padding: 12px 18px; border-top: 1px solid var(--border-soft); }
.pc-notes .eyebrow { display: block; margin-bottom: 4px; }
.pc-notes p { margin: 0; color: var(--text-secondary); font-size: 13px; }
.pc-detail-foot { padding: 14px 18px; border-top: 1px solid var(--border-soft); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pc-total { margin-left: auto; text-align: right; display: flex; flex-direction: column; }
.pc-total .k { font-size: 12px; text-transform: none; color: var(--text-muted); font-weight: 700; }
.pc-total .v { font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; }
.pc-empty { padding: 28px 18px; }
.pc-suppliers { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .pc-suppliers { grid-template-columns: 1fr; } }
.pc-create-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pc-create-h h2 { margin: 0; }

/* ═══ Compras · detalle del pedido en MODAL ancho (como el de partes) ═══ */
.pc-list-full { width: 100%; }
.po-overlay {
  position: fixed; inset: 0; z-index: 130;
  background: rgba(17, 20, 26, .52); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: clamp(20px, calc(1vh * 5), 64px) clamp(16px, calc(1vw * 3), 40px); overflow-y: auto;
  animation: poFade .16s ease;
}
.po-modal {
  position: relative; width: min(1080px, calc(1vw * 94));
  background: var(--panel-solid); border-radius: 24px;
  box-shadow: 0 28px 90px -24px rgba(17, 20, 26, .55); overflow: hidden;
  animation: poRise .22s cubic-bezier(.22,.61,.36,1);
}
@keyframes poFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes poRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .po-overlay, .po-modal { animation: none; } }
.po-modal-body { max-height: calc(1vh * 88); overflow-y: auto; }
.po-modal .pc-detail-h { padding: 22px 24px; padding-right: 64px; }
.po-modal .pc-detail-h h3 { font-size: 20px; }
.po-modal .pc-kv > div,
.po-modal .pc-notes,
.po-modal .pc-detail-foot { padding-left: 24px; padding-right: 24px; }
.po-modal .pc-lines th:first-child,
.po-modal .pc-lines td:first-child { padding-left: 24px; }
.po-modal .pc-lines th:last-child,
.po-modal .pc-lines td:last-child { padding-right: 24px; }

/* ═══ Respiración global: interlineado cómodo y contenido no pegado al borde ═══ */
/* Base de interlineado para texto corrido/etiquetas (los números y títulos que ya
   fijan su propio line-height NO se ven afectados por especificidad). Petición Rubén:
   "textos muy juntos, casi sin interlineado, al borde de las áreas". */
.app-shell { line-height: 1.5; }
.app-shell .section-header-v2 p { line-height: 1.5; margin-top: 4px; }
.app-shell .list-row { line-height: 1.45; }
.app-shell .muted, .app-shell .kpi-sub { line-height: 1.4; }

/* ═══════════════════════════════════════════════════════════════
   Inventario · panel de analítica (rediseño 2026-07)
   Distribución por ubicación (barras horizontales legibles a cualquier escala)
   + Salud del stock (composición OK/bajo/sin-stock). Reemplaza el mini-bars vertical
   (que con 250 vs 2 se veía como un cuadro + una raya) y elimina duplicados.
   ═══════════════════════════════════════════════════════════════ */
.inv-analytics { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; margin: 16px 0; align-items: start; }
@media (max-width: 860px) { .inv-analytics { grid-template-columns: 1fr; } }
.inv-card { padding: 18px 20px; }
.inv-card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.inv-card-h .eyebrow { display: block; margin-bottom: 2px; }
.inv-card-h h3 { font-size: 15px; font-weight: 750; letter-spacing: -0.01em; }
.inv-chip { flex: none; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; background: var(--typy-orange-soft); color: var(--typy-copper-dark, #b5540f); white-space: nowrap; font-variant-numeric: tabular-nums; }

.inv-dist { display: flex; flex-direction: column; gap: 12px; }
.inv-dist-row { display: grid; grid-template-columns: minmax(84px, 148px) 1fr auto; align-items: center; gap: 14px; }
.inv-dist-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-dist-bar { height: 10px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.inv-dist-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), #f2a25e); min-width: 6px; }
.inv-dist-val { font-variant-numeric: tabular-nums; font-weight: 750; font-size: 13.5px; text-align: right; white-space: nowrap; }
.inv-dist-val small { color: var(--text-muted); font-weight: 600; margin-left: 7px; }
.inv-empty { color: var(--text-muted); font-size: 13px; padding: 6px 0; }

.inv-health-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--surface-muted); margin-bottom: 14px; }
.inv-health-bar i { display: block; height: 100%; }
.inv-health-bar i.ok { background: var(--success); }
.inv-health-bar i.warn { background: var(--warning); }
.inv-health-bar i.bad { background: var(--danger); }
.inv-health-legend { display: flex; flex-direction: column; gap: 2px; }
.inv-health-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: transparent; border-radius: 10px; font: inherit; font-size: 13px; color: var(--text-primary); cursor: pointer; text-align: left; width: 100%; transition: background .14s; }
.inv-health-row:hover { background: var(--surface-warm); }
.inv-health-row b { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 14px; }
.inv-health-row .inv-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.inv-health-row .inv-dot.ok { background: var(--success); }
.inv-health-row .inv-dot.warn { background: var(--warning); }
.inv-health-row .inv-dot.bad { background: var(--danger); }
.inv-health-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--text-secondary); flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════
   Inventario · tabla que CABE sin desbordar (rediseño 2026-07)
   Antes: pills de ubicación largas (no partían) + botones grandes hacían la tabla
   más ancha que el panel → scroll horizontal y columna "Acciones" cortada a la derecha.
   ═══════════════════════════════════════════════════════════════ */
.inventory-table td, .inventory-table th { vertical-align: top; }

/* SGA 2.0 · torre de control. Una consola operativa, no una cuadrícula decorativa de tarjetas. */
.sga-control-shell { display: grid; gap: 18px; }
.sga-control-head { display: flex; justify-content: space-between; gap: 24px; align-items: end; padding: 24px 28px; border-radius: var(--control-radius); background: linear-gradient(118deg, var(--typy-navy-950) 0%, var(--typy-navy-900) 68%, var(--typy-navy-800) 100%); color: var(--typy-text-inverse); box-shadow: var(--soft-shadow); }
.sga-control-head h2 { margin: 4px 0 6px; font-size: clamp(25px, calc(1vw * 3), 38px); letter-spacing: -.035em; color: var(--typy-text-inverse); }
.sga-control-head p { margin: 0; max-width: 720px; color: var(--typy-text-inverse); opacity: .76; }
.sga-control-head .eyebrow { color: var(--typy-orange); }
.sga-control-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 520px; }
.sga-control-head .btn:not(.primary) { color: var(--typy-text-inverse); border-color: var(--typy-border-strong); background-color: var(--typy-navy-800); }
.sga-control-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border: 1px solid var(--border-soft); border-radius: var(--control-radius); overflow: hidden; background-color: var(--surface); }
.sga-control-kpi { min-width: 0; padding: 17px 18px 15px; border-left: 3px solid var(--text-muted); }
.sga-control-kpi + .sga-control-kpi { border-top: 0; border-right: 0; border-bottom: 0; }
.sga-control-kpi span, .sga-control-kpi small { display: block; color: var(--muted); }
.sga-control-kpi strong { display: block; margin: 4px 0; font-size: 27px; color: var(--ink); }
.sga-control-kpi.danger { border-left-color: var(--danger); } .sga-control-kpi.warning { border-left-color: var(--warning); } .sga-control-kpi.success { border-left-color: var(--success); } .sga-control-kpi.info { border-left-color: var(--info); }
.sga-flow-track { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; margin-top: 18px; }
.sga-flow-step { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 14px 12px; border-top: 3px solid var(--border-medium); background-color: var(--surface-muted); }
.sga-flow-step::after { content: ""; position: absolute; right: -7px; z-index: var(--ty-z-pegado); width: 14px; height: 14px; background: inherit; border-top: 1px solid var(--border-soft); border-right: 1px solid var(--border-soft); transform: rotate(45deg); }
.sga-flow-step:last-child::after { display: none; }
.sga-flow-step.active { border-top-color: var(--brand); background-color: var(--brand-soft); }
.sga-flow-step span { font: 700 11px/1 ui-monospace, monospace; color: var(--muted); }
.sga-flow-step strong { font-size: 13px; }
.sga-flow-step b { min-width: 24px; text-align: center; color: var(--brand-strong); }
.sga-control-main { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr); gap: 18px; align-items: start; }
.sga-exceptions { position: sticky; top: calc(var(--sticky-top, 64px) + 8px); }
.sga-exception-group { padding: 12px 0; border-top: 1px solid var(--border-soft); }
.sga-exception-group header, .sga-exception-group > div { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.sga-exception-group > div { padding: 8px 2px; align-items: start; }
.sga-exception-group small { color: var(--muted); text-align: right; }
.sga-document-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.sga-document-column .list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; }
.sga-document-column .list-row > div span { display: block; color: var(--muted); margin-top: 2px; }
@media (max-width: 1100px) { .sga-control-kpis { grid-template-columns: repeat(3, 1fr); } .sga-flow-track { grid-template-columns: 1fr; } .sga-flow-step::after { display: none; } .sga-control-main { grid-template-columns: 1fr; } .sga-exceptions { position: static; } }
@media (max-width: 700px) { .sga-control-head { align-items: stretch; flex-direction: column; padding: 20px; } .sga-control-actions { justify-content: flex-start; } .sga-control-kpis, .sga-document-grid { grid-template-columns: 1fr; } .sga-control-kpi { border-left-width: 4px; } }
/* Material acotado (parte por espacios, no estira). */
.inventory-table .inv-col-material { max-width: 220px; }
/* Ubicaciones: un div con ancho máximo REAL (el max-width del <td> se ignora en table-layout:auto)
   y pills que PARTEN su texto (por defecto son inline-flex y nunca partían → columna de 300px+). */
.inventory-table .inv-locs-wrap { display: flex; flex-wrap: wrap; gap: 5px; max-width: 240px; }
.inventory-table .inv-locs-wrap .pill {
  display: inline-block; white-space: normal; overflow-wrap: anywhere; word-break: break-word;
  max-width: 100%; line-height: 1.3; min-height: 0;
}
/* Acciones: se ajusta a su contenido, botones compactos apilados y alineados a la derecha,
   con aire hasta el borde de la tabla. */
.inventory-table .inv-col-actions { width: 1%; white-space: nowrap; padding-right: 20px; text-align: right; }
.inventory-table .inv-col-actions .row-actions { display: inline-flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 118px; }
.inventory-table .inv-col-actions .row-actions .btn { white-space: nowrap; justify-content: center; }
@media (max-width: 720px) {
  .inventory-table .inv-col-material, .inventory-table .inv-col-locs { max-width: 180px; }
}

/* ── tramo 32-modales-unificados (líneas 20412-20780 del antiguo styles.css): Unificación de modales (r151), borde del modal oscuro y carcasa de tablas anchas ── */
/* ============================================================
   UNIFICACIÓN DE MODALES (r151, pedido por Rubén): TODOS los
   modales del sistema idénticos al de PARTES (wo-modal):
   overlay oscuro con blur, tarjeta calc(1vw * 92)/max 1360px/max calc(1vh * 92),
   radio 22, tema oscuro glass (tokens sobreescritos), botón ✕
   cuadrado con hover rojo, y SIEMPRE centrados en la página.
   Este bloque va al FINAL del fichero a propósito: gana la
   cascada sobre las definiciones dispersas de cada modal.
   ============================================================ */

/* ---- 1) Overlays: mismo fondo, mismo blur, CENTRADOS ---- */
.workorder-detail-overlay,
.modal-overlay,
.po-overlay,
.app-sheet-overlay,
.app-modal-overlay,
.customer-editor-overlay{
  position: fixed; inset: 0; z-index: 1300;
  display: flex; align-items: center; justify-content: center;
  align-content: center; justify-items: center; /* neutraliza los overlays que eran grid */
  padding: 22px; overflow-y: auto;
  background: radial-gradient(120% 120% at 50% 0%, rgba(24,14,4,.5), rgba(5,7,12,.74));
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
}

/* ---- 2) Tarjetas de CONTENIDO: clon del wo-modal ---- */
.modal-card,
.po-modal,
.app-sheet,
.bq-modal,
.app-modal-card {
  /* Tokens oscuros (idénticos al wo-modal): todo el contenido hereda el look */
  --ink: #eef1f8; --text-primary: #eef1f8;
  --muted: #9aa3bd; --text-secondary: #9aa3bd; --text-muted: #8f95a3; /* #6f7892 daba 3,74:1 sobre este fondo oscuro; #8f95a3 da 5,48 */
  --line: rgba(255,255,255,.08);
  --border-soft: rgba(255,255,255,.10); --border-medium: rgba(255,255,255,.16);
  --panel: rgba(255,255,255,.045); --panel-solid: #161b2b; --panel-soft: rgba(255,255,255,.04);
  --surface: transparent; --surface-muted: rgba(255,255,255,.03); --surface-warm: rgba(255,255,255,.04);
  --page-background: transparent; --bg-surface: rgba(255,255,255,.04); --bg-surface-muted: rgba(255,255,255,.03);
  --brand-soft: rgba(255,122,26,.16);
  --success-soft: rgba(34,197,94,.16); --warning-soft: rgba(245,158,11,.16);
  --danger-soft: rgba(239,68,68,.16); --info-soft: rgba(59,130,246,.16); --teal-soft: rgba(20,184,166,.16);
  --shadow: 0 24px 70px rgba(0,0,0,.5); --soft-shadow: 0 14px 36px rgba(0,0,0,.4);
  --typy-text: #f3f5fb; --typy-text-muted: #9aa3bd; --typy-text-soft: #8f95a3; /* #6f7892 daba 3,74:1 sobre el fondo oscuro */
  --typy-surface: rgba(255,255,255,.04); --typy-surface-soft: rgba(255,255,255,.035);
  --typy-surface-muted: rgba(255,255,255,.03); --typy-surface-raised: rgba(255,255,255,.05);
  --typy-border: rgba(255,255,255,.1); --typy-border-strong: rgba(255,255,255,.16);
  --typy-copper-dark: #ff944f;

  position: relative;
  width: calc(1vw * 92); max-width: 1360px; min-width: 0; margin: 0;
  height: auto; max-height: calc(1vh * 92); overflow-y: auto;
  background:
    radial-gradient(140% 90% at 100% 0%, rgba(228,103,1,.18), transparent 55%),
    linear-gradient(160deg, #11151f 0%, #0c0f18 60%, #0a0c14 100%);
  border-radius: 22px; color: var(--ink);
  box-shadow: 0 40px 120px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.05),
              inset 0 1px 0 rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.07);
}

/* Confirmaciones/pickers (appConfirm/appPick/appForm): MISMO diseño exacto, pero a su
   contenido — un sí/no estirado a 1360px parecería un error, no un modal. */

/* Modal ancho (p.ej. Editar factura): más aire y formulario a 2 columnas en pantallas grandes. */




/* Inputs del formulario del modal: SIEMPRE legibles (texto claro sobre el fondo oscuro del
   modal), incluso al enfocar o con autofill de Safari. Refuerza el fix general por si el
   contenido del modal no heredó los tokens oscuros. */

/* ---- 3) Botones de cerrar: todos como el del parte ---- */
.wo-modal-close, .po-modal-close, .app-sheet-close, .app-modal-close, .bq-modal-close {
  position: absolute; top: 16px; right: 18px; z-index: 5;
  width: 36px; height: 36px; border-radius: 12px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08);
  color: #fff; font-size: 16px; line-height: 1; transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .16s ease, opacity .16s ease;
  display: flex; align-items: center; justify-content: center; transform: none;
}
.wo-modal-close:hover, .po-modal-close:hover, .app-sheet-close:hover, .app-modal-close:hover, .bq-modal-close:hover {
  background: rgba(239,68,68,.85); border-color: transparent; color: #fff; transform: rotate(90deg);
}

/* ---- 4) Interiores con claros hardcodeados → paleta oscura ---- */
/* app-sheet (fiscal IA / visita agenda) */
.app-sheet { display: flex; flex-direction: column; }
.app-sheet-head { border-bottom: 1px solid var(--line); }
.app-sheet-head p { color: var(--muted); }
.app-sheet-actions { border-top: 1px solid var(--line); background: rgba(255,255,255,.03); }
/* .btn "neutros" (sin .ghost ni .primary) dentro del app-sheet oscuro salían con fondo BLANCO
   por defecto → texto blanco encima ilegible (Rubén 26-jul: "Aplicar solo vacíos" en fiscal IA).
   Se les da el mismo tratamiento oscuro que a los del modal del parte. */
:where(.app-sheet) .btn:where(:not(.primary):not(.ghost):not(.danger):not(.compact)) {
  background: rgba(255, 255, 255, 0.08);
  color: #eef1f8;
  border: 1px solid rgba(255, 255, 255, 0.18);
}
:where(.app-sheet) .btn:where(:not(.primary):not(.ghost):not(.danger):not(.compact)):hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}
:where(.app-sheet) .btn:where(:not(.primary):not(.ghost):not(.danger):not(.compact)):disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Fila de conflicto de sync mejorada (Rubén 26-jul: "no aporta ni aclara de quién es, cuál es
   el conflicto"). Antes ponía "customers · UUID gigante" con un mensaje genérico. Ahora muestra
   NOMBRE humano + una lista de campos que difieren con el valor de cada lado. */
.sync-conflict-row .sync-conflict-body {
  flex: 1 1 320px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sync-conflict-diffs {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(255, 137, 40, 0.06);
  border: 1px solid rgba(255, 137, 40, 0.22);
  border-radius: 8px;
}
.sync-conflict-diff-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 1fr 1fr;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.4;
}
.sync-conflict-diff-row strong { font-weight: 700; }
.sync-conflict-diff-row span { color: var(--text-secondary); }
.sync-conflict-diff-row em { color: var(--text-muted); font-style: normal; margin-right: 3px; }
@media (max-width: 700px) {
  .sync-conflict-diff-row { grid-template-columns: 1fr; gap: 2px; }
}
.fiscal-review-row { background: var(--panel); border-color: var(--line); }
.fiscal-review-row.has-value { background: rgba(255,137,40,.12); border-color: rgba(255,137,40,.35); }
.fiscal-review-suggested { color: var(--ink); }
.fiscal-review-current { color: var(--muted); }
.fiscal-review-meta span { background: rgba(255,255,255,.08); color: var(--muted); }
/* app-modal (confirm/picker/form) */



/* bq-modal (detalle cola de facturación) */
.bq-modal-head.bq-tone-ready { background: rgba(34,197,94,.10); }
.bq-modal-head.bq-tone-issues { background: rgba(245,158,11,.10); }
.bq-modal-head.bq-tone-linked { background: rgba(59,130,246,.10); }
.bq-modal-head.bq-tone-neutral, .bq-modal-head.bq-tone-other { background: rgba(255,255,255,.05); }
.bq-modal-num { color: var(--ink); }
.bq-modal-eyebrow { color: var(--muted); }
/* Inputs/controles dentro de cualquier modal unificado: legibles sobre oscuro
   (mismo tratamiento que el formulario de edición del parte). */
.modal-card input, .modal-card select, .modal-card textarea,
.po-modal input, .po-modal select, .po-modal textarea,
.app-sheet input, .app-sheet select, .app-sheet textarea,
.bq-modal input, .bq-modal select, .bq-modal textarea,
.app-modal-card input, .app-modal-card select, .app-modal-card textarea {
  background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.16); color: var(--ink);
  -webkit-appearance: none; appearance: none; caret-color: var(--ink);
}
.modal-card input::placeholder, .po-modal input::placeholder, .app-sheet input::placeholder,
.bq-modal input::placeholder, .app-modal-card input::placeholder { color: var(--text-muted); }
/* Un campo vacío al enfocarlo se veía "en blanco" (Rubén, 15-jul, "Kilómetros TYPY" en
   Editar día): Safari/WebKit fuerza fondo blanco de autofill en :focus que NINGÚN
   `background` normal anula — hace falta el truco del box-shadow inset + text-fill-color. */
.modal-card input:focus, .modal-card select:focus, .modal-card textarea:focus,
.po-modal input:focus, .po-modal select:focus, .po-modal textarea:focus,
.app-sheet input:focus, .app-sheet select:focus, .app-sheet textarea:focus,
.bq-modal input:focus, .bq-modal select:focus, .bq-modal textarea:focus,
.app-modal-card input:focus, .app-modal-card select:focus, .app-modal-card textarea:focus {
  background: rgba(255,255,255,.09); color: var(--ink); -webkit-text-fill-color: var(--ink);
}
:where(.modal-card) input:-webkit-autofill, :where(.po-modal) input:-webkit-autofill,
:where(.app-sheet) input:-webkit-autofill, :where(.bq-modal) input:-webkit-autofill,
:where(.app-modal-card) input:-webkit-autofill,
:where(.modal-card) input:-webkit-autofill:focus, :where(.po-modal) input:-webkit-autofill:focus,
:where(.app-sheet) input:-webkit-autofill:focus, :where(.bq-modal) input:-webkit-autofill:focus,
:where(.app-modal-card) input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px rgba(255,255,255,.06) inset;
  box-shadow: 0 0 0 1000px rgba(255,255,255,.06) inset;
  caret-color: var(--ink);
  transition: background-color 999999s ease-in-out 0s;
}
/* Checkboxes y radios dentro de CUALQUIER modal: las reglas de inputs de arriba les metían
   appearance:none + fondo + border-radius (pensadas para campos de texto), lo que BORRA el
   tick nativo -> se veían como casillas muertas que "no dejaban seleccionar nada" aunque el
   valor sí cambiaba (Rubén 21-jul: dietas de "Editar día" y ticks de búsqueda de datos
   fiscales). Se restaura el control nativo con acento naranja de marca. Mayor especificidad
   ([type=...]) que las reglas de arriba, así que gana sin tocarlas. */
.modal-card input[type="checkbox"], .modal-card input[type="radio"],
.po-modal input[type="checkbox"], .po-modal input[type="radio"],
.app-sheet input[type="checkbox"], .app-sheet input[type="radio"],
.bq-modal input[type="checkbox"], .bq-modal input[type="radio"],
.app-modal-card input[type="checkbox"], .app-modal-card input[type="radio"],
.app-modal-card input[type="checkbox"]:focus, .app-modal-card input[type="radio"]:focus,
.app-sheet input[type="checkbox"]:focus, .app-sheet input[type="radio"]:focus {
  -webkit-appearance: auto; appearance: auto;
  accent-color: #f97316;
  width: 18px; height: 18px; min-width: 18px; min-height: 18px;
  flex: 0 0 auto; margin: 0; padding: 0;
  border-radius: 4px; border: 0; background: none;
  box-shadow: none; -webkit-box-shadow: none;
  cursor: pointer;
}

/* El formulario de Planificación de visita (agenda: crear/editar/importar) es una tarjeta
   CLARA (.command-create-card, fondo blanco explícito) que vive dentro del modal OSCURO
   (.app-sheet). Sin este reset heredaba las variables de tema oscuro (--ink/--text-primary
   claros) sobre su propio fondo blanco -> etiquetas y valores salían gris clarito, casi
   invisibles ("no se ve nada al importar/editar una visita", Rubén 16-jul). Se resetean las
   variables al valor CLARO dentro de esta tarjeta y se fuerza el estilo normal de los inputs,
   con más especificidad que el reset oscuro del .app-sheet contenedor.
   Mayor especificidad (.app-sheet .command-create-card) ganaba sobre .app-sheet sola.
   21-sep-2026: coherencia.css ya aporta la paleta completa de cada superficie. Este antiguo
   recurso claro queda en :where() para no imponerse sobre ella. Sus reglas de texto excluyen
   casillas y radios: appearance:none borraba su estado marcado y no marcado. */
:where(.modal-card .command-create-card), :where(.po-modal .command-create-card),
:where(.app-sheet .command-create-card), :where(.bq-modal .command-create-card),
:where(.app-modal-card .command-create-card) {
  --ink: #1f2430; --text-primary: #1f2430;
  --muted: #6b7280; --text-secondary: #6b7280; --text-muted: #6b7280; /* era #94a0b8: 2,63:1 sobre esta tarjeta blanca */
  --line: rgb(226 216 204 / 80%); --border-soft: rgb(226 216 204 / 80%); --border-medium: rgb(226 216 204 / 88%);
  color: #1f2430;
}
:where(.modal-card .command-create-card) input:where(:not([type="checkbox"]):not([type="radio"])), :where(.modal-card .command-create-card) select, :where(.modal-card .command-create-card) textarea,
:where(.po-modal .command-create-card) input:where(:not([type="checkbox"]):not([type="radio"])), :where(.po-modal .command-create-card) select, :where(.po-modal .command-create-card) textarea,
:where(.app-sheet .command-create-card) input:where(:not([type="checkbox"]):not([type="radio"])), :where(.app-sheet .command-create-card) select, :where(.app-sheet .command-create-card) textarea,
:where(.bq-modal .command-create-card) input:where(:not([type="checkbox"]):not([type="radio"])), :where(.bq-modal .command-create-card) select, :where(.bq-modal .command-create-card) textarea,
:where(.app-modal-card .command-create-card) input:where(:not([type="checkbox"]):not([type="radio"])), :where(.app-modal-card .command-create-card) select, :where(.app-modal-card .command-create-card) textarea {
  background: #fff; border-color: var(--hairline-strong, #d6d9df); color: #1f2430;
  -webkit-text-fill-color: #1f2430; -webkit-appearance: none; appearance: none;
}
:where(.modal-card .command-create-card) input:where(:not([type="checkbox"]):not([type="radio"]))::placeholder, :where(.po-modal .command-create-card) input:where(:not([type="checkbox"]):not([type="radio"]))::placeholder,
:where(.app-sheet .command-create-card) input:where(:not([type="checkbox"]):not([type="radio"]))::placeholder, :where(.bq-modal .command-create-card) input:where(:not([type="checkbox"]):not([type="radio"]))::placeholder,
:where(.app-modal-card .command-create-card) input:where(:not([type="checkbox"]):not([type="radio"]))::placeholder {
  color: #9aa3bd;
}

/* Editor de FICHA DE CLIENTE / EQUIPO: es un .panel de fondo BLANCO dentro del .modal-card
   (tokens de tema oscuro → texto claro). Resultado: panel blanco + texto gris muy claro =
   ilegible (Rubén 20-jul "la letra debe ser negra"). No son quotes (esos van aparte). Se
   resetea el panel a tarjeta CLARA con texto oscuro y sus campos a fondo blanco/texto negro. */





/* …pero la regla de arriba (pensada para campos de TEXTO) también alcanzaba a las casillas y
   radios de la ficha, y con appearance:none + fondo blanco quedaban INVISIBLES sobre la tarjeta
   blanca: una casilla marcada no se distinguía de una sin marcar. Se les devuelve el control
   nativo con el naranja de marca, con más especificidad que ese bloque. */


/* Móvil: a pantalla completa, igual que el parte */
@media (max-width: 720px) {
  .modal-card, .po-modal, .app-sheet, .bq-modal {
    width: calc(1vw * 100); max-width: calc(1vw * 100); max-height: calc(1vh * 100); height: calc(1vh * 100); border-radius: 0;
  }
  .workorder-detail-overlay, .modal-overlay, .po-overlay, .app-sheet-overlay,
  .customer-editor-overlay{ padding: 0; }
}

/* Borde de tablas y tarjetas en el modal oscuro del parte (21-jul); lo que no cede está en utilidades. */
.workorder-detail-overlay .table-wrap {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  overflow: hidden;
}
.workorder-detail-overlay .wo-equipment-work-card {
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.workorder-detail-overlay .wo-equipment-work-card > .table-wrap {
  border: 0;
  border-radius: 0;
}
.workorder-detail-overlay .wo-equipment-work-card .wo-equipment-work-title {
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
}

/* ═══════════════════════════════════════════════════════════════════════════
   CARCASA DE TABLAS ANCHAS (.table-scroll-shell) — Rubén 26-jul: "en un lado
   la tabla está cerrada y en el otro no, en la mayoría de tablas del PWA".
   app.js envuelve cada .table-wrap en esta carcasa tras cada render:
   - El BORDE y el radio viven en la carcasa (no scrollean con el contenido)
     → la tabla queda SIEMPRE cerrada por los 4 lados.
   - Cuando hay contenido oculto a un lado, un degradado lo indica; desaparece
     al llegar al final (clases is-scroll-x / at-start / at-end desde JS).
   ═══════════════════════════════════════════════════════════════════════════ */
.table-scroll-shell {
  position: relative;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--hairline, #e6e8ea);
  border-radius: 12px;
  overflow: hidden;
}
.table-scroll-shell > .table-wrap {
  border: 0;
  border-radius: 0;
  margin: 0;
  max-width: 100%;
  overflow-x: auto;
}
/* Heredar los márgenes que antes llevaba .panel > .table-wrap */
.panel > .table-scroll-shell {
  margin-left: 18px;
  margin-right: 18px;
  margin-bottom: 18px;
}
/* Degradados indicadores de scroll: derecha (más contenido →) e izquierda (← más contenido) */
.table-scroll-shell::before,
.table-scroll-shell::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 34px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 2;
}
.table-scroll-shell::before {
  left: 0;
  background: linear-gradient(to right, rgba(15, 23, 42, 0.12), transparent);
}
.table-scroll-shell::after {
  right: 0;
  background: linear-gradient(to left, rgba(15, 23, 42, 0.12), transparent);
}
.table-scroll-shell.is-scroll-x:not(.at-end)::after { opacity: 1; }
.table-scroll-shell.is-scroll-x:not(.at-start)::before { opacity: 1; }
/* Dentro de tarjetas que YA tienen borde propio (trabajo por equipo), sin doble marco */
.wo-equipment-work-card .table-scroll-shell {
  border: 0;
  border-radius: 0;
}
/* Modal oscuro del parte: borde visible sobre negro + degradados oscuros */
.workorder-detail-overlay .table-scroll-shell {
  border-color: rgba(255, 255, 255, 0.18);
}
.workorder-detail-overlay .table-scroll-shell::before {
  background: linear-gradient(to right, rgba(0, 0, 0, 0.55), transparent);
}
.workorder-detail-overlay .table-scroll-shell::after {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.55), transparent);
}
}

@layer utilidades {
  .workorder-detail-overlay .table-wrap { border-radius: 12px; overflow: hidden; }
  .workorder-detail-overlay .wo-equipment-work-card > .table-wrap { border-radius: 0; }
  .table-scroll-shell > .table-wrap { border: 0; border-radius: 0; margin: 0; }
}
