/* Viraliza Encuestas — estilos base con modo claro y oscuro.
   Colores de Viraliza: azul marino #1A2332 · naranja #FF5F1F · ámbar #F5A623 · azul #3A6DB5 */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url(/fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url(/fonts/inter-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url(/fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url(/fonts/inter-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 600; font-display: swap; src: url(/fonts/sora-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 700; font-display: swap; src: url(/fonts/sora-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Sora'; font-weight: 800; font-display: swap; src: url(/fonts/sora-latin-800-normal.woff2) format('woff2'); }

:root {
  --navy: #1A2332; --green: #FF5F1F; --red: #3A6DB5; --amber: #F5A623;
  --brand: var(--navy); --accent: var(--green); --highlight: var(--red);
  --bg: #F3F5F9; --surface: #FFFFFF; --surface-2: #F7F8FB; --surface-3: #EEF1F7;
  --text: #141C2B; --muted: #5B6480; --faint: #8A93A8; --border: #DFE3EC; --border-strong: #C5CCDB;
  --action: #FF5F1F; --action-hover: #F04E0E; --on-action: #FFFFFF;
  --ok: #2E7D32; --ok-soft: #E8F5E8; --warn: #B45309; --warn-soft: #FFF5E0; --bad: #D32F2F; --bad-soft: #FDEBEF;
  --focus: 0 0 0 3px rgba(255, 95, 31, .28);
  --bar: #3A6DB5; --bar-track: #E9ECF3;
  --shadow: 0 1px 2px rgba(26, 35, 50, .06), 0 4px 16px rgba(26, 35, 50, .06);
  --shadow-lg: 0 12px 40px rgba(26, 35, 50, .18);
  --radius: 12px; --radius-sm: 8px;
  --header-bg: var(--navy); --header-text: #FFFFFF;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0B111C; --surface: #131B2A; --surface-2: #182234; --surface-3: #202B40;
  --text: #E8EBF5; --muted: #A3ABC6; --faint: #6F789A; --border: #2A3650; --border-strong: #3A4864;
  --action: #FF5F1F; --action-hover: #FF7840; --on-action: #FFFFFF;
  --ok: #3DBA3A; --ok-soft: rgba(61, 186, 58, .14); --warn: #F0A43A; --warn-soft: rgba(240, 164, 58, .14); --bad: #FF4D6D; --bad-soft: rgba(255, 77, 109, .14);
  --bar: #6F9BE0; --bar-track: #202B40;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
  --header-bg: #0E1521;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: 'Inter', system-ui, sans-serif; font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); min-height: 100vh; }
h1, h2, h3, .display { font-family: 'Sora', 'Inter', sans-serif; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
a { color: inherit; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--action); color: var(--on-action); }
.btn-primary:hover { background: var(--action-hover); }
.btn-accent { background: var(--green); color: #fff; }
.btn-accent:hover { background: #13A811; }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-quiet { background: transparent; color: var(--muted); padding: 0 10px; }
.btn-quiet:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; background: transparent; border: none; color: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: rgba(127, 140, 180, .16); }
.btn-icon svg { width: 18px; height: 18px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Formularios */
label.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.input, select.input, textarea.input { width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--green); box-shadow: var(--focus); }
.input::placeholder { color: var(--faint); }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--faint); margin-top: 4px; }
input[type=color].input { padding: 3px; width: 54px; cursor: pointer; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--green); }

/* Interruptor */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 22px; cursor: pointer; transition: background .2s; }
.switch span::before { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }

/* Tarjetas */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.chip.plain::before { display: none; }
.chip.open { background: var(--ok-soft); color: var(--ok); }
.chip.draft { background: var(--warn-soft); color: var(--warn); }
.chip.closed { background: var(--surface-3); color: var(--muted); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(3, 8, 30, .55); display: none; align-items: flex-start; justify-content: center; z-index: 100; padding: 6vh 16px 16px; overflow-y: auto; backdrop-filter: blur(2px); }
.modal-bg.open { display: flex; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; padding: 24px; animation: pop .16s ease-out; }
.modal.wide { max-width: 860px; }
.modal h2 { font-size: 20px; margin-bottom: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Avisos */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #141A33; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); border-left: 4px solid var(--green); animation: pop .16s ease-out; max-width: 92vw; }
.toast.err { border-left-color: var(--red); }

/* Tablas */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--surface-2); }

/* Logo */
.logo-light { display: block; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

/* Accesibilidad */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Ver / ocultar contraseña */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 32px; border: none; background: transparent; color: var(--muted); border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pw-eye:hover { color: var(--text); background: var(--surface-3); }
.pw-eye svg { width: 18px; height: 18px; }
