/*
 * Monitor de Conversas iSUPER — sistema de tokens e componentes.
 * Introduzido no redesign de 2026-07 (ver PROJETO.md).
 *
 * Modo TV usa os MESMOS tokens (reatribuídos em `body.modo-tv`), então qualquer
 * elemento estilizado com var(--token) já funciona nos dois modos automaticamente.
 * Não adicionar `!important`/overrides por nome de classe Tailwind aqui — é
 * exatamente o padrão frágil que este arquivo substitui.
 */

/* ============ TOKENS (tema claro = padrão) ============ */
:root {
  --bg: oklch(0.975 0.004 255);
  --surface: oklch(1 0 0);
  --surface-alt: oklch(0.965 0.007 255);
  --ink: oklch(0.22 0.012 260);
  --ink-muted: oklch(0.48 0.014 260);
  --ink-faint: oklch(0.63 0.012 260);
  --border: oklch(0.9 0.008 255);
  --border-soft: oklch(0.94 0.006 255);

  --accent: oklch(0.53 0.19 25);
  --accent-hex: #c81e3a;
  --accent-fill-10-hex: #c81e3a1a;
  --accent-fill-20-hex: #c81e3a33;
  --accent-ink: oklch(0.99 0 0);
  --accent-soft: oklch(0.94 0.03 25);
  --accent-soft-ink: oklch(0.4 0.15 25);

  /* Equivalentes hex das cores neutras — Canvas (Chart.js) não lê var()/oklch(),
     então JS resolve estes via getComputedStyle(document.body) (cssVar() no <script>). */
  --ink-hex: #383c47;
  --ink-muted-hex: #6c7280;
  --ink-faint-hex: #979dab;
  --border-soft-hex: #e9ebf0;

  --success: oklch(0.62 0.14 152);
  --success-hex: #1a9c6b;
  --success-soft: oklch(0.94 0.04 152);
  --success-ink: oklch(0.36 0.1 152);

  --good: oklch(0.72 0.13 165);
  --good-hex: #35b88a;
  --good-soft: oklch(0.94 0.05 165);
  --good-ink: oklch(0.38 0.1 165);

  --warning: oklch(0.78 0.14 80);
  --warning-hex: #d9a441;
  --warning-soft: oklch(0.95 0.05 80);
  --warning-ink: oklch(0.42 0.1 70);

  --orange: oklch(0.68 0.17 45);
  --orange-hex: #d9762e;
  --orange-soft: oklch(0.94 0.06 45);
  --orange-ink: oklch(0.42 0.13 40);

  --critical: oklch(0.58 0.21 25);
  --critical-hex: #d1293f;
  --critical-soft: oklch(0.94 0.05 20);
  --critical-ink: oklch(0.44 0.18 22);

  --info: oklch(0.6 0.13 250);
  --info-hex: #4d7fc4;
  --info-soft: oklch(0.94 0.03 250);
  --info-ink: oklch(0.4 0.1 250);

  --heat-0: oklch(0.97 0.006 250);
  --heat-1: oklch(0.88 0.05 250);
  --heat-2: oklch(0.76 0.1 250);
  --heat-3: oklch(0.62 0.15 250);
  --heat-4: oklch(0.5 0.17 255);
  --heat-0-hex: #f4f6fb;
  --heat-1-hex: #cfe0f7;
  --heat-2-hex: #93c5f5;
  --heat-3-hex: #4f86d8;
  --heat-4-hex: #2c5eb0;

  --shadow-float: 0 8px 24px -8px oklch(0.2 0.02 260 / 0.18);
  --radius-card: 12px;
  --radius-control: 8px;
  --radius-pill: 999px;

  --font-ui: Helvetica, Arial, sans-serif;
  --font-data: Helvetica, Arial, sans-serif;
}

/* ============ TOKENS (Modo TV = escuro) ============ */
body.modo-tv {
  --bg: oklch(0.19 0.012 260);
  --surface: oklch(0.24 0.014 260);
  --surface-alt: oklch(0.27 0.016 260);
  --ink: oklch(0.94 0.006 260);
  --ink-muted: oklch(0.72 0.012 260);
  --ink-faint: oklch(0.55 0.012 260);
  --border: oklch(0.34 0.016 260);
  --border-soft: oklch(0.3 0.015 260);

  --accent: oklch(0.66 0.19 25);
  --accent-hex: #e04a5e;
  --accent-fill-10-hex: #e04a5e1a;
  --accent-fill-20-hex: #e04a5e33;
  --accent-soft: oklch(0.32 0.08 25);
  --accent-soft-ink: oklch(0.86 0.08 25);

  --ink-hex: #eef0f4;
  --ink-muted-hex: #b7bcc7;
  --ink-faint-hex: #8b91a0;
  --border-soft-hex: #3a4049;

  --success-hex: #34c98a;
  --success-soft: oklch(0.3 0.06 152);
  --success-ink: oklch(0.82 0.1 152);
  --good-hex: #4fd2a5;
  --good-soft: oklch(0.3 0.06 165);
  --good-ink: oklch(0.82 0.09 165);
  --warning-hex: #e8bf6b;
  --warning-soft: oklch(0.32 0.06 80);
  --warning-ink: oklch(0.85 0.1 80);
  --orange-hex: #e69257;
  --orange-soft: oklch(0.32 0.07 45);
  --orange-ink: oklch(0.82 0.12 45);
  --critical-hex: #ec5b6d;
  --critical-soft: oklch(0.32 0.08 22);
  --critical-ink: oklch(0.84 0.14 22);
  --info-hex: #7fa8de;
  --info-soft: oklch(0.3 0.05 250);
  --info-ink: oklch(0.82 0.08 250);

  --heat-0: oklch(0.27 0.012 255);
  --heat-1: oklch(0.34 0.05 250);
  --heat-2: oklch(0.42 0.09 250);
  --heat-3: oklch(0.5 0.13 252);
  --heat-4: oklch(0.6 0.16 255);
  --heat-0-hex: #2c3138;
  --heat-1-hex: #34445e;
  --heat-2-hex: #3d5f8f;
  --heat-3-hex: #4779b8;
  --heat-4-hex: #5f94d6;

  --shadow-float: 0 8px 28px -8px oklch(0 0 0 / 0.5);
}

/* ============ BASE ============ */
body { font-family: var(--font-ui); background-color: var(--bg); color: var(--ink); }
.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; }

/* ============ TOPBAR ============ */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-ink); font-weight: 800; font-size: 13px;
  flex-shrink: 0;
}
.brand-text { line-height: 1.2; }
.brand-text .co { font-size: 11px; color: var(--ink-faint); font-weight: 600; letter-spacing: 0.04em; }
.brand-text .page { font-size: 15px; font-weight: 650; color: var(--ink); }

/* ============ BREADCRUMB (drill-down) ============ */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; flex-wrap: wrap; }
.breadcrumb a { color: var(--ink-faint); text-decoration: none; font-weight: 600; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border); }
.breadcrumb .current { color: var(--ink-muted); font-weight: 600; }
.breadcrumb .lvl-tag {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  background: var(--accent-soft); color: var(--accent); padding: 1px 6px; border-radius: 999px; margin-left: 2px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-alt);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-pill);
  gap: 2px;
}
.segmented a, .segmented button {
  border: 0;
  background: transparent;
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 160ms ease-out, color 160ms ease-out;
}
.segmented a:hover, .segmented button:hover { color: var(--ink); }
.segmented a.is-active, .segmented button.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px; font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-control);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 160ms ease-out, background 160ms ease-out;
}
.btn:hover { border-color: var(--ink-faint); background: var(--surface-alt); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-alt); border-color: var(--border-soft); }
.btn:disabled { opacity: 0.6; cursor: default; }

.user-chip { display: flex; align-items: center; gap: 8px; }
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-alt); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--ink-muted);
}
.user-chip .who { line-height: 1.2; }
.user-chip .who .name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.user-chip .who .role { font-size: 11px; color: var(--accent); font-weight: 600; text-decoration: none; }

/* ============ FILTER BAR ============ */
.filterbar {
  display: flex; align-items: flex-end; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  flex-wrap: wrap;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; font-weight: 650; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.field input, .field select {
  font-family: var(--font-ui); font-size: 13px; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 7px 10px;
}
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; }
.field-grow { flex: 1; min-width: 160px; }

/* ============ CARD ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 7px; color: var(--ink); }
.card-sub { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.info-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--ink-faint);
  font-size: 9.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: help; flex-shrink: 0;
}

/* ============ KPI ============ */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 720px) { .kpi-row { grid-template-columns: 1fr 1fr; } }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.kpi-label {
  font-size: 11px; font-weight: 650; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.045em;
  display: flex; align-items: center; gap: 5px;
}
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.kpi-value .unit { font-size: 15px; font-weight: 600; color: var(--ink-faint); margin-left: 2px; }
.kpi-foot { font-size: 12px; color: var(--ink-muted); }
.kpi-foot a { color: var(--accent); font-weight: 600; text-decoration: none; }
.kpi-foot a:hover { text-decoration: underline; }
.kpi-bar { height: 4px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; margin-top: 2px; }
.kpi-bar > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.kpi-input {
  width: 52px; font-family: var(--font-data); font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px;
  background: var(--surface); color: var(--ink);
}

/* ============ RANKING ============ */
.rank-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .rank-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .rank-grid { grid-template-columns: 1fr; } }

.rank-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px;
  position: relative;
  cursor: pointer;
  transition: border-color 160ms ease-out;
}
.rank-card:hover { border-color: var(--ink-faint); }
.rank-card .place {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-alt);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-data); font-size: 11px; font-weight: 700;
  color: var(--ink-muted); flex-shrink: 0;
}
.rank-card .place.p1 { background: var(--warning-soft); color: var(--warning-ink); }
.rank-card .head-row { display: flex; align-items: center; gap: 10px; margin-bottom: 3px; }
.rank-card .name { font-size: 13.5px; font-weight: 650; color: var(--ink); }
.rank-card .meta { font-size: 11.5px; color: var(--ink-faint); }
.rank-card .score-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-top: 10px; }
.rank-card .score { font-family: var(--font-data); font-size: 20px; font-weight: 700; color: var(--ink); }
.rank-card .score-label { font-size: 11px; color: var(--ink-faint); }

.dist-bar {
  display: flex; height: 8px; border-radius: 999px; overflow: hidden;
  margin-top: 10px; background: var(--surface-alt);
}
.dist-bar > span { display: block; height: 100%; }
.dist-legend { display: flex; gap: 10px; margin-top: 7px; flex-wrap: wrap; }
.dist-legend .item { display: flex; align-items: center; gap: 4px; font-size: 10.5px; color: var(--ink-faint); }
.dist-legend .sw { width: 6px; height: 6px; border-radius: 2px; flex-shrink: 0; }
.dist-legend .n { font-family: var(--font-data); color: var(--ink-muted); font-weight: 600; }

.criticos-label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 650; color: var(--critical-ink);
  background: var(--critical-soft); padding: 3px 8px; border-radius: var(--radius-pill);
}
.criticos-label:empty { background: none; padding: 0; } /* recalcularCriticos() zera o texto quando não há críticos */

.chip-filter {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700;
  padding: 4px 10px; border-radius: var(--radius-pill);
  border: 1px solid; cursor: pointer;
  transition: filter 120ms ease-out;
  background: none;
}
.chip-filter:hover { filter: brightness(0.96); }

/* Botões "Atendimentos Críticos" (toggle por nota) — toggleNotaCritica() troca
   a classe inteira entre a variante -on e -off, mantém 1:1 com $notas no PHP. */
.chip-crit-1-on  { background: var(--critical); color: white; border-color: var(--critical); }
.chip-crit-1-off { background: var(--surface); color: var(--critical-ink); border-color: var(--critical-soft); }
.chip-crit-2-on  { background: var(--orange); color: white; border-color: var(--orange); }
.chip-crit-2-off { background: var(--surface); color: var(--orange-ink); border-color: var(--orange-soft); }
.chip-crit-3-on  { background: var(--warning); color: white; border-color: var(--warning); }
.chip-crit-3-off { background: var(--surface); color: var(--warning-ink); border-color: var(--warning-soft); }
.chip-crit-4-on  { background: var(--good); color: white; border-color: var(--good); }
.chip-crit-4-off { background: var(--surface); color: var(--good-ink); border-color: var(--good-soft); }
.chip-crit-5-on  { background: var(--success); color: white; border-color: var(--success); }
.chip-crit-5-off { background: var(--surface); color: var(--success-ink); border-color: var(--success-soft); }

/* ============ AI DIAGNOSTIC ============ */
.ai-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 10px; padding: 30px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-control);
  background: var(--surface-alt);
}
.ai-empty .ai-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.ai-empty p { font-size: 12.5px; color: var(--ink-muted); max-width: 46ch; margin: 0 auto; }

/* ============ CHART GRID ============ */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 820px) { .chart-grid { grid-template-columns: 1fr; } }

.hbar-list { display: flex; flex-direction: column; gap: 12px; }
.hbar-row .hbar-top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; gap: 8px; }
.hbar-row .hbar-top .label { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-row .hbar-top .val { font-family: var(--font-data); color: var(--ink-faint); flex-shrink: 0; }
.hbar-track { height: 7px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; }
.hbar-track > span { display: block; height: 100%; border-radius: inherit; background: var(--critical); }

.chart-caption { font-size: 11.5px; color: var(--ink-faint); margin-top: 10px; text-align: center; }
.chart-empty { text-align: center; padding: 30px 12px; color: var(--ink-faint); font-size: 12.5px; }

/* ============ HEATMAP ============ */
.heatmap-scroll { overflow-x: auto; }
.heatmap-table { border-collapse: collapse; width: 100%; min-width: 480px; }
.heatmap-table td, .heatmap-table th {
  text-align: center; font-family: var(--font-data); font-size: 10.5px; font-weight: 650;
  padding: 4px; border-radius: 5px;
}
.heatmap-table th { color: var(--ink-faint); font-family: var(--font-ui); font-weight: 650; }
.heatmap-table .htime { color: var(--ink-faint); text-align: left; font-weight: 600; }

/* ============ TABLE ============ */
.table-scroll { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 720px; }
.data-table thead th {
  text-align: left; font-size: 11px; font-weight: 650; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.03em;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table thead th a { color: inherit; text-decoration: none; }
.data-table thead th a:hover { color: var(--ink); }
.data-table thead th .arrow { color: var(--accent); margin-left: 3px; }
.data-table tbody td { padding: 9px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; color: var(--ink); }
.data-table tbody tr { transition: background 120ms ease-out; }
.data-table tbody tr:hover { background: var(--surface-alt); cursor: pointer; }
.data-table .id-cell { font-family: var(--font-data); color: var(--ink-muted); }
.data-table .name-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.data-table .name-link:hover { text-decoration: underline; }

.note-chip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; padding: 2px 6px;
  font-family: var(--font-data); font-weight: 700; font-size: 11.5px;
  border-radius: 6px;
}
.note-1 { background: var(--critical-soft); color: var(--critical-ink); }
.note-2 { background: var(--orange-soft); color: var(--orange-ink); }
.note-3 { background: var(--warning-soft); color: var(--warning-ink); }
.note-4 { background: var(--good-soft); color: var(--good-ink); }
.note-5 { background: var(--success-soft); color: var(--success-ink); }

.variance-note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; margin-bottom: 14px;
  border: 1px solid var(--info-soft);
  background: var(--info-soft);
  border-radius: var(--radius-control);
}
.variance-note .txt { font-size: 12px; color: var(--info-ink); }
.variance-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.variance-tags span {
  font-size: 10.5px; font-weight: 650; color: var(--info-ink);
  background: var(--surface); border: 1px solid var(--info-soft);
  padding: 2px 7px; border-radius: var(--radius-pill);
}

.checkbox-cell { width: 32px; text-align: center !important; }
.checkbox-cell input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }

.bulk-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin-bottom: 12px;
  background: var(--accent-soft); border: 1px solid var(--accent-soft);
  border-radius: var(--radius-control);
  font-size: 12.5px; font-weight: 650; color: var(--accent-soft-ink);
}
.bulk-bar .count { color: var(--accent-soft-ink); }
.bulk-bar button {
  margin-left: auto; border: 1px solid var(--accent); background: var(--surface); color: var(--accent);
  font-size: 12px; font-weight: 650; padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.bulk-bar button:hover { background: var(--accent-soft); }

.skel {
  display: inline-block; height: 12px; border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border-soft) 50%, var(--surface-alt) 75%);
  background-size: 200% 100%; animation: skel-shimmer 1.4s infinite;
}
@keyframes skel-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

.table-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; flex-wrap: wrap; gap: 10px; }
.table-foot .count { font-size: 12px; color: var(--ink-faint); }
.pager { display: flex; align-items: center; gap: 4px; }
.pager a, .pager span.pager-current {
  min-width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 7px; text-decoration: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-muted);
  font-family: var(--font-data); font-size: 12px; font-weight: 650; cursor: pointer;
}
.pager span.pager-current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pager a:hover { border-color: var(--ink-faint); color: var(--ink); }

/* ============ ALERTS RAIL ============ */
.rail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px;
  box-shadow: var(--shadow-float);
}
.rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.rail-head .title { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; color: var(--critical-ink); }
.rail-head .count {
  background: var(--critical); color: white; font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: var(--radius-pill); font-family: var(--font-data);
}
.sync-row { display: flex; align-items: center; gap: 8px; margin: 8px 0 12px; }
.sync-row .lbl { font-size: 10.5px; color: var(--ink-faint); white-space: nowrap; }
.sync-track { flex: 1; height: 4px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; }
.sync-track > span { display: block; height: 100%; background: var(--critical); border-radius: inherit; }
.sync-row .time { font-family: var(--font-data); font-size: 10.5px; color: var(--ink-muted); font-weight: 600; }

/* ============ LIVE PULSE (sincronização ativa) ============ */
.live-dot {
  position: relative; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.live-dot::after {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 1.5px solid currentColor; animation: live-pulse 2s ease-out infinite;
}
@keyframes live-pulse { 0% { transform: scale(0.6); opacity: .8; } 100% { transform: scale(2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .live-dot::after { animation: none; opacity: .35; } }

.alert-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 9px 4px; border-top: 1px solid var(--border-soft);
  cursor: pointer;
}
.alert-item:first-of-type { border-top: none; }
.alert-item:hover .alert-name { color: var(--accent); }
.alert-name { font-size: 12.5px; font-weight: 650; color: var(--ink); transition: color 120ms ease-out; }
.alert-meta { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }

/* ============ KEYWORDS.PHP: intro cards / bars / chips ============ */
.intro-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 16px;
}
.intro-card .num-badge {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-soft-ink);
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; flex-shrink: 0;
}
.intro-card h3 { font-size: 13.5px; font-weight: 650; color: var(--ink); margin: 8px 0 6px; }
.intro-card p { font-size: 12.5px; color: var(--ink-muted); line-height: 1.55; }

.cat-bar-track { height: 8px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; }
.cat-bar-track > span { display: block; height: 100%; border-radius: inherit; }

.word-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 650; border: 1px solid;
  color: var(--ink);
}
.word-chip .sw { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

.coverage-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 650; color: var(--warning-ink);
  background: var(--warning-soft); padding: 3px 9px; border-radius: var(--radius-pill);
}

/* ============ DATE RANGE PICKER ============ */
.daterange-mount { position: relative; }
.daterange-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: var(--radius-control);
  cursor: pointer; white-space: nowrap; font-family: var(--font-ui);
}
.daterange-trigger:hover { border-color: var(--ink-faint); background: var(--surface-alt); }

.daterange-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-float); overflow: hidden;
}
.daterange-body { display: flex; align-items: stretch; }

.daterange-side { width: 168px; padding: 10px 8px; border-right: 1px solid var(--border-soft); overflow-y: auto; max-height: 420px; }
.daterange-side-title { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); padding: 6px 8px 4px; }
.daterange-side-sep { height: 1px; background: var(--border-soft); margin: 6px 4px; }
.daterange-radio {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
  font-size: 12.5px; color: var(--ink-muted); cursor: pointer; white-space: nowrap;
}
.daterange-radio:hover { background: var(--surface-alt); color: var(--ink); }
.daterange-radio input { accent-color: var(--accent); }
.daterange-radio input:checked ~ span { color: var(--ink); font-weight: 650; }

.daterange-main { padding: 14px 16px; }
.daterange-calendars { display: flex; gap: 20px; }
.daterange-month { width: 220px; }
.daterange-month-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 6px; }
.daterange-month-head button {
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-muted);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer; flex-shrink: 0;
}
.daterange-month-head button:hover { background: var(--surface-alt); color: var(--ink); }
.daterange-month-sel { display: flex; gap: 4px; flex: 1; }
.daterange-month-sel select {
  font-size: 12px; font-weight: 600; color: var(--ink); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 4px; background: var(--surface); font-family: var(--font-ui);
}

.daterange-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.daterange-grid-head { margin-bottom: 2px; }
.daterange-grid-head span { text-align: center; font-size: 10px; font-weight: 650; color: var(--ink-faint); padding: 4px 0; }
.dr-day {
  border: 0; background: none; text-align: center; font-size: 12px; color: var(--ink);
  padding: 6px 0; border-radius: 6px; cursor: pointer; font-family: var(--font-ui);
}
.dr-day:hover { background: var(--surface-alt); }
.dr-empty { cursor: default; }
.dr-in-range { background: var(--accent-soft); border-radius: 0; }
.dr-edge { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.dr-today:not(.dr-edge) { box-shadow: inset 0 0 0 1px var(--accent); }

.daterange-compare-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft); flex-wrap: wrap; }
.daterange-checkbox { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 650; color: var(--ink); cursor: pointer; }
.daterange-checkbox input { accent-color: var(--accent); width: 15px; height: 15px; }
.daterange-compare-opts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.daterange-compare-opts select, .daterange-compare-custom input {
  font-size: 12px; border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px;
  background: var(--surface); color: var(--ink); font-family: var(--font-ui);
}
.daterange-compare-preview { font-size: 12px; color: var(--accent); font-weight: 650; }

.daterange-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.daterange-footer-range { font-size: 12.5px; color: var(--ink-muted); font-weight: 600; }
.daterange-footer-actions { display: flex; gap: 8px; }

/* ============ CHIP DE CITAÇÃO (Diagnóstico de IA → atendimento específico) ============ */
.ai-ref-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; font-family: var(--font-data);
  padding: 1px 8px; border-radius: var(--radius-pill);
  vertical-align: middle; margin: 0 1px;
}
button.ai-ref-chip {
  background: var(--accent-soft); color: var(--accent-soft-ink);
  border: 1px solid transparent; cursor: pointer;
}
button.ai-ref-chip:hover { background: var(--accent); color: var(--accent-ink); }
.ai-ref-chip-missing {
  background: var(--surface-alt); color: var(--ink-faint); border: 1px dashed var(--border);
}

/* ============ KPI DELTA (comparação de período) ============ */
.kpi-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; margin-top: 4px; }
.kpi-delta.up { color: var(--success-ink); }
.kpi-delta.down { color: var(--critical-ink); }
.kpi-delta.flat { color: var(--ink-faint); }
.kpi-delta .vs { font-weight: 500; color: var(--ink-faint); margin-left: 2px; }
