/* Operaciones Elemental — sistema de diseño.
   Negro y blanco hacen todo el trabajo; los colores solo marcan estado.
   Referencia visual de cada pieza: /ops/sistema.html */
/* Outfit variable (400–700, subset latin), auto-alojada. Licencia: fonts/OFL.txt */
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/outfit-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  /* Color */
  --black: #000000;
  --white: #ffffff;
  --g-50: #f5f5f5;
  --g-100: #ececec;
  --g-200: #e3e3e3;
  --g-300: #c8c8c8;
  --g-400: #949494;
  --g-600: #5c5c5c;
  --g-800: #333333;
  --on-black-muted: #a3a3a3;
  --ok: #006400;
  --ok-soft: #e8f2e8;
  --danger: #8b0000;
  --danger-hover: #6b0000;
  --danger-soft: #f7e9e9;
  --alert: #ffde6a;
  --alert-soft: #fff6d1;
  /* Alias usados en todo el archivo */
  --mist: var(--g-50);
  --line: var(--g-200);
  --line-strong: var(--g-300);
  --muted: var(--g-600);
  --graphite: var(--g-800);

  /* Tipografía: 12 · 13 · 15 · 17 · 20 · 28 · 40 */
  --font: "Outfit", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --t-xs: 12px;
  --t-sm: 13px;
  --t-base: 15px;
  --t-md: 17px;
  --t-lg: 20px;
  --t-xl: 28px;
  --t-2xl: 40px;

  /* Espacio: múltiplos de 4 */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;

  /* Forma */
  --r-control: 4px;
  --r-panel: 8px;
  --r-pill: 999px;
  --h-sm: 32px;
  --h-md: 40px;
  --h-lg: 48px;
  --side: 248px;

  /* Foco: anillo doble, se ve sobre blanco y sobre negro */
  --ring: 0 0 0 2px var(--white), 0 0 0 4px var(--black);
  --ring-inverse: 0 0 0 2px var(--black), 0 0 0 4px var(--white);

  /* Movimiento */
  --fast: 120ms;
  --ease: cubic-bezier(.2, .7, .3, 1);

  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 var(--t-base)/1.5 var(--font); background: var(--white); color: var(--black); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; height: auto; }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: var(--t-xl); letter-spacing: -.02em; margin: 0; }
h2 { font-size: var(--t-lg); margin: var(--s-6) 0 var(--s-3); }
h3 { font-size: var(--t-md); margin: var(--s-5) 0 var(--s-2); }
h4 { font-size: var(--t-sm); font-weight: 500; margin: var(--s-4) 0 2px; color: var(--muted); letter-spacing: 0; }
a { color: var(--black); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
code { font-size: 12.5px; background: var(--g-50); padding: 1px 5px; border-radius: 3px; }
.muted { color: var(--muted); }
.small { font-size: var(--t-sm); }
.error { color: var(--danger); min-height: 1.2em; margin: 0; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--black); background: var(--alert); padding: 0 4px; border-radius: 3px; }
.danger-text { color: var(--danger); font-weight: 600; }
.pre { white-space: pre-wrap; margin: 0; }

:focus-visible { outline: 2px solid var(--black); outline-offset: 2px; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 30; background: var(--black); color: var(--white); padding: 8px 12px; border-radius: var(--r-control); }
.skip:focus { top: 12px; }

/* Íconos del sprite icons.svg: trazo, heredan el color del texto */
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }

/* ---------- Botones ----------
   Jerarquía: primario (negro) > secundario (borde) > fantasma (sin borde) > enlace.
   Destructivo: .danger (lleno) o .secondary.danger / .ghost.danger (contorno).
   Tamaños: .sm 32 px · base 40 px · .lg 48 px. Solo ícono: .icon-only + aria-label. */
button, .button {
  --bg: var(--black); --fg: var(--white); --bd: var(--black);
  --bg-hover: var(--g-800); --fg-hover: var(--white); --bd-hover: var(--g-800);
  appearance: none; font: inherit; font-size: 14px; font-weight: 500; letter-spacing: .005em; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--h-md); padding: 0 var(--s-4); border: 1px solid var(--bd); border-radius: var(--r-control);
  background: var(--bg); color: var(--fg); cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
button:hover, .button:hover { background: var(--bg-hover); border-color: var(--bd-hover); color: var(--fg-hover); }
button:active:not(:disabled), .button:active { transform: translateY(1px); }
button:focus-visible, .button:focus-visible { outline: none; box-shadow: var(--ring); }
button.secondary, .button.secondary {
  --bg: var(--white); --fg: var(--black); --bd: var(--g-400);
  --bg-hover: var(--g-50); --fg-hover: var(--black); --bd-hover: var(--black);
}
button.ghost, .button.ghost {
  --bg: transparent; --fg: var(--black); --bd: transparent;
  --bg-hover: var(--g-100); --fg-hover: var(--black); --bd-hover: transparent;
}
button.danger, .button.danger {
  --bg: var(--danger); --fg: var(--white); --bd: var(--danger);
  --bg-hover: var(--danger-hover); --fg-hover: var(--white); --bd-hover: var(--danger-hover);
}
button.secondary.danger, button.ghost.danger { --bg: var(--white); --fg: var(--danger); --bg-hover: var(--danger-soft); --fg-hover: var(--danger); --bd-hover: var(--danger); }
button.secondary.danger { --bd: var(--g-400); }
button.ghost.danger { --bg: transparent; --bd: transparent; --bd-hover: transparent; }
button.link, .button.link {
  --bg: transparent; --fg: var(--black); --bd: transparent; --bg-hover: transparent; --fg-hover: var(--black); --bd-hover: transparent;
  height: auto; padding: 0; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
button.link:hover { text-decoration-thickness: 2px; }
button.link.danger { --fg: var(--danger); --fg-hover: var(--danger); }
button.sm, .button.sm { height: var(--h-sm); padding: 0 var(--s-3); font-size: var(--t-sm); gap: 6px; }
button.sm .i, .button.sm .i { width: 16px; height: 16px; }
button.lg, .button.lg { height: var(--h-lg); padding: 0 22px; font-size: var(--t-base); }
button.icon-only, .button.icon-only { width: var(--h-md); padding: 0; }
button.icon-only.sm { width: var(--h-sm); }
button:disabled, button:disabled:hover {
  background: var(--g-100); border-color: var(--g-100); color: var(--g-400); cursor: not-allowed; transform: none;
}
button.ghost:disabled, button.link:disabled { background: transparent; border-color: transparent; }
/* Mientras envía: mantiene su color, cambia el ícono por un indicador */
button[aria-busy="true"]:disabled { background: var(--bg); border-color: var(--bd); color: var(--fg); cursor: progress; }
button[aria-busy="true"] .i { display: none; }
button[aria-busy="true"]::before { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.buttons, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.actions { margin-top: var(--s-4); }

/* ---------- Campos ---------- */
label { display: grid; gap: 6px; font-size: var(--t-sm); font-weight: 500; color: var(--g-800); }
label.inline { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--t-base); font-weight: 400; color: var(--black); margin-right: var(--s-4); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  font: inherit; font-size: var(--t-base); font-weight: 400; color: var(--black);
  height: var(--h-md); padding: 0 var(--s-3); max-width: 100%;
  border: 1px solid var(--g-400); border-radius: var(--r-control); background: var(--white);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
textarea { height: auto; padding: 10px var(--s-3); resize: vertical; line-height: 1.5; }
select {
  appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
select[multiple] { height: auto; padding: 6px; background-image: none; cursor: default; }
input::placeholder, textarea::placeholder { color: var(--g-400); }
input:hover, select:hover, textarea:hover { border-color: var(--black); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--black); box-shadow: 0 0 0 1px var(--black); }
[aria-invalid="true"] { border-color: var(--danger) !important; }
[aria-invalid="true"]:focus-visible { box-shadow: 0 0 0 1px var(--danger); }
input:disabled, select:disabled, textarea:disabled { background: var(--g-50); color: var(--g-600); border-color: var(--g-200); cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; margin: 0; accent-color: var(--black); cursor: pointer; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--s-3) var(--s-4); margin: 0; }
legend { font-size: var(--t-sm); font-weight: 500; padding: 0 4px; }
.field-error { color: var(--danger); font-size: var(--t-sm); font-weight: 500; margin: 0; }

/* ---------- Elegir tipo de solicitud (tarjetas) ----------
   Al elegir, quedan solo la tarjeta elegida y «Cambiar tipo». */
.type-picker { border: 0; padding: 0; display: grid; gap: var(--s-4); }
.type-picker legend { font-size: var(--t-sm); font-weight: 500; color: var(--g-800); padding: 0; margin-bottom: var(--s-2); }
.type-group { display: grid; gap: var(--s-2); }
.type-group-title { margin: 0; font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s-2); }
.type-card {
  position: relative; display: grid; gap: 4px; align-content: start; cursor: pointer;
  padding: var(--s-3); border: 1px solid var(--line-strong); border-radius: var(--r-panel); background: var(--white);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast) var(--ease);
}
.type-card input { position: absolute; opacity: 0; pointer-events: none; }
.type-card:hover { border-color: var(--black); }
.type-card:has(input:focus-visible) { box-shadow: 0 0 0 2px var(--black); }
.type-card:has(input:checked) { border-color: var(--black); box-shadow: 0 0 0 1px var(--black); background: var(--g-50); }
.type-card-title { font-size: var(--t-base); font-weight: 600; color: var(--black); }
.type-card-desc { font-size: var(--t-sm); font-weight: 400; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.type-picker.chosen .type-group:not(:has(input:checked)), .type-picker.chosen .type-card:not(:has(input:checked)) { display: none; }
.type-picker.chosen .type-group-title { display: none; }
.type-picker.chosen .type-grid { grid-template-columns: 1fr; }
.type-picker.chosen .type-card-desc { -webkit-line-clamp: unset; }
.type-picker #type-change { justify-self: start; }
.type-picker[aria-invalid="true"] .type-card { border-color: var(--danger); }

/* ---------- Conversaciones de Chatwoot de la solicitud ---------- */
.conversations { display: grid; gap: var(--s-2); }
.conversations > p { margin: 0; }
.conversation-list { display: grid; gap: var(--s-1); margin: 0; }
.conversation { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); padding: var(--s-2) 0; border-top: 1px solid var(--line); }
.conversation:first-child { border-top: 0; }
.conversation label.inline { align-items: flex-start; margin-right: 0; }
.conversation label.inline input { margin-top: 2px; }
.conversation .badge { margin-left: var(--s-1); vertical-align: middle; }
.conversation-meta { display: block; margin-top: 2px; }
.conversation a { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.conversation a .i { width: 14px; height: 14px; }
.conversation-add { display: flex; align-items: flex-end; gap: var(--s-2); flex-wrap: wrap; }
.conversation-add label { flex: 0 1 220px; }

/* ---------- Ingreso ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-brand { background: var(--black); color: var(--white); padding: var(--s-7); display: flex; flex-direction: column; justify-content: space-between; }
.login-brand img { width: 220px; }
.login-brand p { font-size: 34px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; max-width: 12ch; margin: 0; }
.login-form-wrap { display: grid; place-items: center; padding: var(--s-6) var(--s-4); }
.login-form { width: min(360px, 100%); display: grid; gap: var(--s-4); }
.login-form h1 { font-size: 26px; }
.login-form p { margin: 0; }
.login-form button[type="submit"] { width: 100%; height: var(--h-lg); font-size: var(--t-base); margin-top: var(--s-1); }

/* ---------- Estructura ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--black); color: var(--white); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-5) 20px 20px; }
.brand { display: block; border-radius: var(--r-control); }
.brand img { width: 150px; }
.side :focus-visible { outline: none; box-shadow: var(--ring-inverse); }
.side button {
  --bg: transparent; --fg: var(--white); --bd: var(--g-800);
  --bg-hover: var(--g-800); --fg-hover: var(--white); --bd-hover: var(--g-800);
}
.menu-toggle { display: none; }
.menu-panel { display: flex; flex-direction: column; flex: 1; }
.side nav { padding: 0 var(--s-3); }
.nav-group { margin: 0 0 20px; padding: 0; list-style: none; display: grid; gap: 2px; }
.nav-group-title { display: block; color: var(--on-black-muted); font-size: var(--t-xs); padding: 0 10px 6px; }
.side nav a {
  display: flex; align-items: center; gap: 10px; height: 38px;
  color: var(--white); text-decoration: none; padding: 0 10px; border-radius: var(--r-control); font-weight: 400;
  transition: background-color var(--fast) var(--ease);
}
.side nav a .i { color: var(--on-black-muted); }
.side nav a span:first-of-type { flex: 1; }
.side nav a:hover { background: var(--g-800); }
.side nav a:hover .i { color: var(--white); }
.side nav a[aria-current="page"] { background: var(--white); color: var(--black); font-weight: 500; }
.side nav a[aria-current="page"] .i { color: var(--black); }
.count { min-width: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--white); color: var(--black); font-size: var(--t-xs); font-weight: 600; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.side nav a[aria-current="page"] .count { background: var(--black); color: var(--white); }

/* El corte: lo único grande de la barra. Dice en una línea cuándo sale lo que se carga ahora. */
.corte-clock { margin: 0 var(--s-3) 22px; padding: var(--s-4) 14px; border: 1px solid var(--g-800); border-radius: var(--r-panel); }
.corte-clock strong { display: block; font-size: 24px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.corte-clock.later strong { color: var(--alert); }
.corte-clock span { display: block; margin-top: 6px; color: var(--on-black-muted); font-size: var(--t-sm); }
.side-foot { margin-top: auto; border-top: 1px solid var(--g-800); padding: 14px 20px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: var(--t-sm); }
.side-foot .who { color: var(--on-black-muted); line-height: 1.3; min-width: 0; }
.side-foot .who b { display: block; color: var(--white); font-weight: 500; overflow-wrap: anywhere; }
.side-foot button { flex: none; }
.side-foot { flex-wrap: wrap; }
.side-foot .view-as { flex: 1 0 100%; }
.side-foot .view-as label { color: var(--on-black-muted); font-weight: 500; }
.side-foot .view-as select { width: 100%; height: 36px; }
.side-foot .who .viewing { color: var(--alert); font-weight: 600; }

main { padding: 36px 40px 64px; max-width: 1240px; width: 100%; outline: none; }

/* ---------- Encabezado de página ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 14px; color: var(--muted); text-decoration: none; border-radius: var(--r-control); }
.back .i { width: 16px; height: 16px; transition: transform var(--fast) var(--ease); }
.back:hover { color: var(--black); }
.back:hover .i { transform: translateX(-2px); }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-3) 20px; padding-bottom: 18px; margin-bottom: var(--s-5); border-bottom: 1px solid var(--black); }
.page-head .sub { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.page-head .sub .badge { vertical-align: 1px; }

/* ---------- Barras de filtros y herramientas ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3); margin: 0 0 var(--s-3); padding: 14px; background: var(--g-50); border-radius: var(--r-panel); }
.filters > label:not(.inline) { flex: 1 1 170px; min-width: 0; }
.filters > label.narrow { flex: 0 1 160px; }
.filters > label select, .filters > label input { width: 100%; }
.filters > label.inline { flex: none; margin-right: 0; min-height: var(--h-md); white-space: nowrap; }
.filters > input[type="search"] { flex: 1 1 240px; }
.filter-actions { display: flex; align-items: center; gap: var(--s-2); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3); margin: 0 0 var(--s-3); }
.toolbar .export { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); font-size: var(--t-sm); color: var(--muted); }
.toolbar .export input { height: var(--h-sm); font-size: var(--t-sm); }
.row-form { display: flex; flex-wrap: wrap; align-items: end; gap: var(--s-2); margin: 10px 0; }

/* ---------- Bloques ---------- */
.stack { display: grid; gap: 14px; }
.cols { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 20px; margin-bottom: var(--s-4); }
.panel > h2:first-child, .panel > h3:first-child, .panel > h4:first-child { margin-top: 0; }
.panel.quiet { background: var(--g-50); border-color: var(--g-50); }
.notice { background: var(--alert-soft); border: 1px solid var(--alert); border-radius: var(--r-panel); padding: var(--s-3) 14px; }
.notice p:first-child { margin-top: 0; }
.announcement { border-left: 3px solid var(--black); }
.announcement h3 { font-size: var(--t-lg); margin-top: var(--s-3); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.timeline { margin: 0; padding: 0; list-style: none; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 var(--s-4) 20px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--white); border: 2px solid var(--black); }
.timeline li:first-child::before { background: var(--black); }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 4px; top: 20px; bottom: 2px; width: 1px; background: var(--g-300); }
.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { border: 1px solid var(--g-300); border-radius: var(--r-pill); padding: 2px 4px 2px 10px; font-size: var(--t-sm); display: inline-flex; gap: 4px; align-items: center; }
.sources { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0 0 14px; font-size: var(--t-sm); }
.source { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--g-300); border-radius: var(--r-pill); padding: 2px 10px; }
.source::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.source.down { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.source.down::before { background: var(--danger); }
.sku-lines .line { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-bottom: var(--s-2); }
.sku-lines [data-sku] { flex: 1 1 220px; }
.sku-lines [data-qty] { width: 76px; }
.teams { min-width: 220px; }
.embed { width: 100%; height: calc(100vh - 220px); min-height: 480px; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--white); }

/* ---------- Inicio ---------- */
.today { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border: 1px solid var(--black); border-radius: var(--r-panel); margin-bottom: 28px; }
.today > * { padding: 18px 20px; border-right: 1px solid var(--line); }
.today > *:last-child { border-right: 0; }
.today h2 { margin: 0; font-size: var(--t-sm); font-weight: 500; color: var(--g-800); }
.today .figure { font-size: var(--t-2xl); font-weight: 600; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 6px 0 10px; }
.today .figure.attention { text-decoration: underline; text-decoration-color: var(--alert); text-decoration-thickness: 6px; text-underline-offset: 2px; }
.today p { margin: 0; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--white); }
.table-wrap.tall { max-height: 70vh; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-weight: 500; font-size: var(--t-xs); color: var(--muted); background: var(--g-50); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
td { font-size: 14px; }
tbody tr { transition: background-color var(--fast) var(--ease); }
tbody tr:hover td { background: #fafafa; }
td a[href^="#"] { font-weight: 500; }
table.dense th, table.dense td { padding: 6px 10px; font-size: var(--t-sm); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.summary { max-width: 360px; font-size: var(--t-sm); }
td.empty-row { text-align: center; color: var(--muted); padding: 28px 12px; }
tr.urgent td:first-child { box-shadow: inset 3px 0 var(--danger); }
tr.faded td { color: var(--muted); }
tr.group td { background: var(--white); font-weight: 600; padding-top: 18px; border-bottom-color: var(--black); }
tr.row-link { cursor: pointer; }

/* ---------- Badges de estado: punto + texto, el color nunca va solo ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: var(--r-pill); font-size: var(--t-xs); font-weight: 500; line-height: 1; white-space: nowrap;
  border: 1px solid var(--g-300); background: var(--white); color: var(--black);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok, .badge.state-aplicada { background: var(--ok-soft); border-color: var(--ok-soft); color: var(--ok); }
.badge.pendiente, .badge.prio-alta { background: var(--alert-soft); border-color: var(--alert); }
.badge.state-tomada { border-color: var(--black); }
.badge.error, .badge.state-error_shopify, .badge.state-rechazada, .badge.prio-urgente { background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger); }
.badge.state-nueva { background: var(--black); border-color: var(--black); color: var(--white); }
.badge.state-cancelada { color: var(--muted); }
.badge.state-cancelada::before { background: var(--g-300); }

/* ---------- Pasos del alta ---------- */
.steps { list-style: none; margin: 0 0 var(--s-5); padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; counter-reset: step; }
.steps li { counter-increment: step; padding-top: 10px; border-top: 3px solid var(--line); color: var(--muted); font-size: 14px; }
.steps li::before { content: counter(step) ". "; font-variant-numeric: tabular-nums; }
.steps li.done { border-top-color: var(--black); color: var(--black); }
.steps li.current { border-top-color: var(--black); color: var(--black); font-weight: 600; }
.order-found { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px var(--s-3); }
.order-found h2 { margin: 0; font-size: 22px; }
.review dl { margin-bottom: var(--s-1); }
.review .corte-line { font-weight: 600; }

/* ---------- Estados ---------- */
.skeleton { display: grid; gap: 14px; }
.skeleton span { display: block; height: 14px; border-radius: var(--r-control); background: var(--g-50); animation: pulse 1.2s ease-in-out infinite; }
.skeleton span:first-child { height: 30px; width: 40%; }
.skeleton span:nth-child(3) { width: 80%; }
.skeleton span:nth-child(4) { height: 160px; }
.state { padding: var(--s-7) var(--s-5); border: 1px dashed var(--g-300); border-radius: var(--r-panel); text-align: center; }
.state h2 { margin: 0 0 6px; }
.state p { margin: 0 auto var(--s-4); color: var(--muted); max-width: 52ch; }
.state .buttons { justify-content: center; }
.state.failed { border-style: solid; border-color: var(--danger); }
.state.failed h2 { color: var(--danger); }

/* ---------- Avisos ---------- */
.toast {
  position: fixed; left: 50%; bottom: var(--s-5); transform: translateX(-50%); max-width: min(560px, calc(100% - 32px));
  display: flex; align-items: flex-start; gap: 10px;
  padding: var(--s-3) 18px var(--s-3) 14px; border-radius: var(--r-panel); background: var(--black); color: var(--white); z-index: 40;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .28); animation: rise .18s var(--ease);
}
.toast::before {
  content: ""; flex: none; width: 18px; height: 18px; margin-top: 2px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.toast.error { background: var(--danger); }
.toast.error::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 2.5 20h19z'/%3E%3Cpath d='M12 10v4.5M12 17.2h.01'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 2.5 20h19z'/%3E%3Cpath d='M12 10v4.5M12 17.2h.01'/%3E%3C/svg%3E");
}
dialog { border: 0; border-radius: 10px; padding: var(--s-5); width: min(440px, calc(100% - 32px)); box-shadow: 0 24px 64px rgba(0, 0, 0, .35); }
dialog[open] { animation: pop .16s var(--ease); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog p { margin: 0 0 6px; font-size: var(--t-md); font-weight: 600; }
dialog p.muted { font-size: 14px; font-weight: 400; }
dialog .actions { justify-content: flex-end; margin-top: var(--s-5); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Celular y tablet ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .side { position: sticky; top: 0; height: auto; z-index: 20; overflow: visible; }
  .side-top { padding: 10px var(--s-4); }
  .brand img { width: 118px; }
  .menu-toggle { display: inline-flex; height: 36px; padding: 0 var(--s-3); }
  .menu-toggle .count { margin-left: 2px; }
  .menu-panel { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--black); max-height: calc(100vh - 100px); overflow-y: auto; border-top: 1px solid var(--g-800); padding-top: 14px; }
  .side.open .menu-panel { display: flex; }
  .corte-clock { margin: 0; padding: var(--s-2) var(--s-4); border: 0; border-top: 1px solid var(--g-800); border-radius: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
  .corte-clock strong { font-size: var(--t-base); }
  .corte-clock span { margin: 0; }
  main { padding: var(--s-5) var(--s-4) 56px; }
  h1 { font-size: 24px; }
  .cols { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
  .login-brand { padding: 28px var(--s-4); gap: 28px; }
  .login-brand img { width: 160px; }
  .login-brand p { font-size: 24px; max-width: 16ch; }
  .login-form-wrap { place-items: start center; padding-top: 36px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dt { margin-top: 10px; }
  .steps li { font-size: 12.5px; }
  .today > * { border-right: 0; border-bottom: 1px solid var(--line); }
  .today > *:last-child { border-bottom: 0; }
  .page-head { align-items: flex-start; }
  .filters > label:not(.inline), .filters > input[type="search"], .filters > select { flex: 1 1 100%; }
  .filter-actions { flex: 1 1 100%; }
  .filter-actions button { flex: 1; }
}

/* ---------- Página de referencia (sistema.html) ---------- */
.ds-head { background: var(--black); color: var(--white); padding: var(--s-6) max(var(--s-7), calc((100% - 1080px) / 2 + var(--s-7))); display: grid; gap: var(--s-5); }
.ds-main .sources { margin-top: var(--s-4); }
.ds-head img { width: 180px; }
.ds-head h1 { font-size: var(--t-2xl); }
.ds-head p { margin: var(--s-2) 0 0; color: var(--on-black-muted); max-width: 60ch; }
.ds-main { max-width: 1080px; margin: 0 auto; padding: var(--s-6) var(--s-7) 96px; }
.ds-main > section { padding: var(--s-5) 0 var(--s-6); border-top: 1px solid var(--black); }
.ds-main > section > h2:first-child { margin-top: 0; }
.ds-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-4); }
.ds-swatches figure { margin: 0; font-size: var(--t-sm); color: var(--muted); }
.ds-swatches b { display: block; color: var(--black); font-weight: 500; }
.ds-sw { display: block; height: 64px; border-radius: var(--r-panel); border: 1px solid var(--line); margin-bottom: var(--s-2); }
.sw-black { background: var(--black); } .sw-white { background: var(--white); } .sw-g800 { background: var(--g-800); }
.sw-g600 { background: var(--g-600); } .sw-g400 { background: var(--g-400); } .sw-g200 { background: var(--g-200); }
.sw-g50 { background: var(--g-50); } .sw-ok { background: var(--ok); } .sw-danger { background: var(--danger); } .sw-alert { background: var(--alert); }
.ds-type p { margin: 0 0 var(--s-2); line-height: 1.2; }
.t-2xl { font-size: var(--t-2xl); font-weight: 600; letter-spacing: -.02em; }
.t-xl { font-size: var(--t-xl); font-weight: 600; letter-spacing: -.02em; }
.t-lg { font-size: var(--t-lg); font-weight: 600; }
.t-md { font-size: var(--t-md); font-weight: 600; }
.t-xs { font-size: var(--t-xs); color: var(--muted); }
.ds-grid { display: grid; grid-template-columns: 120px 1fr; gap: var(--s-4) var(--s-5); align-items: center; }
.ds-label { font-size: var(--t-sm); color: var(--muted); }
.ds-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s-4); align-items: start; }
.ds-toasts { display: flex; flex-wrap: wrap; gap: var(--s-3); margin: var(--s-4) 0; }
.toast.ds-static { position: static; transform: none; animation: none; }
.ds-icons { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--s-2); }
.ds-icons li { display: flex; align-items: center; gap: 10px; font-size: var(--t-sm); color: var(--muted); padding: var(--s-2); border: 1px solid var(--line); border-radius: var(--r-control); }
.ds-icons .i { color: var(--black); width: 20px; height: 20px; }
@media (max-width: 760px) {
  .ds-head, .ds-main { padding-left: var(--s-4); padding-right: var(--s-4); }
  .ds-grid { grid-template-columns: 1fr; gap: var(--s-2); }
  .ds-grid .buttons { margin-bottom: var(--s-3); }
}

/* ---------- Detalle de solicitud: rótulos en mayúscula chica, datos clave en negrita ---------- */
.eyebrow { margin: 0 0 4px; font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.request-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-3) var(--s-4); padding-bottom: var(--s-4); margin-bottom: var(--s-4); border-bottom: 1px solid var(--line); }
.request-type { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); font-size: 20px; font-weight: 700; }
.request-when { text-align: right; }
.request-day { margin: 0; font-size: 20px; font-weight: 700; text-transform: capitalize; }
.request-data { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s-4); margin-bottom: var(--s-4); }
.request-data .data-item:has(> .badge) { grid-column: 1 / -1; }
.request-data p:not(.eyebrow) { margin: 0; }
.sku-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sku-list li { display: flex; align-items: center; gap: var(--s-2); }
.sku-list .qty { min-width: 28px; font-variant-numeric: tabular-nums; }
.sku-list code { font-size: 13.5px; font-weight: 600; }
.request-note { margin-bottom: var(--s-4); padding: var(--s-3) 14px; background: var(--g-50); border-left: 3px solid var(--black); border-radius: 0 var(--r-panel) var(--r-panel) 0; }
.request-note p:not(.eyebrow) { margin: 0; font-weight: 500; }
.facts.compact { padding-top: var(--s-4); border-top: 1px solid var(--line); font-size: var(--t-sm); }
.facts.compact:not(:has(dt)) { display: none; }
@media (max-width: 640px) { .request-when { text-align: left; } }
.facts.compact dt { font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; align-self: center; }

/* ---------- Distribución de soporte (OPS-13) ---------- */
.seg { display: inline-flex; border: 1px solid var(--black); border-radius: var(--r-pill); overflow: hidden; margin: 0 0 var(--s-3); max-width: 100%; }
.seg button { border: 0; border-radius: 0; background: var(--white); color: var(--black); padding: 6px 14px; min-height: 36px; flex: 1 1 auto; }
.seg button + button { border-left: 1px solid var(--black); }
.seg button.on { background: var(--black); color: var(--white); }
.lead { font-size: var(--t-md); line-height: 1.5; max-width: 68ch; margin: 0 0 28px; }
.attention-text { color: var(--black); font-weight: 600; background: var(--alert); border-radius: 3px; padding: 0 4px; }
/* Quién tiene qué: una tarjeta por persona */
.owners { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s-3); margin: 0 0 28px; }
.owner { border: 1px solid var(--line-strong); border-radius: var(--r-panel); padding: 14px 16px; background: var(--white); min-width: 0; display: grid; gap: 8px; align-content: start; }
.owner header { display: grid; grid-template-columns: 1fr auto; align-items: baseline; column-gap: var(--s-2); }
.owner h3 { margin: 0; font-size: var(--t-md, 15px); font-weight: 600; overflow-wrap: anywhere; }
.owner .figure { grid-row: span 2; margin: 0; font-size: var(--t-2xl); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.owner header .small { margin: 0; }
.owner p { margin: 0; }
.owner.sin-asignar { background: var(--alert-soft); border-color: var(--alert); }
.owner.ia { border-style: dashed; border-color: var(--black); }
.owner .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--r-pill); font-size: var(--t-xs); border: 1px solid var(--g-300); background: var(--white); white-space: nowrap; }
.chip.level-2 { border-color: var(--g-600); }
.chip.level-3 { background: var(--black); border-color: var(--black); color: var(--white); }
.owner details summary { cursor: pointer; font-size: var(--t-sm); min-height: 32px; display: flex; align-items: center; }
.owner details summary { list-style: none; text-decoration: underline; text-underline-offset: 3px; }
.owner details summary::-webkit-details-marker { display: none; }
.cases { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; font-size: var(--t-sm); }
.cases li { display: grid; gap: 1px; padding-top: 6px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
/* Cómo se reparte: tres caminos según la dificultad */
.how { margin: 0 0 var(--s-3); padding-left: 20px; display: grid; gap: 2px; }
.lanes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s-3); margin: 0 0 28px; }
.lane { border: 1px solid var(--black); border-radius: var(--r-panel); padding: 14px 16px; min-width: 0; display: grid; gap: 6px; align-content: start; }
.lane p { margin: 0; }
.lane .tag { font-size: var(--t-xs); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.lane h3 { margin: 0; font-size: var(--t-lg); }
.lane .figure { font-size: var(--t-2xl); font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.bar { display: flex; gap: 2px; height: 10px; border-radius: var(--r-pill); overflow: hidden; background: var(--g-100); margin-top: 4px; }
.bar span { flex: 1 1 0; }
.bar .ia, .dot.ia { background: var(--black); }
.bar .equipo, .dot.equipo { background: var(--g-400); }
.bar .sin-asignar, .dot.sin-asignar { background: var(--alert); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--t-sm); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
details.more { border-top: 1px solid var(--line); padding: 4px 0; }
details.more:last-of-type { border-bottom: 1px solid var(--line); margin-bottom: var(--s-4); }
details.more > summary { cursor: pointer; font-weight: 500; min-height: 44px; display: flex; align-items: center; gap: var(--s-2); }
details.more[open] > summary { margin-bottom: var(--s-2); }
details.more > summary { list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; margin-left: auto; font-size: var(--t-lg); font-weight: 400; }
details.more[open] > summary::after { content: "−"; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-3); }
.two .panel h3 { margin: 0; }
.today.four { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.flow-health li { display: block; margin-bottom: 6px; }
/* Sugerencias de políticas (OPS-14) */
.suggestion h3 { margin: 0; }
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s-3); margin: 0; }
.compare > div { border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--s-3); min-width: 0; }
.compare dt { font-size: var(--t-xs); color: var(--muted); }
.compare dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.examples li { margin-bottom: var(--s-2); overflow-wrap: anywhere; }
.examples blockquote { margin: 4px 0 0; padding-left: var(--s-3); border-left: 2px solid var(--line-strong); color: var(--g-800); }
.suggestion details summary { cursor: pointer; font-size: var(--t-sm); }
.suggestion details form { margin-top: var(--s-3); }
.suggestion-tabs { margin-bottom: var(--s-3); }
