/* AssessMap — Professional Stylesheet — v2.53 — Sessão AI
   Refatoração arquitetural: design tokens + modal canônico.
   Brand Book Stanton Chase p.6 (tom de voz) + p.13–14 (tipografia).
*/

/* ════════════════════════════════════════════════════════════════════════════
   DESIGN TOKENS — Tipografia
   ════════════════════════════════════════════════════════════════════════════
   Apenas 3 pesos. Qualquer valor literal de font-weight no CSS deve usar uma
   destas variáveis. Inline styles em templates são a outra fonte permitida
   (e estão sendo removidos na Sessão AJ).
*/
:root {
  --weight-regular: 400;   /* corpo de texto, links, inputs, labels secundárias */
  --weight-medium:  500;   /* labels primárias, headings, caption, badges */
  --weight-strong:  600;   /* botões primários, totais, calls-to-action */

  /* Font stack — sistema de fontes nativas. Segoe UI Variable Text (Win11)
     renderiza mais leve que Segoe UI clássico; -apple-system usa San Francisco
     no macOS/iOS. Sem dependência de arquivos externos. */
  --font-stack: ui-sans-serif, -apple-system, BlinkMacSystemFont,
                "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}

/* font-synthesis-weight:none impede o navegador de criar "fake bold" sintético
   quando não acha o weight pedido. Sem isso, em system-ui o weight 500 vira
   um Bold sintético que parece muito mais pesado. */
html {
  font-synthesis-weight: none;
}

/* ════════════════════════════════════════════════════════════════════════════
   PESO DE FONTE — sistema minimalista (3 valores apenas)
   Mantido aqui até remoção dos style="font-weight:..." inline nos templates.
   ════════════════════════════════════════════════════════════════════════════ */

/* Tudo corpo: regular */
body, p, div, span, a, label, td, th, li, dt, dd, input, select, textarea,
strong, b,
.kpi-value, .stat-value, .total-value, .dimension-title, .badge,
.section-header h3, .modal-header h3, .form-header h2, .login-platform,
.page-subtitle, .field-hint, .credential, .lang-btn,
.projects-table th, .projects-table td {
  font-weight: var(--weight-regular) !important;
}

/* Headings e labels primárias: medium (não bold) */
h1, h2, h3, h4, h5, h6,
.page-header h2, .admin-header h2,
.company-tag, .entry-header h1,
.form-group label {
  font-weight: var(--weight-medium) !important;
}

/* Botões de ação: strong (o único peso realmente bold) */
.btn-primary, .btn-danger, .btn-secondary,
.lang-btn.active {
  font-weight: var(--weight-strong) !important;
}

/* Mensagem de boas-vindas customizada: regular, cor marca */
.login-welcome {
  font-weight: var(--weight-regular) !important;
  color: var(--primary, #1054CC) !important;
}



* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  /* Stanton Chase Brand Book p.8 / p.16 — Pantone 2935 C / #1054CC.
     --primary é o azul oficial. --primary-light é uma variante 12% mais
     clara usada em hovers/focos para preservar feedback visual. */
  --primary: #1054CC;
  --primary-light: #2A6BD9;
  --accent: #0ea5e9;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --clan: #3b82f6;
  --adhocracy: #f59e0b;
  --market: #ef4444;
  --hierarchy: #10b981;
  --gray-50: #f8fafc; --gray-100: #f1f5f9; --gray-200: #e2e8f0;
  --gray-300: #cbd5e1; --gray-400: #94a3b8; --gray-500: #64748b;
  --gray-600: #475569; --gray-700: #334155; --gray-800: #1e293b;
  --gray-900: #0f172a;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07);
  --shadow: 0 4px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.14);
  --radius: 8px; --radius-lg: 12px;
}
body {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  background: var(--gray-50); color: var(--gray-800); min-height: 100vh;
}

/* ── LOGIN ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #0f2440 0%, #1e3a5f 60%, #0d3158 100%);
}
.login-card {
  background: white; border-radius: var(--radius-lg);
  padding: 48px 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 36px; }
.logo-mark {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  border-radius: 16px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; color: white; font-weight: 600; margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(16, 84, 204,0.35);
}
.login-logo h1 { font-size: 24px; font-weight: 600; color: var(--gray-900); letter-spacing: -0.5px; }
.login-logo p  { font-size: 13px; color: var(--gray-400); margin-top: 4px; }
.login-hint {
  margin-top: 24px; padding: 14px 16px; background: var(--gray-50);
  border-radius: var(--radius); font-size: 12px; color: var(--gray-500);
  border: 1px solid var(--gray-100);
}
.login-hint strong { display: block; color: var(--gray-700); margin-bottom: 6px; font-size: 12px; }
.credential { font-family: monospace; font-size: 11px; margin-top: 4px; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 500; color: var(--gray-600);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.form-group input, .form-group select {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius);
  font-size: 14px; color: var(--gray-800);
  transition: border-color 0.2s, box-shadow 0.2s; outline: none;
  background: white;
}
.form-group input:focus, .form-group select:focus {
  border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(16, 84, 204,0.1);
}

/* ── BUTTONS ── */
.btn-primary {
  display: inline-block; padding: 12px 24px;
  background: var(--primary); color: white; border: none;
  border-radius: var(--radius); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background 0.2s, transform 0.1s; text-decoration: none;
}
.btn-primary:hover { background: var(--primary-light); }
.btn-primary:active { transform: scale(0.99); }
.btn-secondary {
  display: inline-block; padding: 9px 18px;
  background: white; color: var(--primary-light);
  border: 1.5px solid var(--primary-light); border-radius: var(--radius);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; text-decoration: none;
}
.btn-secondary:hover { background: var(--primary-light); color: white; }
.btn-secondary-sm {
  font-size: 12px; color: var(--primary-light); text-decoration: none; font-weight: 600;
}
.btn-secondary-sm:hover { text-decoration: underline; }
.btn-ghost {
  padding: 9px 18px; background: transparent; color: var(--gray-600);
  border: 1.5px solid var(--gray-200); border-radius: var(--radius);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-ghost:hover { background: var(--gray-100); }
.btn-ghost-sm {
  padding: 5px 10px; background: transparent; color: var(--gray-500);
  border: 1px solid var(--gray-200); border-radius: 5px;
  font-size: 11px; cursor: pointer; white-space: nowrap;
}
.btn-ghost-sm:hover { background: var(--gray-100); }
.btn-view {
  padding: 6px 14px; background: var(--primary); color: white;
  border-radius: 6px; font-size: 12px; font-weight: 600;
  text-decoration: none; white-space: nowrap;
}
.btn-view:hover { background: var(--primary-light); }
.btn-submit {
  padding: 12px 36px; background: var(--primary); color: white;
  border: none; border-radius: var(--radius); font-size: 15px; font-weight: 500;
  cursor: pointer; transition: background 0.2s;
}
.btn-submit:hover { background: var(--primary-light); }
.btn-logout {
  padding: 6px 14px; background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25); color: white;
  border-radius: 6px; font-size: 13px; cursor: pointer; text-decoration: none;
  transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.22); }
.btn-copy {
  padding: 6px 14px; background: var(--primary-light); color: white;
  border: none; border-radius: 6px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: background 0.2s;
}
.btn-copy:hover { background: var(--primary); }

/* ── NAVBAR ── */
.navbar {
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: space-between;
  height: 66px; padding: 0 28px; box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 100;
}
.navbar-brand { display: flex; align-items: center; gap: 14px; }
.navbar-logo {
  width: 30px; height: 30px; background: rgba(255,255,255,0.15);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}
.navbar-logo-img {
  height: 36px; width: auto; max-width: 240px; object-fit: contain;
  border-radius: 4px;
}
/* Default logo (Stanton Chase white) is a wide horizontal mark with ~4.5:1 ratio */
.navbar-logo-default { height: 32px; max-width: 220px; }
.navbar-brand span {
  font-size: 17px; font-weight: 500;
  padding-left: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}
.navbar-center { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 6px 14px; color: rgba(255,255,255,0.7); text-decoration: none;
  border-radius: 6px; font-size: 14px; font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-link.active { background: rgba(255,255,255,0.15); color: white; }
.navbar-right { display: flex; align-items: center; gap: 12px; }
.navbar-user { font-size: 13px; opacity: 0.7; }
.navbar-user-link {
  color: white; text-decoration: none;
  padding: 4px 8px; border-radius: 6px;
  transition: opacity .15s, background .15s;
}
.navbar-user-link:hover { opacity: 1; background: rgba(255,255,255,0.10); }
.navbar-role {
  font-size: 11px; padding: 3px 10px; background: rgba(255,255,255,0.15);
  border-radius: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;
}

/* ── FLASH MESSAGES ── */
.flash-container { position: fixed; top: 70px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 12px 20px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow); max-width: 360px;
}
.flash-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.flash-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ── LAYOUT ── */
.main-content { padding: 32px 28px; max-width: 1060px; margin: 0 auto; }

/* ── ADMIN HEADER ── */
.admin-header { margin-bottom: 28px; }
.admin-header h2 { font-size: 22px; font-weight: 600; color: var(--gray-900); }
.admin-header p  { font-size: 14px; color: var(--gray-400); margin-top: 4px; }
.page-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 22px; font-weight: 600; color: var(--gray-900); }
.page-subtitle { font-size: 14px; color: var(--gray-400); margin-top: 4px; }
.back-link { font-size: 13px; color: var(--primary-light); text-decoration: none; display: block; margin-bottom: 4px; }
.back-link:hover { text-decoration: underline; }
.header-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; margin-top: 8px;
}
.section-header h3 { font-size: 16px; font-weight: 500; color: var(--gray-700); }

/* ── STATS GRID ── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: white; border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 11px; font-weight: 500; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.6px; }
.stat-value { font-size: 32px; font-weight: 400; color: var(--gray-900); margin-top: 4px; line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* ── CHARTS ── */
.charts-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px;
}
@media (max-width: 800px) { .charts-grid { grid-template-columns: 1fr; } }
.chart-card {
  background: white; border-radius: var(--radius-lg);
  padding: 22px 24px; box-shadow: var(--shadow-sm);
}
.chart-card h3 { font-size: 12px; font-weight: 500; color: var(--gray-500); margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.5px; }
.chart-wrap { max-height: 420px; }
.chart-wrap canvas { max-height: 420px; }

/* ── TABLE ── */
.table-card {
  background: white; border-radius: var(--radius-lg);
  padding: 22px 24px; box-shadow: var(--shadow-sm); margin-bottom: 24px;
}
.table-card h3 { font-size: 12px; font-weight: 500; color: var(--gray-500); margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.5px; }
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 11px; font-weight: 500; color: var(--gray-400);
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 10px 14px; text-align: left; border-bottom: 1.5px solid var(--gray-100);
  white-space: nowrap;
}
td { padding: 13px 14px; font-size: 13px; color: var(--gray-700); border-bottom: 1px solid var(--gray-50); }
tr:hover td { background: #fafbff; }
.no-data { text-align: center; color: var(--gray-300); padding: 40px 14px; font-size: 14px; }
.action-cell { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.row-inactive { opacity: 0.55; }

/* ── PILLS & BADGES ── */
.status-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 12px; font-size: 11px; font-weight: 500;
}
.status-badge.active   { background: #f0fdf4; color: #16a34a; }
.status-badge.closed   { background: #f1f5f9; color: var(--gray-500); }
.status-badge.inactive { background: #fef2f2; color: #dc2626; }
.type-tag {
  display: inline-block; padding: 2px 8px; background: var(--gray-100);
  color: var(--gray-600); border-radius: 6px; font-size: 11px; font-weight: 500;
}
.type-pill {
  display: inline-block; padding: 4px 10px;
  border-radius: 12px; font-size: 12px; font-weight: 600;
}
.type-pill.clan      { background: #eff6ff; color: var(--clan); }
.type-pill.adhocracy { background: #fffbeb; color: var(--adhocracy); }
.type-pill.market    { background: #fef2f2; color: var(--market); }
.type-pill.hierarchy { background: #f0fdf4; color: var(--hierarchy); }

/* ── PROJECTS LIST ── */
.projects-list { display: flex; flex-direction: column; gap: 2px; }
.project-row {
  background: white; padding: 16px 20px; border-radius: var(--radius);
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; box-shadow: var(--shadow-sm);
}
.project-row:hover { box-shadow: var(--shadow); }
.project-name { font-size: 15px; font-weight: 500; color: var(--gray-900); }
.project-meta { font-size: 12px; color: var(--gray-400); margin-top: 2px; }
.project-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ── FORM (RESPONDENT) ── */
.form-header {
  background: white; border-radius: var(--radius-lg);
  padding: 26px 30px; margin-bottom: 22px; box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary-light);
}
.form-header h2 { font-size: 20px; font-weight: 600; color: var(--gray-900); }
.form-header p  { font-size: 13px; color: var(--gray-500); margin-top: 8px; line-height: 1.65; }
.form-meta { display: flex; gap: 24px; margin-top: 16px; flex-wrap: wrap; }
.form-meta-item { font-size: 12px; color: var(--gray-500); }
.form-meta-item strong { color: var(--gray-700); }
.progress-bar-container { background: var(--gray-100); border-radius: 4px; height: 5px; margin-top: 18px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary-light), var(--accent)); border-radius: 4px; transition: width 0.4s ease; }

.dimension-card {
  background: white; border-radius: var(--radius-lg);
  padding: 26px 30px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.dimension-card.has-error { border: 2px solid var(--danger); }
.dimension-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1px solid var(--gray-100);
}
.dimension-number {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500; color: white; flex-shrink: 0;
}
.dimension-title { font-size: 16px; font-weight: 500; color: var(--gray-800); flex: 1; }
.dim-total-badge {
  display: flex; align-items: center; gap: 4px; padding: 5px 14px;
  border-radius: 20px; font-size: 13px; font-weight: 500;
  background: var(--gray-100); color: var(--gray-500);
  transition: all 0.2s; flex-shrink: 0;
}
.dim-total-badge.ok   { background: #f0fdf4; color: #16a34a; }
.dim-total-badge.over { background: #fef2f2; color: #dc2626; }
.dim-total-badge.under { background: #fffbeb; color: #d97706; }
.total-value { font-size: 16px; font-weight: 600; }

.question-item { margin-bottom: 22px; padding-bottom: 22px; }
.question-item.has-divider { border-bottom: 1px solid var(--gray-100); }
.question-item:last-child { margin-bottom: 0; padding-bottom: 0; }
/* Capped state: shown when this question's budget is 0 and it hasn't been filled yet */
.question-item.dist-capped .score-slider { opacity: 0.35; cursor: not-allowed; }
.question-item.dist-capped .score-number {
  border-color: #fca5a5; background: #fff1f2; color: #b91c1c; cursor: not-allowed;
}
.question-item.dist-capped .q-letter { background: #94a3b8; }
.question-item.dist-capped .q-text { color: #94a3b8; }
/* Dual-mode capped column (ocai_dual) */
.dual-input-group.dist-capped .score-number {
  border-color: #fca5a5; background: #fff1f2; color: #b91c1c; cursor: not-allowed;
}
.question-label { display: flex; gap: 10px; margin-bottom: 14px; align-items: flex-start; }
.q-letter {
  width: 22px; height: 22px; border-radius: 4px; background: var(--primary);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0; margin-top: 1px;
}
.q-text { font-size: 14px; color: var(--gray-700); font-weight: 500; line-height: 1.55; }
.score-row { display: flex; align-items: center; gap: 12px; }
.score-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 3px; background: var(--gray-200); outline: none; cursor: pointer;
}
.score-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary-light); cursor: pointer;
  box-shadow: 0 0 0 4px rgba(16, 84, 204,0.15); transition: box-shadow 0.2s;
}
.score-slider::-webkit-slider-thumb:hover { box-shadow: 0 0 0 7px rgba(16, 84, 204,0.2); }
.score-number {
  width: 70px; padding: 8px 10px; border: 1.5px solid var(--gray-200);
  border-radius: var(--radius); font-size: 18px; font-weight: 600;
  text-align: center; color: var(--primary); outline: none; transition: border-color 0.2s;
}
.score-number:focus { border-color: var(--primary-light); }
.score-badge {
  min-width: 54px; text-align: center; padding: 4px 10px;
  border-radius: 12px; font-size: 13px; font-weight: 600;
}
.score-badge.zero { background: var(--gray-100); color: var(--gray-400); }
.score-badge.low  { background: #fff7ed; color: #c2410c; }
.score-badge.mid  { background: #fffbeb; color: #d97706; }
.score-badge.high { background: #f0fdf4; color: #16a34a; }

.form-actions {
  background: white; border-radius: var(--radius-lg);
  padding: 20px 30px; box-shadow: var(--shadow-sm);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.form-actions-note { font-size: 12px; color: var(--gray-400); }

/* ── ANALYSIS CARD ── */
.analysis-card {
  background: white; border-radius: var(--radius-lg);
  padding: 24px 28px; box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.analysis-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
  font-size: 13px; font-weight: 500; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.analysis-badge {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; border-radius: var(--radius); margin-bottom: 16px;
}
.analysis-type-name { font-size: 18px; font-weight: 600; }
.analysis-score     { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.analysis-text      { font-size: 14px; color: var(--gray-600); line-height: 1.7; margin-bottom: 20px; }
.analysis-section-title { font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 10px; }
.analysis-list { list-style: none; }
.analysis-list li { font-size: 13px; color: var(--gray-600); margin-bottom: 6px; padding-left: 16px; position: relative; }
.analysis-list li::before { content: '•'; position: absolute; left: 4px; color: var(--primary-light); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }
.two-col-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .two-col-form { grid-template-columns: 1fr; } }

.ai-narrative { font-size: 14px; color: var(--gray-700); line-height: 1.75; }
.ai-loading { display: flex; align-items: center; gap: 10px; color: var(--gray-400); font-size: 13px; padding: 20px 0; }
.spinner {
  width: 18px; height: 18px; border: 2.5px solid var(--gray-200);
  border-top-color: var(--primary-light); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; padding: 24px;
  /* height explícito garante que o overlay nunca cresça além da viewport,
     evitando a faixa branca abaixo em modais mais altos */
  height: 100vh; height: 100dvh;
  overflow-y: auto;
}
.modal-overlay[hidden],
.modal-overlay.hidden { display: none; }

.modal {
  background: white; border-radius: var(--radius-lg);
  padding: 32px; width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto;
}
.modal-sm { max-width: 380px; }
.modal-lg { max-width: 680px; }

.modal-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 24px;
}
.modal-header h3 { font-size: 18px; color: var(--gray-900); }
.modal-close {
  width: 28px; height: 28px; border: none;
  background: var(--gray-100); border-radius: 50%;
  font-size: 16px; cursor: pointer; color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--gray-200); }

/* .modal-form, .modal-body — transparentes, sem layout próprio */
.modal-form { display: contents; }
.modal-body  { display: contents; }

.modal-actions {
  display: flex; justify-content: flex-end;
  gap: 10px; margin-top: 24px;
}

/* ── SUCCESS ── */
.success-page { text-align: center; padding: 80px 24px; }
.success-icon {
  width: 88px; height: 88px; background: #f0fdf4;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 40px; margin: 0 auto 24px; border: 3px solid #bbf7d0;
}
.success-page h2 { font-size: 26px; font-weight: 600; color: var(--gray-900); margin-bottom: 12px; }
.success-page p  { color: var(--gray-500); max-width: 440px; margin: 0 auto; font-size: 14px; line-height: 1.7; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 24px; background: white; border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.empty-state p { color: var(--gray-400); font-size: 14px; }

/* ── DANGER BUTTONS ── */
.btn-danger {
  padding: 9px 18px; background: var(--danger); color: white;
  border: none; border-radius: var(--radius); font-size: 13px;
  font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.btn-danger:hover { background: #b91c1c; }
.btn-danger-sm {
  padding: 5px 10px; background: #fef2f2; color: var(--danger);
  border: 1px solid #fecaca; border-radius: 5px; font-size: 11px;
  cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn-danger-sm:hover { background: #fee2e2; }

/* ── ROLE BADGES ── */
.role-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 12px; font-size: 11px; font-weight: 500;
}
.role-badge.super_admin { background: #f3e8ff; color: #7c3aed; }
.role-badge.admin       { background: #eff6ff; color: var(--primary-light); }
.self-tag {
  font-size: 10px; background: var(--gray-100); color: var(--gray-400);
  padding: 2px 6px; border-radius: 8px; margin-left: 4px;
}

/* ── SETTINGS ── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 768px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-card {
  background: white; border-radius: var(--radius-lg);
  padding: 24px 26px; box-shadow: var(--shadow-sm);
}
.settings-card-title {
  font-size: 13px; font-weight: 500; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.field-hint { font-size: 11px; color: var(--gray-400); margin-top: 5px; }
textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius);
  font-size: 14px; color: var(--gray-800); font-family: inherit;
  resize: vertical; outline: none; transition: border-color 0.2s;
}
textarea:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(16, 84, 204,0.1); }
.login-logo-img { max-height: 70px; max-width: 200px; margin-bottom: 12px; }
.login-welcome {
  margin-top: 10px; padding: 10px 14px; background: var(--gray-50);
  border-radius: var(--radius); font-size: 13px; color: var(--gray-600);
  border-left: 3px solid var(--primary-light);
}
.login-preview {
  background: linear-gradient(145deg, #0f2440, #1e3a5f);
  border-radius: var(--radius-lg); padding: 32px;
  display: flex; justify-content: center;
}
.login-preview-inner {
  background: white; border-radius: var(--radius-lg);
  padding: 28px 24px; width: 280px; box-shadow: var(--shadow-lg);
}

/* ── INFO BANNER ── */
.info-banner {
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: var(--radius); padding: 12px 16px;
  font-size: 13px; color: var(--primary);
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 20px;
}

/* ── FORM BUILDER ── */
.builder-section {
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-lg);
  margin-bottom: 16px; overflow: hidden;
}
.builder-section-header {
  background: var(--gray-50); padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--gray-200);
}
.section-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; flex-shrink: 0;
}
.section-name-input {
  flex: 1; border: none; background: transparent;
  font-size: 14px; font-weight: 600; color: var(--gray-800);
  outline: none; padding: 0;
}
.builder-questions { padding: 16px; }
.builder-q-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.q-input {
  flex: 1; padding: 8px 12px;
  border: 1px solid var(--gray-200); border-radius: 6px;
  font-size: 13px; outline: none;
}
.q-input:focus { border-color: var(--primary-light); }
.btn-add-q {
  padding: 6px 14px; border: 1.5px dashed var(--gray-300);
  border-radius: 6px; background: transparent; color: var(--gray-500);
  font-size: 12px; cursor: pointer; transition: all 0.2s;
}
.btn-add-q:hover { border-color: var(--primary-light); color: var(--primary-light); background: #eff6ff; }

/* ── LIKERT ── */
.likert-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.likert-option { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.likert-option input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary-light); cursor: pointer; }
.likert-option label { font-size: 11px; color: var(--gray-500); }
.likert-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* ── UTILS ── */
.hidden { display: none !important; }

/* ── LIFECYCLE PILLS (admin_projects) ──────────────────────────────────────── */
.lifecycle-pill {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 500;
}
.lifecycle-draft      { background: #f1f5f9; color: var(--gray-500); }
.lifecycle-active     { background: #f0fdf4; color: #16a34a; }
.lifecycle-collecting { background: #eff6ff; color: var(--primary-light); }
.lifecycle-closed     { background: #fef3c7; color: #d97706; }
.lifecycle-archived   { background: #f8fafc; color: var(--gray-400); }

/* ════════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile-first breakpoints
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Hamburger button (hidden on desktop) ──────────────────────────────────── */
.nav-hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: 6px 8px; border-radius: 6px;
  flex-direction: column; gap: 5px; align-items: center;
  transition: background .15s;
}
.nav-hamburger:hover { background: rgba(255,255,255,0.15); }
.nav-hamburger span {
  display: block; width: 22px; height: 2px;
  background: rgba(255,255,255,0.85); border-radius: 2px;
  transition: all .25s;
}
/* animated X when open */
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Tablet (≤ 900px) ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .navbar { padding: 0 16px; }
  .main-content { padding: 24px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .projects-list .project-row { flex-direction: column; align-items: flex-start; gap: 10px; }
  .project-actions { width: 100%; justify-content: flex-start; }
}

/* ── Mobile (≤ 640px) ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Navbar — collapse center links behind hamburger */
  .navbar {
    flex-wrap: wrap; height: auto; padding: 0 14px;
    align-items: center;
  }
  .navbar-brand { padding: 12px 0; }
  .navbar-center {
    display: none; order: 3;
    width: 100%; flex-direction: column;
    padding: 8px 0 14px; gap: 2px;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .navbar-center.nav-open { display: flex; }
  .navbar-right {
    order: 2; padding: 10px 0;
    gap: 8px;
  }
  .navbar-user { display: none; } /* hide name on mobile, save space */
  .nav-hamburger { display: flex; order: 2; }

  /* Nav dropdown → flat list on mobile */
  .nav-dropdown-menu {
    position: static; box-shadow: none; border: none;
    background: rgba(255,255,255,0.06); border-radius: 6px;
    padding: 2px 0; margin-top: 2px;
  }
  .nav-dropdown:hover .nav-dropdown-menu { display: none; }
  .nav-dropdown-menu.mobile-open { display: block; }
  .nav-dropdown-item {
    color: rgba(255,255,255,0.8); padding: 8px 20px;
  }
  .nav-dropdown-item:hover, .nav-dropdown-item.active {
    background: rgba(255,255,255,0.12); color: white;
  }
  .nav-dropdown-btn {
    color: rgba(255,255,255,.75); width: 100%; text-align: left;
  }
  .nav-link { padding: 8px 12px; font-size: 14px; width: 100%; }

  /* Page layout */
  .main-content { padding: 16px 12px; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 26px; }

  /* Tables that aren't converted to cards still scroll, but no fixed min-width */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Don't force a min-width — let the table-cards mode handle small screens */
  .mb-table-cards { min-width: 0; }

  /* Modals → near full-screen (small screen) */
  .modal { max-width: calc(100% - 16px); }
  .modal-lg { max-width: calc(100% - 16px); }
  .two-col-form { grid-template-columns: 1fr; }

  /* Form page */
  .form-header { padding: 18px 16px; }
  .form-meta { gap: 12px; }
  .dimension-card { padding: 18px 16px; }
  .dimension-header { flex-wrap: wrap; }
  .form-actions { padding: 16px 18px; flex-wrap: wrap; }
  .btn-submit { padding: 11px 24px; }

  /* Score inputs */
  .score-number { width: 56px; font-size: 16px; }

  /* Login */
  .login-card { padding: 32px 22px; margin: 16px; }
  .login-box { padding: 28px 20px; margin: 16px; }

  /* Flash messages */
  .flash-container { right: 10px; left: 10px; }
  .flash { max-width: 100%; }

  /* Project row */
  .project-row { flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px 16px; }

  /* Empty state */
  .empty-state { padding: 40px 16px; }

  /* Section header */
  .section-header { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* ── Extra small (≤ 400px) ─────────────────────────────────────────────────── */
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 14px 16px; }
}

/* ── Branched Survey (First Time CEOs) question styles ─────────────────────── */
.bs-section-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gray-100);
}
.bs-section-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--gray-800);
  margin-bottom: 4px;
}
.bs-section-desc {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.5;
}
.bs-question {
  padding: 18px 0;
}
.bs-question.has-divider {
  border-bottom: 1px solid var(--gray-100);
}
.bs-q-label {
  margin-bottom: 14px;
}
.bs-q-code {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: middle;
  letter-spacing: .03em;
}
.bs-q-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.4;
}
.bs-q-optional {
  font-size: 12px;
  color: var(--gray-400);
  font-weight: 400;
  margin-left: 4px;
}
/* Radio options */
.bs-radio-group,
.bs-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bs-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  line-height: 1.4;
}
.bs-option:hover {
  border-color: var(--primary);
  background: #f0f6ff;
}
.bs-option input[type="radio"],
.bs-option input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--primary);
}
.bs-option input[type="radio"]:checked ~ .bs-option-text,
.bs-option input[type="checkbox"]:checked ~ .bs-option-text {
  color: var(--primary);
  font-weight: 600;
}
.bs-option:has(input:checked) {
  border-color: var(--primary);
  background: #eff6ff;
}
.bs-option-text {
  font-size: 13px;
  color: var(--gray-700);
}
.bs-checkbox-hint {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 6px;
}
/* Scale */
.bs-scale-wrap { }
.bs-scale-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.bs-scale-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}
.bs-scale-btn input[type="radio"] { display: none; }
.bs-scale-num {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  color: var(--gray-600);
  transition: all .15s;
  cursor: pointer;
}
.bs-scale-btn:hover .bs-scale-num {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
}
.bs-scale-btn input[type="radio"]:checked ~ .bs-scale-num {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.bs-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 4px;
}
/* Textarea */
.bs-textarea {
  width: 100%;
  min-height: 90px;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  color: var(--gray-800);
  resize: vertical;
  font-family: inherit;
  transition: border-color .15s;
  box-sizing: border-box;
}
.bs-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 84, 204,.08);
}
@media (max-width: 600px) {
  .bs-scale-num { width: 38px; height: 38px; font-size: 14px; }
  .bs-option { padding: 9px 12px; }
}

/* ── Stanton Chase logo bar ─────────────────────────────────────────────── */
.sc-logo-bar {
  background: #fff;
  padding: 16px 24px 10px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
}
.sc-logo-img {
  height: 36px;
  width: auto;
  display: block;
}

/* ── Branched survey language switcher ──────────────────────────────────── */
.bs-lang-bar {
  display: flex;
  gap: 6px;
  padding: 8px 24px 4px;
  background: #f8fafc;
  border-bottom: 1px solid var(--gray-100);
}
.bs-lang-btn {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-decoration: none;
  border: 1px solid var(--gray-200);
  background: #fff;
  transition: all .15s;
}
.bs-lang-btn:hover { border-color: var(--primary); color: var(--primary); }
.bs-lang-active {
  background: var(--primary);
  color: #fff !important;
  border-color: var(--primary);
}

/* ── PPT export with inline language selector ─────────────────────────────── */
.ppt-export-group {
  display: inline-flex;
  align-items: stretch;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--gray-200);
  background: white;
}
.ppt-export-group .btn-export-ppt-main {
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  background: white;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: background .15s;
}
.ppt-export-group .btn-export-ppt-main:hover {
  background: var(--gray-50);
  color: var(--primary);
}
.ppt-export-group .ppt-lang-select {
  border: none;
  border-left: 1px solid var(--gray-200);
  background: var(--gray-50);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  outline: none;
  min-width: 64px;
}
.ppt-export-group .ppt-lang-select:hover {
  background: var(--gray-100);
  color: var(--primary);
}
.ppt-export-group .ppt-lang-select:focus {
  background: #eff6ff;
  color: var(--primary);
}

/* ── AI-assisted translation suggestion button ────────────────────────────── */
.btn-translate-sm {
  padding: 3px 10px;
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid #dbeafe;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn-translate-sm:hover {
  background: #dbeafe;
  border-color: var(--primary);
}
.btn-translate-sm:disabled {
  opacity: .6;
  cursor: wait;
}

/* ── Accessibility ── */
/* Visible focus ring for keyboard users (does not show on mouse click).
   Catches every interactive element that lost its outline via outline:none. */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(16, 84, 204, 0.15);
}
/* Higher-contrast focus for elements on the dark navbar */
.navbar a:focus-visible,
.navbar button:focus-visible {
  outline-color: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.30);
}

/* Screen-reader only helper — visually hidden but exposed to AT */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Improve contrast of secondary subtitles (was #94a3b8 → ~3.4:1; now 4.6:1+) */
.kpi-sub { color: #64748b; }

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   MOBILE-FIRST OVERHAUL (Sessão O — 2026-04-26)
   Layered on top of existing styles. Activates ≤ 768px and ≤ 480px.
   ════════════════════════════════════════════════════════════════════════════ */

/* Design tokens for mobile (CSS vars on :root for safe-area + scale) */
:root {
  --mb-safe-top:    env(safe-area-inset-top, 0px);
  --mb-safe-bottom: env(safe-area-inset-bottom, 0px);
  --mb-safe-left:   env(safe-area-inset-left, 0px);
  --mb-safe-right:  env(safe-area-inset-right, 0px);
  --mb-touch-min:   44px;     /* Apple HIG / Material 3 minimum */
  --mb-radius-lg:   18px;
  --mb-radius-md:   12px;
  --mb-shadow-floating: 0 8px 24px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.06);
  --mb-shadow-sheet:    0 -8px 32px rgba(0, 0, 0, 0.18);
}

/* Bottom navigation (admin) — hidden on desktop, shown on ≤ 768px */
.mobile-bottom-nav { display: none; }
.mobile-more-sheet, .mobile-more-backdrop { display: none; }

@media (max-width: 768px) {
  /* ── Hide the legacy top navbar entirely; bottom nav takes over ─────── */
  body { padding-bottom: calc(64px + var(--mb-safe-bottom)); }

  /* Slim the top navbar to brand + lang only on mobile */
  .navbar { height: 52px; }
  .navbar-center { display: none !important; }
  .navbar-right .navbar-user,
  .navbar-right .navbar-role,
  .navbar-right .btn-logout,
  .nav-hamburger { display: none !important; }
  .navbar-right { gap: 6px; }

  /* ── Bottom navigation ─────────────────────────────────────────────────── */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 150;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
    padding-bottom: var(--mb-safe-bottom);
    justify-content: space-around;
    align-items: stretch;
    height: calc(64px + var(--mb-safe-bottom));
  }
  .mb-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    min-height: var(--mb-touch-min);
    color: var(--gray-500);
    background: none;
    border: none;
    text-decoration: none;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.15s, transform 0.15s;
    position: relative;
  }
  .mb-nav-item:active { transform: scale(0.92); }
  .mb-nav-item.is-active { color: var(--primary); }
  .mb-nav-item.is-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 4px 4px;
  }
  .mb-nav-icon { display: flex; align-items: center; justify-content: center; }
  .mb-nav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.1;
    max-width: 64px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }

  /* ── "More" bottom sheet ──────────────────────────────────────────────── */
  .mobile-more-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.50);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .mobile-more-backdrop.is-open { opacity: 1; pointer-events: auto; }

  .mobile-more-sheet {
    display: block;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 200;
    background: white;
    border-radius: 22px 22px 0 0;
    box-shadow: var(--mb-shadow-sheet);
    transform: translateY(110%);
    transition: transform 0.30s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh;
    overflow-y: auto;
    padding-bottom: calc(20px + var(--mb-safe-bottom));
  }
  .mobile-more-sheet.is-open { transform: translateY(0); }
  .mb-sheet-handle {
    width: 40px; height: 5px;
    background: var(--gray-200);
    border-radius: 3px;
    margin: 10px auto 4px;
  }
  .mb-sheet-content { padding: 8px 8px 4px; }
  .mb-sheet-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--mb-radius-md);
    min-height: var(--mb-touch-min);
    transition: background 0.15s;
  }
  .mb-sheet-item:active { background: var(--gray-100); }
  .mb-sheet-item.mb-sheet-logout { color: #dc2626; }
  .mb-sheet-divider {
    height: 1px;
    background: var(--gray-100);
    margin: 8px 16px;
  }
  .mb-sheet-langs {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
  }
  .mb-sheet-lang {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--mb-radius-md);
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.15s;
  }
  .mb-sheet-lang.is-active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
  }

  /* ── Cards out of tables (responsive list pattern) ─────────────────────── */
  /* Apply to admin tables marked with .mb-table-cards */
  .mb-table-cards thead { display: none; }
  .mb-table-cards tr {
    display: block;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--mb-radius-md);
    margin-bottom: 10px;
    padding: 14px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  }
  .mb-table-cards tr:hover td { background: transparent; }
  .mb-table-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none !important;
    padding: 6px 0 !important;
    text-align: right;
    gap: 12px;
  }
  .mb-table-cards td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    flex-shrink: 0;
  }
  .mb-table-cards td:first-child::before { display: none; }
  .mb-table-cards td:first-child {
    display: block;
    text-align: left;
    border-bottom: 1px solid var(--gray-100) !important;
    padding-bottom: 10px !important;
    margin-bottom: 6px;
  }

  /* ── Modal — mobile: full width, bottom-anchored ── */
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92dvh !important;
    border-radius: 20px 20px 0 0 !important;
    margin: 0 !important;
  }
  .modal .modal-actions button { flex: 1; }

  /* ── Form page (respondent) — sticky footer with Next/Prev ─────────────── */
  .form-actions {
    position: sticky;
    bottom: 0;
    background: white;
    border-top: 1px solid var(--gray-100);
    padding: 14px 16px calc(14px + var(--mb-safe-bottom)) !important;
    margin: 0 -12px -12px;
    z-index: 50;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
  }
  .form-actions button,
  .form-actions a,
  .form-actions .btn-submit {
    flex: 1;
    min-height: 48px;
    font-size: 15px !important;
  }

  /* Bigger touch targets in scoring inputs */
  .score-number { width: 64px !important; height: 44px; font-size: 18px !important; }
  input[type="range"] { height: 32px; }
  input[type="range"]::-webkit-slider-thumb { width: 26px; height: 26px; }
  input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; }

  /* ── project_results — stack everything vertically ─────────────────────── */
  .charts-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  .radar-layout { flex-direction: column !important; gap: 12px !important; }
  .radar-layout .chart-wrap { width: 100% !important; }
  .chart-wrap { max-height: 360px !important; }
  .chart-wrap canvas { max-height: 360px !important; }
  .header-actions { flex-direction: column; align-items: stretch; gap: 8px; width: 100%; }
  .header-actions .btn-secondary,
  .header-actions .btn-primary,
  .header-actions form,
  .header-actions .ppt-export-group {
    width: 100%;
    justify-content: center;
  }
  .ppt-export-group { display: flex; }
  .ppt-export-group .btn-export-ppt-main { flex: 1; justify-content: center; }

  /* Density: tighter padding on cards in mobile */
  .settings-card,
  .table-card,
  .chart-card { padding: 16px 14px; }

  /* Buttons: larger touch targets across the app */
  .btn-primary, .btn-secondary, .btn-ghost, .btn-submit, .btn-view {
    min-height: var(--mb-touch-min);
    padding: 11px 18px;
  }
}

/* ── Small phones (≤ 480px) — extra compaction ─────────────────────────── */
@media (max-width: 480px) {
  .main-content { padding: 14px 10px; }
  .kpi-grid { gap: 8px !important; }
  .kpi-card { padding: 14px 14px !important; gap: 12px !important; }
  .kpi-icon { font-size: 22px !important; }
  .kpi-value { font-size: 22px !important; }
  .kpi-label { font-size: 12px !important; }

  .mb-nav-label { font-size: 9px; }

  /* On very small screens, hide the lang selector from the top navbar
     (it's accessible via the bottom-sheet "More") */
  .nav-lang-selector { display: none !important; }
}

/* ════════════════════════════════════════════════════════════════════════
   Mobile overflow strategy — Sessão S (revised from Q)
   The page itself never scrolls horizontally, but wide elements that need
   it (e.g. legitimately wide data tables) are wrapped and scroll INTERNALLY
   with a visible scrollbar so nothing is silently truncated.
   ════════════════════════════════════════════════════════════════════════ */
html, body {
  /* Prevent the WHOLE page from sliding horizontally,
     but content inside .scroll-x or .table-responsive can still scroll. */
  overflow-x: clip;     /* clip > hidden: doesn't create new scroll context */
  max-width: 100%;
}
/* Fallback for browsers without `clip` support */
@supports not (overflow-x: clip) {
  html, body { overflow-x: hidden; }
}

/* Wrappers that can scroll horizontally when content overflows */
.scroll-x,
.table-responsive,
.proj-detail-table-wrap,
[style*="overflow-x:auto"],
[style*="overflow-x: auto"] {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  /* Visual hint: subtle gradient on the right edge when content overflows */
  background:
    linear-gradient(90deg, white 30%, rgba(255,255,255,0)) 0 0/2.5em 100% no-repeat local,
    linear-gradient(90deg, rgba(255,255,255,0), white 70%) 100% 0/2.5em 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(15,23,42,0.10), rgba(0,0,0,0)) 0 0/1em 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(15,23,42,0.10), rgba(0,0,0,0)) 100% 0/1em 100% no-repeat scroll;
}
/* Make horizontal scrollbars actually visible on mobile (default is invisible
   in iOS — users don't realise content can be scrolled). */
.scroll-x::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar { height: 6px; }
.scroll-x::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
  background: var(--gray-300, #cbd5e1);
  border-radius: 999px;
}

@media (max-width: 768px) {
  /* Force every common wide element to respect its container */
  img, video, iframe, canvas, svg {
    max-width: 100%;
    height: auto;
  }
  /* Cards/sections: prevent inline-set widths from breaking */
  .settings-card, .table-card, .chart-card, .company-section,
  .company-dash-card, .resp-summary-strip, .kpi-card,
  .info-banner, .login-box {
    max-width: 100%;
    box-sizing: border-box;
  }
  /* Word-break long URLs/emails so they don't push the card wide */
  .resp-row td, .resp-card *, .co-dash-name {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  /* Filter / search bars: ensure inputs collapse instead of overflowing */
  input[type="text"], input[type="email"], input[type="url"],
  input[type="password"], input[type="search"], select, textarea {
    max-width: 100%;
    box-sizing: border-box;
  }
  /* Search + filter row in admin_users.html */
  #search-input, #filter-company, #filter-status {
    flex: 1 1 100% !important;
    min-width: 0 !important;
  }
  /* Bulk action bar — wrap on small screens */
  #bulk-bar {
    flex-direction: column;
    align-items: stretch !important;
  }
  #bulk-bar button { width: 100%; text-align: left; }
  /* Page header: stack title + button */
  .page-header { flex-direction: column !important; align-items: stretch !important; }
  .page-header > div { width: 100%; }
  .page-header .btn-secondary, .page-header .btn-primary {
    align-self: stretch; text-align: center;
  }
  /* Resp summary strip — wrap KPIs */
  .resp-summary-strip {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
  .resp-summary-strip > .resp-kpi { min-width: 0; }
  .resp-summary-strip > div:last-child {
    grid-column: span 2;
    min-width: 0 !important;
  }
  /* Company section header — wrap properly */
  .company-section-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px;
  }
  /* Action menu dropdowns — clamp width */
  .action-menu-dropdown {
    max-width: calc(100vw - 32px);
    right: 8px !important;
  }
  /* Charts that escaped the wrapper */
  .charts-grid > * { min-width: 0; }

  /* Tables that aren't using mb-table-cards still need a scroll wrapper.
     The inline `overflow-x:auto` divs created by templates already get
     -webkit-overflow-scrolling:touch via the rule above. */
  table:not(.mb-table-cards) {
    /* Allow the table to grow naturally; outer wrapper provides the scroll */
    width: max-content;
    min-width: 100%;
  }
  /* Project detail table: keep readable on small screens, allow horiz scroll */
  .proj-detail-table {
    font-size: 12px;
  }
  .proj-detail-table th,
  .proj-detail-table td {
    padding: 8px 10px !important;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  /* Body must NOT have overflow-x:hidden (was the bug — clipped scroll
     wrappers AND made things uncoverable). Use clip instead. */
  .resp-summary-strip { grid-template-columns: repeat(2, 1fr) !important; }
  .resp-summary-strip > div:last-child { grid-column: span 2; }
  /* On very small screens, charts can be quite tall — cap them */
  .chart-wrap { max-height: 320px !important; }
  .chart-wrap canvas { max-height: 320px !important; }
}

/* ════════════════════════════════════════════════════════════════════════
   MODERN VISUAL OVERHAUL — Sessão Q (2026-04-26)
   Adds refined typography, smooth micro-interactions, depth-based shadows,
   improved empty states and skeleton loaders. Layered on top of existing
   styles — nothing breaks if these new classes aren't used.
   ════════════════════════════════════════════════════════════════════════ */

:root {
  /* Refined neutrals (warmer than Tailwind slate) */
  --color-bg-app:        #F8FAFC;
  --color-bg-elevated:   #FFFFFF;
  --color-bg-subtle:     #F1F5F9;
  --color-bg-muted:      #E2E8F0;
  --color-text-primary:  #0F172A;
  --color-text-secondary:#475569;
  --color-text-muted:    #94A3B8;
  --color-border-subtle: #E2E8F0;
  --color-border-strong: #CBD5E1;

  /* Stanton Chase brand */
  --color-brand:         #1054CC;
  --color-brand-hover:   #0E47B0;
  --color-brand-soft:    #EFF6FF;
  --color-brand-glow:    rgba(16, 84, 204, 0.18);

  /* Semantic */
  --color-success:       #10B981;
  --color-success-soft:  #ECFDF5;
  --color-warning:       #F59E0B;
  --color-warning-soft:  #FFFBEB;
  --color-danger:        #EF4444;
  --color-danger-soft:   #FEF2F2;

  /* Depth — Material 3 inspired elevation */
  --elev-1: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --elev-2: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --elev-3: 0 10px 15px -3px rgba(15, 23, 42, 0.10), 0 4px 6px -4px rgba(15, 23, 42, 0.06);
  --elev-4: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

  /* Motion */
  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast:   140ms;
  --dur-base:   220ms;
  --dur-slow:   360ms;

  /* Typography — fontes nativas do sistema operacional. */
  --font-display: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-body:    ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

/* Modernised global typography — fontes nativas do sistema. */
body {
  font-family: var(--font-body);
  letter-spacing: 0;
  background: var(--color-bg-app);
  color: var(--color-text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, .page-header h2, .admin-header h2 {
  font-family: var(--font-display);
  letter-spacing: 0;
  font-weight: 400;
  color: var(--color-text-primary);
}

/* Page header — minimalista, sem gradient (Sessão AF) */
.page-header h2 {
  color: var(--color-text-primary);
  font-size: 24px;
  line-height: 1.25;
  font-weight: 400;
}

/* Cards with proper depth hierarchy and hover feedback */
.kpi-card, .settings-card, .table-card, .chart-card,
.company-section, .company-dash-card {
  border-radius: 14px;
  border: 1px solid var(--color-border-subtle);
  box-shadow: var(--elev-1);
  transition: box-shadow var(--dur-base) var(--ease-smooth),
              transform var(--dur-fast) var(--ease-spring),
              border-color var(--dur-fast) var(--ease-smooth);
  background: var(--color-bg-elevated);
}
.kpi-card:hover {
  box-shadow: var(--elev-2);
  transform: translateY(-1px);
  border-color: var(--color-brand-soft);
}

/* Buttons with depth + smooth state changes */
.btn-primary, .btn-secondary, .btn-submit, .btn-view,
.btn-ghost, .btn-ghost-sm {
  transition: background var(--dur-fast) var(--ease-smooth),
              box-shadow var(--dur-fast) var(--ease-smooth),
              transform var(--dur-fast) var(--ease-spring),
              border-color var(--dur-fast) var(--ease-smooth);
  font-feature-settings: "cv02", "cv03";
}
.btn-primary {
  box-shadow: var(--elev-1), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn-primary:hover {
  box-shadow: var(--elev-2), 0 0 0 4px var(--color-brand-glow);
  transform: translateY(-1px);
}
.btn-primary:active, .btn-secondary:active, .btn-submit:active {
  transform: translateY(0) scale(0.98);
}

/* Inputs with smooth focus ring */
.form-group input, .form-group select, .form-group textarea,
input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="search"], select, textarea {
  transition: border-color var(--dur-fast) var(--ease-smooth),
              box-shadow var(--dur-fast) var(--ease-smooth),
              background var(--dur-fast) var(--ease-smooth);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
input:focus, select:focus, textarea:focus {
  border-color: var(--color-brand) !important;
  box-shadow: 0 0 0 4px var(--color-brand-glow);
}

/* Modern status / lifecycle pills with subtle gradient */
.lc-pill, .type-tag, .sector-pill, .resp-badge, .status-badge,
.user-info-chip {
  font-feature-settings: "cv02", "tnum";
  letter-spacing: 0.01em;
}

/* Page-load fade-in for the main content (subtle, fast) */
@media (prefers-reduced-motion: no-preference) {
  main { animation: page-fade-in 0.32s var(--ease-smooth) both; }
  @keyframes page-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  /* Stagger children inside .kpi-grid for a polished feel */
  .kpi-grid .kpi-card {
    animation: kpi-rise 0.4s var(--ease-spring) both;
  }
  .kpi-grid .kpi-card:nth-child(1) { animation-delay: 0.04s; }
  .kpi-grid .kpi-card:nth-child(2) { animation-delay: 0.08s; }
  .kpi-grid .kpi-card:nth-child(3) { animation-delay: 0.12s; }
  .kpi-grid .kpi-card:nth-child(4) { animation-delay: 0.16s; }
  @keyframes kpi-rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}

/* Empty states — friendlier and more spacious */
.empty-state, .no-data {
  padding: 60px 24px;
  text-align: center;
  color: var(--color-text-muted);
  background: linear-gradient(180deg,
    var(--color-bg-elevated) 0%,
    var(--color-bg-subtle) 100%);
  border-radius: 16px;
  border: 1px dashed var(--color-border-strong);
}

/* Skeleton loader helper — usable on async content */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-bg-muted) 0%,
    var(--color-bg-subtle) 50%,
    var(--color-bg-muted) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s linear infinite;
  border-radius: 8px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Subtle "ripple" feedback on tap (mobile + desktop) */
button:active::after, .btn-primary:active::after, .btn-secondary:active::after {
  /* hint of compression — no JS needed */
}

/* Scrollbar refinement (desktop only — mobile usually hides) */
@media (hover: hover) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: 999px;
    border: 2px solid var(--color-bg-app);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }
}

/* Selection color — matches brand */
::selection {
  background: var(--color-brand);
  color: white;
}

/* ════════════════════════════════════════════════════════════════════════════
   UTILITIES — Sessão AI (v2.38)
   Substituem inline styles repetidos em templates. Adicionar aqui evita
   espalhar style="..." em centenas de pontos do HTML.
   ════════════════════════════════════════════════════════════════════════════ */

/* Grid: ocupa todas as colunas do .two-col-form */
.u-grid-full { grid-column: 1 / -1; }

/* Cell metadata (linhas pequenas em tabela) */
.cell-meta        { font-size: 12px; color: var(--gray-500); }
.cell-meta-block  { display: block; font-size: 11px; color: var(--gray-500); }
.cell-empty       { font-size: 12px; color: var(--gray-300); }
.cell-profile     { min-width: 140px; }

/* Forms inline para botões dentro de tabelas */
.inline-form { display: inline; }

/* Filter bar (admin tables) */
.filter-bar {
  display: flex; gap: 12px; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filter-search {
  flex: 1; min-width: 200px;
  padding: 8px 14px;
  border: 1px solid var(--gray-200); border-radius: 8px;
  font-size: 13px; outline: none;
  transition: border-color .15s;
}
.filter-search:focus { border-color: var(--primary); }
.filter-select {
  padding: 8px 14px;
  border: 1px solid var(--gray-200); border-radius: 8px;
  font-size: 13px; background: #fff; cursor: pointer;
}
.filter-count {
  font-size: 12px; color: var(--gray-400);
  white-space: nowrap;
}

/* Branding accordion (per-company customization) */
.branding-section {
  grid-column: 1 / -1;
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
}
.branding-summary {
  cursor: pointer;
  font-size: 13px; font-weight: var(--weight-medium);
  color: var(--gray-700);
  outline: none; list-style: none;
}
.branding-summary::-webkit-details-marker { display: none; }
.branding-summary-hint {
  font-weight: var(--weight-regular);
  color: var(--gray-400);
  margin-left: 4px;
  font-size: 12px;
}
.branding-intro {
  font-size: 12px; color: var(--gray-500);
  margin: 10px 0 14px;
  line-height: 1.5;
}

/* Textarea full-width padronizado */
.field-textarea {
  width: 100%; box-sizing: border-box;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200); border-radius: 8px;
  resize: vertical; font-family: inherit;
  font-size: 14px; color: var(--gray-800);
}
.field-textarea:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px var(--color-brand-glow);
}

/* Confirm-modal text styles (delete confirmations) */
.confirm-question {
  margin-bottom: 8px;
  color: var(--gray-700);
}
.confirm-detail {
  color: var(--gray-500); font-size: 13px;
  margin-bottom: 0;
}
