:root {
  --rm-bg: #f5f5f5;
  --rm-surface: #ffffff;
  --rm-border: #e0e0e0;
  --rm-text: #323232;
  --rm-muted: #979797;
  --rm-pink: #e4006a;
  --rm-pink-soft: #fde8f1;
  --rm-brown: #8d634f;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Poppins, "Segoe UI", system-ui, sans-serif;
  background: var(--rm-bg);
  color: var(--rm-text);
  line-height: 1.45;
}

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--rm-muted);
  padding: 1rem;
}

.gate-card {
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.gate-login {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gate-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: var(--rm-pink);
  color: #fff;
  text-decoration: none;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-weight: 500;
}

.gate-login-btn:hover {
  filter: brightness(1.05);
}

.gate-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--rm-muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
}

.dashboard.is-loading .dash-section {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.dash-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--rm-bg);
  padding-top: 1rem;
  padding-bottom: 0.5rem;
  margin: 0 -1.25rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  border-bottom: 1px solid transparent;
}

.dash-top.is-stuck {
  border-bottom-color: var(--rm-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.dash-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.dash-header h1 {
  margin: 0.25rem 0 0;
  font-size: 1.35rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.dash-sub {
  margin: 0.25rem 0 0;
  color: var(--rm-muted);
  font-size: 0.9rem;
}

.dash-updated {
  margin: 0.15rem 0 0;
  color: var(--rm-muted);
  font-size: 0.75rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--rm-pink);
  text-decoration: none;
  font-size: 0.85rem;
}

.back-link:hover {
  text-decoration: underline;
}

.dash-actions {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.dash-actions label {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--rm-muted);
  gap: 0.25rem;
}

.dash-actions select,
.dash-actions button {
  font-family: inherit;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--rm-border);
  background: var(--rm-surface);
  font-size: 0.85rem;
}

.dash-actions select:focus,
.dash-actions button:focus {
  outline: 2px solid var(--rm-pink-soft);
  border-color: var(--rm-pink);
}

.dash-actions button {
  background: var(--rm-pink);
  color: #fff;
  border-color: var(--rm-pink);
  cursor: pointer;
  min-width: 6.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.dash-actions button:hover:not(:disabled) {
  filter: brightness(1.05);
}

.dash-actions button:disabled {
  opacity: 0.7;
  cursor: wait;
}

.dash-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.summary-pill {
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-left: 3px solid var(--rm-pink);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.summary-pill .sp-body {
  min-width: 0;
}

.summary-pill .sp-value {
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.2;
}

.summary-pill .sp-label {
  font-size: 0.72rem;
  color: var(--rm-muted);
  margin-top: 0.1rem;
}

.dash-status {
  min-height: 1.25rem;
  margin: 0.5rem 0 0.75rem;
  color: var(--rm-muted);
  font-size: 0.85rem;
}

.dash-status.is-loading::before {
  content: "";
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  margin-right: 0.4rem;
  border: 2px solid var(--rm-border);
  border-top-color: var(--rm-pink);
  border-radius: 50%;
  vertical-align: -0.15rem;
  animation: spin 0.7s linear infinite;
}

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

.empty-banner {
  background: var(--rm-pink-soft);
  border: 1px solid #f5c2dc;
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.88rem;
}

.empty-banner > div {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.empty-banner strong {
  color: var(--rm-pink);
}

.section-nav {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding-bottom: 0.25rem;
}

.section-tab {
  font-family: inherit;
  border: 1px solid var(--rm-border);
  background: var(--rm-surface);
  color: var(--rm-text);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.section-tab:hover {
  border-color: var(--rm-pink);
  color: var(--rm-pink);
}

.section-tab.active {
  background: var(--rm-pink);
  color: #fff;
  border-color: var(--rm-pink);
}

.dash-section {
  margin-bottom: 1.5rem;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.section-intro {
  margin: 0 0 1rem;
  color: var(--rm-muted);
  font-size: 0.88rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.kpi-card {
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  transition: box-shadow 0.15s;
}

.kpi-card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.kpi-card .label {
  font-size: 0.75rem;
  color: var(--rm-muted);
  display: flex;
  align-items: flex-start;
  gap: 0.3rem;
  line-height: 1.35;
}

.kpi-info {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--rm-muted);
  cursor: help;
  opacity: 0.75;
}

.kpi-info:hover {
  opacity: 1;
  color: var(--rm-pink);
}

.kpi-card .value {
  font-size: 1.55rem;
  font-weight: 600;
  margin-top: 0.2rem;
  line-height: 1.2;
  word-break: break-word;
}

.kpi-card .hint {
  display: none;
}

.charts-row,
.panels-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 900px) {
  .charts-row,
  .panels-row {
    grid-template-columns: 1fr;
  }

  .dash-top {
    position: static;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: 12px;
  padding: 1rem;
}

.panel-wide {
  grid-column: 1 / -1;
}

.panel h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.modal-header h2 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.panel-desc {
  margin: 0.25rem 0 0.75rem;
  color: var(--rm-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.chart-wrap {
  position: relative;
  min-height: 180px;
}

.panel-empty {
  text-align: center;
  color: var(--rm-muted);
  font-size: 0.85rem;
  padding: 2rem 1rem;
}

.table-wrap {
  overflow-x: auto;
  font-size: 0.82rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.55rem;
  border-bottom: 1px solid var(--rm-border);
  vertical-align: top;
}

th {
  font-size: 0.75rem;
  color: var(--rm-muted);
  font-weight: 500;
}

tbody tr:hover {
  background: #fafafa;
}

.reports-list a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rm-border);
  color: var(--rm-text);
  text-decoration: none;
  font-size: 0.85rem;
}

.reports-list a:hover {
  color: var(--rm-pink);
}

.conversations-list .conv-item {
  border: 1px solid var(--rm-border);
  border-left: 3px solid var(--rm-pink);
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.65rem;
  font-size: 0.82rem;
  background: #fafafa;
}

.conv-meta {
  color: var(--rm-muted);
  font-size: 0.72rem;
  margin-bottom: 0.35rem;
}

.conv-user {
  font-weight: 500;
}

.conv-assistant {
  color: var(--rm-text);
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--rm-border);
}

.error-box {
  background: #fff5f5;
  border: 1px solid #f5c2c2;
  color: #8b1a1a;
  padding: 0.75rem 1rem;
  border-radius: 8px;
}

.muted-hint {
  color: var(--rm-muted);
  font-size: 0.85rem;
}

.bar-chart {
  font-size: 0.8rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 2fr auto;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--rm-text);
}

.bar-track {
  height: 0.6rem;
  background: var(--rm-bg);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--rm-brown);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.bar-fill-pink {
  background: var(--rm-pink);
}

.bar-val {
  font-weight: 600;
  min-width: 2rem;
  text-align: right;
  font-size: 0.85rem;
}

.heatmap {
  overflow-x: auto;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: 2.75rem repeat(24, minmax(12px, 1fr));
  gap: 3px;
  min-width: 520px;
  font-size: 0.65rem;
}

.hm-corner,
.hm-dow,
.hm-hour,
.hm-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.hm-dow {
  font-weight: 500;
  color: var(--rm-muted);
  justify-content: flex-end;
  padding-right: 0.35rem;
}

.hm-hour {
  color: var(--rm-muted);
  font-size: 0.58rem;
}

.hm-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  min-height: 14px;
  cursor: default;
}

.heatmap-legend {
  margin-top: 0.5rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.modal-card {
  position: relative;
  background: var(--rm-surface);
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--rm-border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
}

.modal-close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--rm-muted);
  padding: 0 0.25rem;
}

.modal-body {
  padding: 1rem 1.15rem;
  overflow-y: auto;
  font-size: 0.88rem;
  line-height: 1.55;
}

.modal-findings {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rm-border);
}

.modal-findings h3 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--rm-muted);
}

.modal-findings li {
  margin-bottom: 0.35rem;
}

/* Ícones SVG */
.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: inherit;
}

.ico svg {
  width: 1.15em;
  height: 1.15em;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ico-sm svg {
  width: 1em;
  height: 1em;
}

.ico-title svg {
  width: 1.35rem;
  height: 1.35rem;
  color: var(--rm-pink);
}

.ico-banner svg {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--rm-pink);
  margin-top: 0.1rem;
}

.ico-pill {
  margin-top: 0.15rem;
  color: var(--rm-pink);
}

.ico-pill svg {
  width: 1.25rem;
  height: 1.25rem;
}

.ico-kpi {
  color: var(--rm-pink);
}

.ico-kpi svg {
  width: 0.95rem;
  height: 0.95rem;
}

.ico-spin svg {
  animation: spin 0.8s linear infinite;
}

.section-tab.active .ico {
  color: #fff;
}

.section-tab:not(.active) .ico {
  color: var(--rm-pink);
}

.panel h2 .ico {
  color: var(--rm-pink);
}

.conv-mode {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.conv-mode .ico svg {
  width: 0.85rem;
  height: 0.85rem;
}

.grade-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.grade-circle {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: var(--rm-pink-soft);
  color: var(--rm-pink);
  font-size: 1.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 3px solid var(--rm-pink);
}

.grade-meta h2 {
  margin: 0;
  font-size: 1.1rem;
}

.grade-meta .muted-hint {
  margin: 0.35rem 0 0;
}

.findings-list .finding-item {
  border: 1px solid var(--rm-border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  background: #fafafa;
}

.finding-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.finding-priority {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: var(--rm-pink-soft);
  color: var(--rm-pink);
}

.finding-priority.p2 {
  background: #fff4e5;
  color: #9a6700;
}

.finding-priority.p3 {
  background: #eef6ee;
  color: #2d6a4f;
}

.finding-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.finding-detail {
  margin: 0;
  font-size: 0.85rem;
  color: var(--rm-text);
  line-height: 1.45;
}

.score-bar {
  height: 0.45rem;
  background: var(--rm-bg);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.35rem;
}

.score-bar-fill {
  height: 100%;
  background: var(--rm-pink);
  border-radius: 999px;
}

.kpi-card.score-good .value { color: #2d6a4f; }
.kpi-card.score-mid .value { color: #9a6700; }
.kpi-card.score-low .value { color: #b42318; }

/* ── Separador Direcção ────────────────────────────────────────────────
   Leitura executiva, organizada por nível de decisão. O contraste entre
   os níveis é deliberado: quem abre o painel tem de perceber em dois
   segundos onde acaba «o negócio» e começa «a operação».
   ------------------------------------------------------------------- */

.nivel-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 2rem 0 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--rm-border);
}

.nivel-header:first-of-type { margin-top: 0.5rem; }

.nivel-header h2 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nivel-header p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--rm-muted);
}

.nivel-estrategico { border-bottom-color: var(--rm-pink); }
.nivel-estrategico h2 { color: var(--rm-pink); }
.nivel-tatico { border-bottom-color: var(--rm-brown); }
.nivel-tatico h2 { color: var(--rm-brown); }

.nivel-footer {
  margin-top: 1.5rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--rm-border);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* O número que responde «vale o que custa?» */
.exec-hero {
  background: linear-gradient(135deg, var(--rm-pink) 0%, #b80057 100%);
  color: #fff;
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.1rem;
}

.exec-hero-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.exec-hero-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

.exec-hero-value {
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
}

.exec-hero-sub {
  font-size: 0.9rem;
  opacity: 0.94;
  max-width: 62ch;
}

.exec-hero-note {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 0.85rem;
  opacity: 0.95;
}

/* Cobertura do suporte */
.cobertura-bar {
  height: 26px;
  background: var(--rm-border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.7rem;
}

.cobertura-fill {
  height: 100%;
  background: var(--rm-pink);
  border-radius: 6px 0 0 6px;
  transition: width 0.4s ease;
}

.cobertura-legenda {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
}

/* Adopção: quem volta contra quem desistiu */
.adopcao-split {
  display: flex;
  height: 26px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.8rem;
  background: var(--rm-border);
}

.adopcao-seg { height: 100%; }
.adopcao-volta { background: var(--rm-pink); }
.adopcao-uma { background: var(--rm-border); }

.adopcao-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.88rem;
}

.adopcao-lista .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 0.5rem;
}

.dot-volta { background: var(--rm-pink); }
.dot-uma { background: var(--rm-border); border: 1px solid var(--rm-muted); }

/* Um alerta honesto vale mais do que um painel todo verde. */
.adopcao-alerta {
  margin: 0.85rem 0 0;
  padding: 0.6rem 0.75rem;
  background: var(--rm-pink-soft);
  border-left: 3px solid var(--rm-pink);
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
}

/* Variação face ao período anterior */
.var-sobe { color: #1d7a4c; font-weight: 600; }
.var-desce { color: #c02929; font-weight: 600; }
.var-neutra { color: var(--rm-muted); font-size: 0.85em; }

.premissas-panel { background: #fafafa; }

/* ── Separador Colaboradores ───────────────────────────────────────────
   As pessoas aparecem aqui pelo nome, e isso obriga a escolhas visuais
   deliberadas: nada de posições, nada de vermelho sobre a pessoa. A cor
   marca o sinal (o que o serviço fez mal), nunca o indivíduo.
   ------------------------------------------------------------------- */

.aviso-enquadramento {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  background: var(--rm-pink-soft);
  border-left: 3px solid var(--rm-pink);
  border-radius: 0 6px 6px 0;
  font-size: 0.87rem;
}

/* Bandas de esforço. Âmbar e não vermelho de propósito: vermelho sobre uma
   linha com nome de pessoa lê-se como alerta sobre a pessoa. */
.banda {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 10px;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
}

.banda-alto {
  background: #fff1e0;
  color: #9a5b00;
  border: 1px solid #f0c890;
}

.banda-moderado {
  background: #fff9e0;
  color: #8a7000;
  border: 1px solid #ecd98a;
}

.banda-baixo {
  background: #f0f0f0;
  color: var(--rm-muted);
  border: 1px solid var(--rm-border);
}

/* Bandas de uso do roster — neutras, nunca hierárquicas. */
.banda-uso-frequente,
.banda-uso-regular,
.banda-uso-pontual {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 10px;
  font-size: 0.76rem;
  background: #f0f0f0;
  color: var(--rm-text);
  border: 1px solid var(--rm-border);
}

.banda-uso-frequente { background: var(--rm-pink-soft); border-color: #f3c4da; }

#colab-notas > div {
  padding: 0.35rem 0 0.35rem 0.75rem;
  border-left: 2px solid var(--rm-border);
  margin-bottom: 0.3rem;
}
