@font-face { font-family: "Bricolage"; src: url("/fonts/bricolage.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/fonts/atkinson-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson"; src: url("/fonts/atkinson-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --rojo: #c8102e; --granate: #7a0a1d; --tinta: #23272a; --suave: #5b6368; --fondo: #eef0f1; --papel: #fff;
  --linea: #b9c0c4; --borde: #dde1e3; --listo: #17695b; --listo-f: #e3f2ee; --pend: #7a4e00; --pend-f: #fff1d1; --err-f: #fde7ea;
  --display: "Bricolage", system-ui, sans-serif; --texto: "Atkinson", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font: 1.0625rem/1.55 var(--texto); color: var(--tinta); background: var(--fondo); }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; line-height: 1.15; margin: 0; }
p { margin: 0; }
a { color: var(--rojo); }
.suave { color: var(--suave); }
:focus-visible { outline: 3px solid var(--tinta); outline-offset: 2px; }

/* Logo */
.logo { background: #fff; border-radius: 12px; padding: 12px 18px; display: inline-block; }
.logo img { display: block; width: 150px; height: auto; }

/* Botones y campos */
.btn, .btn-sec, .btn-mini {
  font: inherit; font-weight: 700; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-block; text-align: center;
}
.btn { background: var(--rojo); color: #fff; border: 0; padding: 13px 22px; font-family: var(--display); font-size: 1.05rem; }
.btn:hover { background: var(--granate); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-sec { background: #fff; color: var(--tinta); border: 1.5px solid var(--tinta); padding: 11px 18px; }
.btn-sec:hover { background: var(--fondo); }
.btn-mini { background: #fff; color: var(--tinta); border: 1.5px solid var(--linea); padding: 6px 12px; font-size: .92rem; }
.btn-mini:hover { border-color: var(--tinta); }
.btn-mini.rojo { color: var(--rojo); border-color: var(--rojo); }
.btn-mini.listo { background: var(--tinta); color: #fff; border-color: var(--tinta); }
label { display: block; font-weight: 700; font-size: 1rem; margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; padding: 11px 13px; background: #fff; border: 1.5px solid var(--linea); border-radius: 8px;
}
textarea { min-height: 7rem; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--tinta); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; padding: 0; margin: 0; flex: none; accent-color: var(--rojo); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 10px 0; }
.error { background: var(--err-f); color: var(--granate); border-left: 4px solid var(--rojo); padding: 10px 14px; border-radius: 6px; font-weight: 700; margin: 12px 0; }
.ayuda { font-size: .92rem; color: var(--suave); margin-top: 6px; }

/* Inicio de sesión */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--rojo); padding: 20px; }
.login-tarjeta { background: #fff; border-radius: 18px; padding: 28px; width: 100%; max-width: 400px; }
.login-tarjeta .logo { padding: 0; margin-bottom: 18px; }
.login-tarjeta h1 { font-size: 1.7rem; margin-bottom: 6px; }
.login-tarjeta .btn { width: 100%; margin-top: 16px; }

/* Estructura */
.app { min-height: 100vh; display: block; }
.lateral { background: var(--rojo); color: #fff; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.lateral .logo { align-self: flex-start; padding: 8px 14px; }
.lateral .logo img { width: 120px; }
#nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
#nav a {
  color: #fff; text-decoration: none; font-weight: 700; padding: 9px 14px; border-radius: 9px; white-space: nowrap; display: flex; gap: 8px; align-items: center;
}
#nav a:hover { background: rgba(255,255,255,.14); }
#nav a[aria-current=page] { background: #fff; color: var(--rojo); }
.cuenta { background: #fff; color: var(--rojo); border-radius: 999px; min-width: 22px; padding: 0 7px; font-size: .85rem; text-align: center; line-height: 22px; }
#nav a[aria-current=page] .cuenta { background: var(--rojo); color: #fff; }
.lateral-pie { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .92rem; }
.estado-wa { display: flex; gap: 8px; align-items: center; }
.estado-wa::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #ffd37a; flex: none; }
.estado-wa.on::before { background: #7be0c3; }
.enlace-claro { background: none; border: 0; color: #fff; font: inherit; text-decoration: underline; cursor: pointer; padding: 4px 0; }
:is(.lateral) :focus-visible { outline-color: #fff; }

.vista { padding: 22px 16px 60px; max-width: 1100px; outline: none; }
.vista h1 { font-size: 1.9rem; margin-bottom: 4px; }
.vista .sub { color: var(--suave); margin-bottom: 22px; max-width: 46em; }

/* Tarjetas y listas */
.tarjeta { background: #fff; border-radius: 14px; box-shadow: 0 0 0 1px var(--borde); padding: 18px 20px; margin-bottom: 18px; }
.tarjeta h2 { font-size: 1.25rem; margin-bottom: 12px; }
.fila { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--borde); align-items: flex-start; }
.fila:first-of-type { border-top: 0; }
.fila .cuerpo { flex: 1 1 260px; min-width: 0; }
.fila .nombre { font-weight: 700; }
.fila .texto { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--tinta); margin-top: 4px; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.vacio { color: var(--suave); padding: 6px 0; }
.aviso { background: var(--pend-f); color: var(--pend); border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-weight: 700; }
.aviso a { color: var(--pend); }
.barra { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.barra input[type=search] { flex: 1 1 220px; max-width: 340px; }

/* Etiquetas */
.etq { display: inline-block; border-radius: 7px; padding: 3px 9px; font-size: .88rem; font-weight: 700; background: var(--fondo); color: var(--tinta); white-space: nowrap; }
.etq.ok { background: var(--listo-f); color: var(--listo); }
.etq.pend { background: var(--pend-f); color: var(--pend); }
.etq.mal { background: var(--err-f); color: var(--granate); }
.etq.alta { background: var(--rojo); color: #fff; }
.etq.media { background: var(--pend-f); color: var(--pend); }
.etq.baja { background: var(--fondo); color: var(--suave); }

/* Tablas */
.tabla-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .97rem; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { font-family: var(--display); font-size: .95rem; background: #f6f7f8; white-space: nowrap; }
td select { padding: 6px 8px; font-size: .92rem; width: auto; }

/* Programar */
.dos-col { display: grid; gap: 18px; }
.lista-contactos { max-height: 260px; overflow: auto; border: 1.5px solid var(--linea); border-radius: 8px; padding: 4px 12px; background: #fff; }
.lista-contactos .check { margin: 8px 0; }
.vista-previa { background: #f0faf6; border-left: 4px solid var(--listo); border-radius: 0 8px 8px 0; padding: 10px 14px; white-space: pre-wrap; margin-top: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { font: inherit; font-size: .88rem; background: var(--fondo); border: 0; border-radius: 7px; padding: 4px 9px; cursor: pointer; }
.chip:hover { background: #e1e5e7; }

/* Sondeo */
.pestanas { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.pestanas button { font: inherit; font-weight: 700; background: #fff; border: 1.5px solid var(--linea); border-radius: 9px; padding: 8px 16px; cursor: pointer; color: var(--suave); }
.pestanas button[aria-selected=true] { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.chat { background: #f6f7f8; border-radius: 12px; padding: 14px; min-height: 280px; max-height: 420px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.burbuja { max-width: 85%; padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.burbuja.yo { align-self: flex-end; background: #dcf8c6; border-bottom-right-radius: 4px; }
.burbuja.bot { align-self: flex-start; background: #fff; box-shadow: 0 0 0 1px var(--borde); border-bottom-left-radius: 4px; }
.enviar-chat { display: flex; gap: 8px; margin-top: 10px; }
.respuestas { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
.respuestas dt { color: var(--suave); }
.respuestas dd { margin: 0; font-weight: 700; }

/* Diálogo y aviso */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(20,24,26,.55); }
.dlg { padding: 22px; }
.dlg h2 { font-size: 1.35rem; margin-bottom: 4px; }
.dlg-pie { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--tinta); color: #fff; padding: 12px 20px; border-radius: 10px; font-weight: 700; z-index: 50; max-width: calc(100vw - 32px); }
.toast.mal { background: var(--granate); }
.codigo { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--fondo); padding: 3px 8px; border-radius: 6px; font-size: .92rem; overflow-wrap: anywhere; }
ol.pasos { padding-left: 22px; } ol.pasos li { margin: 8px 0; }

/* Escritorio: menú lateral fijo */
@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 260px 1fr; }
  .lateral { position: sticky; top: 0; height: 100vh; padding: 26px 20px; gap: 26px; }
  .lateral .logo img { width: 150px; }
  #nav { flex-direction: column; overflow: visible; }
  .lateral-pie { margin-top: auto; flex-direction: column; align-items: flex-start; }
  .vista { padding: 40px 44px 80px; }
  .dos-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
}
@media (prefers-reduced-motion: no-preference) { dialog[open] { animation: ent .18s ease-out; } @keyframes ent { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } } }

/* Utilidades (la política de seguridad no permite estilos en las etiquetas) */
.btn-p { padding: 10px 18px; font-size: 1rem; }
.mt12 { margin-top: 12px; } .mt14 { margin-top: 14px; }
.mb8 { margin: 0 0 8px; } .mb10 { margin: 0 0 10px; } .mb12 { margin: 0 0 12px; }
.pre { white-space: pre-wrap; }
.h3s { margin: 16px 0 8px; font-size: 1.05rem; }
.chat-corto { min-height: 0; }
.sel-260 { max-width: 260px; } .sel-220 { max-width: 220px; }
.izq { margin-right: auto; }
