/* Greenne — Apple Design (HIG), accent VERDE natureza.
   Tokens adaptados do NIPI Hub (skill apple-design). Só CSS.
   Suporta light e dark (prefers-color-scheme) + override manual (data-theme). */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Cores (light) */
  --bg: #F5F5F7;
  --surface: #FFFFFF;
  --surface-2: #FBFBFD;
  --text: #1D1D1F;
  --text-2: #6E6E73;
  --text-3: #86868B;

  /* Accent VERDE natureza (Greenne) */
  --accent: #1D9E75;
  --accent-press: #17835F;

  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.12);
  --fill: #F0F0F3;
  --fill-hover: #E9E9ED;

  /* Estados semânticos (usar com moderação, nunca como accent) */
  --warn: #C7801A;
  --warn-bg: rgba(255,159,10,0.14);
  --danger: #D70015;
  --danger-bg: rgba(255,59,48,0.12);
  --ok: #1D9E75;
  --ok-bg: rgba(29,158,117,0.15);
  --info: #1D9E75;
  --info-bg: rgba(29,158,117,0.10);

  /* Pilares ESG (Etapa G3 — anéis de maturidade). Cores de sistema Apple HIG:
     Ambiental usa o accent Greenne; Social/Governança usam Blue/Indigo, para
     diferenciar os 3 anéis sem sair da paleta sóbria da marca. */
  --pillar-e: #1D9E75;
  --pillar-s: #0071E3;
  --pillar-g: #5E5CE6;

  /* Forma / profundidade */
  --radius: 12px;
  --radius-lg: 20px;
  --radius-sm: 8px;
  --radius-pill: 980px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.14);
  --focus-ring: 0 0 0 4px rgba(29,158,117,0.28);

  /* Espaçamento (grid de 8px) */
  --s1: 8px; --s2: 16px; --s3: 24px; --s4: 32px; --s5: 48px; --s6: 64px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0D0C;
    --surface: #1C1E1D;
    --surface-2: #2C2E2D;
    --text: #F5F5F7;
    --text-2: #AEAEB2;
    --text-3: #8E8E93;
    --accent: #35C48D;
    --accent-press: #57D3A4;
    --border: rgba(255,255,255,0.10);
    --border-strong: rgba(255,255,255,0.16);
    --fill: #2C2E2D;
    --fill-hover: #3A3C3B;

    --warn: #FFD60A;
    --warn-bg: rgba(255,214,10,0.16);
    --danger: #FF453A;
    --danger-bg: rgba(255,69,58,0.18);
    --ok: #35C48D;
    --ok-bg: rgba(53,196,141,0.18);
    --info: #35C48D;
    --info-bg: rgba(53,196,141,0.16);

    --pillar-e: #35C48D;
    --pillar-s: #0A84FF;
    --pillar-g: #7D7AFF;

    --shadow: 0 8px 32px rgba(0,0,0,0.30);
    --shadow-sm: none;
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.45);
    --focus-ring: 0 0 0 4px rgba(53,196,141,0.36);
  }
}

/* Override manual de tema (data-theme no <html>). */
html[data-theme="light"] {
  --bg: #F5F5F7; --surface: #FFFFFF; --surface-2: #FBFBFD;
  --text: #1D1D1F; --text-2: #6E6E73; --text-3: #86868B;
  --accent: #1D9E75; --accent-press: #17835F;
  --border: rgba(0,0,0,0.08); --border-strong: rgba(0,0,0,0.12);
  --fill: #F0F0F3; --fill-hover: #E9E9ED;
  --ok: #1D9E75; --ok-bg: rgba(29,158,117,0.15);
  --info: #1D9E75; --info-bg: rgba(29,158,117,0.10);
  --pillar-e: #1D9E75; --pillar-s: #0071E3; --pillar-g: #5E5CE6;
  --shadow: 0 4px 24px rgba(0,0,0,0.08); --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.14); --focus-ring: 0 0 0 4px rgba(29,158,117,0.28);
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0B0D0C; --surface: #1C1E1D; --surface-2: #2C2E2D;
  --text: #F5F5F7; --text-2: #AEAEB2; --text-3: #8E8E93;
  --accent: #35C48D; --accent-press: #57D3A4;
  --border: rgba(255,255,255,0.10); --border-strong: rgba(255,255,255,0.16);
  --fill: #2C2E2D; --fill-hover: #3A3C3B;
  --ok: #35C48D; --ok-bg: rgba(53,196,141,0.18);
  --info: #35C48D; --info-bg: rgba(53,196,141,0.16);
  --pillar-e: #35C48D; --pillar-s: #0A84FF; --pillar-g: #7D7AFF;
  --shadow: 0 8px 32px rgba(0,0,0,0.30); --shadow-sm: none;
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.45); --focus-ring: 0 0 0 4px rgba(53,196,141,0.36);
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  margin: 0 0 var(--s1);
  line-height: 1.08;
  letter-spacing: -0.022em;
  font-weight: 600;
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.brand { font-weight: 700; letter-spacing: -0.02em; }
.brand span { color: var(--accent); }
.brand.small { font-size: 1.15rem; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent;
  background: var(--fill);
  color: var(--text);
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font: inherit; font-size: 0.94rem; font-weight: 500;
  text-decoration: none; line-height: 1;
  transition: background .2s var(--ease), color .2s var(--ease),
              box-shadow .2s var(--ease), transform .1s var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--fill-hover); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.btn-primary { background: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-press); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--fill); }
.btn-secondary { background: var(--fill); color: var(--text); }
.btn-secondary:hover { background: var(--fill-hover); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }

.icon-btn {
  background: transparent; border: 0; color: var(--text);
  font-size: 1.4rem; cursor: pointer; display: none;
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  transition: background .2s var(--ease);
}
.icon-btn:hover { background: var(--fill); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* ---------- Campos ---------- */
input, select, textarea {
  width: 100%;
  background: var(--fill);
  color: var(--text);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 14px;
  font: inherit; font-size: 1rem;
  transition: background .2s var(--ease), box-shadow .2s var(--ease),
              border-color .2s var(--ease);
  appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { background: var(--fill-hover); }
input:focus, select:focus, textarea:focus {
  outline: none; background: var(--surface);
  border-color: var(--accent); box-shadow: var(--focus-ring);
}
label {
  display: block; margin: var(--s2) 0 6px;
  color: var(--text-2); font-size: 0.85rem; font-weight: 500;
  letter-spacing: -0.01em;
}
.field-error { color: var(--danger); font-size: 0.85rem; margin: var(--s1) 0 0; }

/* ---------- Login ---------- */
.login {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: var(--s3); overflow-y: auto;
  background:
    radial-gradient(circle at 20% 20%, rgba(29,158,117,0.10), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(29,158,117,0.08), transparent 40%),
    var(--bg);
}
.login-hint { text-align: center; margin: var(--s2) 0 0; }
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s5) var(--s4);
  box-shadow: var(--shadow);
}
.login-logo {
  width: 48px; height: 48px; margin: 0 auto var(--s2);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-press));
  box-shadow: var(--shadow-sm);
}
.login-card h1 {
  font-size: 2.4rem; text-align: center; letter-spacing: -0.03em;
  margin-bottom: var(--s1);
}
.login-sub {
  text-align: center; color: var(--text-2); margin: 0 0 var(--s3); font-size: 1rem;
}
.login-card .btn { width: 100%; margin-top: var(--s3); padding: 13px; }

/* Abas Entrar / Criar conta */
.auth-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--fill); border-radius: var(--radius-pill);
  margin-bottom: var(--s2);
}
.auth-tab {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  padding: 9px 14px; border-radius: var(--radius-pill);
  font: inherit; font-size: 0.9rem; font-weight: 500; color: var(--text-2);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: var(--shadow-sm); }
.auth-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.field-info { color: var(--accent); font-size: 0.85rem; margin: var(--s1) 0 0; }

/* Grelha chave/valor (perfil da empresa) */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s2); }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv-key { color: var(--text-3); font-size: 0.76rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kv-val { color: var(--text); font-size: 1.05rem; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: var(--s2);
  padding: 10px var(--s3);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
  min-height: 56px;
}
.topbar-right {
  margin-left: auto; display: flex; align-items: center;
  gap: var(--s1); flex-wrap: wrap;
}
.user-badge {
  background: var(--fill);
  padding: 6px 14px; border-radius: var(--radius-pill);
  font-size: 0.82rem; color: var(--text-2); font-weight: 500;
}

.layout { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 248px; flex-shrink: 0;
  background: transparent;
  border-right: 1px solid var(--border);
  padding: var(--s2); overflow-y: auto;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin-bottom: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: 0; color: var(--text);
  text-align: left;
  padding: 10px 14px; border-radius: var(--radius); cursor: pointer;
  font: inherit; font-size: 0.95rem; font-weight: 500;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-link:hover { background: var(--fill); }
.nav-link.active { background: var(--info-bg); color: var(--accent); font-weight: 600; }
.nav-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.nav-link .ic { width: 1.3rem; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Ícones SVG (Lucide) ---------- */
.icon-wrap { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.icon { display: block; flex: none; vertical-align: middle; }

.view { flex: 1; padding: var(--s4) var(--s5); overflow-y: auto; max-width: 1120px; }
.view:focus { outline: none; }

/* ---------- Componentes ---------- */
.page-head {
  display: flex; align-items: center; gap: var(--s2);
  flex-wrap: wrap; margin-bottom: var(--s3);
}
.page-head h2 { font-size: 2rem; letter-spacing: -0.03em; margin: 0; }
.page-head .spacer { flex: 1; }

.grid { display: grid; gap: var(--s2); }
.cards { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s3);
  box-shadow: var(--shadow-sm);
  min-width: 0;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.card[role="button"] { cursor: pointer; }
.card[role="button"]:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card[role="button"]:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.metric { font-size: 2.6rem; font-weight: 700; letter-spacing: -0.03em; color: var(--text); line-height: 1; }
.metric-label { color: var(--text-2); font-size: 0.88rem; margin-top: 6px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s3);
  margin-bottom: var(--s2);
  box-shadow: var(--shadow-sm);
}
.panel h3 {
  color: var(--text-3); font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: var(--s2);
}

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 600;
  padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: var(--fill); color: var(--text-2);
  white-space: nowrap; line-height: 1.3;
}
.badge.stage { background: var(--info-bg); color: var(--accent); }

/* Escada de níveis Greenne (visual, sem lógica ainda) */
.levels { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }
.level-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-pill);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 0.85rem; font-weight: 500; color: var(--text-2);
}
.level-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .35; }
.level-pill.current { background: var(--info-bg); color: var(--accent); border-color: transparent; font-weight: 600; }
.level-pill.current .dot { opacity: 1; }

.pillars { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.pillar-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--info-bg); color: var(--accent); margin-bottom: var(--s1);
}

.row { display: flex; gap: var(--s1); flex-wrap: wrap; align-items: center; }
.muted { color: var(--text-2); }
.small { font-size: 0.84rem; }
.lead { font-size: 1.05rem; color: var(--text-2); line-height: 1.6; }
.empty {
  color: var(--text-2); text-align: center; padding: var(--s5) var(--s3);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface-2);
}

/* Toaster */
.toaster {
  position: fixed; bottom: var(--s3); right: var(--s3);
  display: flex; flex-direction: column; gap: var(--s1); z-index: 60;
}
.toast {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--text);
  padding: 12px 16px; border-radius: var(--radius);
  box-shadow: var(--shadow); max-width: 340px;
  font-size: 0.9rem;
}
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .view { padding: var(--s3); }
  .page-head h2 { font-size: 1.6rem; }
}
@media (max-width: 760px) {
  .icon-btn { display: inline-flex; }
  .topbar { padding: 8px var(--s2); }
  .sidebar {
    position: fixed; top: 56px; bottom: 0; left: 0; z-index: 30;
    width: 260px; background: var(--surface);
    transform: translateX(-100%);
    transition: transform .25s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar-right .btn { padding: 7px 12px; font-size: 0.82rem; }
  .user-badge { display: none; }
}

/* ---------- Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============ Diagnóstico ESG (Etapa 2) ============ */
.diag-progress { margin-bottom: var(--s1); }
.diag-progress-head { display: flex; justify-content: space-between; margin-bottom: 6px; }
.progress-track {
  height: 8px; border-radius: var(--radius-pill); background: var(--fill);
  overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: var(--radius-pill); background: var(--accent);
  transition: width .3s var(--ease);
}
.diag-card .diag-question {
  font-size: 1.25rem; letter-spacing: -0.02em; line-height: 1.4;
  margin: var(--s2) 0 0; border: 0; padding: 0;
}
.diag-gri { background: var(--fill); color: var(--text-2); }
.diag-pilar { display: inline-flex; align-items: center; gap: 4px; }
.diag-options { display: flex; flex-direction: column; gap: var(--s1); margin-top: var(--s2); }
.diag-option {
  display: flex; align-items: flex-start; gap: var(--s2); text-align: left;
  width: 100%; padding: 14px 16px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); background: var(--surface); color: var(--text);
  cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease);
}
.diag-option:hover { background: var(--fill); }
.diag-option:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.diag-option.selected { border-color: var(--accent); background: var(--info-bg); }
.diag-option-radio {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border-strong); display: inline-flex;
  align-items: center; justify-content: center; margin-top: 1px; color: #fff;
}
.diag-option-radio.on { background: var(--accent); border-color: var(--accent); }
.diag-option-body { display: flex; flex-direction: column; gap: 2px; }
.diag-option-label { font-weight: 600; }
.diag-nav { align-items: center; }
.diag-review .diag-review-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.diag-review-q { display: block; }
.diag-review-a { display: block; font-weight: 600; color: var(--accent); margin-top: 2px; }
.score-total { background: var(--info-bg); border-color: transparent; }

/* ============ Níveis + Gamificação + Greenne Coins (Etapa 3) ============ */
/* Nível atual no dashboard */
.nivel-atual { display: flex; align-items: center; gap: var(--s2); }
.nivel-icon {
  width: 56px; height: 56px; border-radius: 16px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--info-bg); color: var(--accent);
}
.nivel-nome { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.nivel-progress .diag-progress-head { margin-bottom: 6px; }

/* Badges de recompensa (pontos / coins) e dificuldade */
.badge.reward { background: var(--info-bg); color: var(--accent); }
.badge.dif { text-transform: none; }
.dif-facil { background: var(--info-bg); color: var(--accent); }
.dif-medio { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.dif-avancado { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.coins-stat { text-align: left; }

/* ============ Plano de Ação + Dashboard consolidado (Etapa 4) ============ */
/* Badges de prioridade */
.badge.prio { text-transform: none; }
.prio-alta { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.prio-media { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.prio-baixa { background: var(--info-bg); color: var(--accent); }

/* Cartão-resumo de pilar no plano */
.plano-pilar { padding: var(--s2) var(--s3); }
.plano-pilar-nome { font-size: 1.05rem; font-weight: 600; color: var(--text); }

/* Histórico de diagnósticos (evolução) */
.hist-list { display: flex; flex-direction: column; gap: var(--s2); }
.hist-row {
  display: grid; grid-template-columns: 130px 1fr auto; align-items: center;
  gap: var(--s2);
}
.hist-bar-wrap { min-width: 0; }
.hist-val { text-align: right; white-space: nowrap; }
.hist-score { font-weight: 700; color: var(--text); font-size: 1.05rem; }
.hist-up { color: var(--accent); }
.hist-down { color: var(--danger); }
@media (max-width: 620px) {
  .hist-row { grid-template-columns: 1fr; gap: 4px; }
  .hist-val { text-align: left; }
}

/* Filtros por chips */
.filtros { display: flex; flex-direction: column; gap: var(--s2); }
.chip-row { display: flex; flex-wrap: wrap; gap: var(--s1); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border-strong);
  font-size: 0.85rem; font-weight: 500; color: var(--text-2);
  cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease), color .15s var(--ease);
}
.chip:hover { background: var(--fill); }
.chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.chip.active { background: var(--info-bg); border-color: transparent; color: var(--accent); font-weight: 600; }

/* Cartões de desafio */
.desafio-card { transition: box-shadow .2s var(--ease); }
.desafio-titulo { font-size: 1.1rem; font-weight: 600; margin: 10px 0 0; color: var(--text); }
.desafio-pilar { display: inline-flex; align-items: center; gap: 4px; }
.desafio-actions { align-items: center; gap: var(--s1); margin-top: 4px; }
.desafio-evidencia {
  flex: 1; min-width: 200px; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 0.9rem;
}
.desafio-evidencia:focus-visible { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }
.desafio-card.done { background: var(--surface-2); }
.desafio-check {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
}

/* ============ Relatório ESG (Etapa 5) ============ */
.rel-toolbar { align-items: center; }
.rel-hint { margin: 0 0 var(--s2); }

/* Documento imprimível */
.rel-doc { display: flex; flex-direction: column; gap: var(--s2); }
.rel-sec { break-inside: avoid; }

/* Cabeçalho */
.rel-header {
  padding: var(--s3); border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.rel-brand { display: flex; align-items: center; gap: 8px; }
.rel-logo {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--info-bg); color: var(--accent);
}
.rel-header .brand { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
.rel-header .brand-accent { color: var(--accent); }
.rel-empresa { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; margin: var(--s2) 0 4px; }
.rel-meta { margin: 0 0 4px; }
.rel-emissao { display: inline-flex; align-items: center; gap: 4px; margin: 0; }

/* Nível */
.rel-nivel { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.rel-total { text-align: right; }

/* Pilares */
.rel-pilares { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s1); }
.rel-pilar-row { display: grid; grid-template-columns: 160px 1fr auto; align-items: center; gap: var(--s2); }
.rel-pilar-nome { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.rel-pilar-val { white-space: nowrap; font-weight: 600; color: var(--text-2); }

/* GRI */
.rel-gri-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s2); margin-top: var(--s2); }
.rel-gri-pilar { display: inline-flex; align-items: center; gap: 6px; font-size: 1rem; color: var(--text); margin: 0 0 8px; }
.rel-gri-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rel-gri-item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* Desafios concluídos */
.rel-desafios-totais { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin: var(--s1) 0 var(--s2); }
.rel-desafios-lista { display: flex; flex-direction: column; gap: var(--s1); }
.rel-desafio-row { display: flex; align-items: flex-start; gap: var(--s1); padding: 8px 0; border-top: 1px solid var(--border); }
.rel-desafio-info { flex: 1; min-width: 0; }
.rel-desafio-titulo { font-weight: 600; color: var(--text); }
.rel-desafio-data { white-space: nowrap; }

/* Plano */
.rel-sub { font-size: 1rem; color: var(--text); margin: var(--s2) 0 8px; }
.rel-plano-pilares { display: flex; flex-direction: column; gap: 6px; }
.rel-plano-pilar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rel-acoes-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.rel-acao-titulo { font-weight: 600; color: var(--text); }

/* Rodapé */
.rel-footer { padding: var(--s2) 0; text-align: center; border-top: 1px solid var(--border); margin-top: var(--s1); }

@media (max-width: 620px) {
  .rel-pilar-row { grid-template-columns: 1fr; gap: 4px; }
  .rel-desafios-totais { grid-template-columns: 1fr; }
}

/* ============ Gamificação G1+G2: Progresso + Selos verificados ============ */
/* G1 — lista de etapas de onboarding (card "Maturidade ESG" no dashboard) */
.onboarding-etapas { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.onboarding-etapas li { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 0.92rem; }
.onboarding-etapas li.done { color: var(--text); }
.onboarding-check {
  width: 20px; height: 20px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border-strong); color: transparent;
}
.onboarding-etapas li.done .onboarding-check { background: var(--accent); border-color: var(--accent); color: #fff; }

/* G2 — selos como CREDENCIAIS sóbrias (não figurinhas) */
.credential-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s2); margin-top: var(--s2); }
.credential-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: var(--s3); border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.credential-card.obtido { border-color: var(--accent); background: var(--info-bg); }
.credential-card.pendente { opacity: 0.78; }
.credential-icon {
  width: 48px; height: 48px; border-radius: 14px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fill); color: var(--text-3);
}
.credential-card.obtido .credential-icon { background: var(--accent); color: #fff; }
.credential-nome { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.credential-descricao { color: var(--text-2); font-size: 0.87rem; line-height: 1.5; margin: 0; }
.credential-detalhe {
  font-size: 0.84rem; color: var(--text-2);
  border-top: 1px solid var(--border); padding-top: 8px; margin: 0;
}
.credential-card.obtido .credential-detalhe { color: var(--accent); font-weight: 600; }
.credential-status {
  display: inline-flex; align-items: center; gap: 4px; margin-top: 2px;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.credential-status.obtido { color: var(--accent); }
.credential-status.pendente { color: var(--text-3); }

/* ============ Gamificação G3: Anéis de maturidade E/S/G ============ */
.rings-row { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: center; margin-top: var(--s2); }
.ring-block { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 110px; }
.ring-wrap { position: relative; display: inline-flex; }
.ring-value {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  flex-direction: column; font-weight: 700; color: var(--text);
}
.ring-value .n { font-size: 1.3rem; letter-spacing: -0.02em; }
.ring-label { display: flex; align-items: center; gap: 6px; font-size: 0.86rem; font-weight: 600; color: var(--text-2); }
.ring-track { stroke: var(--fill); }
.ring-fill { stroke-linecap: round; transition: stroke-dashoffset .4s var(--ease); }

/* Detalhe dos critérios por nível (#maturidade) */
.criterio-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-top: 1px solid var(--border); font-size: 0.9rem;
}
.criterio-row:first-child { border-top: 0; }
.criterio-label { flex: 1; color: var(--text); }
.criterio-peso { color: var(--text-3); font-size: 0.78rem; }
.criterio-valor { font-weight: 700; min-width: 46px; text-align: right; }
.nivel-detalhe-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--s2) var(--s3); margin-top: var(--s2);
}
.nivel-detalhe-card.atual { border-color: var(--accent); background: var(--info-bg); }

/* ---------- Impressão → PDF (Etapa 5) ---------- */
@media print {
  /* Forçar cores legíveis e fundo branco */
  :root, html[data-theme="dark"], html[data-theme="light"] {
    --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #FFFFFF;
    --text: #111111; --text-2: #444444; --text-3: #666666;
    --accent: #1D9E75; --border: #DDDDDD; --border-strong: #CCCCCC;
    --fill: #EEEEEE; --info-bg: #EAF6F1;
    --shadow: none; --shadow-sm: none; --shadow-lg: none;
  }
  html, body { background: #FFFFFF !important; color: #111111 !important; font-size: 12px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  @page { size: A4; margin: 14mm; }

  /* Esconder tudo o que não é o relatório */
  .topbar, .sidebar, #toaster, .rel-toolbar, .rel-hint { display: none !important; }

  /* Layout ocupa a folha inteira */
  .shell, .layout, .view {
    display: block !important; height: auto !important; overflow: visible !important;
    padding: 0 !important; margin: 0 !important; background: #FFFFFF !important;
  }
  .view { max-width: none !important; }

  /* Painéis planos, sem sombra, com borda fina */
  .rel-doc { gap: 12px; }
  .panel, .rel-header {
    box-shadow: none !important; border: 1px solid #DDDDDD !important;
    border-radius: 8px !important; padding: 12px 14px !important;
    break-inside: avoid; page-break-inside: avoid;
  }
  .rel-header { border-left: 3px solid var(--accent) !important; }
  .rel-sec, .rel-desafio-row, .hist-row { break-inside: avoid; page-break-inside: avoid; }
  h2, h3, h4 { break-after: avoid; page-break-after: avoid; }

  /* Barras de progresso legíveis a preto e branco */
  .progress-track { background: #E5E5E5 !important; border: 1px solid #CCCCCC; }
  .progress-fill { background: var(--accent) !important; }

  /* Badges com contorno em vez de fundo suave que some na impressão */
  .badge { border: 1px solid #CCCCCC; }

  a[href]::after { content: ""; } /* não imprimir URLs */
}
