:root {
  --primary: #01696f;
  --primary-strong: #0c4e54;
  --primary-soft: #e7f5f4;
  --surface: #ffffff;
  --surface-soft: #fbfcfd;
  --surface-tint: #f3f6fb;
  --surface-accent: #f7fbfb;
  --bg: #f4f7f9;
  --bg-accent: #eef7f7;
  --text: #1f2933;
  --text-strong: #16324f;
  --muted: #5b6770;
  --border: #d8e1e8;
  --border-soft: #e5edf5;
  --border-strong: #c8d5df;
  --shadow-soft: 0 10px 24px rgba(16, 24, 40, 0.05);
  --shadow-card: 0 14px 28px rgba(15, 23, 42, 0.06);
  --shadow-sticky: 0 8px 16px rgba(15, 23, 42, 0.06);
  --radius-lg: 18px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

/* ── Modal de bienvenida ─────────────────────────────────────────── */
.welcome-modal .modal-dialog {
  max-width: 720px;
}

.welcome-modal .modal-content {
  border: none;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.14);
}

.welcome-modal .modal-header {
  background-color: #01696f;
  color: #ffffff;
  padding: 24px 32px 20px;
  border-bottom: none;
}


.welcome-modal .modal-header h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #3a3a3a;
  margin: 0;
  letter-spacing: 0.01em;
}

.welcome-modal .modal-header .modal-subtitle {
  font-size: 0.875rem;
  opacity: 0.85;
  margin-top: 4px;
  color: #3a3a3a;
  margin-bottom: 0;
}

.welcome-modal .modal-body {
  padding: 28px 32px 20px;
  background-color: #f8f9fa;
}

.welcome-modal .modal-body p {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: #3a3a3a;
  margin-bottom: 12px;
}

.welcome-modal .modal-body p:last-child {
  margin-bottom: 0;
}

.welcome-modal .welcome-info-row {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.welcome-modal .welcome-info-box {
  flex: 1;
  min-width: 160px;
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 5px;
  padding: 14px 18px;
}

.welcome-modal .welcome-info-box .wib-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6c757d;
  margin-bottom: 4px;
}

.welcome-modal .welcome-info-box .wib-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #01696f;
}

.welcome-modal .modal-footer {
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
  padding: 16px 32px;
  justify-content: flex-end;
}

.welcome-modal .btn-start {
  background-color: #01696f;
  border-color: #01696f;
  color: #ffffff;
  font-weight: 500;
  padding: 8px 28px;
  border-radius: 4px;
  font-size: 0.9375rem;
  transition: background-color 0.18s ease;
}

.welcome-modal .btn-start:hover,
.welcome-modal .btn-start:focus {
  background-color: #015458;
  border-color: #015458;
  color: #ffffff;
}

body {
  background: linear-gradient(180deg, #f6f9fb 0%, #f3f7f9 100%);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}

.page-shell {
  max-width: 1540px;
  margin: 0 auto;
  padding: 20px 24px 40px 24px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: linear-gradient(180deg, #f3f8fb 0%, #eef6f7 100%);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  flex: 1;
  display: flex;
  align-items: center;
}

.topbar-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 12px;
  gap: 4px;
}

.topbar-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

/* kept for fallback — no longer used in topbar */
.brand-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 12px;
  flex: 1 1 auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.brand-text h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
  color: var(--text-strong);
}

.brand-text p {
  margin: 4px 0 0 0;
  color: #5b7086;
  font-size: 14px;
}

.user-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  text-align: right;
  min-width: 180px;
}

.questionnaire-shell {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tab-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card-lite,
.matrix-group,
.special-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-soft);
}

.questionnaire-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.questionnaire-header-right {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.questionnaire-header h3,
.matrix-head h4,
.question-section-title {
  margin: 0 0 8px 0;
  color: var(--text-strong);
}

.question-section-title {
  font-size: 1.1rem;
}

.muted {
  color: var(--muted);
  white-space: pre-wrap;
}

.badge-soft {
  background: #edf3f4;
  color: var(--primary);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #dbe9ea;
}

.badge-soft.large {
  padding: 8px 12px;
}

.nav-tabs {
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.nav-tabs .nav-link {
  color: var(--text-strong);
  border-radius: 10px 10px 0 0;
}

.nav-tabs .nav-link.active {
  font-weight: 700;
  color: var(--primary);
  background: var(--bg-accent);
  border-color: var(--border) var(--border) transparent;
}

.matrix-group {
  padding: 0;
  overflow: hidden;
}

.matrix-head {
  padding: 18px 20px 0 20px;
}

.matrix-help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 0 20px 16px 20px;
}

.matrix-help-card {
  background: linear-gradient(180deg, #f8fbfd 0%, #f5fafc 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.matrix-help-card h5 {
  margin: 0 0 6px 0;
  color: var(--text-strong);
  font-size: 0.98rem;
}

.matrix-table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  padding: 0 0 6px 0;
  border-top: 1px solid var(--border-soft);
  position: relative;
  z-index: 1;
}

.matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f7fafc;
  color: var(--text-strong);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  text-transform: none;
  box-shadow: inset 0 -1px 0 var(--border-soft), var(--shadow-sticky);
}

.matrix-table th:first-child {
  z-index: 21;
  background: #f7fafc;
}

.matrix-table td:first-child {
  z-index: 10;
  background: var(--surface);
  box-shadow: 8px 0 14px -12px rgba(15, 23, 42, 0.12);
}

.matrix-table th,
.matrix-table td {
  vertical-align: top;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.matrix-table tbody tr:nth-child(even) td {
  background: #fcfdfe;
}

.matrix-table tbody tr:hover td {
  background: #f8fbfc;
}

.matrix-table th:first-child,
.matrix-table td:first-child {
  position: sticky;
  left: 0;
}

.matrix-table th:first-child {
  z-index: 4;
  background: #f7fafc;
}

.matrix-table td:first-child {
  z-index: 2;
  background: var(--surface);
  box-shadow: 8px 0 14px -12px rgba(15, 23, 42, 0.12);
}

.matrix-table tbody tr:nth-child(even) td:first-child {
  background: #fcfdfe;
}

.matrix-question-cell {
  min-width: 460px;
}

.matrix-question-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.matrix-question-text {
  color: var(--text-strong);
  line-height: 1.55;
  white-space: pre-wrap;
  font-size: 0.98rem;
}

.matrix-input-cell {
  min-width: 250px;
}

.matrix-rule-cell {
  min-width: 320px;
}

.matrix-actions-cell {
  min-width: 100px;
}

.current-row td {
  background: #f2fbfa !important;
}

.current-row td:first-child {
  background: #edf9f8 !important;
}

.matrix-input-cell .form-group,
.matrix-rule-cell .form-group {
  margin-bottom: 0;
}

.matrix-input-cell .irs,
.matrix-input-cell .js-irs-0,
.matrix-input-cell .js-irs-1,
.matrix-input-cell .js-irs-2 {
  margin-top: 2px;
}

.matrix-input-cell .irs--shiny {
  height: 48px;
}

.matrix-input-cell .irs-bar,
.matrix-input-cell .irs-single,
.matrix-input-cell .irs-handle > i:first-child {
  background: var(--primary);
  border-color: var(--primary);
}

.matrix-input-cell .irs-line {
  background: #dfe8ee;
  border-color: #dfe8ee;
}
.matrix-table thead th {
  font-size: 0.95rem;
}

.matrix-input-cell .irs-min,
.matrix-input-cell .irs-max,
.matrix-input-cell .irs-single {
  font-size: 13px;
}

.matrix-input-cell .irs-grid-text {
  font-size: 12px !important;
}

.matrix-input-cell .irs-single {
  border-radius: 999px;
  font-weight: 700;
  padding: 2px 8px;
}

.matrix-rule-cell .shiny-options-group {
  display: grid;
  gap: 8px;
}

.matrix-rule-cell .radio {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--surface-soft);
}

.matrix-rule-cell textarea.form-control,
.question-card textarea.form-control {
  border-radius: 12px;
  border-color: var(--border-strong);
  box-shadow: none;
  resize: vertical;
}

.matrix-rule-cell textarea.form-control:focus,
.question-card textarea.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(1, 105, 111, 0.12);
}

.question-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  background: linear-gradient(180deg, #ffffff 0%, #fcfefe 100%);
  padding: 18px;
}

.current-card {
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 3px rgba(1, 105, 111, 0.08);
}

.question-card-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.question-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.question-code {
  font-weight: 800;
  color: var(--text-strong);
}

.question-text-full {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-strong);
  margin-bottom: 18px;
  white-space: pre-wrap;
}

.scale-card,
.rule-card,
.alt-response-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface-soft);
}

.scale-card.compact,
.rule-card.compact {
  height: 100%;
}

.scale-help {
  min-height: 52px;
}

.question-card .checkbox,
.question-card .radio {
  margin-top: 0;
  margin-bottom: 10px;
}

.question-card .checkbox label,
.question-card .radio label {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: #f9fbfc;
}

.question-card .form-control {
  border-radius: 12px;
  min-height: 46px;
}

.question-card .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(1, 105, 111, 0.12);
}

.btn-nav {
  border: none;
  background: #dfe8ec;
  color: #13343c;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  min-width: 120px;
}

.btn-nav.primary {
  background: var(--primary);
  color: white;
}

.btn-nav.primary:hover,
.btn-nav.primary:focus {
  background: var(--primary-strong);
  color: white;
}

.btn-nav.secondary {
  background: #eef2f4;
}

.bottom-nav {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 18px;
  position: sticky;
  bottom: 16px;
  z-index: 100;
  isolation: isolate;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.12);
  padding: 18px 20px;
}

.bottom-tab-strip {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  flex: 0 0 auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 101;
}

a.bottom-tab-btn,
a.bottom-tab-btn:link,
a.bottom-tab-btn:visited {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 18px !important;
  border-radius: var(--radius-sm);
  min-width: 160px;
  background: var(--primary) !important;
  color: #ffffff !important;
  border: 1px solid var(--primary) !important;
  text-decoration: none !important;
  font-weight: 700 !important;
  font-size: 14px;
  line-height: 1.1;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
}


.bottom-nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  margin-left: auto;
  flex-wrap: wrap;
  position: relative;
  z-index: 101;
}



.bottom-nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 0 0 auto;
  margin-left: auto;
  flex-wrap: wrap;
}

.auth-warning {
  margin-bottom: 18px;
  background: #fff4e5;
  color: #8a4d00;
  border: 1px solid #ffd59c;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}

@media (max-width: 1200px) {
  .matrix-table {
    min-width: 1120px;
  }

  .matrix-question-cell {
    min-width: 380px;
  }
}

@media (max-width: 992px) {
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .topbar-left, .topbar-right {
    flex: 0 0 auto;
  }

  .topbar-center {
    order: -1;
    flex: 1 1 100%;
    padding: 0;
  }

  .user-box {
    text-align: left;
    align-items: flex-start;
  }

  .questionnaire-header {
    flex-direction: column;
  }

  .questionnaire-header-right {
    justify-content: flex-start;
  }

  .matrix-help-grid {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .bottom-tab-strip {
    justify-content: flex-start;
  }

  .bottom-nav-right {
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .question-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .matrix-table th:first-child,
  .matrix-table td:first-child {
    position: static;
    box-shadow: none;
  }
}


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

.feedback-card {
  padding: 20px;
}

.feedback-header {
  margin-bottom: 12px;
}

.feedback-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.feedback-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.metric-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid #e9ecef;
}

.metric-card-alert {
  background: #fff4e5;
  border-color: #ffd8a8;
}

.feedback-subsection {
  margin-top: 14px;
}

.feedback-bar-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 2fr 56px;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.feedback-bar-label {
  font-size: 0.95rem;
}

.feedback-bar-track {
  width: 100%;
  height: 12px;
  background: #e9ecef;
  border-radius: 999px;
  overflow: hidden;
}

.feedback-bar-fill {
  height: 100%;
  background: #01696f;
  border-radius: 999px;
}

.feedback-bar-value {
  text-align: right;
  font-weight: 600;
}


.your-response-card {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f7fbfb;
  border: 1px solid #d2e4e4;
}

.feedback-subsection {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid #e6ecec;
}

.your-response-card h5 {
  margin-bottom: 10px;
  color: #01696f;
}

.your-response-list {
  margin: 0;
  padding-left: 18px;
}

.your-response-list li {
  margin-bottom: 4px;
}


/* ─── Botón Enviar ────────────────────────────────────────────────────── */
#submit_btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  min-width: 180px;
  box-shadow: 0 4px 14px rgba(1, 105, 111, 0.22);
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
  letter-spacing: 0.01em;
}

#submit_btn:hover,
#submit_btn:focus {
  background: var(--primary-strong);
  box-shadow: 0 6px 18px rgba(1, 105, 111, 0.32);
  color: #fff;
  transform: translateY(-1px);
}

#submit_btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(1, 105, 111, 0.18);
}

/* ─── Modales ─────────────────────────────────────────────────────────── */
.modal-content {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.14);
  font-family: Inter, system-ui, sans-serif;
  overflow: hidden;
}

.modal-header {
  background: linear-gradient(180deg, #f7fafc 0%, #f3f7f9 100%);
  border-bottom: 1px solid var(--border-soft);
  padding: 18px 22px;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-strong);
}

.modal-body {
  padding: 20px 22px;
  color: var(--text);
  font-size: 0.97rem;
  line-height: 1.65;
}

.modal-footer {
  background: #f8fbfc;
  border-top: 1px solid var(--border-soft);
  padding: 14px 20px;
  gap: 10px;
  display: flex;
  justify-content: flex-end;
}

/* Botón cancelar dentro del modal */
.modal-footer .btn-default,
.modal-footer button.btn:not(.btn-primary) {
  background: #eef2f4;
  border: 1px solid var(--border);
  color: var(--text-strong);
  border-radius: var(--radius-sm);
  font-weight: 600;
  padding: 10px 18px;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.modal-footer .btn-default:hover,
.modal-footer button.btn:not(.btn-primary):hover {
  background: #dfe8ec;
}

/* Botón confirmar dentro del modal */
.modal-footer .btn-primary,
#confirm_submit_btn {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
  border-radius: var(--radius-sm);
  font-weight: 700;
  padding: 10px 20px;
  font-size: 0.9rem;
  box-shadow: 0 3px 10px rgba(1, 105, 111, 0.2);
  transition: background 0.15s, box-shadow 0.15s;
}

.modal-footer .btn-primary:hover,
#confirm_submit_btn:hover {
  background: var(--primary-strong) !important;
  border-color: var(--primary-strong) !important;
  box-shadow: 0 5px 14px rgba(1, 105, 111, 0.28);
}

/* Lista de preguntas obligatorias pendientes */
.modal-body ul li {
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #fafcfd;
  margin-bottom: 8px;
  list-style: none;
  margin-left: -20px;
}

.modal-body ul li strong {
  color: var(--primary-strong);
}

/* ─── Pantalla de agradecimiento ──────────────────────────────────────── */
.thank-you-icon {
  font-size: 3.2rem;
  margin-bottom: 18px;
  filter: drop-shadow(0 4px 8px rgba(1, 105, 111, 0.18));
}

.thank-you-card {
  max-width: 720px;
  margin: 60px auto;
  padding: 48px 40px;
  text-align: center;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbfb 100%);
  border: 1px solid #d2e4e4;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(1, 105, 111, 0.08);
}

.thank-you-card h3 {
  font-size: 1.6rem;
  color: var(--primary-strong);
  font-weight: 800;
  margin-bottom: 16px;
}

.thank-you-card .thank-you-body {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
  margin-top: 12px;
}

.thank-you-card .thank-you-meta {
  margin-top: 28px;
  font-size: 0.88rem;
  color: #a0adb5;
  letter-spacing: 0.02em;
}

/* ── Logos de encabezado (tres logos) ──────────────────────────────── */
.header-logos {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-logo {
  object-fit: contain;
  width: auto;
  display: block;
}
