/* ─────────────────────────────────────────────────────────────────────────
   El Centro de Producción · componentes de las pantallas auxiliares
   (cola de eventos · oportunidades · chats)

   El color y la tipografía viven en tokens.css, que estas tres páginas y el
   SPA cargan por igual. Acá abajo van SÓLO reglas de componente.

   Reglas de la casa:
   - Los nombres de clase son los que ya usa el JS de cada página. No renombrar
     sin tocar el JS.
   - `--surface-page` DEBE coincidir con el `background` del body del SPA: si no,
     el iframe embebido dibuja un escalón visible.
   ───────────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--ui);
  background: var(--surface-page);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.45;
}

/* Foco visible y coherente en todo lo interactivo. Antes no había ninguno:
   con teclado no se sabía dónde estabas parado. */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ─────────────────────────── Header ─────────────────────────── */

header {
  background: var(--ink-deep);
  color: #fff;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: var(--sh-2);
  position: relative;
  z-index: 5;
}
header .brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
/* El dibujo de el cliente es un retrato con fondo transparente, no el disco que
   había: sin border-radius (le cortaría la cabeza) y sin box-shadow (sobre un
   PNG transparente la sombra sale rectangular). Invertido porque el trazo es
   carbón y el header es casi negro. */
header img {
  height: 34px; width: auto; flex-shrink: 0; filter: invert(1);
}
header .titles { min-width: 0; }
/* El wordmark en la voz de póster del panel (Archivo Black, tokens.css). El
   tracking corto a propósito: la Archivo ya es ancha, estirarla la afloja. */
header h1 {
  font-family: var(--cifra);
  font-size: 14px; margin: 0; font-weight: 400; letter-spacing: .05em;
  text-transform: uppercase; line-height: 1.2; color: #fff;
}
header .sub {
  color: var(--text-onink-2); font-size: 11px; font-weight: 500;
  letter-spacing: .13em; text-transform: uppercase; margin-top: 2px;
}

nav { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
nav a {
  color: var(--text-onink); text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--r-md);
  background: rgba(255,255,255,.08);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
nav a:hover { background: rgba(255,255,255,.16); color: #fff; }
nav a.active { background: var(--gold); color: var(--gold-ink); }
nav a.active:hover { background: var(--gold-deep); }

/* Modo embebido: el SPA ya dibuja su propio encabezado y sidebar. */
:root.embed header { display: none; }
:root.embed .wrap { margin-top: 12px; }

/* En celular la nav envuelta se comía dos filas de alto. Scroll lateral: el
   header queda en un solo bloque y las 4 secciones siguen alcanzables. */
@media (max-width: 620px) {
  header { padding: 12px 16px; gap: 12px; }
  nav {
    margin-left: 0; width: 100%; flex-wrap: nowrap;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  nav::-webkit-scrollbar { display: none; }
  nav a { flex-shrink: 0; }
  .wrap { margin: 16px auto; padding: 0 16px; }
}

/* ─────────────────────────── Layout ─────────────────────────── */

.wrap { max-width: 1280px; margin: 22px auto; padding: 0 20px; }

.bar {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.pill {
  font-size: 12.5px; color: var(--text-muted); font-weight: 500;
  display: inline-flex; align-items: center;
}
.dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok); margin-right: 7px;
  box-shadow: 0 0 0 3px rgba(85,112,62,.16);
  animation: pulse 2s var(--ease) infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ─────────────────────────── Botones ─────────────────────────── */

.btn, .pausebtn, .winbtn, .send {
  font-family: inherit; cursor: pointer;
  transition: background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease),
              box-shadow var(--t-fast) var(--ease);
}
.btn:active, .pausebtn:active, .winbtn:active, .send:active { transform: translateY(1px); }

/* El botón que manda lleva la sombra DURA de sticker y se hunde al apretarlo:
   la actitud del panel vive acá y en las cifras, no en el cuerpo del texto. */
.btn.gold, .pausebtn.on {
  border: 2px solid var(--ink);
  box-shadow: var(--sh-pop-sm);
}
.btn.gold:hover, .pausebtn.on:hover { box-shadow: var(--sh-pop); transform: translate(-1px,-1px); }
.btn.gold:active, .pausebtn.on:active { box-shadow: none; transform: translate(2px,2px); }

.pausebtn {
  margin-left: auto; border: 1px solid var(--line); background: #fff;
  color: var(--ink); font-size: 13px; font-weight: 600;
  padding: 9px 16px; border-radius: var(--r-md);
  display: inline-flex; align-items: center; gap: 8px; box-shadow: var(--sh-1);
}
.pausebtn:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); }
.pausebtn.on { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.pausebtn.on:hover { background: var(--gold-deep); }
.pausebtn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn {
  padding: 9px 15px; border-radius: var(--r-md); border: none;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.btn.gold { background: var(--gold); color: var(--gold-ink); }
.btn.gold:hover { background: var(--gold); }
.btn.ghost { background: #fff; color: var(--gold-deep); border: 1px solid var(--warn-line); }
.btn.ghost:hover { background: var(--surface-soft); border-color: var(--warn-line); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }

/* ─────────────────────────── Banner ─────────────────────────── */

.banner {
  display: none; align-items: center; gap: 9px;
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  color: var(--warn-ink); border-radius: var(--r-md);
  padding: 11px 15px; font-size: 13px; font-weight: 600; margin-bottom: 16px;
}
.banner svg { width: 16px; height: 16px; flex-shrink: 0; }
.banner.danger {
  background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink);
}

/* ─────────────────────────── Board kanban ─────────────────────────── */

.board {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  align-items: stretch;      /* antes `start`: las columnas quedaban desparejas */
}
@media (max-width: 980px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px)  { .board { grid-template-columns: 1fr; } }

.col {
  background: var(--surface-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 12px 12px 14px;
  min-height: 180px;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.col.over {
  background: var(--warn-bg); border-color: var(--gold); border-style: dashed;
}
.col h2 {
  font-family: var(--ui);
  font-size: 11px; text-transform: uppercase; letter-spacing: .09em;
  font-weight: 700; margin: 2px 4px 12px;
  display: flex; align-items: center; gap: 8px; color: var(--ink);
}
.col h2 .n {
  margin-left: auto; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 2px 9px; font-size: 12px;
  color: var(--text-muted); font-variant-numeric: tabular-nums;
  letter-spacing: 0; font-weight: 600;
}
.tag { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ─────────────────────────── Tarjetas ─────────────────────────── */

.card {
  background: var(--surface-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 13px;
  margin-bottom: 9px;
  box-shadow: var(--sh-1);
  transition: box-shadow var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}
.card:last-child { margin-bottom: 0; }
.card:hover { box-shadow: var(--sh-2); border-color: var(--line-strong); }
.card[draggable="true"] { cursor: grab; }
.card[draggable="true"]:active { cursor: grabbing; }
.card.p-failed { border-color: var(--danger-line); }
.card.p-failed:hover { border-color: var(--danger-line); }

.ctop { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.tipo {
  font-weight: 600; font-size: 13px; color: var(--text);
  display: inline-flex; align-items: center; gap: 7px;
}
.tipo svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--ink); opacity: .75; }
.hora { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ph { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.det {
  font-size: 12.5px; color: var(--text-soft); margin-top: 6px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ep {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px; color: var(--text-soft); background: var(--surface-sunk);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 5px 8px; margin-top: 9px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ep b { color: var(--gold-deep); font-weight: 700; }
.err {
  font-size: 11.5px; color: var(--danger); margin-top: 8px;
  background: var(--danger-bg); border-radius: var(--r-sm);
  padding: 6px 9px; line-height: 1.35;
}

.colempty {
  color: var(--text-faint); font-size: 12.5px; text-align: center;
  padding: 26px 8px; border: 1px dashed var(--line); border-radius: var(--r-md);
}
.hint {
  font-size: 12.5px; color: var(--text-muted); margin-top: 14px;
  display: flex; align-items: center; gap: 8px;
}
.hint svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; }
.hint b { color: var(--ink); font-weight: 600; }

/* ─────────────────────────── Chips ─────────────────────────── */

.chip {
  font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: var(--r-pill); background: var(--surface-sunk); color: var(--text-soft);
}
.chip.human { background: var(--warn-bg); color: var(--gold-deep); }
.chip.won   { background: var(--ok-bg); color: var(--ok-ink); }

/* ─────────────────────────── Toast ─────────────────────────── */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 10px);
  background: var(--ink-deep); color: #fff; padding: 12px 20px;
  border-radius: var(--r-md); font-size: 13.5px; font-weight: 500;
  box-shadow: var(--sh-3); opacity: 0; pointer-events: none;
  transition: opacity var(--t-mid) var(--ease), transform var(--t-mid) var(--ease);
  z-index: 50; max-width: 90%;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ─────────────────────────── Scrollbars ─────────────────────────── */

::-webkit-scrollbar { width: 10px; height: 10px; }
/* No var(--line-strong): ahora es la tinta y un scrollbar negro pesa demasiado. */
::-webkit-scrollbar-thumb { background: #C7C1B5; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }
::-webkit-scrollbar-track { background: transparent; }

/* ─────────────────────────── Accesibilidad ─────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .dot { opacity: 1; }
}
