/* ============================================
   COPSOQ II v2 — Loss Control Consultoria
   Fluxo anônimo (colaborador) + área admin
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,wght@0,400;0,600;0,700;0,800;1,400&display=swap');

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: #f4f4f4;
  color: #1a1a1a;
  line-height: 1.5;
  min-height: 100vh;
}

:root {
  --lc-black: #1a1a1a;
  --lc-black-soft: #2a2a2a;
  --lc-yellow: #f5c400;
  --lc-yellow-dark: #d9aa00;
  --lc-yellow-soft: #fff4cc;
  --lc-green: #10b981;
  --lc-green-dark: #059669;
  --lc-white: #ffffff;
  --lc-gray-100: #f4f4f4;
  --lc-gray-200: #e5e5e5;
  --lc-gray-300: #cccccc;
  --lc-gray-500: #6b7280;
  --lc-gray-700: #374151;
  --primary: var(--lc-black);
  --primary-accent: var(--lc-yellow);
  --secondary: var(--lc-green);
  --bg: var(--lc-gray-100);
  --surface: var(--lc-white);
  --border: var(--lc-gray-200);
  --text: var(--lc-black);
  --muted: var(--lc-gray-500);
  --green: #16a34a;
  --yellow: #f59e0b;
  --red: #dc2626;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --radius: 8px;
}

.view { display: none; min-height: 100vh; }
.view.active { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* ============================================
   ADMIN LOGIN (mesma estilização do v1)
   ============================================ */
#view-admin-login {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(26,26,26,0.94) 0%, rgba(26,26,26,0.98) 100%),
    radial-gradient(circle at top right, var(--lc-yellow) 0%, transparent 40%),
    var(--lc-black);
  position: relative;
}
#view-admin-login::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(45deg, transparent 48%, rgba(245,196,0,0.06) 48%, rgba(245,196,0,0.06) 52%, transparent 52%);
  background-size: 30px 30px;
  pointer-events: none;
}
#view-admin-login.active { display: flex; }

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 36px 30px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  border-top: 5px solid var(--lc-yellow);
}
.brand { text-align: center; margin-bottom: 28px; }
.brand-img { height: 60px; margin-bottom: 14px; }
.brand h1 {
  font-size: 1.25rem; margin: 0 0 4px;
  font-weight: 800; color: var(--lc-black);
  letter-spacing: -0.3px;
}
.brand .subtitle {
  font-size: 0.82rem; color: var(--muted);
  margin: 0; letter-spacing: 0.2px;
}
.brand-divider {
  width: 40px; height: 3px;
  background: var(--lc-yellow);
  margin: 12px auto 8px;
  border-radius: 2px;
}
.auth-form h2 {
  margin: 0 0 18px;
  font-size: 1.05rem; font-weight: 700;
  color: var(--lc-black);
}
.auth-form label { display: block; margin-bottom: 14px; }
.auth-form label > span {
  display: block; font-size: 0.8rem;
  font-weight: 700; margin-bottom: 5px;
  color: var(--lc-gray-700);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.auth-form input, .auth-form select {
  width: 100%; padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem; font-family: inherit;
  transition: all 0.2s; background: #fafafa;
}
.auth-form input:focus, .auth-form select:focus {
  outline: none; border-color: var(--lc-yellow);
  background: white;
  box-shadow: 0 0 0 3px rgba(245,196,0,0.2);
}
.auth-links {
  display: flex; justify-content: center;
  margin-top: 14px; font-size: 0.85rem;
}
.auth-links a {
  color: var(--lc-black); text-decoration: none;
  font-weight: 600;
  border-bottom: 1.5px solid var(--lc-yellow);
  padding-bottom: 1px;
}
.auth-links a:hover { color: var(--lc-yellow-dark); }

/* ============================================
   BOTÕES
   ============================================ */
.btn-primary, .btn-secondary, .btn-ghost, .btn-accent, .btn-ghost-dark {
  display: inline-block; border: none;
  padding: 11px 20px; border-radius: 6px;
  font-size: 0.93rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
  font-family: inherit; letter-spacing: 0.3px;
}
.btn-primary {
  background: var(--lc-black); color: white;
  width: 100%; padding: 13px;
}
.btn-primary:hover {
  background: var(--lc-yellow); color: var(--lc-black);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245,196,0,0.4);
}
.btn-primary:disabled {
  opacity: 0.4; cursor: not-allowed;
  background: var(--lc-gray-500); color: white;
  transform: none; box-shadow: none;
}
.btn-primary.btn-large {
  font-size: 1.05rem; padding: 16px 36px;
  max-width: 340px;
}
.btn-secondary {
  background: var(--lc-yellow); color: var(--lc-black);
  border: 2px solid var(--lc-yellow);
}
.btn-secondary:hover {
  background: var(--lc-yellow-dark);
  border-color: var(--lc-yellow-dark);
}
.btn-accent {
  background: var(--lc-green); color: white;
}
.btn-accent:hover { background: var(--lc-green-dark); }
.btn-ghost {
  background: transparent; color: white;
  padding: 7px 12px;
  border: 1px solid rgba(255,255,255,0.3);
}
.btn-ghost:hover {
  background: var(--lc-yellow); color: var(--lc-black);
  border-color: var(--lc-yellow);
}
.btn-ghost-dark {
  background: transparent; color: var(--lc-black);
  padding: 10px 20px;
  border: 1.5px solid var(--lc-gray-300);
}
.btn-ghost-dark:hover {
  border-color: var(--lc-black);
  background: white;
}

/* ============================================
   APP SHELL / HEADER
   ============================================ */
#view-public.active, #view-admin.active {
  display: flex; flex-direction: column;
}

.app-header {
  background: var(--lc-black); color: white;
  border-bottom: 4px solid var(--lc-yellow);
  padding: 12px 24px;
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  position: sticky; top: 0; z-index: 50;
}
.app-header.public { border-bottom-color: var(--lc-yellow); }

.brand-mini {
  display: flex; align-items: center; gap: 12px;
}
.brand-mini img { height: 40px; }
.brand-text {
  font-weight: 700; font-size: 0.95rem;
  color: white;
  padding-left: 12px;
  border-left: 2px solid var(--lc-yellow);
  line-height: 1.2;
}
.brand-text small {
  display: block; font-weight: 400;
  color: var(--lc-gray-300); font-size: 0.75rem;
}

.app-nav {
  display: flex; gap: 4px; flex: 1;
  justify-content: center; flex-wrap: wrap;
}
.nav-btn {
  background: transparent; border: none;
  padding: 9px 16px; border-radius: 4px;
  cursor: pointer; font-size: 0.88rem;
  font-weight: 600; color: rgba(255,255,255,0.75);
  font-family: inherit; transition: all 0.2s;
}
.nav-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-btn.active {
  background: var(--lc-yellow); color: var(--lc-black);
}

.user-box {
  display: flex; align-items: center;
  gap: 10px; font-size: 0.85rem; color: white;
}
.badge {
  background: rgba(255,255,255,0.15); color: white;
  padding: 3px 9px; border-radius: 10px;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.badge.admin { background: var(--lc-yellow); color: var(--lc-black); }

.app-main {
  padding: 28px 20px;
  max-width: 900px;
  margin: 0 auto; width: 100%;
}
.page, .admin-page { display: none; }
.page.active, .admin-page.active { display: block; }

/* ============================================
   PÁGINA DE BOAS-VINDAS (letter institucional)
   ============================================ */
.welcome h1 {
  margin-top: 0;
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--lc-black);
  position: relative;
  padding-bottom: 14px;
  margin-bottom: 24px;
}
.welcome h1::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 80px; height: 4px;
  background: var(--lc-yellow);
  border-radius: 2px;
}

.institutional-letter {
  background: white;
  border-radius: var(--radius);
  padding: 32px 34px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--lc-yellow);
  font-size: 0.98rem;
  line-height: 1.7;
}
.institutional-letter p {
  margin: 0 0 14px;
  color: #333;
}
.institutional-letter h3 {
  font-size: 1.1rem;
  color: var(--lc-black);
  font-weight: 800;
  margin: 26px 0 10px;
  padding-left: 12px;
  border-left: 4px solid var(--lc-yellow);
}
.institutional-letter ul {
  padding-left: 22px;
  margin: 8px 0 16px;
}
.institutional-letter ul li {
  margin-bottom: 6px;
  color: #333;
}
.institutional-letter .letter-subject {
  background: var(--lc-yellow-soft);
  border-left: 4px solid var(--lc-yellow);
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 20px;
}
.institutional-letter .highlight-box {
  background: #fef3c7;
  border-left: 4px solid var(--lc-yellow-dark);
  padding: 14px 18px;
  border-radius: 4px;
  margin: 12px 0;
  font-size: 0.95rem;
}

.cta-block {
  text-align: center;
  margin: 30px 0 20px;
}

/* ============================================
   STEP HEADER
   ============================================ */
.step-header {
  margin-bottom: 24px;
}
.step-badge {
  display: inline-block;
  background: var(--lc-black);
  color: var(--lc-yellow);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}
.step-header h1 {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--lc-black);
  margin: 0 0 6px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--lc-yellow);
  display: inline-block;
}

.step-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.step-actions .btn-primary { flex: 1; max-width: 300px; }
.step-actions .btn-ghost-dark { flex: 0 0 auto; }

/* ============================================
   COMPANY SELECTION
   ============================================ */
.company-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 20px 0;
}
.company-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.company-card:hover {
  border-color: var(--lc-yellow);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
.company-card input[type="radio"] {
  width: 20px; height: 20px;
  accent-color: var(--lc-yellow);
  cursor: pointer;
  flex-shrink: 0;
}
.company-card:has(input:checked) {
  border-color: var(--lc-yellow);
  background: var(--lc-yellow-soft);
  box-shadow: 0 4px 14px rgba(245,196,0,0.25);
}
.company-info h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: var(--lc-black);
  font-weight: 800;
}
.company-info small {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 4px;
}
.company-cnpj {
  display: inline-block;
  background: rgba(0,0,0,0.06);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  color: var(--lc-gray-700);
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

/* ============================================
   DEMO FORM (simplificado)
   ============================================ */
.demo-form {
  background: white;
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-top: 3px solid var(--lc-yellow);
}
.demo-form label {
  display: block;
  margin-bottom: 18px;
}
.demo-form label > span {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--lc-gray-700);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.demo-form input, .demo-form select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: #fafafa;
  transition: all 0.2s;
}
.demo-form input:focus, .demo-form select:focus {
  outline: none;
  border-color: var(--lc-yellow);
  background: white;
  box-shadow: 0 0 0 3px rgba(245,196,0,0.15);
}

/* ============================================
   PROGRESS + QUESTIONNAIRE
   ============================================ */
.progress-bar {
  position: sticky;
  top: 78px;
  background: var(--lc-black);
  border-radius: 999px;
  height: 34px;
  margin-bottom: 22px;
  overflow: hidden;
  z-index: 10;
  box-shadow: var(--shadow);
}
.progress-fill {
  background: linear-gradient(90deg, var(--lc-yellow), var(--lc-yellow-dark));
  height: 100%;
  width: 0%;
  transition: width 0.3s;
}
.progress-label {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  font-weight: 700;
  color: white;
  z-index: 1;
}

.quest-dimension {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--lc-yellow);
}
.quest-dimension h2 {
  font-size: 1.05rem;
  margin: 0 0 6px;
  color: var(--lc-black);
  font-weight: 800;
}
.quest-dimension .scale-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 14px;
  padding: 8px 12px;
  background: var(--lc-yellow-soft);
  border-radius: 4px;
  border-left: 3px solid var(--lc-yellow);
}
.quest-item {
  padding: 14px 0;
  border-top: 1px solid var(--lc-gray-200);
}
.quest-item:first-of-type { border-top: none; }
.quest-item .q-text {
  font-weight: 500;
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--lc-black);
}
.quest-item .q-num {
  display: inline-block;
  background: var(--lc-black);
  color: var(--lc-yellow);
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  margin-right: 8px;
  font-weight: 700;
}
.q-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.q-option {
  display: flex;
  align-items: center;
  padding: 9px 11px;
  background: #fafafa;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.87rem;
  transition: all 0.15s;
}
.q-option:hover {
  background: var(--lc-yellow-soft);
  border-color: var(--lc-yellow);
}
.q-option input { margin-right: 8px; accent-color: var(--lc-yellow); }
.q-option.selected {
  background: var(--lc-yellow-soft);
  border-color: var(--lc-yellow);
  font-weight: 600;
}

.quest-actions { margin: 24px 0 40px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================
   PÁGINA DE CONFIRMAÇÃO (colaborador)
   ============================================ */
.done-box {
  background: white;
  border-radius: var(--radius);
  padding: 44px 34px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 5px solid var(--lc-green);
  max-width: 620px;
  margin: 40px auto;
}
.done-icon {
  width: 80px; height: 80px;
  background: var(--lc-green);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(16,185,129,0.3);
}
.done-box h1 {
  color: var(--lc-black);
  margin: 0 0 12px;
  font-size: 1.6rem;
}
.done-box .lead {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--lc-black);
  margin-bottom: 16px;
}
.done-box p {
  color: var(--lc-gray-700);
  line-height: 1.7;
}
.done-actions { margin-top: 26px; }
.done-actions .btn-primary { max-width: 260px; }

/* ============================================
   ADMIN DASHBOARD
   ============================================ */
#view-admin .app-main { max-width: 1300px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.stat-box {
  background: var(--lc-black);
  color: white;
  padding: 16px 18px;
  border-radius: 6px;
  border-left: 3px solid var(--lc-yellow);
}
.stat-box .stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--lc-yellow);
  letter-spacing: 0.5px;
  font-weight: 700;
}
.stat-box .stat-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  margin-top: 3px;
}
.stat-box .stat-sub {
  font-size: 0.72rem;
  color: var(--lc-gray-300);
  margin-top: 2px;
}

.admin-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 24px;
}
.admin-col {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--lc-yellow);
}
.admin-col h3 {
  margin: 0 0 14px;
  font-size: 1rem;
  color: var(--lc-black);
  font-weight: 800;
}

.company-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}
.company-bar .cb-name { flex: 1; }
.company-bar .cb-bar-wrap {
  flex: 2;
  height: 22px;
  background: #f4f4f4;
  border-radius: 11px;
  overflow: hidden;
}
.company-bar .cb-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--lc-yellow), var(--lc-yellow-dark));
  display: flex;
  align-items: center;
  padding: 0 8px;
  color: var(--lc-black);
  font-weight: 700;
  font-size: 0.78rem;
}

.filters {
  background: var(--surface);
  padding: 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  border-top: 3px solid var(--lc-yellow);
}
.filters label {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--lc-gray-700);
  gap: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.filters input, .filters select {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  font-size: 0.9rem;
  font-family: inherit;
  text-transform: none;
  font-weight: 400;
}
.filter-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.analytics-controls {
  background: white;
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  border-top: 3px solid var(--lc-yellow);
}
.analytics-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--lc-gray-700);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex: 1;
  min-width: 220px;
}
.analytics-controls select {
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  font-size: 0.9rem;
  font-family: inherit;
  text-transform: none;
  font-weight: 400;
}

.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th, .data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  background: var(--lc-black);
  color: var(--lc-yellow);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.data-table tbody tr:hover { background: var(--lc-yellow-soft); }
.btn-link {
  background: none; border: none;
  color: var(--lc-black); cursor: pointer;
  font-size: 0.85rem; font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--lc-yellow);
  text-decoration-thickness: 2px;
  padding: 0; font-family: inherit;
}
.btn-link:hover { color: var(--lc-yellow-dark); }

/* Dimension rows (result cards, admin details) */
.dim-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.dim-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  background: #f9f9f9;
  border-radius: 5px;
  border-left: 4px solid var(--lc-gray-500);
  gap: 10px;
}
.dim-row.green  { border-left-color: var(--green);  background: #f0fdf4; }
.dim-row.yellow { border-left-color: var(--yellow); background: #fffbeb; }
.dim-row.red    { border-left-color: var(--red);    background: #fef2f2; }
.dim-name { font-size: 0.9rem; flex: 1; font-weight: 500; }
.dim-score {
  font-weight: 800;
  font-size: 0.95rem;
  background: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
}
.dim-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 10px;
  letter-spacing: 0.4px;
}
.dim-label.green  { background: var(--green);  color: white; }
.dim-label.yellow { background: var(--yellow); color: white; }
.dim-label.red    { background: var(--red);    color: white; }

.summary-box {
  display: flex; gap: 14px; flex-wrap: wrap; margin: 16px 0;
}
.summary-pill {
  flex: 1; min-width: 110px;
  padding: 14px; border-radius: 6px;
  text-align: center; border: 1px solid;
}
.summary-pill.green  { background: #f0fdf4; border-color: #bbf7d0; }
.summary-pill.yellow { background: #fffbeb; border-color: #fde68a; }
.summary-pill.red    { background: #fef2f2; border-color: #fecaca; }
.summary-pill strong { display: block; font-size: 1.9rem; font-weight: 800; }
.summary-pill span {
  font-size: 0.78rem; color: var(--muted);
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Risk explanations */
.risk-explanation {
  background: #fff;
  border: 1px solid #fecaca;
  border-left: 5px solid var(--red);
  border-radius: 6px;
  padding: 18px 20px;
  margin-bottom: 14px;
}
.risk-explanation h4 {
  margin: 0 0 8px;
  color: var(--red);
  font-weight: 800;
  font-size: 1.05rem;
  display: flex; align-items: center; gap: 8px;
}
.risk-explanation h4::before {
  content: '⚠';
  background: var(--red); color: white;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  font-size: 0.85rem;
}
.risk-explanation .risk-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 10px;
  padding: 6px 10px;
  background: #fef2f2;
  border-radius: 4px;
  display: inline-block;
}
.risk-explanation .risk-section { margin: 12px 0; }
.risk-explanation .risk-section h5 {
  margin: 0 0 5px;
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--lc-black);
  font-weight: 800;
}
.risk-explanation .risk-section p,
.risk-explanation .risk-section ul {
  margin: 0 0 6px;
  font-size: 0.92rem;
  line-height: 1.6;
}
.risk-explanation ul { padding-left: 20px; }
.risk-explanation li { margin-bottom: 4px; }

/* Reference table */
.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 14px 0;
}
.ref-table th, .ref-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.ref-table th {
  background: var(--lc-black);
  color: var(--lc-yellow);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ref-table tr.is-red    td:first-child { border-left: 3px solid var(--red); }
.ref-table tr.is-yellow td:first-child { border-left: 3px solid var(--yellow); }
.ref-table tr.is-green  td:first-child { border-left: 3px solid var(--green); }
.diff-up   { color: var(--red);   font-weight: 700; }
.diff-down { color: var(--green); font-weight: 700; }
.diff-eq   { color: var(--muted); font-weight: 600; }

/* Print report */
.print-report {
  background: white; color: black; font-size: 0.9rem;
}
.print-header {
  display: flex; justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--lc-yellow);
  padding-bottom: 14px; margin-bottom: 18px;
}
.print-header .pr-left img { height: 50px; }
.print-header .pr-right {
  text-align: right; font-size: 0.8rem; color: var(--muted);
}
.print-title {
  font-size: 1.3rem; font-weight: 800;
  color: var(--lc-black); margin: 0 0 4px;
}
.print-subtitle {
  font-size: 0.9rem; color: var(--muted); margin: 0;
}
.print-section { margin: 22px 0; page-break-inside: avoid; }
.print-section h3 {
  background: var(--lc-black);
  color: var(--lc-yellow);
  padding: 8px 14px;
  font-size: 0.95rem;
  font-weight: 800;
  margin: 0 0 12px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.print-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  font-size: 0.88rem;
}
.print-info > div {
  padding: 6px 10px;
  background: #fafafa;
  border-left: 2px solid var(--lc-yellow);
}
.print-info strong {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}
.print-footer {
  margin-top: 30px;
  padding-top: 14px;
  border-top: 2px solid var(--lc-yellow);
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(26,26,26,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal.hidden { display: none; }
.modal-content {
  background: white;
  border-radius: var(--radius);
  padding: 0;
  max-width: 900px; width: 100%;
  max-height: 92vh; overflow-y: auto;
  position: relative;
  border-top: 5px solid var(--lc-yellow);
}
#modal-body { padding: 28px; }
.modal-close {
  position: absolute;
  top: 8px; right: 12px;
  background: none; border: none;
  font-size: 1.8rem; cursor: pointer;
  color: var(--lc-gray-500);
  line-height: 1;
}
.modal-close:hover { color: var(--lc-black); }

/* Toast */
.toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--lc-black); color: white;
  padding: 13px 22px;
  border-radius: 6px;
  font-size: 0.9rem; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  transition: transform 0.3s;
  z-index: 200;
  max-width: 90%;
  border-left: 4px solid var(--lc-yellow);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-left-color: var(--lc-green); }
.toast.error { border-left-color: var(--red); }

/* Print */
@media print {
  body { background: white; }
  .app-header, .filters, .quest-actions,
  .btn-primary, .btn-secondary, .btn-accent, .btn-ghost, .btn-ghost-dark,
  .toast, .modal-close, .nav-btn, .step-actions,
  .filter-actions, #view-admin-login, #view-public,
  .analytics-controls { display: none !important; }
  .modal { position: static; background: none; padding: 0; }
  .modal-content { box-shadow: none; max-width: 100%; max-height: none; border-top: none; }
  #modal-body { padding: 0; }
  .app-main { padding: 0; max-width: 100%; }
  .admin-page, .page { display: block !important; }
  .risk-explanation { break-inside: avoid; }
  .print-section { break-inside: avoid; }
}

/* Responsivo */
@media (min-width: 600px) {
  .demo-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .demo-form label { margin-bottom: 0; }
  .demo-form .step-actions { grid-column: 1 / -1; margin-top: 20px; }
  .q-options { grid-template-columns: repeat(5, 1fr); }
  .q-option {
    flex-direction: column; text-align: center;
    font-size: 0.76rem; padding: 9px 5px;
  }
  .q-option input { margin: 0 0 4px 0; }
  .admin-columns { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .app-header { padding: 10px 14px; }
  .brand-text { display: none; }
  .brand-mini img { height: 32px; }
  .app-nav { order: 3; width: 100%; justify-content: stretch; }
  .nav-btn { flex: 1; font-size: 0.74rem; padding: 7px 4px; }
  .filters { flex-direction: column; align-items: stretch; }
  .filter-actions { margin-left: 0; }
  .dim-row { flex-wrap: wrap; }
  .data-table { font-size: 0.8rem; }
  .data-table th, .data-table td { padding: 8px 8px; }
  .print-info { grid-template-columns: 1fr; }
  .institutional-letter { padding: 22px 20px; }
  .welcome h1 { font-size: 1.5rem; }
  .step-header h1 { font-size: 1.4rem; }
}

/* ============================================
   DASHBOARD v2 — Gráficos e controles
   ============================================ */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}
.dashboard-header h1 { margin: 0; }
.dashboard-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--lc-gray-700);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.toggle-label select {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  font-size: 0.9rem;
  font-family: inherit;
  text-transform: none;
  font-weight: 500;
  background: white;
  min-width: 280px;
  cursor: pointer;
}
.toggle-label select:focus {
  outline: none;
  border-color: var(--lc-yellow);
  box-shadow: 0 0 0 3px rgba(245,196,0,0.15);
}

.chart-card {
  background: white;
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--lc-yellow);
  margin-bottom: 18px;
}
.chart-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  color: var(--lc-black);
  font-weight: 800;
}

.chart-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--lc-gray-700);
}
.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.chart-legend .dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* Barras horizontais (volume, top risks) */
.hbar-chart { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.hbar-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  align-items: center;
}
.hbar-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--lc-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hbar-track {
  background: #f4f4f4;
  border-radius: 12px;
  height: 26px;
  overflow: hidden;
  position: relative;
}
.hbar-fill {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px;
  border-radius: 12px;
  min-width: 42px;
  transition: width 0.4s ease-out;
}
.hbar-value {
  color: white;
  font-weight: 700;
  font-size: 0.82rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* Barras empilhadas (verde/amarelo/vermelho) */
.stack-chart { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.stack-row {
  display: grid;
  grid-template-columns: 200px 1fr 70px;
  gap: 12px;
  align-items: center;
}
.stack-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--lc-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stack-track {
  background: #f4f4f4;
  border-radius: 12px;
  height: 26px;
  overflow: hidden;
  display: flex;
}
.stack-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.78rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: width 0.4s ease-out;
}
.stack-count {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
  text-align: right;
}

/* Barras agrupadas (múltiplas empresas por dimensão) */
.grouped-chart { display: flex; flex-direction: column; gap: 14px; margin-top: 12px; }
.grouped-row {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
  align-items: center;
}
.grouped-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--lc-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grouped-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.grouped-bar-item {
  background: #f4f4f4;
  border-radius: 8px;
  height: 16px;
  overflow: hidden;
  position: relative;
}
.grouped-bar-fill {
  height: 100%;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  min-width: 30px;
  transition: width 0.4s ease-out;
}
.grouped-bar-value {
  color: white;
  font-weight: 700;
  font-size: 0.7rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Wrapper SVG */
.svg-chart-wrap { width: 100%; overflow-x: auto; }

/* ============================================
   EXCLUSÃO - Botões e bulk bar
   ============================================ */
.btn-danger {
  background: #dc2626;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-danger:hover {
  background: #b91c1c;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220,38,38,0.35);
}

.btn-link-danger {
  background: none;
  border: none;
  color: #dc2626;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: #fca5a5;
  text-decoration-thickness: 2px;
  padding: 0;
  font-family: inherit;
}
.btn-link-danger:hover { color: #991b1b; text-decoration-color: #dc2626; }

.bulk-actions {
  background: #1a1a1a;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-left: 4px solid #dc2626;
  animation: slide-in 0.25s ease-out;
}
.bulk-actions #bulk-count {
  font-weight: 700;
  font-size: 0.9rem;
  flex: 1;
}
.bulk-actions .btn-danger { padding: 8px 16px; font-size: 0.85rem; }
.bulk-actions .btn-ghost-dark {
  color: white;
  border-color: rgba(255,255,255,0.3);
  padding: 8px 16px;
  font-size: 0.85rem;
}
.bulk-actions .btn-ghost-dark:hover {
  background: rgba(255,255,255,0.1);
  color: white;
  border-color: rgba(255,255,255,0.5);
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.row-check, #select-all {
  width: 18px; height: 18px;
  accent-color: var(--lc-yellow);
  cursor: pointer;
}

.chart-note { font-size: 0.78rem; }

/* Responsivo específico dos gráficos */
@media (max-width: 700px) {
  .hbar-row, .stack-row, .grouped-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .stack-count { text-align: left; }
  .toggle-label select { min-width: 100%; }
  .dashboard-header { flex-direction: column; align-items: stretch; }
}

/* ============================================
   LIXEIRA - Estilos
   ============================================ */
.trash-page-header {
  margin-bottom: 20px;
}
.trash-page-header h1 { margin: 0 0 4px; }

/* Badge de contagem no menu */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dc2626;
  color: white;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 4px;
}
.nav-btn.active .nav-badge { background: white; color: #dc2626; }

/* Barra de info da lixeira */
.trash-info-bar {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border: 1px solid #fca5a5;
  border-left: 5px solid #dc2626;
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.trash-info-icon {
  font-size: 2.4rem;
  line-height: 1;
  flex-shrink: 0;
}
.trash-info-text { flex: 1; min-width: 240px; }
.trash-info-text strong { font-size: 1.05rem; color: #991b1b; display: block; margin-bottom: 4px; }
.trash-info-text p { margin: 0; line-height: 1.6; }
.trash-actions-header { flex-shrink: 0; }
.trash-actions-header .btn-ghost-dark {
  background: white;
  border-color: #dc2626;
  color: #dc2626;
}
.trash-actions-header .btn-ghost-dark:hover {
  background: #dc2626;
  color: white;
}

/* Estado vazio */
.trash-empty-state {
  background: white;
  border-radius: var(--radius);
  padding: 60px 30px;
  text-align: center;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--lc-gray-300);
}
.trash-icon-large {
  font-size: 4rem;
  opacity: 0.35;
  margin-bottom: 12px;
}
.trash-empty-state h2 {
  color: var(--lc-black);
  margin: 0 0 8px;
  font-weight: 700;
}
.trash-empty-state p { margin: 4px 0; }

/* Badge "excluída em" na tabela */
.trash-deleted-badge {
  display: inline-block;
  background: #fef2f2;
  color: #991b1b;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid #fecaca;
  white-space: nowrap;
}

/* Botão restaurar (link) */
.btn-link-restore {
  background: none;
  border: none;
  color: #059669;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: #86efac;
  text-decoration-thickness: 2px;
  padding: 0;
  font-family: inherit;
}
.btn-link-restore:hover {
  color: #047857;
  text-decoration-color: #059669;
}

/* Preview no modal */
.restore-preview {
  background: #f9fafb;
  border: 1px solid #e5e5e5;
  border-left: 4px solid #10b981;
  border-radius: 6px;
  padding: 12px 16px;
  margin: 12px 0;
  font-size: 0.9rem;
  line-height: 1.9;
}
.restore-preview > div { padding: 2px 0; }
.restore-preview strong { font-weight: 700; color: var(--lc-black); }

/* Caixa de aviso severo */
.warning-box {
  background: #fef2f2;
  border: 2px solid #fca5a5;
  border-radius: 8px;
  padding: 14px 18px;
  margin: 12px 0;
  color: #991b1b;
}
.warning-box strong { font-size: 1rem; }
.warning-box p { color: #7f1d1d; font-size: 0.9rem; line-height: 1.6; }

/* Bulk bar da lixeira com destaque em amarelo (permite tanto restaurar quanto excluir) */
#trash-bulk-actions {
  border-left-color: var(--lc-yellow);
}

/* Responsivo lixeira */
@media (max-width: 700px) {
  .trash-info-bar {
    flex-direction: column;
    text-align: center;
    align-items: stretch;
  }
  .trash-actions-header { text-align: center; }
}

/* ============================================
   V3 - Loading screen + Storage badge
   ============================================ */
#app-loading {
  position: fixed;
  inset: 0;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  color: white;
}
.loading-content { text-align: center; }
.loading-spinner {
  width: 44px; height: 44px;
  border: 4px solid rgba(245,196,0,0.2);
  border-top-color: #f5c400;
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#app-loading p {
  color: #f5c400;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

.storage-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  background: #6b7280;
  color: white;
  cursor: help;
}

#btn-refresh-data {
  font-size: 1.05rem;
  padding: 6px 10px;
  min-width: 36px;
}
#btn-refresh-data:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* Ajuste no user-box para caber mais elementos */
@media (max-width: 900px) {
  .user-box {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }
  .storage-badge { font-size: 0.65rem; padding: 3px 8px; }
}

/* ============================================
   BATCH PRINT — Modal de opções de impressão
   ============================================ */
.batch-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 18px 0;
}
.batch-section h3 {
  margin: 0 0 12px;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: #6b7280;
  letter-spacing: 0.6px;
  font-weight: 800;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--lc-yellow);
}
.batch-radio-card {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 10px;
  background: white;
}
.batch-radio-card:hover {
  border-color: var(--lc-yellow);
  background: var(--lc-yellow-soft);
}
.batch-radio-card:has(input:checked) {
  border-color: var(--lc-yellow);
  background: var(--lc-yellow-soft);
  box-shadow: 0 4px 12px rgba(245,196,0,0.2);
}
.batch-radio-card input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--lc-yellow);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}
.batch-radio-content { flex: 1; }
.batch-radio-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--lc-black);
  margin-bottom: 4px;
}
.batch-radio-desc {
  font-size: 0.85rem;
  color: #4b5563;
  line-height: 1.5;
}
.batch-radio-meta {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  background: rgba(0,0,0,0.06);
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #4b5563;
}
.batch-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
