/* ============================================================
   app.css — Sistema de diseño "Ópticas Premium"
   Compartido por: panel admin (lista/editar/resultados) y encuesta público.
   Marca: azul marino + cian. Tipografía: Open Sans.
   ============================================================ */

:root {
  /* Marca */
  --navy: #0a3c62;
  --navy-deep: #062a47;
  --accent: #1096c5;
  --accent-2: #0e7fa8;
  --accent-soft: #6cc4e2;
  --accent-wash: #e8f3f9;
  --dorado: #dbb742;
  --dorado-2: #b3861f;

  /* Neutros fríos */
  --paper: #ffffff;
  --cream: #f1f6fa;
  --ink: #12304c;
  --muted: #47525e;
  --faint: #93a6ba;
  --line: #dde8f0;
  --line-soft: #eaf1f6;
  --bg: #eef3f8;

  /* Semánticos */
  --ok: #1098b0;
  --ok-bg: #e2f4f1;
  --ok-ink: #0c6b62;
  --warn-bg: #fef3e0;
  --warn-ink: #9a6a1a;
  --err: #c0392b;
  --err-bg: #fdecea;

  /* Radios y profundidad */
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --shadow: 0 24px 60px -28px rgba(8, 40, 66, .50);
  --shadow-sm: 0 10px 26px -16px rgba(8, 40, 66, .45);
  --shadow-xs: 0 2px 8px -4px rgba(8, 40, 66, .35);
  --ring: 0 0 0 4px rgba(16, 150, 197, .16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Open Sans', system-ui, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent-soft);
  color: var(--navy-deep);
}

/* ============================================================
   TIPOGRAFÍA
   ============================================================ */
h1,
h2 {
  font-family: 'Open Sans', sans-serif;
  color: var(--dorado);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
}

h1 {
  font-size: clamp(22px, 2.4vw, 28px);
}

h2 {
  font-size: clamp(19px, 2vw, 23px);
  margin-bottom: 7px;
  text-align: center;
}

/* Título oro metálico (encuesta + login) · mismo look que .btn-next */
.login-titulo,
#pantalla-form h2 {
  background-image: linear-gradient(
    90deg,
    #b3861f 0%,
    #cfa636 22%,
    #dbb742 32%,
    #cfa636 42%,
    #b3861f 62%,
    #d9b556 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-transform: uppercase;
  letter-spacing: 0.015em;
}

h3 {
  font-family: 'Open Sans', sans-serif;
  color: var(--navy);
  line-height: 1.15;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.lead {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 18px;
}

.muted {
  color: var(--muted);
}

/* ============================================================
   LAYOUT PÚBLICO (tarjeta centrada sobre atmósfera marina)
   ============================================================ */
body.layout-publico {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background:
    radial-gradient(900px 520px at 82% -8%, rgba(108, 196, 226, .28), transparent 60%),
    radial-gradient(820px 520px at -8% 112%, rgba(16, 150, 197, .26), transparent 58%),
    linear-gradient(158deg, #0e4a72 0%, #072539 78%);
  position: relative;
}

body.layout-publico::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}

/* ============================================================
   LAYOUT ADMIN (app shell)
   ============================================================ */

.admin-main {
  max-width: 940px;
  margin: 0 auto;
  padding: 30px 22px 96px;
  animation: rise .5s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.admin-titulo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.admin-titulo h1 {
  position: relative;
  padding-left: 14px;
}

.admin-titulo h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  border-radius: 99px;
  background: linear-gradient(var(--accent), var(--accent-soft));
}

/* ============================================================
   SUPERFICIES
   ============================================================ */
.card {
  width: 100%;
  max-width: 560px;
  background: var(--paper);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  z-index: 1;
  animation: pop .5s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(.985);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

/* ---- Cabecera pública con logo ---- */
.topbar {
  background: linear-gradient(135deg, var(--navy), var(--navy-deep));
  padding: 10px 15px;
  color: #fff;
  position: relative;
  overflow: hidden;
  /* Reserva alto para el botón "Volver" (absolute) cuando saludo/barra se ocultan
     (p. ej. pantalla de gracias). En vista normal el contenido ya supera este alto. */
  min-height: 46px;
  box-sizing: border-box;
}

.topbar::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -80px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(108, 196, 226, .35), transparent 70%);
}

.brand {
  display: flex;
  justify-content: center;
  position: relative;
}

.logo-img {
  display: block;
  height: 120px;
  width: auto;
}

.eyebrow {
  text-align: center;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-soft);
  font-weight: 600;
}

.progress {
  height: 6px;
  background: rgba(255, 255, 255, .16);
  border-radius: 99px;
  margin-top: 14px;
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  width: 20%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
  border-radius: 99px;
}

.step-label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-top: 8px;
  font-weight: 600;
}

/* ---- Cuerpo ---- */
.body {
  padding: 12px 30px 12px;
}

.screen {
  display: none;
  animation: fade .45s ease;
}

.screen.active {
  display: block;
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   CAMPOS
   ============================================================ */
.field {
  margin-bottom: 12px;
}

label.q,
.q {
  display: block;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 5px;
  color: var(--ink);
}

input[type=text],
input[type=date],
input[type=time],
input[type=number],
select,
textarea {
  width: 100%;
  padding: 7px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 15px;
  background: var(--cream);
  color: var(--ink);
  transition: border-color .18s, background .18s, box-shadow .18s;
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background-color: #fff;
  box-shadow: var(--ring);
}

textarea {
  resize: vertical;
  min-height: 70px;
}

.input-err,
.input-err:focus {
  border-color: var(--err);
}

.input-err:focus {
  box-shadow: 0 0 0 4px rgba(192, 57, 43, .15);
}

/* ---- Opciones (radio/checkbox) ---- */
.opt {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  background: var(--cream);
  transition: border-color .16s, background .16s, box-shadow .16s, transform .16s;
  font-size: 14.5px;
}

.opt:hover {
  border-color: var(--accent-soft);
  background: #fff;
}

.opt input {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex: none;
}

.opt.sel {
  border-color: var(--accent);
  background: #daf6ff;
  box-shadow: 0 0 0 3px rgba(16, 150, 197, .14);
}

/* ---- Opción "Otro" con campo en línea (estilo Google Forms) ---- */
.opt-otro {
  gap: 8px;
}

.otro-tag {
  flex: none;
}

.opt-otro .other-line {
  flex: 1;
  width: auto;
  min-width: 0;
  height: auto;
  padding: 2px 2px 4px;
  border: none;
  border-bottom: 1.5px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 14.5px;
  transition: border-color .16s;
}

.other-line::placeholder {
  font-size: smaller;
}

.opt-otro .other-line:focus {
  outline: none;
  border-bottom: 2px solid var(--accent);
  background: transparent;
  box-shadow: none;
}

.opt-otro.sel .other-line {
  border-bottom-color: var(--accent);
}

/* ---- Estrellas / escala ---- */
.stars {
  display: flex;
  gap: 8px;
  font-size: 33px;
  line-height: 1;
}

.stars span {
  cursor: pointer;
  color: #cdd9e2;
  transition: transform .12s, color .12s;
}

.stars span:hover {
  transform: scale(1.18) rotate(-4deg);
}

.stars span.on {
  color: var(--dorado);
  text-shadow: 0 4px 12px rgb(195 184 7 / 40%);
}

.escala {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.escala label {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.escala input {
  accent-color: var(--accent);
  width: 19px;
  height: 19px;
}

.escala-ends {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

/* ============================================================
   BOTONES
   ============================================================ */
/* Base compartida: aplica a <button> Y a enlaces <a> usados como botón */
button,
.btn,
.btn-next,
.btn-prev,
.btn-sec,
.btn-ghost {
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.1;
  border: none;
  cursor: pointer;
  padding: 11px 22px;
  border-radius: 99px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  transition: transform .16s, box-shadow .16s, background .16s, color .16s, border-color .16s;
}

/* Botón oro metálico cepillado (login + envío de encuesta) */
.btn-next {
  /* capa 1: vetas cepilladas horizontales · capa 2: degradado metálico vertical */
  background-image:
    linear-gradient(
      90deg,
      #cfa636 0%,
    #cfa636 12%,
    #e7c75c 32%,
    #cfa636 42%,
    #b3861f 62%,
    #d6b137 100%);
  color: linear-gradient(135deg, var(--navy), var(--navy-deep));
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 800;
  border-radius: 14px;
  padding: 13px 30px;
  border: 1px solid rgba(120, 78, 8, 0.65);
  text-shadow: 0 1px 0 rgba(255, 248, 210, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    inset 0 -3px 4px rgba(120, 70, 0, 0.4),
    inset 0 0 0 1px rgba(255, 240, 190, 0.25),
    var(--shadow-sm);
}

.btn{
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 12px 26px -12px rgba(0, 123, 168, 0.85);
}

.btn-next:hover {
  transform: translateY(-2px);
  filter: brightness(1.06) saturate(1.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -3px 4px rgba(120, 70, 0, 0.4),
    inset 0 0 0 1px rgba(255, 245, 200, 0.35),
    0 9px 20px rgba(60, 40, 0, 0.45);
}

.btn:hover{
  transform: translateY(-2px);
  box-shadow: 0 18px 32px -14px rgba(16, 150, 197, .85);
}

.btn:active {
  transform: translateY(0);
}

.btn-next:active {
  transform: translateY(0);
  filter: brightness(0.96);
  box-shadow:
    inset 0 2px 5px rgba(90, 55, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 2px 5px rgba(60, 40, 0, 0.3);
}

.btn:disabled,
.btn-next:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-prev {
  background: transparent;
  color: var(--muted);
}

.btn-prev:hover {
  color: var(--navy);
}

.btn-sec {
  background: #fff;
  color: var(--navy);
  border: 1.5px solid var(--line);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-sec:hover {
  border-color: var(--accent-soft);
  color: var(--accent-2);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-ghost:hover {
  color: var(--navy);
  background: var(--accent-wash);
}

.btn-sm {
  padding: 8px 15px;
  font-size: 13px;
}

.btn svg,
.btn-sec svg,
.btn-ghost svg {
  flex: none;
  pointer-events: none;
}

/* Enlace-botón inactivo (p. ej. "Abrir" sin slug todavía). */
a.btn-sec.disabled {
  opacity: .5;
  pointer-events: none;
}

.row-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 18px 22px;
  flex-direction: column;
}

/* ============================================================
   ESTADOS / VARIOS
   ============================================================ */
.center {
  text-align: center;
  padding: 14px 0 4px;
}

.seal {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: -5px auto 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--dorado), var(--dorado-2));
  color: #fff;
  font-size: 32px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 4px 10px rgba(60, 40, 0, .3);
}

.err {
  color: var(--err);
  font-size: 12.5px;
  margin-top: 6px;
  display: none;
  font-weight: 600;
}

.err.show {
  display: block;
}

.req {
  color: var(--err);
}

.chip {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .6px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 99px;
}

.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  background: currentColor;
  opacity: .8;
}

.chip-borrador {
  background: var(--warn-bg);
  color: var(--warn-ink);
}

.chip-publicado {
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.chip-archivado {
  background: #eceff3;
  color: #67788a;
}


/* ============================================================
   LISTA DE ENCUESTAS
   ============================================================ */
.lista-forms {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-left: 4px solid transparent;
  transition: border-color .18s, transform .18s, box-shadow .18s;
  animation: rise .45s ease both;
  position: relative;
  z-index: 1;
}

/* La fila con el menú abierto se eleva sobre las siguientes para que no lo tapen. */
.form-row:has(.menu-wrap.abierto) {
  z-index: 60;
}

.form-row:hover {
  border-left-color: var(--accent);
  transform: translateX(2px);
  box-shadow: var(--shadow);
}

.form-row-info {
  min-width: 0;
}

.form-row-titulo {
  font-weight: 800;
  font-size: 17px;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  letter-spacing: -.01em;
}

.form-row-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 5px;
}

/* ---- Acciones por fila: botones de icono ---- */
.row-acciones {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.icono-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, color .15s, background .15s, transform .15s;
}

.icono-btn:hover {
  border-color: var(--accent-soft);
  color: var(--accent-2);
  transform: translateY(-1px);
}

.icono-btn.peligro {
  color: var(--err);
  border-color: #f0c9c4;
}

.icono-btn.peligro:hover {
  background: var(--err-bg);
  border-color: var(--err);
}

.icono-btn svg {
  display: block;
}

/* ---- Menú desplegable (3 puntos) ---- */
.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  min-width: 184px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(.98);
  transform-origin: top right;
  transition: opacity .16s, transform .16s, visibility .16s;
}

.menu-wrap.abierto .menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(40%) scale(1);
}

.menu-wrap.abierto>.icono-btn {
  border-color: var(--accent);
  color: var(--accent-2);
  background: var(--accent-wash);
}

.menu a,
.menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  justify-content: flex-start;
}

.menu a:hover,
.menu button:hover {
  background: var(--cream);
  color: var(--navy);
}

.menu svg {
  color: var(--muted);
  flex: none;
}

.menu a:hover svg,
.menu button:hover svg {
  color: var(--accent-2);
}

.menu .item-ok {
  color: var(--ok-ink);
}

.menu .item-ok svg {
  color: var(--ok-ink);
}

.menu .item-ok:hover {
  background: var(--ok-bg);
}

/* ============================================================
   CONSTRUCTOR (builder)
   ============================================================ */
.builder {
  max-width: 700px;
  margin: 0 auto;
}

.builder-top {
  position: sticky;
  top: 10px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}

.builder-top .sp {
  flex: 1;
}

/* En móvil: "Volver" arriba, los 3 botones reparten el ancho en una fila */
@media (max-width: 600px) {
  .builder-top {
    gap: 8px;
    padding: 10px;
  }

  .builder-top>a {
    flex: 1 1 100%;
    text-align: left;
  }

  .builder-top .sp,
  .builder-top>#save-status {
    display: none;
  }

  .builder-top>button {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 13px;
  }

  .builder-top>button svg {
    flex: none;
  }
}

/* ---- Tarjeta de cabecera (título + descripción), estilo Google Forms ---- */
.builder-cabecera {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 8px solid var(--accent);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 26px 28px 22px;
  margin-bottom: 20px;
}

.builder-titulo {
  width: 100%;
  font-weight: 700;
  font-size: 30px;
  color: var(--navy);
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 4px 2px 10px;
  letter-spacing: -.02em;
}

.builder-titulo::placeholder {
  color: var(--faint);
  font-weight: 700;
}

.builder-titulo:focus {
  outline: none;
  border-bottom: 2px solid var(--accent);
  box-shadow: none;
  background: transparent;
}

/* ---- Editor de texto enriquecido (Quill) integrado con la marca ---- */
.rich-editor {
  margin-top: 14px;
}

.rich-editor .ql-toolbar.ql-snow {
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  background: var(--cream);
  padding: 6px 8px;
}

.rich-editor .ql-container.ql-snow {
  border: 1px solid var(--line);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
}

.rich-editor .ql-editor {
  min-height: 70px;
  color: var(--ink);
  line-height: 1.5;
}

.rich-editor .ql-editor.ql-blank::before {
  color: var(--faint);
  font-style: normal;
}

.rich-editor .ql-snow .ql-stroke {
  stroke: var(--muted);
}

.rich-editor .ql-snow .ql-fill {
  fill: var(--muted);
}

.rich-editor .ql-snow.ql-toolbar button:hover .ql-stroke,
.rich-editor .ql-snow .ql-toolbar button:hover .ql-stroke,
.rich-editor .ql-snow.ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--accent-2);
}

.rich-editor .ql-snow.ql-toolbar button:hover .ql-fill,
.rich-editor .ql-snow.ql-toolbar button.ql-active .ql-fill {
  fill: var(--accent-2);
}

.rich-editor.rich-mini .ql-editor {
  min-height: 44px;
  font-size: 13px;
}

.rich-editor.rich-mini .ql-toolbar.ql-snow {
  padding: 4px 6px;
}

/* Tooltips instantáneos en los botones de la barra (sin el retardo del title nativo).
   La toolbar de Quill es hermana del .rich-editor, no hija → se apunta a .ql-toolbar directo. */
.ql-toolbar button[data-tip] {
  position: relative;
}

.ql-toolbar button[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-deep);
  color: #fff;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  padding: 6px 9px;
  border-radius: 7px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  visibility: hidden;
  transition: opacity .1s ease;
  pointer-events: none;
  z-index: 50;
}

.ql-toolbar button[data-tip]::before {
  content: "";
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--navy-deep);
  opacity: 0;
  visibility: hidden;
  transition: opacity .1s ease;
  pointer-events: none;
  z-index: 50;
}

.ql-toolbar button[data-tip]:hover::after,
.ql-toolbar button[data-tip]:hover::before {
  opacity: 1;
  visibility: visible;
}

/* ---- HTML renderizado de descripciones (público y vista previa) ---- */
.rich-content {
  line-height: 1.55;
}

.rich-content p {
  margin: 0 0 8px;
}

.lead.rich-content p:last-child {
  text-align: center;
}
.lead.login-subtitulo.rich-content p {
  margin: 10px 0px;
  text-align: start;
}

.rich-content ul,
.rich-content ol {
  margin: 6px 0 8px;
  padding-left: 22px;
}

.rich-content li {
  margin-bottom: 3px;
}

.rich-content a {
  color: var(--accent-2);
  text-decoration: underline;
}

.rich-content a:hover {
  color: var(--accent);
}

.rich-content strong,
.rich-content b {
  font-weight: 700;
}

#save-status {
  font-size: 12.5px;
  min-width: 60px;
  font-weight: 700;
}

.preguntas {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pregunta-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  transition: box-shadow .18s, transform .12s;
}

.pregunta-card:hover {
  box-shadow: var(--shadow);
}

.pc-top {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
}

.drag {
  cursor: grab;
  color: #b3c4d3;
  font-size: 19px;
  line-height: 1;
  padding: 7px;
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  transition: background .15s, color .15s;
}

.drag:hover {
  background: var(--accent-wash);
  color: var(--accent);
}

.drag:active {
  cursor: grabbing;
}

.pc-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  padding: 0 2px 0 4px;
  flex-shrink: 0;
}

.pc-etiqueta {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  padding: 5px;
}

.pc-tipo {
  flex: none;
  width: auto;
  min-width: 158px;
  font-size: 13.5px;
  padding: 6px;
  font-weight: 600;
}

.pc-cuerpo {
  margin: 6px 0 14px;
}

.pc-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  margin-top: 8px;
}

.pc-foot .sp {
  flex: 1;
}

.pc-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background .15s;
}

.pc-toggle:hover {
  background: var(--cream);
}

.pc-toggle input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* Opciones dentro de una tarjeta */
.op-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.op-drag {
  cursor: grab;
  color: #c2cfdb;
  font-size: 16px;
  line-height: 1;
  padding: 4px 2px;
  flex: none;
  touch-action: none;
  user-select: none;
  transition: color .15s;
}

.op-drag:hover { color: var(--accent); }
.op-drag:active { cursor: grabbing; }

.op-marca {
  width: 17px;
  height: 17px;
  border: 2px solid #c2cfdb;
  border-radius: 4px;
  flex: none;
}

.op-marca.radio,
.op-marca.estrella {
  border-radius: 50%;
}

.op-row input.op-text {
  width: -webkit-fill-available;
  padding: 8px 11px;
  font-size: 14px;
  background: #fbfdff;
}

.op-quitar {
  background: transparent;
  border: none;
  color: #b9c6d3;
  cursor: pointer;
  font-size: 19px;
  padding: 2px 9px;
  border-radius: 8px;
  line-height: 1;
  transition: color .15s, background .15s;
}

.op-quitar:hover {
  color: var(--err);
  background: var(--err-bg);
}

.op-agregar {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 2px;
}

.op-agregar:hover {
  color: var(--accent-2);
  text-decoration: underline;
}

.mini {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.mini input,
.mini select {
  width: auto;
  min-width: 70px;
  padding: 4px;
  font-size: 13px;
}

.preview-estatico {
  color: var(--faint);
  font-size: 14px;
  background: var(--cream);
  border: 1.5px dashed var(--line);
  border-radius: var(--r-sm);
  padding: 11px 14px;
}

/* Rail vertical de acciones por pregunta (flota fuera del card, no le quita espacio) */
.pregunta-row {
  position: relative;
  margin-bottom: 14px;
}

.pc-rail {
  position: absolute;
  top: 18px;
  left: -52px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2;
}

.rail-btn {
  width: 40px;
  height: 34px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
  padding: 0;
  transition: background .15s, color .15s, border-color .15s, transform .1s, box-shadow .15s;
}

.rail-btn svg {
  display: block;
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  pointer-events: none;
}

.rail-btn:hover {
  background: var(--accent-wash);
  color: var(--accent);
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-sm);
}

.rail-btn:active {
  transform: scale(.94);
}

/* Variante verde — "Nueva pregunta" */
.rail-btn.ok {
  color: var(--ok-ink);
  border-color: #b8e2d8;
}

.rail-btn.ok:hover {
  background: var(--ok-bg);
  color: var(--ok-ink);
  border-color: var(--ok);
}

/* Variante roja — "Eliminar" */
.rail-btn.peligro {
  color: var(--err);
  border-color: #f3c2bc;
}

.rail-btn.peligro:hover {
  background: var(--err-bg);
  color: var(--err);
  border-color: var(--err);
}

.pregunta-row .pregunta-card {
  margin-bottom: 0;
}

/* En móvil, el rail va DEBAJO del card, en fila */
@media (max-width: 1080px) {
  .pregunta-row {
    display: flex;
    flex-direction: column;
  }

  .pregunta-row .pregunta-card {
    order: 1;
  }

  .pc-rail {
    position: static;
    order: 2;
    flex-direction: row;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
  }
}

.enlace-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-direction: row;
}

.enlace-head strong {
  flex: 1;
  font-size: 15px;
  color: var(--navy);
}

.row-enlace {
  display: flex;
  align-items: center;
  margin-top: 0;
  font-size: 13px;
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
}

.row-enlace .enlace-base {
  color: var(--muted);
  white-space: nowrap;
}

.row-enlace .enlace-slug {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--accent-2);
  border: none;
  border-bottom: 1px dashed var(--border, #cbd5e1);
  background: transparent;
  padding: 2px 0;
}

.row-enlace .enlace-slug:focus {
  outline: none;
  border-bottom-color: var(--accent-2);
}

.row-enlace .enlace-slug:disabled {
  color: var(--faint);
  border-bottom-style: solid;
  border-bottom-color: var(--line-soft);
  cursor: not-allowed;
}

.enlace-hint {
  font-size: 12px;
  margin-top: 8px;
}

/* ---- Modal biblioteca de imágenes ---- */
body.no-scroll {
  overflow: hidden;
}

.media-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 30, 52, .6);
  backdrop-filter: blur(4px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  animation: fade .2s ease;
  overscroll-behavior: contain;
}

.media-modal {
  position: relative;
  background: var(--paper);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  width: min(720px, 100%);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.media-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.media-head strong {
  font-size: 16px;
  color: var(--navy);
  flex: 1;
}

.media-cerrar {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--faint);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--r-sm);
}

.media-cerrar:hover {
  background: var(--line-soft);
  color: var(--navy);
}

.media-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--cream);
  border-bottom: 1px solid var(--line-soft);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  padding: 16px 18px;
  /* flex:1 + min-height:0 dan a la rejilla una altura acotada dentro del modal,
     condición para que su propio overflow scrollee (sin esto, crece y el modal
     comprime/recorta las filas). */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.media-vacio {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--faint);
  padding: 30px 0;
}

.media-card {
  position: relative;
  border: 2px solid var(--line);
  border-radius: var(--r);
  background:
    linear-gradient(45deg, var(--line-soft) 25%, transparent 25%) -7px 0 / 14px 14px,
    linear-gradient(-45deg, var(--line-soft) 25%, transparent 25%) -7px 0 / 14px 14px,
    var(--paper);
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s ease, transform .12s ease, box-shadow .15s ease;
}

.media-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* Imagen recién importada: resalte temporal para que el usuario la ubique. */
.media-card.recien {
  border-color: var(--accent);
  animation: media-recien 1.8s ease-out 2;
}

@keyframes media-recien {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 150, 197, 0); }
  30% { box-shadow: 0 0 0 4px rgba(16, 150, 197, .35); }
}

.media-card img {
  display: block;
  width: 100%;
  height: 96px; /* altura fija: el aspect-ratio no es fiable en algunos webviews móviles */
  object-fit: contain;
  padding: 10px;
  box-sizing: border-box;
}

/* Badge "en uso" */
.media-card .media-uso {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ok-ink);
  background: var(--ok-bg);
  border-radius: 999px;
  padding: 2px 7px;
}

/* Botón "Seleccionar" activo */
.media-seleccionar.activo {
  background: var(--err-bg);
  border-color: var(--err);
  color: var(--err);
}

/* Marca ✓ de selección: solo visible en modo selección, sobre imágenes sin uso. */
.media-tick {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--faint);
  color: transparent;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.media-modal.modo-seleccion .media-card:not(.en-uso) .media-tick {
  display: inline-flex;
}

.media-modal.modo-seleccion .media-card.sel {
  border-color: var(--err);
  box-shadow: 0 0 0 3px var(--err-bg);
}

.media-modal.modo-seleccion .media-card.sel .media-tick {
  background: var(--err);
  border-color: var(--err);
  color: #fff;
}

/* En modo selección, lo "en uso" no es elegible. */
.media-modal.modo-seleccion .media-card.en-uso {
  opacity: .5;
  cursor: not-allowed;
}

.media-modal.modo-seleccion .media-card:hover {
  transform: none;
}

.media-modal.modo-seleccion .media-card:not(.en-uso):hover {
  border-color: var(--err);
}

.media-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  background: var(--cream);
}

.media-foot .media-sel-info {
  font-size: 13px;
  color: var(--muted);
}

.media-importar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* --- Sub-panel "Ajustar imagen" --- */
.media-ajuste {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  overflow-y: auto;
}

/* En modo ajuste se oculta la rejilla y se muestra el panel. */
.media-modal.modo-ajuste .media-grid,
.media-modal.modo-ajuste .media-sub,
.media-modal.modo-ajuste .media-foot,
.media-modal.modo-ajuste .media-importar,
.media-modal.modo-ajuste .media-seleccionar {
  display: none;
}

.media-modal.modo-ajuste .media-ajuste {
  display: flex;
}

.media-ajuste-prev {
  align-self: center;
  width: 210px;
  height: 210px;
  border-radius: var(--r);
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(45deg, var(--line-soft) 25%, transparent 25%) -8px 0 / 16px 16px,
    linear-gradient(-45deg, var(--line-soft) 25%, transparent 25%) -8px 0 / 16px 16px,
    var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-ajuste-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: grab;
  touch-action: none; /* el arrastre mueve la imagen, no hace scroll */
}

.media-ajuste-canvas.arrastrando {
  cursor: grabbing;
}

.media-ajuste-hint {
  text-align: center;
  font-size: 12px;
  color: var(--faint);
  margin: -6px 0 0;
}

.media-ajuste-ctrl {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.media-ajuste-fila {
  display: block;
}

.media-ajuste-fila-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

.media-ajuste-pct {
  color: var(--accent-2);
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
}

.media-ajuste-fila input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.media-ajuste-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
}

.media-ajuste-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.media-ajuste-check input:disabled {
  opacity: .5;
}

.media-ajuste-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* Modal biblioteca en móvil */
@media (max-width: 600px) {
  .media-overlay {
    padding: 10px;
    align-items: flex-end;
  }

  .media-modal {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }

  .media-head {
    flex-wrap: wrap;
    padding: 12px 14px;
    gap: 8px;
  }

  .media-head strong {
    flex: 1 1 100%;
    font-size: 15px;
  }

  .media-head .media-importar,
  .media-head .media-seleccionar {
    flex: 1;
    justify-content: center;
  }

  .media-cerrar {
    position: absolute;
    top: 8px;
    right: 10px;
  }

  .media-sub {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 8px 14px;
  }

  .media-grid {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 10px;
    padding: 12px 14px;
  }

  .media-card img {
    height: 78px;
    padding: 8px;
  }

  .media-foot {
    padding: 10px 14px;
  }
}

.sortable-ghost {
  opacity: .4;
}

.sortable-chosen {
  box-shadow: 0 22px 44px -18px rgba(10, 60, 98, .55);
}

/* Overlay de vista previa */
.op-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 30, 52, .6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  overflow: auto;
  animation: fade .25s ease;
}

.op-overlay-inner {
  width: 100%;
  max-width: 600px;
}

.op-cerrar {
  display: block;
  margin: 0 0 12px auto;
  background: #fff;
  color: var(--navy);
  border: none;
  border-radius: 99px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

/* Pestañas de la vista previa: Encuesta / Login / Gracias */
.op-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin: 0 auto 14px;
  padding: 4px;
  background: rgba(255, 255, 255, .14);
  border-radius: 99px;
  width: fit-content;
}
.op-tab {
  background: transparent;
  color: #fff;
  border: none;
  border-radius: 99px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.op-tab:hover { background: rgba(255, 255, 255, .15); }
.op-tab.activo {
  background: #fff;
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   RESULTADOS
   ============================================================ */
.res-cards {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.res-cards .panel {
  flex: 1;
  min-width: 150px;
  position: relative;
  overflow: hidden;
}

.res-cards .panel::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--accent-wash);
}

.res-cards .muted {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  position: relative;
  z-index: 1;
}

.res-num {
  font-weight: 800;
  font-size: 32px;
  color: var(--navy);
  letter-spacing: -.02em;
  position: relative;
}

.filtros {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-xs);
}

.filtros .campo {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.filtros input {
  width: auto;
}

.resumen-preg {
  margin-bottom: 16px;
}

.resumen-preg h3 {
  font-size: 15px;
  margin-bottom: 12px;
}

.barra {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.barra-track {
  flex: 1;
  height: 12px;
  background: var(--cream);
  border-radius: 99px;
  overflow: hidden;
}

.barra-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  border-radius: 99px;
  animation: grow .6s cubic-bezier(.4, 0, .2, 1) both;
}

@keyframes grow {
  from {
    width: 0 !important;
  }
}

/* Barra "Otro" agrupada: clicable para abrir el detalle de textos libres. */
.barra-otro {
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 6px;
  margin-left: -6px;
  margin-right: -6px;
  transition: background-color .15s ease;
}
.barra-otro:hover,
.barra-otro:focus-visible {
  background: var(--cream);
  outline: none;
}
.barra-otro::after {
  content: '🔍';
  font-size: 12px;
  margin-left: 6px;
  opacity: .55;
}

/* Listado en el modal de "Otros". */
.lista-otros {
  text-align: left;
  margin: 0;
  padding-left: 20px;
  max-height: 360px;
  overflow: auto;
}
.lista-otros li {
  font-size: medium;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border-soft, #eee);
}
.lista-otros li:last-child {
  border-bottom: 0;
}

/* Ítem de leyenda del dashboard cuando es la fila "Otro" agrupada. */
.dash-leg-otro {
  cursor: pointer;
  border-radius: 6px;
  padding: 2px 4px;
  margin-left: -4px;
  transition: background-color .15s ease;
}
.dash-leg-otro:hover,
.dash-leg-otro:focus-visible {
  background: var(--cream);
  outline: none;
}
.dash-leg-otro::after {
  content: '🔍';
  font-size: 11px;
  margin-left: 6px;
  opacity: .55;
}

/* Buscador dentro del modal de "Otros". */
.filtro-otros-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--border, #d8d8d8);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.filtro-otros-input:focus {
  outline: none;
  border-color: var(--accent, #1096c5);
  box-shadow: 0 0 0 3px rgba(16, 150, 197, .14);
}

.barra-val {
  width: 44px;
  text-align: right;
  color: var(--muted);
  font-weight: 700;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .admin-main {
    padding: 20px 14px 96px;
  }

  .admin-titulo {
    gap: 10px;
  }

  .body {
    padding: 22px 18px 8px;
  }

  .footer {
    padding: 5px 18px 20px;
    flex-direction: column-reverse;
  }

  .footer .btn,
  .footer .btn-next,
  .footer .btn-prev {
    width: 100%;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
  }

  .form-row .row-btns {
    justify-content: flex-start;
  }

  .pc-tipo {
    min-width: 0;
    flex: 1;
  }

  .res-cards .panel {
    min-width: 0;
    flex-basis: calc(50% - 7px);
  }
}

/* ============================================================
   OPCIONES CON ESTILO (tarjetas / píldoras) + emoji
   ============================================================ */
.opt-ico {
  font-size: 1.15em;
  line-height: 1;
}

.opt .opt-ico {
  margin-right: 2px;
}

/* Tarjetas en cuadrícula: llenan la fila y saltan solo si no caben */
.op-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 9px;
}

.opt-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  cursor: pointer;
  padding: 12px 6px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--cream);
  transition: border-color .16s, background .16s, box-shadow .16s, transform .12s;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  min-height: 84px;
}

/* El texto de la tarjeta nunca se sale: envuelve y parte palabras largas */
.opt-card .opt-txt {
  display: block;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  line-height: 1.25;
}

.opt-card:hover {
  border-color: var(--accent-soft);
  background: #fff;
}

.opt-card .opt-ico {
  font-size: 26px;
}

.opt-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.opt-card.sel {
  border-color: var(--accent);
  background: #daf6ff;
  box-shadow: 0 0 0 3px rgba(16, 150, 197, .16);
}

/* Píldoras: llenan la fila estirándose; solo saltan a otra fila si no caben */
.op-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.opt-pill {
  flex: 1 1 160px;
  /* se estiran para ocupar el ancho; min ~160px antes de saltar */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  padding: 11px 16px;
  border: 1.5px solid var(--line);
  border-radius: 99px;
  background: var(--cream);
  transition: border-color .16s, background .16s, box-shadow .16s;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

.opt-pill:hover {
  border-color: var(--accent-soft);
  background: #fff;
}

.opt-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.opt-pill.sel {
  border-color: var(--accent);
  background: #daf6ff;
  box-shadow: 0 0 0 3px rgba(16, 150, 197, .16);
}

/* Casillas (checkbox en lista) en 2 columnas iguales — encuesta público.
   Solo aplica al estilo "lista"; tarjetas y píldoras conservan su propio flujo. */
.layout-publico .field[data-tipo="checkbox"] [data-grupo].op-list,
.layout-publico .field[data-tipo="radio"] [data-grupo].op-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.layout-publico .field[data-tipo="checkbox"] .op-list .opt {
  margin-bottom: 0;
}

/* "Otro" (último elemento) ocupa toda la fila SOLO si quedaría solo (posición impar);
   si comparte fila con otra opción (posición par), ocupa una sola columna. */
.layout-publico .field[data-tipo="checkbox"] .op-list .opt-otro:nth-child(odd) {
  grid-column: 1 / -1;
}

/* ============================================================
   ESCALA SLIDER (fila superior con valor central + track relleno)
   ============================================================ */
.escala-wrap {
  padding-top: 4px;
}

.escala-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 13px;
}

.escala-min,
.escala-max {
  font-weight: 700;
  color: var(--muted);
  flex: none;
}

.escala-actual {
  flex: 1;
  text-align: center;
  font-weight: 700;
  color: var(--accent-2);
  min-height: 1.2em;
  /* reserva altura aunque esté vacío */
}

/* Track con relleno usando una CSS custom property (--pct) controlada desde JS */
.escala-slider {
  --pct: 0%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(to right,
      var(--accent) 0 var(--pct),
      var(--line) var(--pct) 100%);
  outline: none;
  padding: 0;
  margin: 0;
}

/* Firefox: el track va por separado */
.escala-slider::-moz-range-track {
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(to right,
      var(--accent) 0 var(--pct),
      var(--line) var(--pct) 100%);
}

.escala-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(16, 150, 197, .5);
}

.escala-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(16, 150, 197, .5);
}

/* Panel colapsable del constructor para editar etiquetas por número */
.scale-labels-toggle {
  background: var(--cream);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.scale-labels-toggle:hover {
  background: #fff;
  border-color: var(--accent-soft);
}

.scale-labels {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
  padding: 10px;
  background: #fbfdff;
  border: 1px dashed var(--line);
  border-radius: 10px;
}

.scale-labels.abierto {
  display: flex;
}

.scale-lab-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scale-lab-n {
  flex: none;
  width: 28px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-2);
}

.scale-lab-row input {
  font-size: 13px;
  padding: 6px 10px;
}

/* Input de emoji por opción (constructor) */
.op-emoji {
  width: 44px;
  flex: none;
  text-align: center;
  padding: 7px 4px;
  font-size: 16px;
}

input.op-emoji::placeholder {
  opacity: 0.35;
  color: var(--muted);
}

/* Línea de respuesta "Otro" debajo del grupo (estilos tarjetas/píldoras) */
.otro-bajo {
  margin-top: 10px;
  animation: fade .2s ease;
}

.otro-bajo .other-line {
  width: 100%;
  padding: 9px 4px;
  font-size: 15px;
  border: none;
  border-bottom: 2px solid var(--accent);
  border-radius: 0;
  background: transparent;
}

.otro-bajo .other-line:focus {
  outline: none;
  box-shadow: none;
}


/* ============================================================
   MÓVIL: reducir fuente y emojis para aprovechar mejor el ancho
   (aplica solo al encuesta público)
   ============================================================ */
@media (max-width: 480px) {

  .op-row{
    width: 37%;
  }

  /* Pantalla completa: sin fondo marino ni márgenes; la tarjeta ocupa todo */
  body.layout-publico {
    display: block;
    padding: 0;
    background: #fff;
  }

  body.layout-publico::before {
    display: none;
  }

  .layout-publico .card {
    max-width: none;
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
    animation: none;
  }

  .layout-publico .body {
    padding: 18px 16px 6px;
  }

  .layout-publico h2 {
    font-size: 18px;
  }

  .layout-publico .lead {
    font-size: 13px;
  }

  .layout-publico .q {
    font-size: 13.5px;
  }

  /* Tarjetas: celdas más estrechas, texto y emoji más pequeños */
  .layout-publico .op-cards {
    grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
    gap: 7px;
  }

  .layout-publico .opt-card {
    padding: 10px 6px;
    min-height: 70px;
    font-size: 11.5px;
    gap: 4px;
    border-radius: 12px;
  }

  .layout-publico .opt-card .opt-ico {
    font-size: 21px;
  }

  /* Píldoras y casillas ya van en 2 columnas (vista normal); solo compactar en móvil */
  .layout-publico .op-pills {
    gap: 8px;
  }

  .layout-publico .opt-pill {
    padding: 9px 12px;
    font-size: 12.5px;
    gap: 6px;
  }

  .layout-publico .opt-pill .opt-ico {
    font-size: 1em;
  }

  .layout-publico .opt {
    font-size: 13px;
    padding: 9px 12px;
    margin-bottom: 0;
  }

  .layout-publico .stars {
    font-size: 26px;
  }

  /*Diseño movil en el login*/
  .login-card .body{
    display: flex;
    position: absolute;
    padding: 25px;
    text-align: center;
    flex-direction: column;
    align-items: center;
    top: 30%;
  }

  .lead.login-subtitulo.rich-content p {
  font-size: 16px;
  }

  .topbar{
    border-radius: 0px 0px 15px 15px;
    box-shadow: 0 24px 35px -28px #b3861f;
    border-bottom: 4px solid #b3861f;
  }
}
/* --- Estilo base: Para pantallas chicas / Celulares --- */
h2.login-titulo{
  font-size: 33px;
}

/* --- Condicional: Para pantallas normales / Computadoras (desde 768px) --- */
@media (min-width: 768px) {
  h2.login-titulo {
    font-size: x-large;
  }
}

/* Estrellas con etiqueta debajo de cada una (público) — distribuidas uniformemente */
.stars-con-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.stars-con-label .star-item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  line-height: 1;
  text-align: center;
}

.stars-con-label .star {
  font-size: 31px;
  color: #cdd9e2;
}

/* Hover sobre TODO el item (estrella o etiqueta): aplica el efecto a ambos */
.stars-con-label .star-item {
  transition: transform .12s;
}

.stars-con-label .star-item:hover {
  transform: scale(1.12);
}

.stars-con-label .star-item:hover .star {
  color: var(--dorado);
}

.stars-con-label .star-item:hover .star-lab {
  color: var(--ink);
}

.stars-con-label .star-item.on .star {
  color: var(--dorado);
}

.star-lab {
  font-size: 12.5px;
  font-weight: bold;
  color: #c8b88f;
  transition: color .12s;
}

.stars-con-label .star-item.sel .star-lab {
  color: var(--ink);
  font-weight: bold;
}

/* Etiqueta oculta (estrellas a la izquierda de la seleccionada). visibility en
   vez de display para no descolocar las estrellas. */
.stars-con-label .star-item.lab-oculta .star-lab {
  visibility: hidden;
}

/* Editor: etiquetas por nivel de estrella (constructor) */
.stars-labels {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.star-lab-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.star-lab-n {
  flex: none;
  width: 34px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-2);
}

.star-lab-row input {
  font-size: 13px;
  padding: 6px 10px;
}

/* ============================================================
   LOGIN POR DNI + MULTIPASO + SECCIONES
   ============================================================ */

/* Spacer del footer para empujar Siguiente/Enviar a la derecha */
.footer .sp {
  flex: 1;
}

/* ---- Saludo en el topbar ---- */
.topbar-saludo {
  display: flex;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 10px;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  position: relative;
  justify-content: center;
}

/* Botón "Volver al login" en el topbar (forma pastilla, sobre el fondo navy). */
.topbar-volver {
  position: absolute;
  top: 13px;
  left: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.topbar-volver:hover {
  background: rgba(255, 255, 255, .22);
  border-color: rgba(255, 255, 255, .5);
}

.topbar-volver:disabled {
  opacity: .6;
  cursor: default;
}

.topbar-volver svg {
  flex: none;
}

/* ---- Pasos (multipaso público) ---- */
.paso-head {
  margin: 2px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.paso-titulo {
  font-size: 18px;
  color: var(--navy);
  font-weight: 800;
  letter-spacing: -.01em;
}

.paso-desc {
  font-size: 13.5px;
  line-height: 1.55;
  margin-top: 4px;
}

.paso-head-inline {
  margin-top: 8px;
}

/* ============================================================
   PANTALLA DE LOGIN (vistas/login.php)
   ============================================================ */
.login-card .body {
  padding: 25px;
  text-align: center;
}

.login-banner {
  margin: -4px 0 16px;
  border-radius: var(--r);
  overflow: hidden;
}

.login-banner img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}

.login-titulo {
  margin-bottom: 6px;
}

.login-subtitulo {
  margin-bottom: 18px;
  font-size: small;
}

/* Tamaños de letra de Quill (subtítulo login) en el render público */
.ql-size-small { font-size: 0.75em; }
.ql-size-large { font-size: 1.5em; }
.ql-size-huge { font-size: 2.5em; }

/* Alineación de Quill (subtítulo login) en el render público.
   Especificidad alta para ganar a las reglas base de .lead/.rich-content.
   Sin clase = izquierda (igual que el editor Quill); clases para el resto. */
.lead.login-subtitulo.rich-content p { text-align: left; }
.lead.login-subtitulo.rich-content p.ql-align-center { text-align: center; }
.lead.login-subtitulo.rich-content p.ql-align-right { text-align: right; }
.lead.login-subtitulo.rich-content p.ql-align-justify { text-align: justify; }

.login-form {
  max-width: 320px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-input {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
}

.login-btn {
  width: 100%;
}

.login-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.login-terminos {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.login-terminos input {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  flex: none;
  accent-color: var(--accent);
}

.login-terminos a {
  color: var(--accent-2);
  font-weight: 700;
  text-decoration: underline;
}

.login-registro {
  width: 100%;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.login-error {
  display: none;
  color: var(--err);
  background: var(--err-bg);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
}

.login-error.show {
  display: block;
}

/* ============================================================
   CONSTRUCTOR: tarjeta de sección + panel de login
   ============================================================ */

/* Tarjeta de "Sección" en el constructor (borde dorado para distinguirla) */
.pregunta-card.es-seccion {
  border-left: 4px solid #d8a33a;
  background: linear-gradient(180deg, #fffaf0, #ffffff 60%);
}

.pregunta-card.es-seccion .pc-etiqueta {
  font-size: 17px;
  font-weight: 800;
  color: var(--navy);
}

.seccion-nota {
  font-size: 12.5px;
  margin-top: 10px;
  padding: 8px 12px;
  background: #fff6e6;
  border: 1px dashed #e3c47e;
  border-radius: 10px;
}

/* Panel de configuración de login en la cabecera del editor */
.login-config {
  margin: 16px 0px;
}

.login-config-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.login-config-top input {
  width: auto;
  margin-top: 2px;
}

.login-config-top span {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.login-config-top .muted {
  font-size: 12.5px;
  font-weight: 400;
}

.login-config-campos {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-config .campo {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.login-config .campo input[type="text"] {
  font-weight: 400;
}

.lc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lc-imagen {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  background: var(--cream);
  border-radius: var(--r-sm);
}

.lc-imagen-acciones {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#f-login-imagen-prev, #f-login-logo-prev {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

@media (max-width: 600px) {
  .footer .sp {
    display: none;
  }

  .lc-grid {
    grid-template-columns: 1fr;
  }
}

/* Fix Quill: el editor del subtítulo no debe heredar el peso del .campo, si no
   Quill detecta el texto como negrita y deja el botón B siempre marcado. */
.login-config .campo .rich-editor,
.login-config .campo .rich-editor .ql-editor,
.login-config .campo .rich-editor .ql-editor p {
  font-weight: 400;
  color: var(--ink);
}

/* ============================================================
   ICONOS POR OPCIÓN (emoji o SVG subido)
   ============================================================ */

/* Render público */
.opt-ico-svg {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -2px;
  display: inline-block;
  object-fit: contain;
}

.opt-card .opt-ico-svg {
  width: 33px;
  height: 33px;
  vertical-align: 0;
}

.opt-pill .opt-ico-svg {
  width: 18px;
  height: 18px;
}

/* Constructor */
.op-icono-sel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.op-svg-prev {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
  background: var(--paper);
}

.op-svg-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--cream);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.op-svg-btn:hover {
  background: var(--accent-wash);
  color: var(--accent);
  border-color: var(--accent-soft);
}

.op-icono-quitar {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--err);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}

.op-icono-quitar:hover {
  background: var(--err-bg);
  border-color: var(--err);
}

/* ============================================================
   SORTEO — modal en la vista de resultados
   ============================================================ */

.sorteo-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(8, 30, 50, .58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .2s ease;
  overflow-y: auto;
}

.sorteo-overlay.visible {
  opacity: 1;
}

.sorteo-modal {
  background: var(--paper);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 560px;
  padding: 22px 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 92vh;
  overflow-y: auto;
}

.sorteo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sorteo-titulo {
  font-size: 17px;
  color: var(--navy);
  font-weight: 800;
}

.sorteo-cerrar {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 19px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.sorteo-cerrar:hover {
  background: var(--cream);
  color: var(--navy);
}

.sorteo-filtros {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.sorteo-campo .campo-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

.sorteo-campo input {
  font-size: 14px;
  padding: 9px 12px;
}

.sorteo-contador {
  background: var(--cream);
  border-radius: var(--r-sm);
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
  text-align: center;
}

/* Arena: zona central donde gira y se revela el ganador. */
.sorteo-arena {
  border: 2px dashed var(--line);
  border-radius: var(--r);
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  text-align: center;
}

.sorteo-arena-vacia {
  color: var(--muted);
  font-size: 13.5px;
}

@keyframes sorteoCuenta {
  0% {
    opacity: 0;
    transform: scale(.4);
  }

  35% {
    opacity: 1;
    transform: scale(1);
  }

  85% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

.sorteo-cuenta {
  font-size: 88px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  animation: sorteoCuenta .68s ease both;
}

@keyframes sorteoSpin {
  from {
    transform: translateY(0);
    opacity: .55;
  }

  to {
    transform: translateY(-6px);
    opacity: 1;
  }
}

.sorteo-spin {
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: 1.5px;
  animation: sorteoSpin .12s ease-in-out infinite alternate;
}

@keyframes sorteoGanador {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.92);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.sorteo-ganador {
  background: linear-gradient(135deg, #fffaf0, var(--paper));
  border: 2px solid #d8a33a;
  border-radius: var(--r);
  padding: 18px 22px;
  width: 100%;
  text-align: center;
  animation: sorteoGanador .35s ease both;
  box-shadow: 0 12px 26px -16px rgba(216, 163, 58, .8);
}

.sorteo-ganador-puesto {
  font-size: 12px;
  font-weight: 800;
  color: #b1801a;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.sorteo-ganador-nombre {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy-deep);
  line-height: 1.2;
}

.sorteo-ganador-dni {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 1px;
}

/* Lista de ganadores aceptados (se va apilando) */
.sorteo-lista {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sorteo-lista-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--cream);
  border-radius: var(--r-sm);
  font-size: 13.5px;
}

.sorteo-lista-puesto {
  font-weight: 800;
  color: var(--accent);
}

.sorteo-lista-nombre {
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sorteo-lista-dni {
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 1px;
}

.sorteo-botonera {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Historial */
.sorteo-historial {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sorteo-historial-item {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  background: var(--paper);
}

.sorteo-historial-fecha {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.sorteo-historial-ganador {
  font-size: 13px;
  color: var(--ink);
}

@media (max-width: 600px) {
  .sorteo-filtros {
    grid-template-columns: 1fr;
  }

  .sorteo-modal {
    padding: 18px 14px 20px;
  }

  .sorteo-botonera {
    justify-content: stretch;
  }

  .sorteo-botonera .btn,
  .sorteo-botonera .btn-sec {
    flex: 1;
  }
}

/* ============================================================
   DASHBOARD de resultados
   ============================================================ */
.dash-grid {
  position: absolute;
  display: grid;
  grid-template-columns: repeat(3, minmax(370px, 1fr));
  gap: 16px;
  left: -100px;

}

.dash-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-card-tit {
  font-size: 15px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.25;
}

.dash-sub {
  font-size: 12px;
}

/* Botón toggle del desglose calificación↔persona (asesor / optómetra) */
.dash-cruce-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: 14px;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px dashed var(--line);
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  text-align: left;
}
.dash-cruce-toggle:hover {
  color: var(--accent);
}
.dash-cruce-flecha {
  display: inline-block;
  transition: transform .15s ease;
  font-size: 11px;
  color: var(--muted);
}
.dash-cruce-toggle.abierto .dash-cruce-flecha {
  transform: rotate(90deg);
}
.dash-cruce-panel {
  margin-top: 8px;
}

/* Separador de sección a todo el ancho del grid */
.dash-seccion {
  grid-column: 1 / -1;
  margin: 8px 0 -4px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
  color: var(--navy);
  font-size: 16px;
}

/* Contenedor de un gráfico Chart.js */
.chart-box {
  position: relative;
  height: 170px;
  width: 100%;
}

/* KPIs */
.dash-kpi {
  text-align: center;
}

.dash-kpi .res-num {
  margin-top: 2px;
}

.dash-nps-num {
  font-size: 38px;
}

/* Leyenda manual (donas / nps) */
.dash-leyenda {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-leg-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.dash-leg-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
}

.dash-leg-svg {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex: none;
}

.dash-leg-txt {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.dash-leg-val {
  color: var(--muted);
  font-weight: 700;
  font-size: 12.5px;
}

/* Promedio (escala / estrellas) */
.dash-promedio {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.dash-prom-num {
  font-size: 34px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}

.dash-stars {
  font-size: 22px;
  letter-spacing: 2px;
}

.dash-star {
  color: var(--line);
}

.dash-star.on {
  color: #f39c12;
}

/* NPS grande */
.dash-nps-grande {
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

/* Texto libre */
.dash-nube {
  width: 100%;
  overflow: hidden;
}

.dash-nube canvas {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.dash-textos {
  font-size: 13px;
}

.dash-textos summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent-2);
  padding: 4px 0;
}

.dash-textos-lista {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.dash-texto-item {
  padding: 8px 10px;
  background: var(--cream);
  border-radius: var(--r-sm);
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .dash-grid {
    /* En móvil neutralizamos el position:absolute + left:-100px del desktop
       para que las tarjetas no se desborden por la izquierda del viewport. */
    position: static;
    left: auto;
    grid-template-columns: 1fr;
    width: 100%;
  }
}

/* ============================================================
   PREGUNTAS DEPENDIENTES — botón en opción + modal apilable
   ============================================================ */

/* Botón "🔗" al final de cada .op-row (radio/checkbox).
   Gris cuando no hay dependientes; resaltado con el contador cuando sí. */
.op-dep-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
  flex: none;
}

.op-dep-btn:hover {
  background: var(--accent-wash);
  color: var(--accent-2);
  border-color: var(--accent-soft);
}

.op-dep-btn.tiene {
  background: var(--accent-wash);
  color: var(--accent-2);
  border-color: var(--accent-soft);
}

.op-dep-btn.tiene:hover {
  background: #d6ebf6;
  color: var(--navy-deep);
}

.op-dep-btn.vacio,
.op-dep-btn:disabled {
  opacity: .35;
  cursor: not-allowed;
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.op-dep-btn.vacio:hover,
.op-dep-btn:disabled:hover {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

/* Modal de preguntas dependientes (reusa el patrón de .op-overlay) */
.modal-dep {
  position: fixed;
  inset: 0;
  background: rgba(6, 42, 71, .56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity .18s ease;
  overflow-y: auto;
}

.modal-dep.visible {
  opacity: 1;
}

.modal-dep-caja {
  background: var(--paper);
  border-radius: var(--r);
  max-width: 880px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  border-top: 6px solid var(--accent);
}

.modal-dep-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--line);
}

.modal-dep-titulo {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.35;
}

.modal-dep-opcion {
  color: var(--accent-2);
  background: var(--accent-wash);
  padding: 2px 8px;
  border-radius: 8px;
  margin-left: 2px;
}

.modal-dep-cerrar {
  padding: 11px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 50%;
  height: 33px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  flex: none;
}

.modal-dep-cerrar:hover {
  background: var(--cream);
  color: var(--ink);
}

.modal-dep-lista {
  flex: 1;
  overflow-y: auto;
  padding: 10px 68px;
  background: var(--cream);
}

/* Dentro del modal, el botón "+ Nueva pregunta" del rail es redundante con
   "+ Nueva pregunta dependiente" del pie del modal: lo ocultamos. */
.modal-dep-lista .pc-rail .rail-btn:first-child {
  display: none;
}

.modal-dep-vacio {
  text-align: center;
  padding: 32px 12px;
  font-size: 13px;
  line-height: 1.5;
}

.modal-dep-pie {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
}

/* Tarjetas dentro del modal: misma estructura, fondo ligeramente distinto
   para hint visual de que estamos en otra capa. */
.modal-dep-lista .pregunta-row {
  margin-bottom: 14px;
}

.modal-dep-lista .pregunta-row:last-child {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .modal-dep {
    padding: 12px;
  }

  .modal-dep-head,
  .modal-dep-pie {
    padding: 14px 16px;
  }

  .modal-dep-lista {
    padding: 14px 16px;
  }
}

/* Botón "× Limpiar" del slider de escala (visible solo tras tocarlo) */
.escala-limpiar {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  margin-left: 8px;
  flex: none;
  transition: background .15s, color .15s, border-color .15s;
}

.escala-limpiar:hover {
  background: var(--err-bg);
  color: var(--err);
  border-color: var(--err);
}

.field[data-tipo="radio"] .opt-card,
.field[data-tipo="radio"] .opt-pill,
.field[data-tipo="radio"] .opt {
  position: relative;
}

/* Estrellas: cursor pointer en cada nivel, hint similar al pasar sobre la ya seleccionada */
.star-item.sel:hover .star {
  filter: brightness(0.85);
}

/* ============================================================
   PANTALLA DE GRACIAS (vistas/publico.php #pantalla-gracias)
   ============================================================ */
.gracias-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.gracias-titulo {
  margin-bottom: 6px;
}
.gracias-subtitulo {
  margin-bottom: 4px;
}

/* Caja de sorteo: borde dorado metálico + cabecera con icono y badge. */
.gracias-sorteo {
  width: 100%;
  margin: 18px 0 6px;
  padding: 18px 20px;
  border-radius: 16px;
  border: 2px solid transparent;
  background:
    linear-gradient(#fffdf6, #fffdf6) padding-box,
    linear-gradient(135deg, #fdf2bf, #cfa636 45%, #b3861f 75%, #d9b556) border-box;
  box-shadow: 0 10px 26px -16px rgba(120, 80, 10, 0.55);
  text-align: center;
}
.gracias-sorteo-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px 5px 12px;
  margin-bottom: 10px;
  border-radius: 999px;
  color: #2a1d05;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.06) 0 1px, rgba(90,60,0,.06) 2px 3px),
    linear-gradient(90deg, #e7c75c, #cfa636 55%, #d9b556);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 4px 10px rgba(60,40,0,.3);
}
.gracias-sorteo-icono { display: inline-flex; }
.gracias-sorteo-label {
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-size: 16px;
}
.gracias-sorteo-cont { color: var(--navy-deep); }

/* Acciones: botones apilados a todo el ancho. */
.gracias-acciones {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}
.gracias-btn { width: 100%; }

/* Hoja de compartir propia (fallback cuando no hay navigator.share) */
.share-sheet {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(6, 30, 52, .55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade .2s ease;
}
.share-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px 18px 0 0;
  padding: 16px 18px 22px;
  box-shadow: 0 -12px 40px -16px rgba(6, 30, 52, .5);
  animation: sheetUp .22s ease;
}
@keyframes sheetUp { from { transform: translateY(20px); opacity: .6; } to { transform: none; opacity: 1; } }
.share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.share-head strong { font-size: 16px; color: var(--navy); }
.share-x {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.share-link {
  display: flex;
  align-items: center;
  background: var(--cream);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--navy);
}
.share-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 8px;
}
.share-item {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 4px 2px;
}
.share-ic {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .5);
}
.share-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  text-align: center;
  line-height: 1.2;
}
@media (min-width: 520px) {
  .share-sheet { align-items: center; }
  .share-card { border-radius: 18px; }
}