/* ==========================================================================
   Radar Erros — folha de estilo única, sem dependências.
   Base copiada do radardev (tokens, topo, controles, cards, tabela, gráficos,
   avisos, etiqueta de status do Jira); o que é do Radar Erros fica no fim.
   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;
}

/* ---------- 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, #5b5bd6, #dc2626); /* o mesmo do favicon.svg */
  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; }
/* ---------- 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.row-link { cursor: pointer; transition: background .12s; }
table.rank tbody tr.row-link:hover { background: var(--surface-2); }
table.rank tbody tr.row-link.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; }
/* ---------- 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;
}

/* ---------- 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%; } }

@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; }
  /* 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; }
}

/* ---------- 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);
}

/* ---------- 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; }

/* 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);
}


/* ==========================================================================
   Radar Erros
   ========================================================================== */

:root {
  --st-novo: #5b5bd6;
  --st-andamento: #2563eb;
  --st-resolvido: #16a34a;
  --st-ignorado: #64748b;
  --env-production: #dc2626;
  --env-staging: #d97706;
  --env-other: #64748b;
}
[data-theme="dark"] {
  --st-novo: #8b8bf7;
  --st-andamento: #60a5fa;
  --st-resolvido: #34d399;
  --st-ignorado: #94a3b8;
  --env-production: #f87171;
  --env-staging: #fbbf24;
  --env-other: #94a3b8;
}

a { color: var(--accent); }
.muted { color: var(--text-faint); }
.dim { color: var(--text-dim); }
.mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.small { font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Links com cara de botão segmentado (período, abas). */
.segmented a {
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 550;
  padding: 6px 13px;
  border-radius: 7px;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.segmented a:hover { color: var(--text); }
.segmented a[aria-current="page"], .segmented a[aria-current="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Barra de filtros (formulário GET). */
.filterbar { gap: 10px 14px; }
.filterbar .field { min-width: 150px; }
.filterbar select, .filterbar input[type="date"] { width: 100%; min-width: 0; padding: 7px 10px; }
.filterbar select[multiple] { min-height: 34px; height: 34px; }
.filterbar .custom-range { display: flex; }
.filterbar .custom-range input { width: 140px; }
.filterbar .field.compact { min-width: 120px; flex: 0 1 170px; }

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

/* Mensagem do erro: monoespaçada, quebra onde precisar. */
.msg {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: normal;
}
.msg.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
a.msg { text-decoration: none; }
a.msg:hover { color: var(--accent); }

/* Destaque dos três primeiros. */
.top3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); margin-bottom: var(--gap); }
@media (max-width: 1020px) { .top3 { grid-template-columns: 1fr; } }
.top-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.top-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.top-card .top-count { font-size: 24px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.top-card .msg { -webkit-line-clamp: 3; }
.top-card .spark { margin-top: auto; }

/* Selos. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.6;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.badge.new { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.badge.regression { color: var(--zer); background: color-mix(in srgb, var(--zer) 12%, transparent); border-color: color-mix(in srgb, var(--zer) 35%, transparent); }
.badge.service { font-family: var(--mono); font-weight: 600; }
.badge.env-production { color: var(--env-production); border-color: color-mix(in srgb, var(--env-production) 40%, transparent); }
.badge.env-staging { color: var(--env-staging); border-color: color-mix(in srgb, var(--env-staging) 40%, transparent); }

.status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.6;
  white-space: nowrap;
  color: var(--st, var(--text-dim));
  background: color-mix(in srgb, var(--st, var(--text-dim)) 13%, transparent);
}
.status.st-novo { --st: var(--st-novo); }
.status.st-em_andamento { --st: var(--st-andamento); }
.status.st-resolvido { --st: var(--st-resolvido); }
.status.st-ignorado { --st: var(--st-ignorado); }

/* Variação contra o período anterior: mais erro é ruim. */
.delta { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--zer); }
.delta.down { color: var(--acm); }
.delta.flat { color: var(--text-faint); }

/* Gráficos. */
.chart-box { width: 100%; min-height: 240px; }
.spark { display: block; width: 120px; height: 28px; }
.spark-wide { width: 100%; height: 34px; }
.chart .deploy-line { stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .deploy-flag { cursor: pointer; }
.legend i.dash { width: 14px; height: 0; border-top: 2px dashed currentColor; border-radius: 0; }

/* Tabelas de dados. */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.data th {
  text-align: left;
  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);
  white-space: nowrap;
}
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data th.right, table.data td.right { text-align: right; }
table.data td.msg-cell { min-width: 280px; max-width: 560px; }
table.data .muted-row td { opacity: .55; }

/* Abas da visão geral. */
.tabs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Amostras brutas. */
pre.sample {
  margin: 0;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 340px;
  overflow: auto;
}

/* Cabeçalho do grupo. */
.group-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: var(--gap); }
.group-head .msg { font-size: 14px; line-height: 1.55; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.actions input[type="text"] { width: 150px; padding: 7px 10px; text-transform: uppercase; }

.btn-danger { color: var(--zer); border-color: color-mix(in srgb, var(--zer) 35%, var(--border)); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--zer) 10%, var(--surface)); border-color: var(--zer); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Formulários do admin. */
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: 1 / -1; }
@media (max-width: 820px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }
.field-error { font-size: 11.5px; color: var(--zer); }
.check-inline { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); }
.check-inline input { width: 15px; height: 15px; accent-color: var(--accent); }

/* Token recém-criado: mostrado uma vez. */
.secret {
  display: block;
  padding: 10px 12px;
  background: var(--bg-elev);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 13px;
  overflow-wrap: anywhere;
  user-select: all;
}

/* Paginação. */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-dim); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
dl.facts dt { color: var(--text-faint); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .filterbar > form { flex: 1 1 100% !important; min-width: 0; }
  .filterbar .field, .filterbar .field.compact { flex: 1 1 100%; min-width: 0; }
  .filterbar .custom-range { flex-wrap: wrap; }
  .filterbar .custom-range input { flex: 1 1 130px; width: auto; min-width: 0; }
  .period-nav { width: 100%; justify-content: space-between; }
  .actions input[type="text"] { width: 120px; }
  .top-card .top-count { font-size: 20px; }
  table.data td.msg-cell { min-width: 220px; }
}
.row.tight { gap: 6px; flex-wrap: nowrap; }
