/* ============================================================
   Sondea — estilos (panel y página pública de encuesta)
   ============================================================ */
:root {
  --bg: #f4f6f8; --card: #ffffff; --line: #e3e8ee; --text: #111827; --muted: #6b7280;
  --accent: #0d9488; --accent-2: #0f766e; --accent-soft: #e6f6f4;
  --danger: #dc2626; --warn: #d97706; --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
svg.lucide { width: 18px; height: 18px; flex: none; vertical-align: -3px; }

/* ---------- Botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: .15s; }
.btn:hover { border-color: #c5ced8; background: #fafbfc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #eceff3; }
.btn.danger { color: var(--danger); }
.btn.icon { padding: 8px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); font: inherit; outline: none; transition: .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 70px; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.err { color: var(--danger); font-size: 13.5px; min-height: 20px; margin: 6px 0; }

/* Interruptor */
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 12px 0; }
.switch input { position: absolute; opacity: 0; }
.switch .track { flex: none; width: 42px; height: 24px; border-radius: 99px; background: #cbd3dc; position: relative; transition: .2s; margin-top: 2px; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { left: 21px; }
.switch b { display: block; }
.switch small { color: var(--muted); }

/* ---------- Conexión ---------- */
#auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 30px 26px; box-shadow: var(--shadow); }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 19px; letter-spacing: -.2px; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.auth-card h1 { font-size: 21px; margin: 18px 0 4px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 18px; }
.link { background: none; border: 0; color: var(--accent-2); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.otp-input { text-align: center; font-size: 26px !important; letter-spacing: 10px; font-weight: 700; }

/* ---------- Panel ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 1000px; margin: 0 auto; padding: 12px 18px; display: flex; align-items: center; gap: 10px; }
main { max-width: 1000px; margin: 0 auto; padding: 22px 18px 80px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 23px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.survey-card { cursor: pointer; transition: .15s; display: flex; flex-direction: column; gap: 10px; }
.survey-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.survey-card h3 { font-size: 16.5px; }
.stats { display: flex; gap: 16px; color: var(--muted); font-size: 13.5px; }
.stats b { color: var(--text); font-size: 15px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent-2); }
.chip.gray { background: #eceff3; color: #556070; }
.chip.amber { background: #fdf1dc; color: #a45a05; }
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty svg.lucide { width: 40px; height: 40px; color: #b7c0cb; margin-bottom: 8px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--accent-2); border-bottom-color: var(--accent); }

/* Editor de preguntas */
.q-card { margin-bottom: 12px; }
.q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.q-num { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-2); font-weight: 800; display: grid; place-items: center; flex: none; font-size: 13.5px; }
.q-head select { width: auto; font-weight: 600; }
.q-title { font-size: 16px !important; font-weight: 600; }
.q-help { margin-top: 8px; font-size: 13.5px !important; }
.opt-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.opt-row .dot { width: 14px; height: 14px; border: 2px solid #b7c0cb; border-radius: 50%; flex: none; }
.opt-row .dot.sq { border-radius: 4px; }
.opt-row .fixed { flex: 1; font-weight: 600; padding: 10px 2px; }
.goto { display: flex; align-items: center; gap: 6px; flex: none; color: var(--muted); }
.goto select { width: 190px; font-size: 13.5px; padding: 8px 10px; }
.goto select.set { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); font-weight: 600; }
.q-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 13.5px; }
.q-foot label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.add-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.saved { font-size: 13px; color: var(--accent-2); opacity: 0; transition: opacity .3s; }
.saved.on { opacity: 1; }

/* Compartir */
.col-card { display: flex; gap: 16px; margin-bottom: 12px; align-items: flex-start; }
.col-card img.qr { width: 132px; height: 132px; border: 1px solid var(--line); border-radius: 10px; flex: none; }
.col-card.off { opacity: .6; }
.linkbox { display: flex; gap: 6px; margin: 8px 0; }
.linkbox input { font-size: 13px; color: var(--muted); }

/* Resultados */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi b { display: block; font-size: 28px; line-height: 1.1; }
.kpi span { color: var(--muted); font-size: 13.5px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 74px; gap: 10px; align-items: center; margin-top: 8px; font-size: 14px; }
.bar { height: 10px; background: #edf0f4; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-row .n { text-align: right; color: var(--muted); font-size: 13px; }
.txt-list { margin: 8px 0 0; padding: 0; list-style: none; max-height: 220px; overflow: auto; }
.txt-list li { padding: 7px 10px; background: #f6f8fa; border-radius: 8px; margin-top: 5px; font-size: 14px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr.rrow { cursor: pointer; }
.tbl tr.rrow:hover td { background: #fafbfc; }
.detail dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
.detail dt { color: var(--muted); font-size: 13px; }
.detail dd { margin: 0; font-weight: 600; }
.table-scroll { overflow-x: auto; }

/* Modal y avisos */
.modal-bg { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); display: grid; place-items: center; padding: 16px; z-index: 100; }
.modal { width: 100%; max-width: 440px; background: #fff; border-radius: 16px; padding: 22px; max-height: 92vh; overflow: auto; }
.modal h2 { font-size: 18px; margin-bottom: 14px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 4000; max-width: 90vw; }
#toast.on { opacity: 1; transform: translateX(-50%); }

/* Recorrido de bienvenida */
#tourWrap { position: fixed; inset: 0; z-index: 3000; }
#tourHole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(15, 20, 40, .55); pointer-events: none; transition: all .25s; }
#tourCard { position: fixed; width: min(340px, calc(100vw - 24px)); background: #fff; border-radius: 14px; padding: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
#tourCard h3 { margin: 2px 0 6px; font-size: 16px; }
#tourCard p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.tour-step { font-size: 11px; font-weight: 700; letter-spacing: .4px; color: var(--accent); }
.tour-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-foot .btn { padding: 7px 12px; font-size: 13px; }
#tourWrap.center { background: rgba(15, 20, 40, .55); }

/* ============================================================
   Página pública: responder la encuesta (pensada para móvil)
   ============================================================ */
body.fill { background: #fff; }
.progress { position: fixed; top: 0; left: 0; right: 0; height: 5px; background: #edf0f4; z-index: 10; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .35s; border-radius: 0 99px 99px 0; }
.fill-wrap { max-width: 620px; margin: 0 auto; min-height: 100dvh; padding: 34px 20px 110px; display: flex; flex-direction: column; }
.fill-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 26px; min-height: 26px; }
.fill-body { flex: 1; display: flex; flex-direction: column; justify-content: center; animation: rise .3s ease; }
@keyframes rise { from { transform: translateY(14px); } to { transform: none; } }
.fill-body h1 { font-size: 27px; letter-spacing: -.3px; }
.fill-body h2 { font-size: 23px; letter-spacing: -.2px; }
.fill-body .desc { color: var(--muted); margin: 10px 0 0; white-space: pre-line; }
.q-count { color: var(--accent-2); font-weight: 700; font-size: 13.5px; margin-bottom: 8px; }
.choices { display: grid; gap: 10px; margin-top: 22px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 15px 16px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; font: inherit; font-size: 16.5px; font-weight: 500; color: var(--text); cursor: pointer; transition: .12s; }
.choice:hover { border-color: #b9c3ce; }
.choice .mark { width: 22px; height: 22px; border: 2px solid #b7c0cb; border-radius: 50%; flex: none; display: grid; place-items: center; transition: .12s; }
.choice.multi .mark { border-radius: 6px; }
.choice.on { border-color: var(--accent); background: var(--accent-soft); }
.choice.on .mark { border-color: var(--accent); background: var(--accent); }
.choice.on .mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.choice.multi.on .mark::after { width: 10px; height: 6px; border-radius: 0; background: none; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.yesno { grid-template-columns: 1fr 1fr; }
.yesno .choice { justify-content: center; font-weight: 700; padding: 22px 12px; font-size: 18px; }
.yesno .choice .mark { display: none; }
.scale { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.scale button { flex: 1; min-width: 44px; padding: 14px 0; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font: inherit; font-size: 17px; font-weight: 700; cursor: pointer; color: var(--text); }
.scale button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fill-body .big { margin-top: 22px; font-size: 17px; padding: 14px; }
.fill-nav { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); }
.fill-nav .in { max-width: 620px; margin: 0 auto; display: flex; gap: 10px; }
.fill-nav .btn { padding: 14px 18px; font-size: 16px; border-radius: 12px; }
.fill-nav .btn.primary { flex: 1; }
.done-ico { width: 68px; height: 68px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 18px; }
.done-ico svg.lucide { width: 34px; height: 34px; }
.fill-err { color: var(--danger); font-size: 14px; margin-top: 12px; min-height: 21px; }
.powered { text-align: center; color: #a3acb8; font-size: 12px; margin-top: 30px; }

@media (max-width: 600px) {
  .goto select { width: 128px; }
  .col-card { flex-direction: column; }
  .kpi b { font-size: 23px; }
  .bar-row { grid-template-columns: 1fr 64px; }
  .bar-row .bar { grid-column: 1 / -1; order: 3; }
  .hide-sm { display: none; }
}
