/* ── Reset & Tokens ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #07070d;
  --surface:      #0e0e18;
  --surface-2:    #14141f;
  --surface-3:    #1a1a28;
  --surface-4:    #22223a;
  --border:       rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12);
  --border-strong:rgba(255,255,255,0.18);
  --text:         #e6e6f2;
  --text-muted:   #7a7a98;
  --text-subtle:  #44445e;
  --accent:       #C9A24C;
  --accent-hover: #d9b25e;
  --accent-dim:   rgba(201,162,76,0.14);
  --accent-soft:  rgba(201,162,76,0.06);
  --accent-ink:   #8a7a4f;
  --urgente:      #ef4444;
  --urgente-bg:   rgba(239,68,68,0.10);
  --urgente-border: rgba(239,68,68,0.28);
  --atencao:      #f59e0b;
  --atencao-bg:   rgba(245,158,11,0.10);
  --atencao-border: rgba(245,158,11,0.28);
  --normal:       #22c55e;
  --normal-bg:    rgba(34,197,94,0.10);
  --normal-border: rgba(34,197,94,0.28);
  --radius:       10px;
  --radius-lg:    14px;
  --shadow:       0 8px 32px rgba(0,0,0,0.5);
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.4);
  --font:         -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --transition:   140ms cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  grid-template-rows: 56px 1fr;
  min-height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 14.5px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.015em;
}

.topbar-spacer { flex: 1; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.topbar-user-name {
  font-weight: 500;
  color: var(--text);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon svg { width: 16px; height: 16px; }

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--surface-3);
  color: var(--text);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -2px; top: 9px; bottom: 9px;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.nav-item .badge {
  margin-left: auto;
  background: var(--urgente);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 9999px;
  min-width: 20px;
  text-align: center;
}

.sidebar-section {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 16px 12px 6px;
}

.sidebar-spacer { flex: 1; }

/* Main */
.main {
  padding: 28px 32px 60px;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 56px auto 1fr; }
  .sidebar { grid-column: 1; flex-direction: row; overflow-x: auto; padding: 8px 10px; border-right: none; border-bottom: 1px solid var(--border); gap: 4px; }
  .nav-item.active::before { left: 6px; top: auto; bottom: 4px; right: 6px; width: auto; height: 2px; }
  .sidebar-section, .sidebar-spacer { display: none; }
  .main { padding: 20px 16px; }
}

/* ── Tipografia ──────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}
.page-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.01em;
  font-style: italic;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.card-sm { padding: 16px; }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
  opacity: 0.6;
}
.stat-card:hover { border-color: var(--border-hover); }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 4px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-label svg { width: 12px; height: 12px; }

.stat-card.urgente .stat-value { color: var(--urgente); }
.stat-card.atencao  .stat-value { color: var(--atencao); }
.stat-card.normal   .stat-value { color: var(--normal);  }

/* ── Badges urgência ────────────────────────────────────────────────────── */
.badge-urgencia {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 650;
  padding: 3px 9px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-urgencia svg { width: 10px; height: 10px; }
.badge-urgencia.urgente { background: var(--urgente-bg); color: var(--urgente); border: 1px solid var(--urgente-border); }
.badge-urgencia.atencao { background: var(--atencao-bg); color: var(--atencao); border: 1px solid var(--atencao-border); }
.badge-urgencia.normal  { background: var(--normal-bg);  color: var(--normal);  border: 1px solid var(--normal-border);  }

/* ── Publication cards ──────────────────────────────────────────────────── */
.pub-list { display: flex; flex-direction: column; gap: 10px; }

.pub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}
.pub-card:hover { border-color: var(--border-hover); background: var(--surface-2); }

.pub-card::before {
  content: '';
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 0 2px 2px 0;
}
.pub-card.urgente::before { background: var(--urgente); }
.pub-card.atencao::before  { background: var(--atencao); }
.pub-card.normal::before   { background: var(--normal); }

.pub-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.pub-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pub-tribunal {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-3);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.pub-date { font-size: 12px; color: var(--text-muted); }

.pub-processo {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-mono);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.pub-partes { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.pub-tipo   { font-size: 12px; color: var(--text-subtle); }
.pub-conteudo {
  font-size: 12px;
  color: var(--text-subtle);
  line-height: 1.6;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pub-prazo {
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pub-prazo.urgente { color: var(--urgente); }
.pub-prazo.atencao { color: var(--atencao); }
.pub-prazo.normal  { color: var(--normal); }

/* ── Source tags / verified ─────────────────────────────────────────────── */
.source-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text-muted);
}
.source-tag.source-djen     { color: #818cf8; border-color: rgba(129,140,248,0.3); background: rgba(129,140,248,0.08); }
.source-tag.source-datajud  { color: #34d399; border-color: rgba(52,211,153,0.3);  background: rgba(52,211,153,0.08); }
.source-tag.source-dje      { color: #fcd34d; border-color: rgba(252,211,77,0.3);  background: rgba(252,211,77,0.08); }

.source-verified {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  background: rgba(59,130,246,0.12);
  color: #93c5fd;
  border: 1px solid rgba(59,130,246,0.3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.source-verified svg { width: 11px; height: 11px; }

/* ── Collector health card ─────────────────────────────────────────────── */
.collector-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.collector-card:hover { border-color: var(--border-hover); }
.collector-info { display: flex; align-items: center; gap: 14px; }
.collector-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.collector-dot.ok       { background: var(--normal);  box-shadow: 0 0 0 4px var(--normal-bg); }
.collector-dot.degraded { background: var(--atencao); box-shadow: 0 0 0 4px var(--atencao-bg); }
.collector-dot.disabled { background: var(--text-subtle); }
.collector-dot.down     { background: var(--urgente); box-shadow: 0 0 0 4px var(--urgente-bg); }
.collector-dot.unknown  { background: var(--text-subtle); }

.collector-name {
  font-weight: 650;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.collector-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.collector-status-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 9999px;
}
.collector-status-label.ok       { background: var(--normal-bg);  color: var(--normal);  }
.collector-status-label.degraded { background: var(--atencao-bg); color: var(--atencao); }
.collector-status-label.disabled { background: var(--surface-3);  color: var(--text-muted); }
.collector-status-label.down     { background: var(--urgente-bg); color: var(--urgente); }
.collector-status-label.unknown  { background: var(--surface-3);  color: var(--text-muted); }

/* ── Filtros ───────────────────────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  width: fit-content;
}

.filter-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.filter-btn:hover { color: var(--text); background: var(--surface-3); }
.filter-btn.active { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-sm); }
.filter-btn svg { width: 12px; height: 12px; }

/* ── Botões ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
  text-decoration: none;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #0a0a0a; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--border-hover); background: var(--surface-3); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--border-hover); }

.btn-danger {
  background: var(--urgente-bg);
  color: var(--urgente);
  border-color: var(--urgente-border);
}
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-sm svg { width: 12px; height: 12px; }

/* ── Forms ───────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.form-input, .form-select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 13px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: var(--transition);
  font-family: var(--font);
}
.form-input:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--surface);
}
.form-input::placeholder { color: var(--text-subtle); }
.form-hint  { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--urgente); margin-top: 6px; }

/* ── Login page ──────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 70% 50% at 50% 0%, rgba(99,102,241,0.12), transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(99,102,241,0.06), transparent 60%);
}

.login-card {
  width: 100%;
  max-width: 408px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.login-title {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.025em;
  color: var(--text);
}
.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -8px;
  letter-spacing: -0.005em;
}

/* ── Tabs ────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 24px;
}
.tab {
  flex: 1;
  padding: 8px;
  border-radius: 7px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  letter-spacing: -0.005em;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ── Alerts ──────────────────────────────────────────────────────────── */
.alert {
  padding: 11px 14px;
  border-radius: 9px;
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert svg { width: 14px; height: 14px; margin-top: 2px; flex-shrink: 0; }
.alert-error   { background: var(--urgente-bg); border: 1px solid var(--urgente-border); color: #fca5a5; }
.alert-success { background: var(--normal-bg);  border: 1px solid var(--normal-border);  color: #86efac;  }
.alert-warning { background: var(--atencao-bg); border: 1px solid var(--atencao-border); color: #fcd34d;  }

/* ── Table ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
th:first-child { border-top-left-radius: 8px; }
th:last-child  { border-top-right-radius: 8px; }
td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ── Chips (termos + tribunais selecionados) ────────────────────────── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 32px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 8px 5px 10px;
  font-size: 12.5px;
  color: var(--text);
  transition: var(--transition);
}
.chip:hover { border-color: var(--border-hover); }
.chip .chip-tag {
  font-size: 10px;
  background: var(--accent-dim);
  color: var(--accent-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.chip .chip-remove {
  background: none;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  transition: var(--transition);
}
.chip .chip-remove:hover { color: var(--urgente); background: var(--urgente-bg); }
.chip .chip-remove svg { width: 12px; height: 12px; }

/* Search dropdown (tribunais + outros) */
.combo {
  position: relative;
}
.combo-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}
.combo-trigger:hover { color: var(--text); border-color: var(--accent); }
.combo-trigger svg { width: 12px; height: 12px; }

.combo-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
}
.combo.open .combo-panel { display: block; }

.combo-search {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  margin-bottom: 6px;
}
.combo-search:focus { border-color: var(--accent); }

.combo-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.combo-option {
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}
.combo-option:hover, .combo-option.active { background: var(--surface-3); }
.combo-option.selected { color: var(--accent-hover); }
.combo-option .check { color: var(--accent); opacity: 0; }
.combo-option.selected .check { opacity: 1; }
.combo-option .check svg { width: 14px; height: 14px; }

.combo-group {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 10px 4px;
}

/* ── Date navigator (substitui native date picker) ──────────────────── */
.date-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
}
.date-nav button {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}
.date-nav button:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.date-nav button:disabled { opacity: 0.4; cursor: default; }
.date-nav button svg { width: 14px; height: 14px; }
.date-nav .date-label {
  padding: 6px 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  min-width: 130px;
  text-align: center;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.date-nav .today-btn {
  font-weight: 600;
  color: var(--accent-hover);
}

/* ── Loader / Skeleton ─────────────────────────────────────────────── */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 13px;
  gap: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--surface)   0%,
    var(--surface-3) 50%,
    var(--surface)   100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: 6px;
}
.skeleton-stack { display: flex; flex-direction: column; gap: 10px; }
.skeleton-card {
  height: 86px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.skeleton-stat {
  height: 78px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.skeleton-row {
  height: 48px;
  border-radius: 8px;
}
.skeleton-line { height: 12px; }
.skeleton-line.short { width: 40%; }
.skeleton-line.mid   { width: 70%; }

/* ── Empty states ──────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.empty-icon svg { width: 26px; height: 26px; }
.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.empty-message {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 360px;
  line-height: 1.55;
  margin: 0 auto;
}
.empty-action { margin-top: 4px; }

/* ── Modal ─────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 24px;
  animation: fadeIn 140ms ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: scaleIn 180ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes scaleIn { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Scrollbar ─────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-subtle); }

/* ── Pagination ────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
}
.pagination button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.pagination button:hover:not(:disabled) { border-color: var(--border-hover); color: var(--text); }
.pagination button.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent-hover); }
.pagination button:disabled { opacity: 0.3; cursor: default; }
.pagination button svg { width: 12px; height: 12px; }

/* ── Section header ────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.012em;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.section-title svg { width: 15px; height: 15px; color: var(--text-muted); }

/* ── Log items ─────────────────────────────────────────────────────── */
.log-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.log-item:last-child { border-bottom: none; }
.log-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.log-dot.concluido { background: var(--normal); box-shadow: 0 0 0 3px var(--normal-bg); }
.log-dot.iniciado  { background: var(--atencao); box-shadow: 0 0 0 3px var(--atencao-bg); }
.log-dot.erro      { background: var(--urgente); box-shadow: 0 0 0 3px var(--urgente-bg); }

/* ── Help page ─────────────────────────────────────────────────────── */
.help-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  max-width: 1100px;
}
@media (max-width: 900px) {
  .help-layout { grid-template-columns: 1fr; gap: 24px; }
  .help-toc { position: static !important; }
}

.help-toc {
  position: sticky;
  top: 80px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 0;
  font-size: 12.5px;
  border-left: 1px solid var(--border);
}
.help-toc a {
  padding: 7px 14px;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: var(--transition);
  font-weight: 500;
}
.help-toc a:hover { color: var(--text); }
.help-toc a.active { color: var(--accent-hover); border-left-color: var(--accent); }

.help-content { min-width: 0; }

.help-section {
  margin-bottom: 56px;
  scroll-margin-top: 80px;
}
.help-section h2 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.help-section h2 svg {
  width: 20px; height: 20px;
  color: var(--accent-hover);
  flex-shrink: 0;
}
.help-section h3 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.012em;
  margin: 24px 0 10px;
  color: var(--text);
}
.help-section p,
.help-section li {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted);
}
.help-section p { margin-bottom: 12px; }
.help-section strong { color: var(--text); font-weight: 600; }
.help-section code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--accent-hover);
}

.help-lead {
  font-size: 15px !important;
  color: var(--text) !important;
  line-height: 1.65 !important;
  margin-bottom: 24px !important;
}

/* Numbered steps */
.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.steps > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.steps > li::before {
  content: counter(step);
  width: 28px; height: 28px;
  background: var(--accent-dim);
  color: var(--accent-hover);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}
.steps > li .step-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.steps > li .step-body {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
}
.steps > li .step-body a { color: var(--accent-hover); text-decoration: none; }
.steps > li .step-body a:hover { text-decoration: underline; }

/* Callout boxes */
.callout {
  padding: 14px 16px;
  border-radius: 10px;
  border-left: 3px solid;
  margin: 18px 0;
  font-size: 13.5px;
  line-height: 1.6;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.callout svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.callout.info  { background: var(--accent-soft);  border-left-color: var(--accent);  color: var(--text); }
.callout.tip   { background: var(--normal-bg);    border-left-color: var(--normal);  color: var(--text); }
.callout.warn  { background: var(--atencao-bg);   border-left-color: var(--atencao); color: var(--text); }
.callout .callout-title { font-weight: 650; color: var(--text); display: block; margin-bottom: 2px; font-size: 13px; }

/* Color legend cards */
.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.legend-card {
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface);
}
.legend-card.l-urgente { border-left-color: #ef4444; }
.legend-card.l-atencao { border-left-color: #f59e0b; }
.legend-card.l-normal  { border-left-color: #22c55e; }
.legend-card.l-semp    { border-left-color: #9ca3af; }
.legend-card .legend-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.legend-card .legend-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* FAQ accordion */
.faq-item {
  border-bottom: 1px solid var(--border);
}
.faq-item:last-child { border-bottom: none; }
.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  list-style: none;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q svg { transition: transform 200ms ease; flex-shrink: 0; }
.faq-item[open] .faq-q svg { transform: rotate(180deg); }
.faq-a {
  padding: 0 4px 14px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ── Utility ───────────────────────────────────────────────────────── */
.text-mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; }
.row-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ── Status badges (anotações 008) ──────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 9px; border-radius: 99px; text-transform: uppercase;
}
.status-badge.status-nova      { background: rgba(201,162,76,0.14); color: #C9A24C; }
.status-badge.status-lida      { background: rgba(255,255,255,0.08); color: var(--text-muted); }
.status-badge.status-tratada   { background: rgba(34,197,94,0.14); color: #22c55e; }
.status-badge.status-delegada  { background: rgba(99,102,241,0.16); color: #818cf8; }
.status-badge.status-arquivada { background: rgba(0,0,0,0.2); color: var(--text-subtle); }

.pub-dimmed { opacity: 0.55; transition: opacity 200ms; }
.pub-dimmed:hover { opacity: 0.85; }

/* Status bar no modal */
.status-bar {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 14px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.status-bar-label {
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 700;
  color: var(--text-muted);
}
.status-bar-options { display: flex; gap: 6px; flex-wrap: wrap; }
.status-opt {
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  font-size: 11.5px; padding: 6px 12px; border-radius: 6px; cursor: pointer;
  font-weight: 600; transition: all 140ms;
}
.status-opt:hover { color: var(--text); border-color: var(--border-hover); }
.status-opt.active { background: #C9A24C; color: #0a0a0a; border-color: #C9A24C; }

.modal-wide { max-width: 640px; }

/* Notas / timeline */
.notes-section {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
}
.notes-timeline { display: flex; flex-direction: column; gap: 10px; max-height: 240px; overflow-y: auto; }
.note-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px;
}
.note-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.note-meta { font-size: 10.5px; color: var(--text-subtle); margin-top: 4px; letter-spacing: 0.04em; }
