/* =====================================================================
   WebCodeCol · Panel — estilo Apple (claro/oscuro automático)
   Para cambiar la paleta basta con editar las variables de :root.
   ===================================================================== */

:root {
  --fondo: #f5f5f7;
  --superficie: #ffffff;
  --superficie-2: #f5f5f7;
  --superficie-3: #e8e8ed;
  --translucido: rgba(251, 251, 253, 0.78);
  --texto: #1d1d1f;
  --texto-2: #6e6e73;
  --texto-3: #86868b;
  --borde: rgba(0, 0, 0, 0.08);
  --borde-fuerte: rgba(0, 0, 0, 0.14);
  --acento: #0071e3;
  --acento-hover: #0077ed;
  --acento-suave: rgba(0, 113, 227, 0.1);
  --verde: #28a745;
  --verde-ios: #34c759;
  --rojo: #ff3b30;
  --naranja: #ff9500;
  --amarillo: #ffcc00;
  --morado: #af52de;
  --indigo: #5856d6;
  --teal: #30b0c7;
  --gris: #8e8e93;
  --burbuja-cliente: #e9e9eb;
  --burbuja-ia: #0a84ff;
  --burbuja-asesor: #34c759;
  --sombra: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --sombra-alta: 0 12px 40px rgba(0, 0, 0, 0.12);
  --radio: 18px;
  --radio-sm: 12px;
  --fuente: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #000000;
    --superficie: #1c1c1e;
    --superficie-2: #2c2c2e;
    --superficie-3: #3a3a3c;
    --translucido: rgba(28, 28, 30, 0.72);
    --texto: #f5f5f7;
    --texto-2: #a1a1a6;
    --texto-3: #8e8e93;
    --borde: rgba(255, 255, 255, 0.09);
    --borde-fuerte: rgba(255, 255, 255, 0.16);
    --acento: #0a84ff;
    --acento-hover: #409cff;
    --acento-suave: rgba(10, 132, 255, 0.16);
    --verde: #30d158;
    --rojo: #ff453a;
    --naranja: #ff9f0a;
    --morado: #bf5af2;
    --indigo: #5e5ce6;
    --teal: #40c8e0;
    --burbuja-cliente: #2c2c2e;
    --sombra: 0 0 0 1px rgba(255, 255, 255, 0.04);
    --sombra-alta: 0 12px 40px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--fuente);
  font-size: 15px;
  line-height: 1.47;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -0.022em; font-weight: 700; }
h2 { font-size: 21px; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0 0 10px; }
[hidden] { display: none !important; }
.icono { width: 20px; height: 20px; flex: none; }
.texto-2 { color: var(--texto-2); }
.texto-3 { color: var(--texto-3); font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.derecha { text-align: right; }
.fila { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.fila-entre { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pila > * + * { margin-top: 16px; }

/* ------------------------------------------------------------ layout */
.app { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 20px 12px;
  background: var(--translucido);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--borde);
}
.marca { display: flex; align-items: center; gap: 12px; padding: 4px 10px 22px; }
.marca strong { display: block; font-size: 16px; letter-spacing: -0.02em; }
.marca span { display: block; font-size: 12px; color: var(--texto-2); }
.marca-logo {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #1d1d1f, #48484a);
  color: #fff; font-weight: 700; font-size: 17px;
}
@media (prefers-color-scheme: dark) { .marca-logo { background: linear-gradient(145deg, #f5f5f7, #c7c7cc); color: #000; } }
.marca-logo.grande { width: 64px; height: 64px; border-radius: 18px; font-size: 30px; margin: 0 auto 20px; }

.menu { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px;
  color: var(--texto); font-weight: 500;
  transition: background .15s;
}
.menu-item:hover { background: var(--superficie-3); text-decoration: none; }
.menu-item.activo { background: var(--acento); color: #fff; }
.menu-item .icono { color: var(--acento); }
.menu-item.activo .icono { color: #fff; }
.menu-item .contador { margin-left: auto; }
.contador {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--rojo); color: #fff; font-size: 12px; font-weight: 600;
  display: inline-grid; place-items: center;
}
.menu-item.activo .contador { background: #fff; color: var(--acento); }

.usuario-menu { display: flex; align-items: center; gap: 10px; padding: 12px 8px 0; border-top: 1px solid var(--borde); }
.usuario-menu form { margin-left: auto; }
.usuario-datos strong { display: block; font-size: 13px; }
.usuario-datos span { display: block; font-size: 12px; color: var(--texto-2); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #a1a1a6, #8e8e93); color: #fff;
  font-size: 14px; font-weight: 600;
}

.principal { min-width: 0; padding: 0 40px 48px; }
.barra-titulo { padding: 32px 0 20px; max-width: 1160px; margin: 0 auto; }
.barra-titulo-fila { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.barra-titulo h1 { font-size: 34px; line-height: 1.12; letter-spacing: -0.028em; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.volver { display: inline-flex; align-items: center; gap: 2px; margin: 0 0 6px -6px; font-size: 15px; }
.volver .icono { width: 22px; height: 22px; }
.contenido { max-width: 1160px; margin: 0 auto; }

.tabbar { display: none; }

/* ------------------------------------------------------------ tarjetas */
.tarjeta {
  background: var(--superficie);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 22px 24px;
}
.tarjeta + .tarjeta { margin-top: 20px; }
.rejilla > .tarjeta + .tarjeta { margin-top: 0; }
.tarjeta-titulo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.tarjeta-titulo h2 { font-size: 19px; }
.tarjeta.sin-relleno { padding: 0; overflow: hidden; }
.tarjeta.sin-relleno .tarjeta-titulo { padding: 20px 24px 0; }

.rejilla { display: grid; gap: 20px; }
.rejilla-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rejilla-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rejilla-lateral { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }

/* métricas del dashboard */
.metricas { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.metrica {
  display: block; padding: 16px 18px; border-radius: 16px;
  background: var(--superficie); box-shadow: var(--sombra); color: var(--texto);
  transition: transform .15s, box-shadow .15s;
}
.metrica:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--sombra-alta); }
.metrica .valor { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.metrica .etiqueta { font-size: 13px; color: var(--texto-2); display: flex; align-items: center; gap: 6px; }
.metrica .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--gris)); }
.metrica.destacada { background: var(--acento); color: #fff; }
.metrica.destacada .etiqueta { color: rgba(255,255,255,.85); }

/* ------------------------------------------------------------ badges */
.badge {
  --c: var(--gris);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 980px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
}
.estado-nuevo { --c: var(--acento); }
.estado-en_diseno { --c: var(--morado); }
.estado-esperando_aprobacion { --c: var(--naranja); }
.estado-aprobado { --c: var(--teal); }
.estado-en_produccion { --c: var(--indigo); }
.estado-listo { --c: var(--verde); }
.estado-entregado { --c: var(--gris); }
.estado-cancelado { --c: var(--rojo); }
.conv-ia { --c: var(--acento); }
.conv-humano { --c: var(--naranja); }
.conv-cerrada { --c: var(--gris); }

/* ------------------------------------------------------------ botones */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: 980px; border: 0;
  background: var(--acento); color: #fff;
  font: inherit; font-weight: 500; font-size: 15px; line-height: 1.2;
  cursor: pointer; white-space: nowrap;
  transition: background .15s, opacity .15s, transform .05s;
}
.boton:hover { background: var(--acento-hover); text-decoration: none; }
.boton:active { transform: scale(.98); }
.boton:disabled { opacity: .45; cursor: default; }
.boton .icono { width: 18px; height: 18px; }
.boton-secundario { background: var(--superficie-3); color: var(--texto); }
.boton-secundario:hover { background: var(--borde-fuerte); }
.boton-peligro { background: color-mix(in srgb, var(--rojo) 12%, transparent); color: var(--rojo); }
.boton-peligro:hover { background: color-mix(in srgb, var(--rojo) 20%, transparent); }
.boton-exito { background: var(--verde-ios); }
.boton-exito:hover { background: var(--verde); }
.boton-chico { padding: 6px 14px; font-size: 13px; }
.boton-enlace { background: none; border: 0; padding: 0; color: var(--acento); font: inherit; cursor: pointer; }
.boton-enlace:hover { text-decoration: underline; }
.boton-icono {
  width: 34px; height: 34px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: transparent; color: var(--texto-2); cursor: pointer;
}
.boton-icono:hover { background: var(--superficie-3); color: var(--texto); }

/* ------------------------------------------------------------ formularios */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > span, .etiqueta-campo { font-size: 13px; font-weight: 500; color: var(--texto-2); }
.campo small { color: var(--texto-3); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--borde);
  border-radius: var(--radio-sm);
  background: var(--superficie-2);
  color: var(--texto);
  font: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
  appearance: none;
  -webkit-appearance: none;
}
select {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--acento);
  background: var(--superficie);
  box-shadow: 0 0 0 4px var(--acento-suave);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--acento); }
.formulario { display: grid; gap: 16px; }
.formulario-fila { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }

/* control segmentado */
.segmentado {
  display: inline-flex; padding: 2px; gap: 2px; border-radius: 10px;
  background: var(--superficie-3); overflow-x: auto; max-width: 100%;
  scrollbar-width: none;
}
.segmentado::-webkit-scrollbar { display: none; }
.segmentado a, .segmentado button {
  padding: 6px 14px; border-radius: 8px; border: 0; background: none;
  color: var(--texto); font: inherit; font-size: 13px; font-weight: 500;
  white-space: nowrap; cursor: pointer;
}
.segmentado a:hover { text-decoration: none; background: var(--borde); }
.segmentado .activo { background: var(--superficie); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.buscador { position: relative; flex: 1; min-width: 200px; }
.buscador .icono { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--texto-3); width: 18px; }
.buscador input { padding-left: 38px; }

/* ------------------------------------------------------------ avisos */
.aviso {
  padding: 12px 16px; border-radius: var(--radio-sm); margin-bottom: 16px;
  font-size: 14px; font-weight: 500;
  background: var(--acento-suave); color: var(--acento);
}
.aviso-exito { background: color-mix(in srgb, var(--verde) 14%, transparent); color: var(--verde); }
.aviso-error { background: color-mix(in srgb, var(--rojo) 12%, transparent); color: var(--rojo); }
.aviso-alerta { background: color-mix(in srgb, var(--naranja) 14%, transparent); color: color-mix(in srgb, var(--naranja) 80%, var(--texto)); }

/* ------------------------------------------------------------ tablas / listas */
.tabla { width: 100%; border-collapse: collapse; }
.tabla th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--texto-2);
  text-transform: uppercase; letter-spacing: .02em;
  padding: 12px 16px; border-bottom: 1px solid var(--borde);
}
.tabla td { padding: 14px 16px; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr { transition: background .1s; }
.tabla tbody tr.clic { cursor: pointer; }
.tabla tbody tr.clic:hover { background: var(--superficie-2); }
.tabla .principal-celda { font-weight: 600; }
.tabla .secundaria { display: block; font-size: 13px; color: var(--texto-2); }

.lista { list-style: none; margin: 0; padding: 0; }
.lista > li { border-bottom: 1px solid var(--borde); }
.lista > li:last-child { border-bottom: 0; }
.lista-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; color: var(--texto); }
a.lista-item:hover { text-decoration: none; }
.lista-item .cuerpo { flex: 1; min-width: 0; }
.lista-item .titulo { font-weight: 600; }
.lista-item .detalle { font-size: 13px; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.vacio { padding: 40px 20px; text-align: center; color: var(--texto-2); }
.vacio .icono { width: 40px; height: 40px; color: var(--texto-3); margin-bottom: 8px; }

.paginacion { display: flex; justify-content: center; gap: 8px; padding: 16px; }

/* definición de datos (detalle de pedido) */
.datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px 24px; margin: 0; }
.datos dt { font-size: 12px; color: var(--texto-2); font-weight: 500; margin-bottom: 2px; }
.datos dd { margin: 0; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.datos .ancho { grid-column: 1 / -1; }

/* archivos */
.archivos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.archivo {
  border-radius: 14px; overflow: hidden; background: var(--superficie-2);
  border: 1px solid var(--borde); display: flex; flex-direction: column;
}
.archivo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: var(--superficie-3); }
.archivo-pie { padding: 10px 12px; font-size: 13px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.archivo-pie span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archivo-doc { aspect-ratio: 4 / 3; display: grid; place-items: center; color: var(--texto-3); }
.archivo-doc .icono { width: 44px; height: 44px; }
.audio-transcrito { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 16px; padding: 14px; align-items: center; }
.audio-transcrito audio { width: 100%; }
.transcripcion { font-size: 14px; color: var(--texto); background: var(--superficie); border-radius: 12px; padding: 10px 14px; }
.transcripcion::before { content: "Transcripción"; display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--texto-3); margin-bottom: 4px; letter-spacing: .03em; }

/* línea de tiempo del historial */
.linea-tiempo { list-style: none; margin: 0; padding: 0; position: relative; }
.linea-tiempo li { position: relative; padding: 0 0 18px 26px; }
.linea-tiempo li::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: -6px; width: 2px; background: var(--borde); }
.linea-tiempo li:last-child::before { display: none; }
.linea-tiempo li::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--superficie); border: 3px solid var(--acento); }
.linea-tiempo .cuando { font-size: 12px; color: var(--texto-3); }

/* ------------------------------------------------------------ chats (lista) */
.chats-lista .lista-item { padding: 12px 20px; }
.chats-lista .lista-item:hover { background: var(--superficie-2); }
.chats-lista .hora { font-size: 13px; color: var(--texto-3); white-space: nowrap; }
.chats-lista .no-leido { width: 10px; height: 10px; border-radius: 50%; background: var(--acento); flex: none; }
.chats-lista .titulo { display: flex; gap: 8px; align-items: center; }

/* ------------------------------------------------------------ chat (conversación) */
.chat {
  display: flex; flex-direction: column;
  height: calc(100vh - 150px); min-height: 480px;
  background: var(--superficie); border-radius: var(--radio); box-shadow: var(--sombra);
  overflow: hidden;
}
.chat-cabecera {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--borde);
  background: var(--translucido); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.chat-cabecera .cuerpo { flex: 1; min-width: 160px; }
.chat-cabecera .ventana { font-size: 12px; color: var(--texto-2); }
.chat-cabecera .ventana.cerrada { color: var(--naranja); }
.chat-mensajes { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.separador-dia { align-self: center; font-size: 12px; color: var(--texto-3); font-weight: 500; margin: 14px 0 8px; }
.burbuja {
  max-width: min(72%, 560px); padding: 8px 14px; border-radius: 20px;
  font-size: 15px; line-height: 1.4; word-wrap: break-word; white-space: pre-wrap;
  position: relative;
}
.burbuja.cliente { align-self: flex-start; background: var(--burbuja-cliente); color: var(--texto); border-bottom-left-radius: 6px; }
.burbuja.ia { align-self: flex-end; background: var(--burbuja-ia); color: #fff; border-bottom-right-radius: 6px; }
.burbuja.asesor { align-self: flex-end; background: var(--burbuja-asesor); color: #fff; border-bottom-right-radius: 6px; }
.burbuja.fallido { opacity: .6; outline: 2px solid var(--rojo); }
.burbuja-meta { font-size: 11px; color: var(--texto-3); margin: 0 8px 8px; }
.burbuja-meta.derecha { align-self: flex-end; }
.burbuja-meta.izquierda { align-self: flex-start; }
.burbuja img { width: 260px; max-width: 100%; max-height: 320px; object-fit: cover; border-radius: 14px; display: block; margin: 2px 0 4px; cursor: zoom-in; }
.burbuja audio { width: 260px; max-width: 100%; display: block; margin: 4px 0; }
.burbuja .nota { font-style: italic; opacity: .85; }
.burbuja .adjunto { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: inherit; }
.burbuja .transcripcion { margin-top: 6px; background: rgba(255,255,255,.55); font-size: 13px; }
@media (prefers-color-scheme: dark) { .burbuja .transcripcion { background: rgba(0,0,0,.25); } }
.chat-escribir {
  display: flex; gap: 8px; align-items: flex-end; padding: 12px 16px;
  border-top: 1px solid var(--borde); background: var(--superficie);
}
.chat-escribir textarea { min-height: 42px; max-height: 160px; border-radius: 21px; padding: 10px 16px; resize: none; }
.chat-escribir .boton { width: 42px; height: 42px; padding: 0; flex: none; }
.chat-escribir .boton .icono { width: 20px; height: 20px; }
.chat-aviso { padding: 10px 20px; font-size: 13px; text-align: center; background: var(--superficie-2); color: var(--texto-2); border-top: 1px solid var(--borde); }

/* ------------------------------------------------------------ configuración IA */
.editor-conocimiento { min-height: calc(100vh - 360px); font-size: 15px; line-height: 1.6; font-family: var(--fuente); }
.contador-caracteres { font-size: 13px; color: var(--texto-2); }
.contador-caracteres.alerta { color: var(--naranja); font-weight: 600; }
.mini-chat { display: flex; flex-direction: column; height: 460px; border-radius: 16px; background: var(--superficie-2); overflow: hidden; }
.mini-chat .chat-mensajes { padding: 14px; }
.mini-chat .chat-escribir { background: var(--superficie-2); }
.mini-chat .burbuja { max-width: 88%; font-size: 14px; }
.escribiendo { align-self: flex-start; padding: 10px 14px; border-radius: 20px; background: var(--burbuja-cliente); display: inline-flex; gap: 4px; }
.escribiendo i { width: 7px; height: 7px; border-radius: 50%; background: var(--texto-3); animation: rebote 1.2s infinite; }
.escribiendo i:nth-child(2) { animation-delay: .15s; }
.escribiendo i:nth-child(3) { animation-delay: .3s; }
@keyframes rebote { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.proveedor {
  padding: 16px 18px; border-radius: 14px; border: 1px solid var(--borde);
  transition: border-color .15s, background .15s;
}
.proveedor:has(input[type=radio]:checked) { border-color: var(--acento); background: var(--acento-suave); }
.proveedor-cabecera { display: flex; align-items: center; gap: 14px; cursor: pointer; margin-bottom: 12px; }
.proveedor input[type=radio] { accent-color: var(--acento); width: 18px; height: 18px; }
.proveedor .cuerpo { flex: 1; }
.proveedor .estado-key { font-size: 12px; }
.estado-key.ok { color: var(--verde); }
.estado-key.falta { color: var(--texto-3); }
.resultado-prueba { font-size: 14px; background: var(--superficie-2); border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; }

/* barras simples (uso de IA) */
.barra { height: 6px; border-radius: 3px; background: var(--superficie-3); overflow: hidden; min-width: 60px; }
.barra > i { display: block; height: 100%; background: var(--acento); border-radius: 3px; }

/* ------------------------------------------------------------ visor de imágenes */
.visor { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.85); display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.visor img { max-width: 100%; max-height: 100%; border-radius: 12px; }

/* ------------------------------------------------------------ login / páginas simples */
.pagina-simple { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.tarjeta-simple {
  width: 100%; max-width: 400px; padding: 40px 32px;
  background: var(--superficie); border-radius: 24px; box-shadow: var(--sombra-alta);
  text-align: center;
}
.tarjeta-simple h1 { font-size: 26px; margin-bottom: 6px; }
.tarjeta-simple p { color: var(--texto-2); margin-bottom: 24px; }
.tarjeta-simple form { text-align: left; }
.tarjeta-simple .boton { width: 100%; padding: 12px; margin-top: 8px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1080px) {
  .rejilla-lateral { grid-template-columns: 1fr; }
  .rejilla-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .app { display: block; }
  .sidebar { display: none; }
  .principal { padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
  .barra-titulo { padding: calc(20px + env(safe-area-inset-top)) 0 14px; }
  .barra-titulo h1 { font-size: 28px; }
  .rejilla-2, .rejilla-3 { grid-template-columns: 1fr; }
  .tarjeta { padding: 18px 16px; border-radius: 16px; }
  .tarjeta.sin-relleno .tarjeta-titulo { padding: 16px 16px 0; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--translucido);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--borde);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10px; font-weight: 500; color: var(--texto-3); position: relative;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.activo { color: var(--acento); }
  .tabbar .icono { width: 24px; height: 24px; }
  .tabbar .contador { position: absolute; top: -2px; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 11px; }

  /* tablas → tarjetas apiladas */
  .tabla-responsiva thead { display: none; }
  .tabla-responsiva tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--borde); }
  .tabla-responsiva tr:last-child { border-bottom: 0; }
  .tabla-responsiva td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .tabla-responsiva td::before { content: attr(data-etiqueta); color: var(--texto-2); font-size: 13px; text-align: left; }
  .tabla-responsiva td.principal-celda { display: block; text-align: left; font-size: 16px; }
  .tabla-responsiva td { flex-wrap: wrap; }
  .tabla-responsiva td:not(.principal-celda) .secundaria { flex-basis: 100%; text-align: right; }
  .buscador { flex-basis: 100%; }
  .fila > .campo[style] { flex: 1 1 40% !important; }
  .tabla-responsiva td.principal-celda::before { display: none; }

  .chat { height: calc(100vh - 190px - env(safe-area-inset-bottom)); border-radius: 16px; }
  .burbuja { max-width: 85%; }
  .audio-transcrito { grid-template-columns: 1fr; }
  .editor-conocimiento { min-height: 60vh; }
  .chats-lista .lista-item { padding: 12px 16px; }
}
