/* Clash Grotesk -- tipografia real de croydon.com.co, auto-alojada (no depende
   de internet el dia de la demo). Solo los pesos que usamos para momentos de
   marca (login, header, nombre de producto en Display). */
@font-face {
  font-family: "Clash Grotesk";
  src: url("/static/fonts/ClashGrotesk-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Clash Grotesk";
  src: url("/static/fonts/ClashGrotesk-Semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Clash Grotesk";
  src: url("/static/fonts/ClashGrotesk-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0f14;
  --panel: #131a23;
  --panel-2: #1a2330;
  --border: #253044;
  --text: #e8edf4;
  --text-dim: #8b98ac;
  /* Azul institucional de Croydon (muestreado del logo real, #004e9e) --
     aclarado para --accent porque el tono original es demasiado oscuro para
     usarse como texto sobre un fondo casi negro (ver docs/03 y el calculo de
     contraste WCAG hecho antes de fijar estos valores). */
  --accent: #56a0f2;
  --accent-dark: #1d6fd1;
  --brand-blue-deep: #004e9e;
  --gold: #e8a33d;
  --danger: #f0546a;
  --accent-glow: rgba(86, 160, 242, 0.55);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: "Clash Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- TEMAS ---------- */
/* Paletas alternativas (ver agents.py _ejecutar_cambiar_tema / app.js
   aplicarTema) -- mismo set de variables que :root, cambiando solo color.
   Se activan con [data-theme] en <html>, asi que TODO lo que ya usa var(...)
   cambia automaticamente, sin tocar el resto del CSS. */
/* Los 3 temas oscuros de abajo se suavizaron a pedido del usuario ("suaviza
   tambien los otros 3 temas") tras agregar Mac Claro -- fondos/bordes menos
   saturados (gris neutro con apenas un tinte, en vez de negro-morado/negro-
   cian puro), acentos menos "neon puro" (bajados de luminosidad/saturacion),
   glow mucho mas bajo (0.22-0.25 vs 0.55 original, en linea con el 0.18 de
   Mac Claro) y "--gold" (precio) unificado en una familia dorada/ambar en \
   vez de colores neon que competian visualmente con el acento. Mantienen su \
   identidad de color (cian/rosa/verde-azulado) pero mas serios, menos \
   "gritones". */
html[data-theme="neon"] {
  --bg: #0a0c12;
  --panel: #10131c;
  --panel-2: #171b28;
  --border: #262c3d;
  --text: #e8edf3;
  --text-dim: #838fa8;
  --accent: #2bc4d6;
  --accent-dark: #1a93a3;
  --gold: #d9a24d;
  --danger: #e2536b;
  --accent-glow: rgba(43, 196, 214, 0.25);
}
html[data-theme="synthwave"] {
  --bg: #120c16;
  --panel: #1c1620;
  --panel-2: #251e2c;
  --border: #3a3040;
  --text: #f3ecf5;
  --text-dim: #a290ac;
  --accent: #cf6f96;
  --accent-dark: #a84f74;
  --gold: #e3ab5c;
  --danger: #e2536b;
  --accent-glow: rgba(207, 111, 150, 0.25);
}
html[data-theme="aurora"] {
  --bg: #0a1114;
  --panel: #101a1e;
  --panel-2: #17242a;
  --border: #24393e;
  --text: #e6f3f1;
  --text-dim: #7c9c97;
  --accent: #29b3a3;
  --accent-dark: #1c8577;
  --gold: #c7b06a;
  --danger: #e2607a;
  --accent-glow: rgba(41, 179, 163, 0.22);
}
/* Unico tema claro -- deliberadamente mas sobrio que los otros 3 (pedido del
   usuario: "uno que sea claro... mas elegante o serio estilo mac"). Paleta
   tomada del sistema de macOS/Apple (fondo #f5f5f7, texto #1d1d1f, azul de
   sistema #0071e3) y un --accent-glow bajito (0.18 vs 0.55 de los demas) para
   que el mismo glow del boton primario se vea como una sombra discreta en vez
   de un neon, en vez de bajarlo a 0 y perder la coherencia entre temas. */
html[data-theme="claro"] {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-2: #f2f2f4;
  --border: #d9d9de;
  --text: #1d1d1f;
  --text-dim: #6e6e73;
  --accent: #0071e3;
  --accent-dark: #005bb8;
  --gold: #b9770e;
  --danger: #d70015;
  --accent-glow: rgba(0, 113, 227, 0.18);
}

* { box-sizing: border-box; }

/* Reset nativo de <button> -- sin esto, algunos navegadores (notablemente
   Safari/WebKit en macOS) dibujan el control nativo del SO (fondo/marco
   claro) por encima del estilo propio, sobre todo visible en botones chicos
   de fondo oscuro solido como .tema-btn. Foco sigue siendo visible (accesible)
   pero con el color del tema en vez del anillo nativo. */
button {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  outline: none;
}
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
}
/* Transicion suave del tema en los contenedores principales -- que cambiar
   de paleta se sienta como un efecto, no un parpadeo brusco. */
.panel, .header, .agents-strip, .canasta-bar, .logs-panel,
.chat-msg, .status-tooltip, .historial-panel, .tema-panel, .credito-panel, .arquitectura-panel {
  transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease;
}

/* ---------- LOGIN ---------- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, #142230 0%, #0b0f14 65%);
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 360px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.45);
}

.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand-mark { font-family: var(--font-heading); font-size: 28px; font-weight: 700; letter-spacing: 1px; color: var(--text); }
.login-brand-sub { font-size: 12px; color: var(--accent); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 4px; }

#login-form label {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

#login-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
#login-form input:focus { outline: none; border-color: var(--accent); }

.btn-primary {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #04182b;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 0.3px;
  box-shadow: 0 0 18px var(--accent-glow);
  transition: box-shadow 0.2s ease, filter 0.2s ease;
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 0 26px var(--accent-glow); }

.login-error {
  margin-top: 14px;
  color: var(--danger);
  font-size: 12px;
  text-align: center;
}

/* ---------- APP SHELL ---------- */
/* height fija (no min-height) + overflow hidden: la app entera cabe en la
   pantalla sin scroll de pagina -- cada panel maneja su propio scroll interno
   (chat-messages, panel-center, logs-content) en vez de que crezca la pagina. */
.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.header-brand { font-family: var(--font-heading); font-weight: 700; letter-spacing: 1px; font-size: 17px; }
.header-brand span { color: var(--accent); text-shadow: 0 0 16px var(--accent-glow); transition: color 0.3s ease, text-shadow 0.3s ease; }
.header-right { display: flex; align-items: center; gap: 18px; }

.account-status { display: flex; gap: 6px; }
.status-chip {
  position: relative;
  font-size: 10px;
  padding: 4px 9px;
  border-radius: 20px;
  background: rgba(86, 160, 242, 0.12);
  color: var(--accent);
  border: 1px solid rgba(86, 160, 242, 0.3);
  white-space: nowrap;
  cursor: default;
}

/* Tooltip propio (no el title nativo del navegador) con la info de cuenta
   preconfigurada -- se abre en hover o foco de teclado. El mismo dato tambien
   se puede corroborar y cambiar por chat (ver agents.py consultar_cuenta /
   modificar_cuenta); esta ventana solo muestra el estado actual. */
.status-tooltip {
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  min-width: 230px;
  max-width: 300px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 13px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 60;
  white-space: normal;
  text-align: left;
  cursor: default;
}
.status-tooltip::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: var(--panel-2);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.status-tooltip.status-tooltip-right { left: auto; right: -6px; transform: translateY(4px); }
.status-tooltip.status-tooltip-right::before { left: auto; right: 16px; transform: rotate(45deg); }
.status-chip:hover .status-tooltip,
.status-chip:focus .status-tooltip,
.status-chip:focus-within .status-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.status-chip:hover .status-tooltip.status-tooltip-right,
.status-chip:focus .status-tooltip.status-tooltip-right {
  transform: translateY(0);
}
.tooltip-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 5px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.tooltip-body { font-size: 11.5px; color: var(--text-dim); line-height: 1.55; }
.tooltip-body strong { color: var(--text); }
.tooltip-hint { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); font-size: 10px; color: var(--accent); }
.header-user { font-size: 13px; color: var(--text-dim); }

/* Campana de avisos de stock (ver agents.py _resolver_sin_stock -> "avisame")
   -- mismo patron de tooltip propio que Status de cuenta, oculta cuando no
   hay ningun aviso activo. */
.stock-alerts-bell {
  position: relative;
  display: flex;
  align-items: center;
  font-size: 16px;
  cursor: default;
}
.bell-count {
  position: absolute;
  top: -7px;
  right: -9px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  min-width: 14px;
  text-align: center;
  border-radius: 10px;
  padding: 1px 4px;
  line-height: 1.4;
}
.stock-alerts-bell .status-tooltip { min-width: 220px; }
.stock-alerts-bell:hover .status-tooltip,
.stock-alerts-bell:focus .status-tooltip,
.stock-alerts-bell:focus-within .status-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}
/* Selector de tema visual -- a diferencia de los tooltips de solo lectura
   (Status de cuenta, avisos), este panel se abre con click porque hay que
   poder elegir una opcion, no solo leer. Tambien se puede cambiar por chat
   (ver agents.py _ejecutar_cambiar_tema). */
.tema-switcher { position: relative; }
.tema-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  width: 30px;
  height: 30px;
  font-size: 14px;
  cursor: pointer;
}
.tema-btn:hover { border-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.tema-panel {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  min-width: 220px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tema-panel-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 6px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.tema-opcion {
  display: flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 7px 8px;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.tema-opcion:hover { background: var(--panel); border-color: var(--border); }
.tema-opcion.activo { border-color: var(--accent); background: var(--panel); font-weight: 600; }
.tema-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  border: 1px solid var(--border); /* define el borde tambien contra paneles claros (ej. tema-swatch-claro) */
}
.tema-swatch-croydon { background: linear-gradient(135deg, #56a0f2, #1d6fd1); }
.tema-swatch-neon { background: linear-gradient(135deg, #2bc4d6, #d9a24d); }
.tema-swatch-synthwave { background: linear-gradient(135deg, #cf6f96, #e3ab5c); }
.tema-swatch-aurora { background: linear-gradient(135deg, #29b3a3, #c7b06a); }
.tema-swatch-claro { background: linear-gradient(135deg, #ffffff, #0071e3); }
.tema-hint { font-size: 10px; color: var(--accent); padding: 6px 6px 2px; border-top: 1px dashed var(--border); margin-top: 4px; }

.alerta-stock-item { padding: 4px 0; border-bottom: 1px solid var(--border); }
.alerta-stock-item:last-child { border-bottom: none; }
.alerta-stock-item .alerta-nombre { color: var(--text); font-weight: 600; }
.alerta-stock-item .alerta-fecha { color: var(--text-dim); display: block; }

/* ---------- FRANJA DE AGENTES ---------- */
/* Cada chip representa un agente real del backend (mismo "agente" que se
   guarda en session_store.log). Se colorea con .active cuando ese agente
   registro actividad en el turno mas reciente -- ver agentesActivos en app.js. */
.agents-strip {
  display: flex;
  gap: 8px;
  padding: 8px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}
.agent-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  transition: background 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}
.agent-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background 0.35s ease, box-shadow 0.35s ease;
}
.agent-chip[data-agente="Orquestador"].active { background: rgba(86, 160, 242, 0.16); border-color: #56a0f2; color: #56a0f2; }
.agent-chip[data-agente="Orquestador"].active .dot { background: #56a0f2; box-shadow: 0 0 6px #56a0f2; }
.agent-chip[data-agente="Agente de Catalogo"].active { background: rgba(45, 212, 191, 0.16); border-color: #2dd4bf; color: #2dd4bf; }
.agent-chip[data-agente="Agente de Catalogo"].active .dot { background: #2dd4bf; box-shadow: 0 0 6px #2dd4bf; }
.agent-chip[data-agente="Agente de Recomendacion"].active { background: rgba(163, 113, 247, 0.16); border-color: #a371f7; color: #a371f7; }
.agent-chip[data-agente="Agente de Recomendacion"].active .dot { background: #a371f7; box-shadow: 0 0 6px #a371f7; }
.agent-chip[data-agente="Agente de Negociacion"].active { background: rgba(232, 163, 61, 0.18); border-color: #e8a33d; color: #e8a33d; }
.agent-chip[data-agente="Agente de Negociacion"].active .dot { background: #e8a33d; box-shadow: 0 0 6px #e8a33d; }
.agent-chip[data-agente="Agente Tesorero"].active { background: rgba(63, 185, 80, 0.16); border-color: #3fb950; color: #3fb950; }
.agent-chip[data-agente="Agente Tesorero"].active .dot { background: #3fb950; box-shadow: 0 0 6px #3fb950; }
.agent-chip[data-agente="Agente Logistico"].active { background: rgba(240, 136, 62, 0.18); border-color: #f0883e; color: #f0883e; }
.agent-chip[data-agente="Agente Logistico"].active .dot { background: #f0883e; box-shadow: 0 0 6px #f0883e; }
.agent-chip[data-agente="Agente de Voz"].active { background: rgba(236, 72, 153, 0.16); border-color: #ec4899; color: #ec4899; }
.agent-chip[data-agente="Agente de Voz"].active .dot { background: #ec4899; box-shadow: 0 0 6px #ec4899; }
.agent-chip[data-agente="Agente de Experiencia"].active { background: rgba(34, 211, 238, 0.16); border-color: #22d3ee; color: #22d3ee; }
.agent-chip[data-agente="Agente de Experiencia"].active .dot { background: #22d3ee; box-shadow: 0 0 6px #22d3ee; }

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  gap: 14px;
  padding: 16px;
  min-height: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.voice-hint { font-size: 9px; color: var(--accent); text-transform: none; letter-spacing: 0; }

/* ---------- COLUMNA IZQUIERDA (Novedades + Usualmente se compra con) ---------- */
/* .col-novedades reemplaza a panel-novedades como hijo directo de .grid --
   asi la columna entera se estira a la altura de Chat/Display (stretch por
   defecto en grid), y adentro Novedades ocupa solo lo que necesita
   (flex: 0 0 auto) mientras Relacionados usa el resto del alto con su propio
   scroll interno. Antes esa altura quedaba vacia debajo de Novedades. */
.col-novedades {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

/* ---------- NOVEDADES ---------- */
/* Una "pagina" de varias tarjetas a la vez (no todo el listado apilado, ni una
   sola con hueco vacio al costado) -- rota sola cada 4.5s, tipo pantalla
   publicitaria. flex: 0 0 auto para que el panel no se estire a la altura
   de Chat/Display -- solo ocupa lo que su contenido real necesita. */
.panel-novedades { flex: 0 0 auto; }
.novedades-carousel { display: flex; flex-direction: column; gap: 10px; }
/* Miniaturas mas compactas que en Mesa de Opciones -- acá se muestran varias
   tarjetas juntas, no una sola en foco. */
.novedades-carousel .card-thumb,
.novedades-carousel .card-thumb-fallback { height: 56px; font-size: 20px; }
.novedades-dots {
  display: flex; justify-content: center; gap: 5px;
  margin-top: 10px;
}
.novedades-dots .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border);
  cursor: pointer;
}
.novedades-dots .dot.active { background: var(--accent); }

/* ---------- USUALMENTE SE COMPRA CON ---------- */
/* Ocupa el resto del alto de la columna (ver .col-novedades) con su propio
   scroll interno -- mismo patron de "cada panel maneja su propio scroll" ya
   usado en el resto del layout, para que agregar mas de 2-3 sugerencias no
   empuje ni desplace ningun otro panel. */
.panel-relacionados { flex: 1; min-height: 0; }
.relacionados-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  min-height: 0;
}
.relacionados-empty { color: var(--text-dim); font-size: 12px; }

/* Fila compacta (no la tarjeta completa de producto) -- ver renderRelacionadoItem
   en app.js, el panel solo tiene el alto que le sobra a Novedades. */
.rel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  cursor: pointer;
  transition: border-color .15s;
}
.rel-item:hover { border-color: var(--accent); }
.rel-thumb { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.rel-thumb-fallback {
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; background: var(--panel);
}
.rel-info { min-width: 0; }
.rel-name {
  font-size: 11px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rel-price { font-size: 11px; color: var(--gold); font-weight: 700; }

@keyframes novedadFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.novedad-fade { animation: novedadFade .35s ease; }

.product-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
  position: relative;
}
.product-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.product-card .num-badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--accent); color: #04182b;
  font-size: 10px; font-weight: 800;
  padding: 2px 6px; border-radius: 20px;
}
.product-card .cat-badge {
  display: inline-block; font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 20px; margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.3px;
}
.card-thumb {
  display: block;
  width: 100%;
  height: 84px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 8px;
  background: #fff;
}
.card-thumb-fallback {
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  background: linear-gradient(135deg, #1c2534, #0f1620);
  color: var(--text);
}
.product-card .name { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.product-card .price { font-size: 12px; color: var(--gold); font-weight: 700; }
.product-card .stock-agotado { color: var(--danger); font-size: 10px; margin-top: 4px; }

/* Category badge colors */
.cat-colegial { background: rgba(45, 212, 191, 0.15); color: #2dd4bf; }
.cat-running { background: rgba(63, 185, 80, 0.15); color: #3fb950; }
.cat-urbano { background: rgba(232, 163, 61, 0.15); color: #e8a33d; }
.cat-casual { background: rgba(163, 113, 247, 0.15); color: #a371f7; }
.cat-basketball { background: rgba(240, 84, 106, 0.15); color: #f0546a; }
.cat-botas { background: rgba(139, 148, 172, 0.2); color: #8b98ac; }
.cat-workman { background: rgba(240, 136, 62, 0.18); color: #f0883e; }
.cat-accesorios { background: rgba(210, 153, 34, 0.15); color: #d29922; }

/* ---------- CENTRO ---------- */
/* Display a altura FIJA con scroll propio: antes crecia o encogia segun el
   producto (mas o menos tallas, con o sin medidas) y eso empujaba la Mesa de
   Opciones de un lado a otro cada vez que se mostraba un producto distinto --
   una interaccion no deberia mover otros paneles de sitio. Ahora Mesa de
   Opciones vive en su propio bloque de altura fija (el resto del panel) con
   su propio scroll, independiente del contenido del Display. */
.panel-center { gap: 12px; overflow: hidden; }
.display-block { display: flex; flex-direction: column; flex: 0 0 auto; }
.mesa-block { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.display-content {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  height: 400px;
  overflow-y: auto;
}
.display-content.is-empty { display: flex; align-items: center; justify-content: center; }
.display-empty, .mesa-empty { color: var(--text-dim); font-size: 12px; text-align: center; padding: 30px 0; }

.display-carousel {
  height: 170px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1c2534, #0f1620);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  font-size: 42px;
  border: 1px dashed var(--border);
  position: relative;
  overflow: hidden;
}
.display-carousel.has-image { border-style: solid; }
.display-carousel img {
  width: 100%; height: 100%;
  object-fit: contain;
  background: #fff;
}
.carousel-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(11,15,20,0.65); color: var(--text);
  border: 1px solid var(--border);
  font-size: 16px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.carousel-arrow.carousel-prev { left: 8px; }
.carousel-arrow.carousel-next { right: 8px; }
.carousel-arrow:hover { background: rgba(11,15,20,0.9); border-color: var(--accent); }
.carousel-dots {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 5px;
}
.carousel-dots .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,0.35);
}
.carousel-dots .dot.active { background: var(--accent); }

.display-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.display-name { font-family: var(--font-heading); font-size: 16px; font-weight: 600; }
.display-price { font-size: 15px; color: var(--gold); font-weight: 800; white-space: nowrap; }

.display-color-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-dim);
  padding: 6px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 2px;
}
.display-color-row .color-label { text-transform: uppercase; letter-spacing: 0.4px; font-size: 9.5px; }
.display-color-row .color-value { color: var(--text); font-weight: 600; }
.stock-agotado-inline { margin-left: auto; color: var(--danger); font-size: 10.5px; font-weight: 700; }

.display-tallas-label { color: var(--text-dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; margin-top: 8px; }
/* Cada chip muestra la talla y, debajo, los pares disponibles -- antes la
   cantidad solo se veia al pasar el mouse (title), sin forma de comparar
   tallas de un vistazo. */
.talla-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.talla-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 28px;
  padding: 3px 4px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  line-height: 1.25;
}
.talla-num { font-size: 11px; font-weight: 700; color: var(--text); }
.talla-qty { font-size: 8.5px; color: var(--text-dim); }
.talla-chip.sin-stock { opacity: 0.55; border-color: rgba(240, 84, 106, 0.35); }
.talla-chip.sin-stock .talla-num { text-decoration: line-through; color: var(--danger); }
.talla-chip.sin-stock .talla-qty { color: var(--danger); }

/* Productos "sin_tallas" (accesorios: medias, kit de limpieza) no manejan
   tallas de calzado -- en vez del grid de talla-chips, una sola linea con el
   stock disponible. */
.stock-unico { margin-top: 5px; font-size: 13px; font-weight: 700; color: var(--text); }

/* Medidas: antes eran cajas grandes con mucho padding (la queja concreta del
   usuario) -- ahora es una lista compacta de renglones label/valor con un
   divisor fino, la misma informacion en bastante menos alto. */
.measures-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 14px;
  margin-top: 10px;
}
.measure-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.measure-label { font-size: 10px; color: var(--text-dim); }
.measure-value { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.measure-missing { color: var(--danger); font-size: 11px; font-style: italic; margin-top: 10px; }

.mesa-opciones-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  overflow-y: auto;
  align-content: start;
  flex: 1;
  min-height: 0;
}

/* ---------- HISTORIAL DE PEDIDOS ---------- */
/* Superposicion NO modal a proposito: sin backdrop que cubra toda la pantalla,
   y se detiene antes de la columna de Chat (320px + gap + padding) para que
   el chat quede siempre visible y usable mientras la ventana esta abierta --
   pedido explicito del usuario ("que esto no bloquee el chat"). */
.historial-panel {
  position: fixed;
  top: 96px;
  left: 16px;
  right: 352px;
  bottom: 96px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  z-index: 80;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.historial-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.historial-header h2 { font-family: var(--font-heading); font-size: 15px; font-weight: 600; margin: 0; }
.historial-cerrar {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.historial-cerrar:hover { color: var(--text); border-color: var(--accent); }
.historial-lista {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.historial-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.historial-item .hi-info { display: flex; flex-direction: column; gap: 3px; min-width: 220px; }
.historial-item .hi-num { color: var(--text-dim); font-size: 10.5px; }
.historial-item .hi-nombre { font-weight: 600; font-size: 13px; }
.historial-item .hi-detalle { color: var(--text-dim); font-size: 11.5px; }
.historial-item .hi-pago {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
  width: fit-content;
  margin-top: 2px;
}
.hi-pago.credito { background: rgba(232, 163, 61, 0.16); color: #e8a33d; }
.hi-pago.transferencia { background: rgba(63, 185, 80, 0.16); color: #3fb950; }
.historial-item .hi-right { display: flex; align-items: center; gap: 12px; }
.historial-item .hi-total { color: var(--gold); font-weight: 800; font-size: 14px; white-space: nowrap; }
.historial-repetir {
  background: var(--accent-dark);
  color: #f5faff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.historial-repetir:hover { background: var(--accent); }

/* ---------- CUPO DE CREDITO (panel visual) ---------- */
/* Tarjeta centrada sobre Display/Mesa de Opciones (misma banda horizontal que
   .historial-panel -- deja el Chat siempre visible), pero del alto de su
   contenido en vez de ocupar todo el espacio disponible, porque son solo 3
   barras + un total, no una lista larga. */
.credito-panel {
  position: fixed;
  top: 50%;
  left: 16px;
  right: 352px;
  transform: translateY(-50%);
  max-width: 420px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  z-index: 80;
  padding: 20px 24px 18px;
}
.credito-bars {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 18px 0 6px;
}
.credito-bar-col { display: flex; flex-direction: column; align-items: center; width: 84px; }
.credito-bar-track {
  width: 100%;
  height: 130px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.credito-bar-fill { width: 100%; border-radius: 0 0 6px 6px; transition: height 0.4s ease; }
.cr-mercancia { background: var(--accent); }
.cr-envios { background: var(--gold); }
.cr-libre { background: #3fb950; }
.credito-bar-label { margin-top: 8px; font-size: 11px; color: var(--text-dim); text-align: center; }
.credito-bar-monto { font-size: 12px; font-weight: 700; color: var(--text); text-align: center; }
.credito-bar-pct { font-size: 10px; color: var(--text-dim); }
.credito-totales { text-align: center; padding-top: 12px; border-top: 1px solid var(--border); }
.credito-total-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.4px; }
.credito-total-monto { font-size: 20px; font-weight: 800; color: var(--text); margin-top: 2px; }
.credito-hint { text-align: center; font-size: 10.5px; color: var(--accent); margin-top: 14px; }
/* Encabezado arrastrable (ver makeDraggable en app.js) -- pedido del usuario:
   poder mover la ventana del cupo dentro de la app. cursor:grab avisa que se
   puede arrastrar; el boton de cerrar adentro queda excluido del arrastre. */
.credito-header-arrastrable { cursor: grab; user-select: none; }
.credito-header-arrastrable:active { cursor: grabbing; }

/* ---------- ARQUITECTURA DE AGENTES (panel visual) ---------- */
/* Mismo patron de tarjeta flotante no modal, arrastrable, que .credito-panel
   -- mas ancha porque tiene que alojar 8 tarjetas de agente en vez de 3
   barras. max-height + overflow interno en el grid (no en el panel entero)
   para que el encabezado y el hub del Orquestador queden siempre visibles
   aunque haya que hacer scroll para ver todas las tarjetas. */
.arquitectura-panel {
  position: fixed;
  top: 50%;
  left: 16px;
  right: 352px;
  transform: translateY(-50%);
  max-width: 720px;
  max-height: 82vh;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  z-index: 85;
  padding: 18px 22px 16px;
  display: flex;
  flex-direction: column;
}
.arquitectura-hub { display: flex; justify-content: center; margin-top: 10px; flex-shrink: 0; }
.arquitectura-hub-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 8px 20px;
  box-shadow: 0 0 16px var(--accent-glow);
}
.arquitectura-hub-card .ar-icono { font-size: 20px; }
.arquitectura-hub-card .ar-nombre { font-weight: 800; font-size: 13px; color: var(--text); }
.arquitectura-linea { width: 2px; height: 16px; background: var(--border); margin: 0 auto; flex-shrink: 0; }
.arquitectura-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
  padding-top: 4px;
}
.arquitectura-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 10px;
  padding: 10px 12px;
}
.ar-card-head { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.ar-card-icono { font-size: 15px; }
.ar-card-nombre { font-weight: 700; font-size: 12px; color: var(--text); }
.ar-card-llm { font-size: 9.5px; color: var(--text-dim); font-style: italic; margin-bottom: 6px; }
.ar-card-rol { font-size: 11px; color: var(--text); margin-bottom: 6px; line-height: 1.35; }
.ar-card-detalle { font-size: 10px; color: var(--text-dim); line-height: 1.4; margin-top: 3px; }
.ar-card-detalle strong { color: var(--accent); }

/* ---------- CHAT ---------- */
.panel-chat { min-height: 0; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
  margin-bottom: 10px;
}
.chat-msg {
  max-width: 90%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-line;
}
.chat-msg.user { align-self: flex-end; background: var(--accent-dark); color: #f5faff; }
.chat-msg.agent { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); }

/* Diagrama de medidas: SVG esquematico (no una foto real) que resalta en que
   parte del zapato cae la medida explicada -- va en su propia burbuja, mas
   ancha que el texto porque necesita espacio para leerse. */
.chat-msg.diagram { max-width: 100%; padding: 10px; }
.md-svg { display: block; width: 100%; height: auto; }
.md-upper { fill: var(--panel); stroke: var(--text-dim); stroke-width: 2.5; }
.md-sole { fill: var(--border); stroke: var(--text-dim); stroke-width: 2.5; }
.md-lace { stroke: var(--text-dim); stroke-width: 2; opacity: 0.7; }
.md-zona { transition: opacity 0.2s ease; }
.md-zona.md-dim { opacity: 0.22; }
.md-zona-fill { fill: var(--accent); fill-opacity: 0.18; stroke: var(--accent); stroke-width: 1.8; stroke-dasharray: 4,3; }
.md-zona.md-activa .md-zona-fill { fill-opacity: 0.35; stroke-width: 3; stroke-dasharray: none; }
.md-arrow { stroke: var(--accent); stroke-width: 2; }
.md-zona.md-activa .md-arrow { stroke-width: 2.8; }
.md-label { font: 700 16px var(--font); fill: var(--text); }
.md-zona.md-activa .md-label { fill: var(--accent); }

/* Indicador de "pensando" -- visible mientras se transcribe/clasifica/responde,
   para que quede claro que el mensaje SÍ se recibió y está en curso. */
.chat-msg.thinking { padding: 12px 16px; }
.thinking-dots { display: flex; gap: 4px; }
.thinking-dots span {
  display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-dim);
  animation: thinkingBounce 1.2s infinite ease-in-out both;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes thinkingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-form { display: flex; gap: 6px; }
.chat-form input {
  flex: 1;
  min-width: 0; /* sin esto el input no se encoge bajo su ancho de contenido por
                   defecto, y en pantallas angostas empuja al boton Enviar
                   fuera del contenedor en vez de dejarle su espacio */
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
}
.chat-form input:focus { outline: none; border-color: var(--accent); }
.chat-form input:disabled, .btn-send:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-send { width: auto; padding: 10px 16px; margin-top: 0; flex-shrink: 0; }
.mic-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  width: 40px;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 15px;
}
.mic-btn.recording { background: var(--danger); border-color: var(--danger); }
/* Ocupado (transcribiendo/pensando/hablando) -- distinto del rojo de "grabando"
   para que se note que el bloqueo es temporal, no un error. */
.mic-btn.busy { cursor: not-allowed; animation: micBusyPulse 1s ease-in-out infinite; }
@keyframes micBusyPulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.9; } }
.audio-toggle-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  width: 40px;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 15px;
}
.audio-toggle-btn.muted { opacity: 0.5; border-color: var(--danger); }

/* ---------- CANASTA ---------- */
.canasta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  flex-wrap: wrap;
  gap: 14px;
}
.canasta-items { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; }
.canasta-empty { color: var(--text-dim); font-size: 12px; }
.canasta-chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
}
.canasta-chip .name { font-weight: 600; }
.canasta-chip .qty { color: var(--text-dim); }
.canasta-chip.pendiente-reposicion { border-color: rgba(232, 163, 61, 0.4); }
.canasta-chip .repo-badge { color: var(--gold); font-weight: 600; display: block; margin-top: 2px; }

.canasta-side { display: flex; align-items: center; gap: 20px; }
.canasta-total { font-size: 13px; color: var(--text-dim); }
.canasta-total strong { color: var(--gold); font-size: 15px; }

.order-stepper { display: flex; gap: 4px; }
.order-stepper .step {
  font-size: 10px;
  padding: 5px 10px;
  border-radius: 20px;
  background: var(--panel-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.order-stepper .step.active { background: var(--accent); color: #04182b; border-color: var(--accent); font-weight: 700; }
.order-stepper .step.done { background: rgba(86,160,242,0.15); color: var(--accent); border-color: var(--accent-dark); }

/* ---------- LOGS ---------- */
.logs-panel { border-top: 1px solid var(--border); background: var(--panel-2); }
.logs-toggle {
  width: 100%;
  text-align: left;
  padding: 10px 24px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
}
.logs-content {
  max-height: 220px;
  overflow-y: auto;
  padding: 0 24px 14px;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 11px;
}
.log-line { padding: 4px 0; border-bottom: 1px solid var(--border); color: var(--text-dim); }
.log-line .agent { color: var(--accent); font-weight: 700; }
