@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #14171C;
  --bg-raised: #1C2028;
  --line: #2A2F38;
  --ink: #ECEEF1;
  --ink-dim: #9AA1AC;
  --accent: #7DD3C0;
  --accent-dim: #4A6E68;
  --warn: #E8A96B;
  --radius: 14px;
  --accent-fg: #0E1A18;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 40px;
}

.status-bar {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-dim);
}

.signal-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--warn);
  flex-shrink: 0;
  position: relative;
}

.signal-dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid var(--warn);
  opacity: 0;
}

.status-bar.online .signal-dot { background: var(--accent); }
.status-bar.online .signal-dot::after { border-color: var(--accent); animation: pulse 2.2s ease-out infinite; }

@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(1.6); opacity: 0; }
}

.status-text strong { color: var(--ink); font-weight: 600; }

.pending-badge {
  margin-left: auto;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  color: var(--warn);
  font-size: 12px;
}

.btn-sync {
  width: 100%;
  max-width: 480px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 13px;
  background: var(--bg-raised);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  border-radius: 10px;
  padding: 11px 14px;
  margin-bottom: 18px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.btn-sync:active { transform: scale(0.98); }
.btn-sync:disabled { opacity: 0.5; cursor: not-allowed; }

main {
  width: 100%;
  max-width: 480px;
}

header.app-header {
  margin-bottom: 24px;
}

.eyebrow {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 6px;
}

h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--ink-dim);
  font-size: 14px;
  margin: 0;
  white-space: pre-line;
}

.consent-text {
  text-align: justify;
  color: var(--ink);
  line-height: 1.55;
  font-size: 14px;
}

.consent-text p {
  margin: 0 0 12px;
}

.consent-text p:last-child {
  margin-bottom: 0;
}

.progress-track {
  display: flex;
  gap: 6px;
  margin: 22px 0 28px;
}

.progress-track .seg {
  flex: 1;
  height: 4px;
  border-radius: 3px;
  background: var(--line);
  transition: background 0.25s ease;
}

.progress-track .seg.done { background: var(--accent); }
.progress-track .seg.current { background: var(--accent-dim); }

.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 20px;
}

.q-index {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  color: var(--ink-dim);
  margin: 0 0 10px;
}

.q-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 20px;
  line-height: 1.4;
}

.q-title[data-placeholder]::after {
  content: attr(data-placeholder);
  color: var(--ink-dim);
  font-weight: 400;
  font-style: italic;
}

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

.option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.option:hover { border-color: var(--accent-dim); }

.option input {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.option.selected {
  border-color: var(--accent);
  background: var(--accent-tint, rgba(125, 211, 192, 0.08));
}

.option span {
  font-size: 14px;
  color: var(--ink-dim);
  font-style: italic;
}

.option.selected span { color: var(--ink); font-style: normal; }

.nav-row {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

button {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 14px;
  border: none;
  border-radius: 10px;
  padding: 13px 18px;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

button:active { transform: scale(0.98); }
button:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-back {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-dim);
}

.btn-next {
  flex: 1;
  background: var(--accent);
  color: var(--accent-fg);
}

.done-screen {
  text-align: center;
  padding: 40px 20px;
}

.done-screen .signal-dot {
  width: 14px;
  height: 14px;
  margin: 0 auto 18px;
}

.done-screen h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  margin: 0 0 8px;
}

.done-screen p {
  color: var(--ink-dim);
  font-size: 14px;
  margin: 0 0 24px;
  line-height: 1.5;
}

.btn-restart {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
}

.progress-summary {
  margin: 4px 0 20px;
}

.progress-bar-track {
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  margin-top: 8px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.25s ease;
}

.cat-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  background: var(--bg-raised);
}

.cat-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  text-align: left;
}

.cat-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
}

.cat-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cat-count {
  font-size: 12.5px;
  color: var(--ink-dim);
  font-family: 'Space Grotesk', sans-serif;
}

.cat-chevron {
  color: var(--ink-dim);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.cat-section.open .cat-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.cat-body {
  display: none;
  padding: 0 18px 18px;
  flex-direction: column;
  gap: 22px;
}

.cat-section.open .cat-body {
  display: flex;
}

.btn-submit {
  background: var(--accent);
  color: var(--accent-fg);
}

/* ============================================================
   IDENTIDAD VISUAL (banner / logo de la encuesta)
   ============================================================ */

.brand-block {
  margin-bottom: 20px;
}

.brand-banner {
  width: 100%;
  border-radius: var(--radius);
  display: block;
  margin-bottom: 12px;
}

.brand-logo {
  max-height: 40px;
  max-width: 180px;
  display: block;
}

/* ============================================================
   IDENTIFICACIÓN OPCIONAL
   ============================================================ */

.id-card {
  margin-bottom: 18px;
}

.id-hint {
  color: var(--ink-dim);
  font-size: 12.5px;
  margin: 0 0 14px;
}

.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-dim);
  margin-bottom: 6px;
}

/* ============================================================
   CAMPOS DE TEXTO (texto libre, fecha, "otro", etc.)
   ============================================================ */

.text-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
}

.text-input:focus {
  border-color: var(--accent);
  outline: none;
}

.textarea-input {
  resize: vertical;
  min-height: 90px;
}

.select-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%239AA1AC' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.otro-field {
  margin-top: 10px;
}

.hint-text {
  color: var(--ink-dim);
  font-size: 13px;
  margin: 0;
}

.hint-text.error { color: #E88A8A; }
.hint-text.success { color: var(--accent); }

/* ============================================================
   ESCALA (1 a N, ej. recomendación NPS)
   ============================================================ */

.escala-row {
  display: flex;
  gap: 8px;
}

.escala-opt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  color: var(--ink-dim);
}

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

.escala-opt.selected {
  border-color: var(--accent);
  background: var(--accent-tint, rgba(125, 211, 192, 0.08));
  color: var(--ink);
}

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

/* ============================================================
   MATRIZ (preguntas tipo grilla, ej. satisfacción por aspecto)
   ============================================================ */

.matriz-wrap {
  overflow-x: auto;
}

.matriz-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
}

.matriz-table th {
  font-size: 11.5px;
  color: var(--ink-dim);
  font-weight: 500;
  padding: 0 6px 10px;
  text-align: center;
  vertical-align: bottom;
}

.matriz-fila-label {
  font-size: 13px;
  color: var(--ink);
  padding: 10px 10px 10px 0;
  text-align: left;
  max-width: 160px;
}

.matriz-table td {
  text-align: center;
  padding: 8px 6px;
  border-top: 1px solid var(--line);
}

.matriz-table input[type="radio"] {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .signal-dot::after { animation: none; }
}
