* { box-sizing: border-box; }
body { font-family: system-ui, sans-serif; margin: 0; background: #f5f5f5; }
header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: #1f3864; color: #fff; }
header h1 { margin: 0; font-size: 18px; }
.header-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.usage { font-size: 12px; color: #c9d4ea; font-variant-numeric: tabular-nums; }
.usage strong { color: #fff; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 8px; }
/* padding-bottom deja lugar para el formulario fijo de abajo (~70px) así no tapa la respuesta. */
#chat { padding: 16px 16px 96px; max-width: 900px; margin: 0 auto; min-height: calc(100vh - 140px); }
.msg { background: #fff; border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.msg.user { background: #e8f0fe; }
.progress { background: #fff; border-radius: 8px; padding: 8px 14px; margin: -4px 0 10px; box-shadow: 0 1px 2px rgba(0,0,0,.06); font-size: 13px; color: #444; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.progress-pct { font-variant-numeric: tabular-nums; color: #1f3864; font-weight: 600; }
.progress-track { height: 8px; background: #e6e9ef; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: #1f3864; border-radius: 4px; transition: width .3s ease; }
.msg table { border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.msg th, .msg td { border: 1px solid #dde1e8; padding: 4px 8px; }
.msg th { background: #f0f3f8; }
/* Botones bajo una respuesta terminada (docs/12_correo_planilla). */
.acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -4px 0 12px; }
.accion { border: 1px solid #1f3864; background: #fff; color: #1f3864; border-radius: 16px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.accion:hover:not(:disabled) { background: #1f3864; color: #fff; }
.accion:disabled { opacity: .6; cursor: progress; }
.acciones-aviso { font-size: 13px; color: #9C5700; }
/* Ventana "Enviar por correo". [hidden] gana a los display de abajo (el buscador oculta personas y grupos). */
[hidden] { display: none !important; }
#dlgCorreo { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.25); color: #222; }
#dlgCorreo::backdrop { background: rgba(20, 30, 50, .45); }
#formCorreo { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 16px; max-height: calc(100vh - 32px); }
#formCorreo h2 { margin: 0; font-size: 18px; color: #1f3864; }
.dlg-ayuda { margin: 0; font-size: 13px; color: #555; }
#filtroCorreo, #comentarioCorreo { width: 100%; padding: 8px 10px; font: inherit; font-size: 14px; border: 1px solid #c9d4ea; border-radius: 6px; }
#comentarioCorreo { resize: vertical; min-height: 60px; }
.dlg-lista { overflow-y: auto; min-height: 80px; max-height: 45vh; border: 1px solid #e6e9ef; border-radius: 8px; padding: 4px 10px; }
.dlg-lista fieldset { border: 0; margin: 0; padding: 6px 0; border-bottom: 1px solid #eef0f4; }
.dlg-lista fieldset:last-child { border-bottom: 0; }
.dlg-lista legend { padding: 0; font-size: 13px; font-weight: 600; color: #1f3864; }
.dlg-lista legend label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.dlg-persona { display: flex; align-items: center; gap: 8px; padding: 5px 0 5px 22px; font-size: 14px; cursor: pointer; }
.dlg-persona span { overflow-wrap: anywhere; }
.dlg-rotulo { font-size: 13px; color: #444; margin-top: 4px; }
.dlg-nota { margin: 0; font-size: 12px; color: #555; }
.dlg-estado { margin: 0; min-height: 1.2em; font-size: 13px; color: #1f3864; }
.dlg-estado.error, .dlg-contador.error { color: #a33; }
.dlg-botones { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dlg-contador { margin-right: auto; font-size: 13px; color: #555; }
.dlg-botones button { padding: 8px 14px; font: inherit; font-size: 14px; border-radius: 6px; border: 1px solid #c9d4ea; background: #fff; cursor: pointer; }
.dlg-botones button.primario { background: #1f3864; border-color: #1f3864; color: #fff; }
.dlg-botones button:disabled { opacity: .55; cursor: not-allowed; }
.grafico { margin: 12px 0; padding: 8px; border: 1px solid #e6e9ef; border-radius: 8px; background: #fff; }
.grafico-lienzo { position: relative; width: 100%; }
.grafico-error { color: #a33; font-size: 13px; }
.welcome { background: #fff; border-radius: 12px; padding: 24px; margin: 8px 0 16px; box-shadow: 0 1px 3px rgba(0,0,0,.08); color: #333; }
.welcome h2 { margin: 0 0 8px; font-size: 22px; color: #1f3864; }
.welcome-lead { margin: 0 0 18px; font-size: 15px; line-height: 1.5; }
.welcome-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.welcome-card { border: 1px solid #e6e9ef; border-radius: 8px; padding: 12px 14px; background: #f8fafd; }
.welcome-card h3 { margin: 0 0 6px; font-size: 15px; color: #1f3864; }
.welcome-card p { margin: 0; font-size: 13px; line-height: 1.45; color: #444; }
.welcome-note { font-size: 13px; color: #555; background: #f0f3f8; border-left: 3px solid #1f3864; padding: 8px 12px; border-radius: 4px; margin: 0 0 18px; }
.welcome-ask { font-size: 15px; margin: 0 0 10px; }
.welcome-examples { display: flex; flex-wrap: wrap; gap: 8px; }
.example { border: 1px solid #1f3864; background: #fff; color: #1f3864; border-radius: 16px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.example:hover { background: #1f3864; color: #fff; }
#form { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 8px; padding: 12px; background: #fff; border-top: 1px solid #ddd; }
#form input { flex: 1; padding: 10px; font-size: 14px; }
#form button { padding: 10px 16px; }
#form button:disabled { opacity: .6; cursor: progress; }
#logout { font: inherit; font-size: 13px; padding: 4px 10px; }
header button:disabled { opacity: .5; cursor: not-allowed; }
/* Login */
.login { display: flex; justify-content: center; padding: 48px 16px; }
.login-caja { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 360px; box-shadow: 0 1px 3px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 8px; }
.login-caja h2 { margin: 0 0 8px; font-size: 20px; color: #1f3864; }
.login-caja label { font-size: 13px; color: #444; }
.login-caja input { padding: 10px; font-size: 15px; border: 1px solid #c9d4ea; border-radius: 6px; }
.login-caja button { margin-top: 8px; padding: 10px; font-size: 15px; background: #1f3864; color: #fff; border: 0; border-radius: 6px; cursor: pointer; }
.login-caja button:disabled { opacity: .6; cursor: progress; }
.login-error { color: #a33; font-size: 13px; margin: 4px 0 0; }
.login-nota { font-size: 12px; color: #666; margin: 12px 0 0; line-height: 1.4; }