/* ==========================================================================
   Radar Dev — folha de estilo única, sem dependências.
   Tokens em :root (tema claro) e sobrescritos em [data-theme="dark"].
   ========================================================================== */

:root {
  --bg:            #f6f7fb;
  --bg-elev:       #ffffff;
  --surface:       #ffffff;
  --surface-2:     #f1f3f9;
  --surface-3:     #e8ebf3;
  --border:        #dfe3ed;
  --border-strong: #c8cede;
  --text:          #151925;
  --text-dim:      #5a6379;
  --text-faint:    #8b93a7;

  --accent:        #5b5bd6;
  --accent-2:      #8b5cf6;
  --accent-soft:   rgba(91, 91, 214, .10);

  --acm:           #16a34a;
  --esp:           #2563eb;
  --abm:           #d97706;
  --zer:           #dc2626;
  --meta:          #9333ea;
  --media:         #64748b;
  --excl:          #a16207;   /* dourado das telas de acesso restrito */

  --shadow-sm: 0 1px 2px rgba(16, 21, 38, .06), 0 1px 3px rgba(16, 21, 38, .04);
  --shadow-md: 0 4px 12px rgba(16, 21, 38, .07), 0 1px 3px rgba(16, 21, 38, .05);
  --shadow-lg: 0 12px 32px rgba(16, 21, 38, .12);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --gap:  18px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo,
          Consolas, monospace;
}

[data-theme="dark"] {
  --bg:            #0a0c12;
  --bg-elev:       #10131c;
  --surface:       #141824;
  --surface-2:     #1b2030;
  --surface-3:     #232a3d;
  --border:        #242b3d;
  --border-strong: #354056;
  --text:          #e8ebf4;
  --text-dim:      #9aa3ba;
  --text-faint:    #6b7590;

  --accent:        #7c7cf5;
  --accent-2:      #a78bfa;
  --accent-soft:   rgba(124, 124, 245, .14);

  --acm:           #34d399;
  --esp:           #60a5fa;
  --abm:           #fbbf24;
  --zer:           #f87171;
  --meta:          #c084fc;
  --media:         #94a3b8;
  --excl:          #e8b84a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 420px;
  background:
    radial-gradient(900px 380px at 12% -8%, var(--accent-soft), transparent 70%),
    radial-gradient(700px 320px at 88% -12%, rgba(139, 92, 246, .10), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  padding: 22px 24px 72px;
}

/* ---------- Rodapé com a versão da tela (partials/rodape) ---------------- */

.page-footer {
  margin-top: 28px;
  text-align: center;
}
.page-version {
  font-size: 11.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  opacity: .8;
}

/* ---------- Cabeçalho ---------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 11px; margin-right: auto; }

.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  box-shadow: var(--shadow-md);
  flex: none;
}
.brand-mark svg { width: 21px; height: 21px; }

.brand-text h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.brand-text p {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* ---------- Usuário logado ------------------------------------------------ */

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.user-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex: none;
}
.user-name {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-dim);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout-form { display: contents; }
.logout-form .btn { padding: 5px 10px; font-size: 12px; }

/* ---------- Controles base ---------------------------------------------- */

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; flex: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }

.btn-icon { padding: 8px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: .02em;
}
.field .hint { font-size: 11.5px; color: var(--text-faint); line-height: 1.45; }
.field .hint a { color: var(--accent); overflow-wrap: anywhere; }

/* Passos numerados do token: espaçados o suficiente para escanear. */
.steps {
  margin: 8px 0 10px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.steps li { line-height: 1.5; }
.steps li::marker { font-weight: 650; color: var(--accent); }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], select, textarea {
  appearance: none;
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 62px; font-family: var(--mono); font-size: 12px; }
::placeholder { color: var(--text-faint); }

/* ---------- Segmented (semana / mês / ano) ------------------------------ */

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  padding: 6px 15px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.segmented button:hover { color: var(--text); }
.segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ---------- Barra de período ------------------------------------------- */

.periodbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--gap);
}

.period-nav { display: flex; align-items: center; gap: 4px; }
.period-label {
  min-width: 214px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 600;
}
.period-sub {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 400;
  display: block;
}

.spacer { margin-left: auto; }

.periodbar .field { min-width: 0; }
.periodbar select {
  /* 200px é o mínimo medido para "Todos os desenvolvedores" não cortar. */
  width: 232px;
  min-width: 200px;
  max-width: 100%;
}

.custom-range {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.custom-range.on { display: flex; }
.custom-range input { width: 148px; }

/* ---------- Filtros avançados ------------------------------------------ */

.advanced {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 16px;
  margin-bottom: var(--gap);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.advanced.on { display: grid; }
@media (max-width: 820px) { .advanced.on { grid-template-columns: 1fr; } }

.advanced .span-2 { grid-column: 1 / -1; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 132px; overflow-y: auto; padding: 2px; }

/* Editor de times: uma linha por pessoa encontrada no período. */
.team-editor {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 6px 12px;
  max-height: 190px;
  overflow-y: auto;
  padding: 2px;
}
.team-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.team-row .who-name { flex: 1; font-size: 12.5px; font-weight: 500; }
.team-row select { width: 108px; flex: none; padding: 4px 7px; font-size: 11.5px; }

/* Formação por período: cada pessoa com o time, o mês "a partir de" e o histórico. */
.team-editor.formacao { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); max-height: 280px; }
.team-person { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.team-row input[type="month"] { width: 124px; flex: none; padding: 3px 6px; font-size: 11.5px; }
.team-hist { display: flex; flex-wrap: wrap; gap: 4px; padding-left: 30px; }
.team-hist .chip-mes {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; color: var(--text-dim);
  background: color-mix(in srgb, var(--text-faint) 14%, transparent);
  border-radius: 4px; padding: 1px 6px;
}
.team-hist .chip-mes button {
  border: 0; background: none; color: var(--text-faint); cursor: pointer;
  padding: 0 1px; font-size: 12px; line-height: 1;
}
.team-hist .chip-mes button:hover { color: var(--text); }

.check { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--text-dim); cursor: pointer; }
.check input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.check em { font-style: normal; color: var(--text-faint); }

/* Etiqueta do time ao lado do nome, na tabela. */
.team-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-faint);
  background: var(--surface-2);
  border-radius: 5px;
  padding: 1px 6px;
  flex: none;
}
.team-tag.dividido { color: var(--abm); background: color-mix(in srgb, var(--abm) 14%, transparent); cursor: help; }
tr.ausente td { opacity: .55; }
tr.ausente .who-name { font-style: italic; }
.chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  font: inherit;
  font-size: 11.5px;
  font-weight: 550;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .14s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- Cards ------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -.005em;
}
.card-head .sub { font-size: 11.5px; color: var(--text-faint); font-weight: 400; }
.card-body { padding: 18px; }

.grid { display: grid; gap: var(--gap); margin-bottom: var(--gap); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-kpi { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid-kpi { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .grid-kpi { grid-template-columns: 1fr; } }
@media (max-width: 1020px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- KPI -------------------------------------------------------- */

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--kpi-color, var(--accent));
}
.kpi .k-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.kpi .k-value {
  font-size: 25px;
  font-weight: 680;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
  line-height: 1.15;
}
.kpi .k-foot { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }

/* ---------- Tabela do ranking ----------------------------------------- */

.table-wrap { overflow-x: auto; }

table.rank {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
table.rank th {
  text-align: right;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
table.rank th:hover { color: var(--text-dim); }
table.rank th.tl, table.rank td.tl { text-align: left; }
table.rank th.sorted { color: var(--accent); }

table.rank td {
  padding: 9px 10px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.rank tbody tr.dev { cursor: pointer; transition: background .12s; }
table.rank tbody tr.dev:hover { background: var(--surface-2); }
table.rank tbody tr.dev.active { background: var(--accent-soft); }
table.rank tbody tr:last-child td { border-bottom: 0; }

.pos {
  display: inline-grid;
  place-items: center;
  min-width: 26px; height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 650;
}
.pos.p1 { background: linear-gradient(135deg, #f0b429, #e08e0b); color: #3d2600; }
.pos.p2 { background: linear-gradient(135deg, #c2ccd9, #9aa7b8); color: #22282f; }
.pos.p3 { background: linear-gradient(135deg, #d9955f, #b9743c); color: #331d0a; }

tr.special td {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text-dim);
}
tr.special.met td:first-child { box-shadow: inset 3px 0 0 var(--meta); }
tr.special.med td:first-child { box-shadow: inset 3px 0 0 var(--media); }
tr.special .pos { background: transparent; letter-spacing: .04em; font-size: 10.5px; }
tr.special.met .pos { color: var(--meta); }
tr.special.med .pos { color: var(--media); }

.who { display: flex; align-items: center; gap: 9px; }
.avatar {
  position: relative;
  width: 26px; height: 26px;
  border-radius: 50%;
  flex: none;
  display: grid; place-items: center;
  font-size: 10.5px;
  font-weight: 650;
  color: #fff;
  background: var(--accent);
  overflow: hidden;
}
/* A foto fica POR CIMA das iniciais: se falhar em carregar, o JS a remove e
   as iniciais reaparecem sem nenhum salto de layout. */
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: inherit;
}
.who-name {
  font-weight: 550;
  /* Trunca em vez de empurrar as colunas numéricas para fora do card. */
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table.rank td.tl:nth-child(2) { max-width: 26ch; }
/* Rótulo de MET/MED trunca em vez de invadir a coluna QP ("Meta média (PEQ-Dev + PEQ-BA)"). */
tr.special td.tl:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pctbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.pctbar .track {
  width: 52px; height: 5px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.pctbar .fill { height: 100%; border-radius: 3px; }

.tag {
  display: inline-block;
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
}
.tag.acm { background: color-mix(in srgb, var(--acm) 15%, transparent); color: var(--acm); }
.tag.abm { background: color-mix(in srgb, var(--abm) 16%, transparent); color: var(--abm); }
.tag.zer { background: color-mix(in srgb, var(--zer) 15%, transparent); color: var(--zer); }
.tag.zero { background: transparent; color: var(--text-faint); font-weight: 400; }
/* Testes realizados: indicador de contexto, então cor neutra de propósito —
   não pode competir visualmente com as classificações que valem nota. */
.tag.ctx { background: color-mix(in srgb, var(--media) 16%, transparent); color: var(--media); }

/* ---------- Gráficos ---------------------------------------------------- */

.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--text-dim); }
.chart .ax { font-size: 10.5px; fill: var(--text-faint); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .ref-line { stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .val { font-size: 11px; font-weight: 600; fill: var(--text); }
.chart .bar { transition: opacity .15s; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart g.dim { opacity: .28; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 11.5px; color: var(--text-dim); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex: none; }

#tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  transition: opacity .12s;
  max-width: 300px;
}
#tooltip.on { opacity: 1; }
#tooltip b { font-weight: 650; }
#tooltip .t-row { display: flex; justify-content: space-between; gap: 16px; font-variant-numeric: tabular-nums; }
#tooltip .t-row span:last-child { font-weight: 600; }
/* Texto livre (resumo de issue): quebra em até duas linhas em vez de vazar da caixa. */
#tooltip .t-sum {
  white-space: normal;
  margin: 1px 0 4px;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Análise individual ----------------------------------------- */

#analysis { margin-bottom: var(--gap); display: none; }
#analysis.on { display: block; }

.an-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.an-head .avatar { width: 46px; height: 46px; font-size: 15px; }
.an-id h3 { margin: 0; font-size: 17px; font-weight: 660; letter-spacing: -.015em; }
.an-id p { margin: 2px 0 0; font-size: 12px; color: var(--text-dim); }

.an-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}
.an-metrics div { background: var(--surface); padding: 12px 14px; }
.an-metrics dt { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); margin: 0; }
.an-metrics dd { margin: 3px 0 0; font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.an-metrics dd { min-width: 0; overflow-wrap: anywhere; }
#highlights .an-metrics dd { font-size: 13.5px; font-weight: 600; line-height: 1.45; }
#highlights .an-metrics { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.an-text { padding: 18px; font-size: 13.5px; line-height: 1.72; }
.an-text p { margin: 0 0 12px; }
.an-text p:last-child { margin-bottom: 0; }
.an-text strong { font-weight: 650; color: var(--text); }
.an-text .verdict {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 13.5px;
}
.an-text .verdict em { font-style: normal; display: block; font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin-bottom: 5px; }

/* ---------- Modal de credenciais --------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(6, 8, 14, .6);
  backdrop-filter: blur(4px);
}
.modal.on { display: grid; }
.modal-box {
  width: 100%;
  max-width: 470px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  max-height: 100%;
  overflow-y: auto;
}
.modal-box .card-head { position: sticky; top: 0; background: var(--surface); }
.modal-box form { padding: 18px; display: flex; flex-direction: column; gap: 15px; }
.modal-foot { display: flex; gap: 10px; align-items: center; }
.modal-foot .spacer { margin-left: auto; }

.periodbar .field { min-width: 0; }
.periodbar select {
  /* 200px é o mínimo medido para "Todos os desenvolvedores" não cortar. */
  width: 232px;
  min-width: 200px;
  max-width: 100%;
}

/* ---------- Avisos / estados ------------------------------------------- */

.note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  line-height: 1.55;
  margin-bottom: var(--gap);
  border: 1px solid var(--border);
  background: var(--surface);
}
.note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.note.err { border-color: color-mix(in srgb, var(--zer) 45%, var(--border)); background: color-mix(in srgb, var(--zer) 8%, var(--surface)); }
.note.err svg { color: var(--zer); }
.note.warn { border-color: color-mix(in srgb, var(--abm) 45%, var(--border)); background: color-mix(in srgb, var(--abm) 8%, var(--surface)); }
.note.warn svg { color: var(--abm); }
.note.ok { border-color: color-mix(in srgb, var(--acm) 45%, var(--border)); background: color-mix(in srgb, var(--acm) 8%, var(--surface)); }
.note.ok svg { color: var(--acm); }
.note code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.note.hidden { display: none; }

.empty { padding: 56px 20px; text-align: center; color: var(--text-faint); }
.empty svg { width: 38px; height: 38px; opacity: .45; margin-bottom: 12px; }
.empty h3 { margin: 0 0 5px; font-size: 14.5px; font-weight: 600; color: var(--text-dim); }
.empty p { margin: 0; font-size: 12.5px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 220% 100%;
  animation: shimmer 1.3s linear infinite;
  border-radius: 6px;
}
@keyframes shimmer { to { background-position: -220% 0; } }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress {
  height: 2px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: var(--gap);
  display: none;
}
.progress.on { display: block; }
.progress i {
  display: block;
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }

/* ---------- Loading dos cards -------------------------------------------- */
/* Ao trocar período/filtro com um resultado já na tela, os cards ficam
   visíveis mas desatualizados até a resposta do proxy chegar — sem isto,
   nada indica que os números ali são da consulta anterior. */

.shell.is-loading .card:not(#emptyState),
.shell.is-loading #kpis {
  position: relative;
  pointer-events: none;
}
.shell.is-loading .card:not(#emptyState)::after,
.shell.is-loading #kpis::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--surface);
  opacity: .6;
  z-index: 4;
}
.shell.is-loading .card:not(#emptyState)::before,
.shell.is-loading #kpis::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  z-index: 5;
  animation: spin .7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 640px) {
  .shell { padding: 16px 14px 56px; }
  .period-label { min-width: 0; flex: 1; }
  .an-text { padding: 15px; }
  /* Com cinco telas no menu, o celular aperta o espaçamento e rola em vez de vazar. */
  .nav-links { max-width: 100%; overflow-x: auto; }
  .nav-links a { padding: 6px 10px; }
}

@media print {
  body::before, .topbar .btn, .periodbar .btn, .advanced, .progress { display: none !important; }
  body { background: #fff; }
  .card { break-inside: avoid; box-shadow: none; }
}

/* ==========================================================================
   Blocos do relatório na análise individual
   ========================================================================== */

.bloco {
  padding: 18px;
  border-top: 1px solid var(--border);
}
.bloco h4 {
  margin: 0 0 12px;
  font-size: 13.5px;
  font-weight: 650;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.bloco h4 .sub { font-size: 11.5px; font-weight: 400; color: var(--text-faint); }
.bloco .nota {
  margin: 10px 0 0;
  font-size: 11.5px;
  color: var(--text-faint);
  line-height: 1.55;
}
.bloco.contexto { background: var(--surface-2); }
.bloco-sub {
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 650;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.bloco-sub .sub { font-size: 11px; font-weight: 400; color: var(--text-faint); }

/* Status na fila de teste. Âmbar = categoria To Do: ninguém começou o teste
   ainda, e é onde o tempo passa sem ninguém perceber. */
.st {
  display: inline-block;
  font-size: 10px;
  font-weight: 650;
  padding: 1px 6px;
  border-radius: 5px;
  white-space: nowrap;
}
.st-parado  { background: color-mix(in srgb, var(--abm) 18%, transparent); color: var(--abm); }
.st-rodando { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }

table.rank.mini { font-size: 12px; }
table.rank.mini th { font-size: 10px; padding: 7px 8px; position: static; cursor: default; }
table.rank.mini td { padding: 6px 8px; }
table.rank.mini a { color: var(--accent); text-decoration: none; font-weight: 550; }
table.rank.mini a:hover { text-decoration: underline; }
table.rank.mini .sub2 { font-size: 10px; color: var(--text-faint); font-weight: 400; }
table.rank.mini .resumo {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
}
table.rank.mini tr.corrente td { background: color-mix(in srgb, var(--abm) 8%, transparent); font-weight: 600; }
table.rank.mini .v-zer { color: var(--zer); font-weight: 650; }
table.rank.mini .v-acm { color: var(--acm); font-weight: 650; }
table.rank.mini .v-abm { color: var(--abm); font-weight: 650; }
.prov { color: var(--abm); font-weight: 700; cursor: help; margin-left: 2px; }

/* Barra de "onde deveria estar" */
.barra-topo {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.barra-topo b { color: var(--text); font-variant-numeric: tabular-nums; }
.barra .track {
  height: 9px;
  border-radius: 5px;
  background: var(--surface-3);
  overflow: hidden;
}
.barra .track i { display: block; height: 100%; border-radius: 5px; transition: width .3s; }

/* Projeção (PQP): camadas sobrepostas na escala da meta cheia */
.barra.proj { margin-top: 14px; }
.barra .proj-track { position: relative; height: 11px; overflow: visible; }
.barra .proj-track i { position: absolute; left: 0; top: 0; }
.barra .proj-track .proj-fill {
  background: repeating-linear-gradient(-45deg,
    color-mix(in srgb, var(--cor) 45%, transparent) 0 4px,
    color-mix(in srgb, var(--cor) 15%, transparent) 4px 8px);
}
.barra .proj-track .proj-ref,
.barra .proj-track .proj-meta {
  position: absolute; top: -2px; bottom: -2px; width: 2px; margin-left: -1px;
  background: var(--text); opacity: .7; border-radius: 1px;
}
.barra .proj-track .proj-meta { background: var(--meta); opacity: 1; }

/* Trio de indicadores (feito / onde deveria estar / meta do ano) */
.tri {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-top: 14px;
}
.tri > div { background: var(--surface); padding: 13px 15px; text-align: center; }
.tri > div.destaque { background: var(--surface-2); }
.tri dt {
  margin: 0;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-faint);
}
.tri dd {
  margin: 4px 0 2px;
  font-size: 21px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.015em;
}
.tri span { font-size: 11px; color: var(--text-dim); }

.perfil-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 650;
  padding: 1px 7px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--meta) 16%, transparent);
  color: var(--meta);
}

/* Editor de perfis de meta */
.goal-editor {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 6px 12px;
  max-height: 190px;
  overflow-y: auto;
  padding: 2px;
}
.goal-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.goal-row .who-name { flex: 1; font-size: 12.5px; font-weight: 500; }
.goal-row select { width: 104px; flex: none; padding: 4px 7px; font-size: 11.5px; }
.goal-row .meta-val {
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
}

.feriados {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
  line-height: 1.5;
}

.goal-row .excecao {
  font-size: 10px;
  font-weight: 650;
  color: var(--abm);
  background: color-mix(in srgb, var(--abm) 14%, transparent);
  border-radius: 4px;
  padding: 1px 4px;
  flex: none;
  cursor: help;
}

/* ---------- Navegação entre telas --------------------------------------- */

.nav-links a {
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 550;
  padding: 6px 15px;
  border-radius: 7px;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ---------- Tela Fluxo: tabela de issues -------------------------------- */

table.flow-table td { white-space: nowrap; }
table.flow-table a { color: var(--accent); text-decoration: none; font-weight: 550; }
table.flow-table a:hover { text-decoration: underline; }
table.flow-table a.dev-link { color: inherit; font-weight: 500; }
/* O resumo fica com o espaço que SOBRA (max-width: 0 + width: 100% é o truque
   para uma célula de tabela aceitar reticências): a tabela acompanha a largura
   do card e só rola quando nem o mínimo de 16ch cabe. */
table.rank.flow-table td.tl.resumo {
  max-width: 0;
  width: 100%;
  min-width: 16ch;
  overflow: hidden;
  text-overflow: ellipsis;
}
table.flow-table th[data-dir="asc"]::after  { content: " ▲"; font-size: 9px; }
table.flow-table th[data-dir="desc"]::after { content: " ▼"; font-size: 9px; }

/* ---------- Glossário: botões "?" e popover ----------------------------- */

.help-btn {
  appearance: none;
  display: inline-grid;
  place-items: center;
  width: 16px; height: 16px;
  padding: 0;
  margin-left: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text-faint);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  vertical-align: 1px;
  cursor: help;
  transition: color .12s, border-color .12s, background .12s;
}
.help-btn:hover, .help-btn[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.help-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.help-pop {
  position: absolute;
  z-index: 60;
  width: min(340px, calc(100vw - 16px));
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-dim);
}
.help-pop .help-title { font-weight: 650; color: var(--text); margin-bottom: 4px; font-size: 13px; }
.help-pop strong { color: var(--text); font-weight: 600; }

/* ---------- Tela Fluxo: bloco "Em andamento agora" ---------------------- */

.section-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 2px var(--gap);
}
.section-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.section-head .sub { font-size: 11.5px; color: var(--text-faint); }

/* ---------- Etiqueta de status no formato do Jira ---------------------- */

:root {
  --loz-todo-bg: #f1f2f4;  --loz-todo-fg: #44546f;
  --loz-prog-bg: #e9f2ff;  --loz-prog-fg: #0055cc;
  --loz-done-bg: #dcfff1;  --loz-done-fg: #216e4e;
}
[data-theme="dark"] {
  --loz-todo-bg: #2c333a;  --loz-todo-fg: #b6c2cf;
  --loz-prog-bg: #1c2b41;  --loz-prog-fg: #85b8ff;
  --loz-done-bg: #1c3329;  --loz-done-fg: #7ee2b8;
}
.lozenge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.6;
  white-space: nowrap;
}
.lozenge.loz-todo     { background: var(--loz-todo-bg); color: var(--loz-todo-fg); }
.lozenge.loz-progress { background: var(--loz-prog-bg); color: var(--loz-prog-fg); }
.lozenge.loz-done     { background: var(--loz-done-bg); color: var(--loz-done-fg); }

#tooltip .t-row { align-items: center; }
#tooltip .t-who { display: inline-flex; align-items: center; gap: 6px; }
#tooltip .t-who .avatar { font-weight: 650; }
table.flow-table .who { gap: 7px; }

/* Ícone do tipo de issue: a inicial fica por trás, como no avatar — se a
   imagem do Jira falhar, o JS a remove e a inicial aparece. */
.type-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 16px; height: 16px;
  border-radius: 3px;
  background: var(--media);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  vertical-align: -3px;
  cursor: default;
  overflow: hidden;
}
.type-icon img { position: absolute; inset: 0; width: 100%; height: 100%; background: var(--surface); }

/* Seletor "comparar com" do gráfico de aging. */
.compare-toggle { display: inline-flex; align-items: center; gap: 8px; }
.compare-toggle[hidden] { display: none; }
.segmented.mini { padding: 2px; border-radius: 8px; }
.segmented.mini button { padding: 3px 10px; font-size: 11.5px; border-radius: 6px; }
.segmented.mini button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ---------- Tela Matriz ------------------------------------------------- */

.mx-painel {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  padding: 14px 16px;
  margin-bottom: var(--gap);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.mx-painel[hidden] { display: none; }
.mx-painel select { width: auto; min-width: 150px; }
.mx-troca { align-self: flex-end; }

/* Filtro de múltipla escolha: botão + lista suspensa com contagem. */
.mx-multi { position: relative; }
.mx-trigger {
  appearance: none;
  min-width: 190px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-align: left;
}
.mx-trigger::after { content: "▾"; font-size: 10px; color: var(--text-faint); }
.mx-trigger:disabled { color: var(--text-faint); cursor: default; background: var(--surface-2); }
.mx-ops {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 20;
  min-width: 250px;
  max-height: 300px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
.mx-ops[hidden] { display: none; }
.mx-acoes { display: flex; gap: 6px; padding: 4px 6px 8px; border-bottom: 1px solid var(--border); margin-bottom: 5px; }
.mx-acoes .btn { flex: 1; justify-content: center; padding: 5px 8px; font-size: 11.5px; }
.mx-ops label { display: flex; align-items: flex-start; gap: 9px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; line-height: 1.35; }
.mx-ops label:hover { background: var(--accent-soft); }
.mx-ops input { margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.mx-cnt { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-faint); }

/* A grade: cabeçalho e primeira coluna fixos, números tabulares. */
.mx-wrap { overflow: auto; max-height: 76vh; }
table.mx-grade { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
.mx-grade th, .mx-grade td { padding: 8px 11px; white-space: nowrap; border-bottom: 1px solid var(--border); }
.mx-grade thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface);
  font-size: 10.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border-strong);
}
.mx-grade th.mx-col { text-align: right; }
.mx-grade th.mx-canto { left: 0; z-index: 5; text-align: left; border-right: 1px solid var(--border-strong); }
.mx-grade th.mx-lin {
  position: sticky; left: 0; z-index: 2;
  background: var(--surface);
  text-align: left; font-weight: 500; color: var(--text);
  border-right: 1px solid var(--border-strong);
  max-width: 240px; white-space: normal;
}
.mx-grade td {
  text-align: right;
  font-family: var(--mono); font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.mx-grade td.mx-quente { color: #fff; }
.mx-grade td.mx-vazia { color: var(--text-faint); cursor: default; }
.mx-grade td[data-l]:hover, .mx-grade td[data-l]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mx-grade .mx-tot, .mx-grade tr.mx-tot td, .mx-grade tr.mx-tot th {
  background: var(--surface-2); font-weight: 650; color: var(--text); cursor: default;
}
.mx-grade tr.mx-tot td, .mx-grade tr.mx-tot th { border-top: 1px solid var(--border-strong); }

.mx-escala {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 18px;
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  border-top: 1px solid var(--border);
}
.mx-faixa { display: flex; height: 12px; width: 190px; border: 1px solid var(--border-strong); border-radius: 3px; overflow: hidden; }
.mx-faixa i { flex: 1; }

.mx-det { margin-top: var(--gap); }
.mx-det[hidden] { display: none; }
.mx-lista { max-height: 420px; overflow: auto; }
table.mx-det-tab { width: 100%; border-collapse: collapse; font-size: 13px; }
.mx-det-tab td { padding: 8px 14px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mx-det-tab td.tl { text-align: left; white-space: normal; }
.mx-chave { font-family: var(--mono); font-size: 11.5px; color: var(--accent); margin-right: 9px; text-decoration: none; }
a.mx-chave:hover { text-decoration: underline; }
.mx-mais { color: var(--text-faint); }
.mx-nada { padding: 26px; text-align: center !important; color: var(--text-faint); }

.mx-method { margin-top: var(--gap); }
.mx-method ol { margin: 0; padding-left: 20px; }
.mx-method li { margin-bottom: 10px; color: var(--text-dim); font-size: 13px; line-height: 1.6; }
.mx-method strong { color: var(--text); }

.mx-hint { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.mx-folha-box { max-width: 620px; }
.mx-folha-nova { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.mx-folha-nova .field span { font-size: 11.5px; font-weight: 600; color: var(--text-dim); }
.mx-folha-nova input[type="month"] { appearance: none; width: 100%; background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text); font: inherit; font-size: 13px; padding: 8px 11px; border-radius: var(--r-sm); color-scheme: light dark; }
.mx-erro { font-size: 12px; color: var(--zer); min-height: 1em; }
.mx-erro:empty { display: none; }
.mx-folha { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mx-f-cel { display: flex; flex-direction: column; gap: 1px; padding: 6px 8px; border-radius: 7px;
  border: 1px solid var(--border); font-size: 11px; color: var(--text-faint); }
.mx-f-cel strong { font-size: 12px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.mx-f-alterou { border-color: var(--accent); background: var(--accent-soft); }
.mx-f-sem strong { color: var(--text-faint); }
.mx-f-lista { list-style: none; margin: 0; padding: 0; max-height: 220px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--r-sm); }
.mx-f-lista li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.mx-f-lista li:last-child { border-bottom: 0; }
.mx-f-mes { font-weight: 600; }
.mx-f-val { font-variant-numeric: tabular-nums; text-align: right; }
.mx-f-quem { font-size: 11px; color: var(--text-faint); }
.mx-f-lista .btn { justify-self: end; padding: 3px 8px; font-size: 11.5px; }
.mx-f-vazio { color: var(--text-faint); display: block !important; }
@media (max-width: 520px) {
  .mx-folha { grid-template-columns: repeat(3, 1fr); }
  .mx-folha-nova { grid-template-columns: 1fr 1fr; }
  .mx-folha-nova .btn { grid-column: 1 / -1; justify-content: center; }
}
.grid[hidden] { display: none; }

/* ---------- Tela Árvore ------------------------------------------------- */

.av-kpi { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .av-kpi { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .av-kpi { grid-template-columns: 1fr; } }

.av-comp { margin-bottom: var(--gap); }
.av-comp[hidden], #arvCard[hidden] { display: none; }
.av-lede { margin: 0 0 14px; font-size: 13px; line-height: 1.6; color: var(--text-dim); }
.av-split { display: flex; height: 38px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--border); }
.av-split button {
  appearance: none; border: 0; margin: 0; min-width: 0; cursor: pointer;
  font: inherit; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; white-space: nowrap;
}
.av-split button + button { border-left: 2px solid var(--surface); }
.av-split button:hover, .av-split button:focus-visible { filter: brightness(1.08); outline: 2px solid var(--accent); outline-offset: -2px; }
.av-ter  { background: color-mix(in srgb, var(--esp) 34%, transparent); }
.av-sust { background: color-mix(in srgb, var(--zer) 32%, transparent); }
.av-split-leg { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 10px; font-size: 12.5px; color: var(--text-dim); }
.av-split-leg span { display: inline-flex; align-items: center; gap: 7px; }
.av-split-leg i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

.av-bar { align-items: flex-end; }
.av-busca { flex: 1 1 320px; }
.av-busca input {
  appearance: none; width: 100%; background: var(--bg-elev); border: 1px solid var(--border);
  color: var(--text); font: inherit; font-size: 13px; padding: 9px 11px; border-radius: var(--r-sm);
}

.av-wrap { overflow: auto; max-height: 78vh; }
table.av-tab { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.av-tab th, .av-tab td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: right; vertical-align: top; }
.av-tab thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface); white-space: nowrap;
  font-size: 10.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint);
  border-bottom: 1px solid var(--border-strong);
}
.av-tab th.l, .av-tab td.l { text-align: left; }
.av-tab td:not(.l) { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.av-tab td.av-zero { color: var(--text-faint); }
.av-tab tr.av-n0 > td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.av-tab tr.av-sint > td { background: color-mix(in srgb, var(--zer) 7%, transparent); }
.av-tab tr.av-n0 .av-res { font-weight: 600; }
.av-rot { display: flex; align-items: flex-start; gap: 8px; min-width: 300px; }
.av-tog {
  appearance: none; flex: none; width: 20px; height: 20px; margin-top: 1px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: 5px; background: var(--surface);
  color: var(--text-dim); font: 600 13px/1 var(--mono); cursor: pointer;
}
.av-tog:hover, .av-tog:focus-visible { border-color: var(--accent); color: var(--accent); }
.av-tog:disabled { border-color: transparent; background: none; cursor: default; }
.av-res { color: var(--text); line-height: 1.4; }
.av-meta { margin-top: 2px; font-size: 11.5px; color: var(--text-faint); }
.av-s { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 10.5px; font-weight: 600; }
.av-s-g { background: color-mix(in srgb, var(--acm) 15%, transparent); color: var(--acm); }
.av-s-w { background: color-mix(in srgb, var(--abm) 16%, transparent); color: var(--abm); }
.av-s-n { background: var(--surface-2); color: var(--text-dim); }
.av-tab td.av-pct { position: relative; min-width: 96px; }
.av-fill { position: absolute; left: 0; top: 4px; bottom: 4px; background: color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 0 3px 3px 0; }
.av-pct span { position: relative; }
.av-vazio { padding: 30px 20px; }
.av-vazio[hidden] { display: none; }

/* ---------- Tela Saúde dos Sistemas ------------------------------------ */

.sd-lede { margin: 0 0 14px; color: var(--text-dim); font-size: 13.5px; }
.sd-lede strong { color: var(--text); }
.sd-card { margin-bottom: var(--gap); }
.sd-hint { margin: 0 0 14px; color: var(--text-dim); font-size: 12.5px; line-height: 1.6; }
.sd-hint.sd-after { margin: 14px 0 0; }
.table-wrap.sd-after { margin-top: 16px; }
table.rank.sd-tab th { cursor: default; position: static; }
table.rank.sd-tab th:hover { color: var(--text-faint); }
table.rank.sd-tab td.tl, table.rank.sd-tab th.tl { text-align: left; }
table.rank.sd-tab tr.sd-total td { font-weight: 650; border-top: 1px solid var(--border-strong); }
table.rank.sd-tab tr.sd-fora-p td { color: var(--text-faint); }
.sd-bom  { color: var(--acm); }
.sd-ruim { color: var(--zer); }
.sd-dim  { color: var(--text-faint); }

.sd-s { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.sd-dentro { color: var(--acm); background: color-mix(in srgb, var(--acm) 14%, transparent); }
.sd-limite { color: var(--abm); background: color-mix(in srgb, var(--abm) 16%, transparent); }
.sd-fora   { color: var(--zer); background: color-mix(in srgb, var(--zer) 14%, transparent); }

.sd-det { margin-top: 14px; }
.sd-det summary { cursor: pointer; font-size: 12.5px; color: var(--accent); font-weight: 600; }
.sd-det[open] summary { margin-bottom: 10px; }

/* Barras horizontais em HTML, com marcador de meta tracejado. */
.sd-barras { display: grid; gap: 10px; }
.sd-bar-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; align-items: center; gap: 10px; font-size: 12.5px; }
.sd-bar-rot { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-bar-val { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }
.sd-bar-trk { position: relative; height: 12px; border-radius: 6px; background: var(--surface-2); }
.sd-bar-trk > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--accent); }
.sd-bar-meta { position: absolute; top: -4px; bottom: -4px; width: 0; border-left: 2px dashed var(--zer); }

/* Blocos "contra as marcas". */
.sd-blocos { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.sd-bloco { border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px; background: var(--surface); }
.sd-bloco-hi { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.sd-bloco h3 { margin: 0; font-size: 13px; font-weight: 650; }
.sd-bloco-sub { font-size: 11.5px; color: var(--text-faint); margin: 2px 0 12px; }
.sd-m { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin-bottom: 10px; font-size: 12px; }
.sd-m .sd-bar-trk { grid-column: 1 / -1; grid-row: 2; height: 8px; }
.sd-m-rot { color: var(--text-dim); }
.sd-m-rot small { display: block; color: var(--text-faint); font-size: 10.5px; }
.sd-m-val { font-family: var(--mono); font-size: 11.5px; text-align: right; }
.sd-m-val em { font-style: normal; margin-left: 6px; }
.sd-bar-trk > i.sd-neutro { background: var(--media); }
.sd-bar-trk > i.sd-ok { background: var(--acm); }
.sd-bar-trk > i.sd-acima { background: var(--zer); }
@media (max-width: 520px) { .sd-bar-row { grid-template-columns: 1fr auto; } .sd-bar-row .sd-bar-trk { grid-column: 1 / -1; grid-row: 2; } }

/* ---------- Telas de acesso restrito (Gate view-management) ------------- */

/* No menu, um grupo à parte, dourado e com cadeado. */
.nav-excl {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  padding: 2px 2px 2px 9px;
  border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--excl) 18%, transparent), color-mix(in srgb, var(--excl) 5%, transparent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--excl) 45%, transparent);
}
.nav-excl-ic { width: 13px; height: 13px; flex: none; margin-right: 3px; color: var(--excl); }
.nav-links .nav-excl a { color: color-mix(in srgb, var(--excl) 75%, var(--text-dim)); padding: 4px 11px; }
.nav-links .nav-excl a:hover { color: var(--excl); }
.nav-links .nav-excl a[aria-current="page"] {
  background: var(--surface);
  color: var(--excl);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px color-mix(in srgb, var(--excl) 50%, transparent);
}

/* Selo no topo de Matriz, Árvore e Saúde. */
.excl-banner {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 var(--gap);
  padding: 12px 16px 12px 18px;
  border-radius: var(--r-md);
  border: 1px solid color-mix(in srgb, var(--excl) 45%, var(--border));
  background: linear-gradient(100deg, color-mix(in srgb, var(--excl) 14%, var(--surface)) 0%, var(--surface) 72%);
  box-shadow: var(--shadow-sm);
}
.excl-banner::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--excl), color-mix(in srgb, var(--excl) 35%, transparent));
}
.excl-banner-ic {
  width: 34px; height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--excl);
  background: color-mix(in srgb, var(--excl) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--excl) 40%, transparent);
}
.excl-banner-ic svg { width: 17px; height: 17px; }
.excl-banner-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-dim); }
.excl-banner-txt strong { color: var(--excl); font-size: 13px; }
.excl-banner-txt em { font-style: normal; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.excl-chip {
  margin-left: auto;
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--excl) 55%, transparent);
  color: var(--excl);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
@media (max-width: 640px) {
  .excl-chip { display: none; }
  .excl-banner { align-items: flex-start; }
}
