/* =====================================================
   DATASENSE ANALITICA — SYSTEMATIC / DATA BLUE THEME
   ===================================================== */

/* ── Variables ── */
:root {
  --bg:           #f0f4fb;
  --bg-gradient:  linear-gradient(160deg, #eef2ff 0%, #f0f4fb 50%, #e8eef8 100%);
  --panel:        #ffffff;
  --panel-warm:   #f8faff;
  --panel-accent: #eff6ff;

  --text:         #1e293b;
  --text-2:       #334155;
  --muted:        #64748b;

  --border:       #cbd5e1;
  --border-light: #e2e8f0;

  --blue:         #2563eb;
  --blue-dark:    #1d4ed8;
  --blue-light:   #eff6ff;
  --blue-mid:     #bfdbfe;
  --sky:          #0ea5e9;
  --sky-light:    #e0f2fe;
  --slate:        #475569;
  --slate-light:  #f1f5f9;

  --green:        #059669;
  --green-light:  #ecfdf5;
  --red:          #dc2626;
  --red-light:    #fef2f2;
  --navy:         #0f172a;

  --shadow:       0 2px 12px rgba(30,60,120,0.08);
  --shadow-md:    0 4px 24px rgba(30,60,120,0.11);
  --shadow-lg:    0 8px 40px rgba(30,60,120,0.15);

  --radius:       18px;
  --radius-sm:    10px;
  --radius-full:  999px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg-gradient);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
canvas { max-width: 100%; }

/* ── Layout ── */
.page-shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 72px;
  display: grid;
  gap: 22px;
}

/* ── Base Cards ── */
.hero-card,
.card,
.flash,
.mini-stat,
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card,
.card,
.login-card { padding: 28px 32px; }

.card { display: grid; gap: 22px; }

/* ── Hero Card ── */
.hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
  border-top: 4px solid var(--blue);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
}

/* ── Eyebrow ── */
.eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
}

/* ── Typography ── */
h1 {
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  font-size: clamp(1.85rem, 4vw, 2.9rem);
  font-weight: 700;
  font-style: normal;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 10px;
}

h2 {
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  font-style: normal;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.2;
}

h3 {
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 10px;
}

.lead        { color: var(--text-2); font-size: 0.975rem; }
.muted       { color: var(--muted); }
.helper-text { color: var(--muted); font-size: 0.85rem; text-align: center; margin-top: 16px; }

/* ── Forms ── */
.survey-form,
.admin-form,
.admin-shell { display: grid; gap: 22px; }

.question-block { display: grid; gap: 14px; }

.question {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  padding: 12px 16px;
  background: var(--blue-light);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Personal data section */
.personal-data-section {
  background: linear-gradient(135deg, #f0f7ff 0%, #f8faff 100%);
  border: 1px solid rgba(37,99,235,0.18);
  border-top: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 28px 32px;
  display: grid;
  gap: 20px;
  box-shadow: var(--shadow);
}

.personal-data-section h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.personal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

/* ── Candidate Cards ── */
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 10px;
}

.scale-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.choice-card,
.scale-option {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--panel);
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  transition: all 0.18s ease;
  font-size: 0.9rem;
  font-weight: 500;
}

.choice-card:hover,
.scale-option:hover {
  border-color: var(--blue);
  background: var(--blue-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.choice-card input[type="radio"],
.scale-option input[type="radio"] {
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.choice-card:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-light);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.18);
}

.reject-card {
  border-color: #c7d4f0;
  background: #f8faff;
}

.reject-card:hover {
  border-color: var(--slate);
  background: var(--slate-light);
}

.reject-card:has(input:checked) {
  border-color: var(--slate);
  background: var(--slate-light);
  box-shadow: 0 0 0 2px rgba(71,85,105,0.15);
}

/* ── Input Fields ── */
.stack-field { display: grid; gap: 6px; font-size: 0.875rem; }
.stack-field > span { font-weight: 600; color: var(--text-2); letter-spacing: 0.02em; }

input[type="text"],
input[type="tel"],
input[type="number"],
input[type="password"],
textarea,
select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font: inherit;
  font-size: 0.925rem;
  color: var(--text);
  background: var(--panel);
  transition: border-color 0.18s, box-shadow 0.18s;
  appearance: none;
}

/* Remove number input spinners so it looks identical to text inputs */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.10);
}

textarea { resize: vertical; }

/* ── Buttons ── */
.primary-btn,
.secondary-btn,
.admin-link,
.text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-full);
  padding: 11px 24px;
  font: inherit;
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.primary-btn {
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 18px rgba(37,99,235,0.32);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(37,99,235,0.42);
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.secondary-btn,
.admin-link {
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
}

.secondary-btn:hover,
.admin-link:hover {
  background: var(--blue-light);
  border-color: var(--blue);
  color: var(--blue-dark);
}

.text-btn {
  border: none;
  background: transparent;
  color: var(--slate);
  font: inherit;
  padding: 6px 12px;
  border-radius: 8px;
}

.text-btn:hover { background: var(--slate-light); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
}

/* ── Flash Messages ── */
.flash {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.925rem;
}

.flash-success {
  background: var(--green-light);
  border-color: rgba(5,150,105,0.22);
  color: var(--green);
}

.flash-error {
  background: var(--red-light);
  border-color: rgba(220,38,38,0.22);
  color: var(--red);
}

/* ── Login Page ── */
.admin-login-page,
.survey-page,
.admin-page { padding-bottom: 30px; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg-gradient);
}

.login-card {
  width: min(480px, 100%);
  padding: 40px;
  border-radius: 24px;
  border-top: 4px solid var(--blue);
  box-shadow: var(--shadow-lg);
}

.login-form { display: grid; gap: 16px; margin-top: 24px; }

/* ── Stats Strip ── */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.mini-stat {
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.mini-stat:nth-child(1) { border-top: 3px solid var(--blue); }
.mini-stat:nth-child(2) { border-top: 3px solid var(--sky); }
.mini-stat:nth-child(3) { border-top: 3px solid var(--green); }
.mini-stat:nth-child(4) { border-top: 3px solid var(--slate); }

.mini-label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.mini-stat strong {
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ── Tabs ── */
.tab-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: var(--panel);
  padding: 6px;
  border-radius: var(--radius-sm);
  width: fit-content;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.tab-link {
  padding: 9px 20px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--muted);
  transition: all 0.18s ease;
}

.tab-link:hover { color: var(--text); background: var(--bg); }

.tab-link.is-active {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 3px 12px rgba(37,99,235,0.28);
}

.tab-panel { display: none; gap: 20px; }
.tab-panel.is-active { display: grid; }

/* ── Section Heading ── */
.section-heading { margin-bottom: 4px; }

.section-heading h2 { display: flex; align-items: center; gap: 12px; }

.section-heading::after {
  content: '';
  display: block;
  width: 44px;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--sky));
  border-radius: 2px;
  margin-top: 10px;
}

.section-heading.inline::after { display: none; }

.section-heading p { color: var(--muted); font-size: 0.925rem; margin-top: 6px; }

.section-heading.inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ── Result Cards ── */
.result-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--blue-light);
  color: var(--blue-dark);
  border: 1px solid rgba(37,99,235,0.18);
}

.result-badge.badge-gold {
  background: var(--sky-light);
  color: #0369a1;
  border-color: rgba(14,165,233,0.25);
}

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

.result-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  align-items: start;
}

.result-col { display: grid; gap: 12px; }

.question-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}

.chart-wrap { position: relative; width: 100%; }
.chart-wrap canvas { width: 100% !important; max-height: 100%; }
.chart-wrap--donut { height: 300px; }
.chart-wrap--bar   { min-height: 120px; }

.reason-list {
  border-top: 1px solid var(--border-light);
  padding-top: 14px;
  display: grid;
  gap: 2px;
}

.reason-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(203,213,225,0.5);
  font-size: 0.875rem;
}

.reason-item span { color: var(--muted); }

.reason-item strong {
  background: var(--blue-light);
  color: var(--blue-dark);
  padding: 3px 11px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  white-space: nowrap;
}

/* ── Respondents Table ── */
.respondents-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.respondents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--panel);
}

.respondents-table thead {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: white;
}

.respondents-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.respondents-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}

.respondents-table tbody tr:last-child td { border-bottom: none; }
.respondents-table tbody tr:nth-child(even) { background: var(--panel-warm); }
.respondents-table tbody tr:hover { background: var(--blue-light); }

.respondents-table .no-data {
  text-align: center;
  color: var(--muted);
  padding: 48px 20px;
  font-style: italic;
}

.respondent-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
}

.respondents-total {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 10px 4px;
  text-align: right;
}

/* ── Builder (Config) ── */
.builder-list { display: grid; gap: 16px; }

.builder-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  background: var(--panel-warm);
  display: grid;
  gap: 14px;
}

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

.builder-head strong {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

/* ── Top Actions / Admin Topbar ── */
.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  flex-shrink: 0;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

/* ── Logo & Brand ── */
.brand-logo {
  height: 72px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.10));
  flex-shrink: 0;
}

.brand-logo--login { height: 86px; }
.brand-logo--admin { height: 56px; }

.hero-body {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.hero-body > div { flex: 1; min-width: 0; }

.login-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

/* ── Card Header ── */
.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-header h2 { margin-bottom: 0; }

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  font-weight: 800;
  font-size: 0.875rem;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(37,99,235,0.28);
}

/* DB status badge in admin */
.db-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.db-badge-ok {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid rgba(5,150,105,0.2);
}

.db-badge-off {
  background: var(--sky-light);
  color: #0369a1;
  border: 1px solid rgba(14,165,233,0.25);
}

/* ── Mobile ── */
@media (max-width: 720px) {
  html, body { overflow-x: hidden; }

  .hero-card,
  .admin-topbar { flex-direction: column; align-items: stretch; }

  /* Survey form hero — centre logo + text */
  .hero-body {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
  }
  .hero-body > div { flex: none; width: 100%; }
  .eyebrow { justify-content: center; }
  .brand-logo { margin: 0 auto; }

  /* Admin topbar — logo + compact title row */
  .admin-topbar .hero-body {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 10px;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  .admin-topbar .hero-body > div { flex: 1; min-width: 0; overflow: hidden; }
  .admin-topbar .eyebrow { display: none; }
  .admin-topbar h1 {
    font-size: 0.92rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .admin-topbar .lead { font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-logo--admin { height: 34px; margin: 0; flex-shrink: 0; }

  /* Top action buttons — 2-column grid */
  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .top-actions .secondary-btn,
  .top-actions form { width: 100%; }
  .top-actions form .secondary-btn { width: 100%; justify-content: center; font-size: 0.82rem; padding: 9px 10px; }

  .section-heading.inline { flex-direction: column; align-items: flex-start; }
  .form-actions { justify-content: stretch; }
  .primary-btn { width: 100%; }
  .page-shell { padding: 16px 0 60px; }
  .hero-card,
  .card,
  .login-card,
  .personal-data-section { padding: 16px 16px; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .result-columns { grid-template-columns: 1fr; gap: 16px; }
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1rem; }
  .personal-grid { grid-template-columns: 1fr; }
  .tab-nav { gap: 2px; padding: 4px; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tab-link { padding: 8px 14px; white-space: nowrap; font-size: 0.83rem; }
  .option-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .scale-grid  { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .choice-card,
  .scale-option { padding: 10px 12px; font-size: 0.85rem; }
  .mini-stat strong { font-size: 2rem; }
  .brand-logo { height: 52px; }
  .brand-logo--login { height: 68px; }
  .login-card { padding: 24px 20px; }
  .question { font-size: 0.9rem; padding: 10px 14px; }
  .builder-card { padding: 16px; }
  .respondents-table-wrap { -webkit-overflow-scrolling: touch; }
  .chart-wrap--donut { height: 220px; }
}

/* ── Extra small (< 400px) ── */
@media (max-width: 400px) {
  .page-shell { width: calc(100% - 24px); }
  .option-grid,
  .scale-grid  { grid-template-columns: 1fr; }
  h1 { font-size: 1.4rem; }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .mini-stat strong { font-size: 1.6rem; }
}

/* ── Panel mobile overflow fixes ── */
@media (max-width: 720px) {
  /* Page shell centering */
  .page-shell, .admin-shell {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 12px 14px 60px;
    overflow-x: hidden;
  }

  /* Tab panels */
  .tab-panel { overflow-x: hidden; min-width: 0; }

  /* All cards */
  .result-card, .card, .builder-card { overflow-x: hidden; }

  /* Tables — scrollable, not overflowing */
  .respondents-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .respondents-table th:nth-child(n+4),
  .respondents-table td:nth-child(n+4) { display: none; }

  /* Config builder inputs */
  .builder-card input,
  .builder-card select,
  .builder-card textarea { width: 100%; box-sizing: border-box; max-width: 100%; }

  /* Usuarios tab */
  .user-table { display: block; overflow-x: auto; }
  .user-table th:nth-child(n+4),
  .user-table td:nth-child(n+4) { display: none; }

  /* Análisis IA */
  #analisis-ia { overflow-x: hidden; }
  #analisis-ia .ai-output { font-size: 0.875rem; overflow-x: hidden; }
  .ai-card-body { font-size: 0.875rem; overflow-x: hidden; word-break: break-word; }
}

/* ── Touch targets (mobile-first) ── */
@media (hover: none) {
  .choice-card,
  .scale-option { min-height: 48px; }
  .primary-btn,
  .secondary-btn,
  .admin-link,
  .tab-link { min-height: 44px; }
  input[type="text"],
  input[type="tel"],
  input[type="password"],
  select { min-height: 46px; font-size: 16px; /* prevent iOS zoom */ }
}

/* ══════════════════════════════════════════
   ROLE BADGES
══════════════════════════════════════════ */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.role-admin      { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.role-supervisor { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.role-encuestador { background: #fefce8; color: #a16207; border: 1px solid #fde047; }

/* ══════════════════════════════════════════
   PANEL — STAFF PORTAL STYLES
══════════════════════════════════════════ */
.panel-welcome {
  display: grid;
  gap: 20px;
  text-align: center;
  padding: 48px 24px;
}

.panel-welcome .role-icon {
  font-size: 4rem;
  line-height: 1;
}

.panel-welcome h2 { font-size: 1.7rem; }
.panel-welcome .lead { max-width: 360px; margin: 0 auto; }

.user-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.user-table th {
  background: var(--slate-light);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.user-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.user-table tbody tr:hover { background: var(--blue-light); }

/* Danger button */
.danger-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border: 1.5px solid #fca5a5;
  background: #fef2f2;
  color: #dc2626;
  border-radius: var(--radius-full);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.danger-btn:hover { background: #fee2e2; border-color: #ef4444; }

/* Supervisor masked field */
.masked {
  color: var(--border);
  font-style: italic;
  user-select: none;
  letter-spacing: 0.1em;
}

/* Add-user form */
.add-user-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}

@media (max-width: 600px) {
  .add-user-form { grid-template-columns: 1fr; }
  .user-table th:nth-child(n+4),
  .user-table td:nth-child(n+4) { display: none; }
}

/* ══════════════════════════════════════════
   GEO DROPDOWNS
══════════════════════════════════════════ */
.geo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

select:disabled {
  background: var(--slate-light);
  color: var(--muted);
  cursor: not-allowed;
}

/* ══════════════════════════════════════════
   PANEL TOPBAR rol indicator
══════════════════════════════════════════ */
.panel-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  flex-shrink: 0;
}

.panel-user-info strong { color: var(--text); }

/* ── Party candidate sub-question ── */
.party-candidate-block {
  margin-top: 12px;
  padding: 18px 20px;
  background: linear-gradient(135deg, #f0f7ff 0%, #eff6ff 100%);
  border: 1.5px solid var(--blue-mid);
  border-left: 4px solid var(--sky);
  border-radius: var(--radius-sm);
  animation: fadeSlide 0.22s ease;
}
.party-sub-label {
  background: var(--sky-light) !important;
  border-left-color: var(--sky) !important;
  font-size: 0.9rem;
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Drag-and-drop handles ── */
.drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  user-select: none;
  padding: 0 4px;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.drag-handle:hover { opacity: 1; cursor: grab; }
.drag-handle:active { cursor: grabbing; }

.sortable-ghost {
  opacity: 0.4;
  background: var(--blue-light) !important;
  border: 2px dashed var(--blue-mid) !important;
}

/* ══════════════════════════════════════════
   AI ANALYSIS
══════════════════════════════════════════ */
.ai-analysis-card { display: grid; gap: 20px; }

.ai-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #f0f7ff, #eff6ff);
  border: 1.5px solid var(--blue-mid);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 12px;
  border-radius: 99px;
  white-space: nowrap;
}

.ai-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 12px 0;
}

.ai-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--blue-light);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: ai-spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes ai-spin {
  to { transform: rotate(360deg); }
}

.ai-output {
  line-height: 1.7;
  color: var(--text);
}
.ai-output h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue);
  margin: 22px 0 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--blue-light);
}
.ai-output h3:first-child { margin-top: 0; }
.ai-output p  { margin: 6px 0; font-size: 0.925rem; }
.ai-output ul { margin: 6px 0 10px 20px; }
.ai-output li { font-size: 0.9rem; margin-bottom: 4px; }
.ai-output strong { color: var(--text); }


