/* =============================================
   ELEITORAL APP — CSS Principal
   Dark theme, inspirado no Polijetro
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── VARIÁVEIS ─── */
:root {
  --bg-base:        #0d0f14;
  --bg-surface:     #13161f;
  --bg-card:        #181c27;
  --bg-hover:       #1e2333;
  --bg-input:       #1a1e2d;
  --bg-modal:       #181c27;

  --border-subtle:  rgba(255,255,255,0.06);
  --border-default: rgba(255,255,255,0.10);
  --border-strong:  rgba(255,255,255,0.18);

  --text-primary:   #e8eaf0;
  --text-secondary: #8b91a8;
  --text-muted:     #575d72;
  --text-disabled:  #3a3f52;

  --accent-green:   #00e676;
  --accent-green-dim: rgba(0,230,118,0.12);
  --accent-blue:    #4d9fff;
  --accent-blue-dim: rgba(77,159,255,0.12);

  --risk-crise:     #ff4444;
  --risk-formacao:  #ff8c00;
  --risk-atencao:   #ffd600;
  --risk-ok:        #00e676;

  --risk-crise-bg:  rgba(255,68,68,0.10);
  --risk-formacao-bg: rgba(255,140,0,0.10);
  --risk-atencao-bg:  rgba(255,214,0,0.10);
  --risk-ok-bg:       rgba(0,230,118,0.10);

  --sidebar-width:  220px;
  --topbar-height:  0px;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  --shadow-card: 0 2px 16px rgba(0,0,0,0.4);
  --shadow-modal: 0 8px 48px rgba(0,0,0,0.7);

  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition: 0.15s ease;
}

/* ─── RESET ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── LAYOUT APP ─── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-logo-inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #1a5e3a, var(--accent-green));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg { color: #fff; width: 18px; height: 18px; }

.sidebar-logo-text { line-height: 1.2; }
.sidebar-logo-name {
  font-size: 13px; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.sidebar-logo-sub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-section {
  margin-bottom: 4px;
}

.sidebar-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 18px 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-left: 2px solid transparent;
  text-decoration: none;
  position: relative;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.sidebar-item.active {
  background: var(--accent-green-dim);
  color: var(--accent-green);
  border-left-color: var(--accent-green);
}

.sidebar-item svg {
  width: 16px; height: 16px; flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--risk-crise);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 20px;
  min-width: 16px;
  text-align: center;
}

.sidebar-badge.badge-ok {
  background: var(--accent-green);
  color: #000;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 1px solid var(--border-default);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: var(--text-secondary);
  overflow: hidden; flex-shrink: 0;
}
.sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 12px; font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 10px; color: var(--text-muted);
  text-transform: capitalize;
}

.sidebar-logout {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  display: flex;
}
.sidebar-logout:hover { color: var(--risk-crise); background: var(--risk-crise-bg); }
.sidebar-logout svg { width: 14px; height: 14px; }

/* ─── CONTEÚDO PRINCIPAL ─── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-container {
  padding: 28px 32px;
  flex: 1;
}

/* ─── CABEÇALHO DE PÁGINA ─── */
.page-header {
  margin-bottom: 24px;
}

.page-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* ─── CARDS ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-sm { padding: 14px 16px; }
.card-lg { padding: 28px; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ─── STAT CARDS (DASHBOARD) ─── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: var(--border-default);
  transform: translateY(-1px);
}

.stat-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  font-feature-settings: 'tnum';
}

.stat-card-value.green { color: var(--accent-green); }
.stat-card-value.blue { color: var(--accent-blue); }
.stat-card-value.red { color: var(--risk-crise); }
.stat-card-value.orange { color: var(--risk-formacao); }

.stat-card-icon {
  position: absolute;
  top: 16px; right: 16px;
  opacity: 0.15;
  width: 32px; height: 32px;
}

/* ─── BOTÕES ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}
.btn-primary:hover { background: #3a8fe8; color: #fff; text-decoration: none; }

.btn-success {
  background: var(--accent-green);
  color: #000;
  border-color: var(--accent-green);
}
.btn-success:hover { background: #00c65a; color: #000; text-decoration: none; }

.btn-danger {
  background: var(--risk-crise);
  color: #fff;
  border-color: var(--risk-crise);
}
.btn-danger:hover { background: #e03030; text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-icon { padding: 7px; }

.btn:disabled, .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── FORMULÁRIOS ─── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-control {
  display: block;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(77,159,255,0.15);
}

.form-control::placeholder { color: var(--text-disabled); }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b91a8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ─── TABELAS ─── */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead tr {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }

.data-table td {
  padding: 11px 14px;
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table td.td-name {
  color: var(--text-primary);
  font-weight: 500;
}

/* ─── BADGES / TAGS ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-crise     { background: var(--risk-crise-bg);    color: var(--risk-crise); }
.badge-formacao  { background: var(--risk-formacao-bg); color: var(--risk-formacao); }
.badge-atencao   { background: var(--risk-atencao-bg);  color: var(--risk-atencao); }
.badge-ok        { background: var(--risk-ok-bg);       color: var(--risk-ok); }
.badge-blue      { background: var(--accent-blue-dim);  color: var(--accent-blue); }
.badge-green     { background: var(--accent-green-dim); color: var(--accent-green); }
.badge-gray      { background: rgba(255,255,255,0.06);  color: var(--text-muted); }

/* ─── ALERTAS FLASH ─── */
.flash-messages {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.flash-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  animation: slideInRight 0.2s ease;
  position: relative;
}

.flash-message.success {
  background: rgba(0,230,118,0.12);
  border: 1px solid rgba(0,230,118,0.3);
  color: var(--accent-green);
}

.flash-message.error {
  background: rgba(255,68,68,0.12);
  border: 1px solid rgba(255,68,68,0.3);
  color: var(--risk-crise);
}

.flash-message.warning {
  background: rgba(255,214,0,0.10);
  border: 1px solid rgba(255,214,0,0.3);
  color: var(--risk-atencao);
}

.flash-close {
  background: none; border: none; cursor: pointer;
  opacity: 0.6; margin-left: auto; padding: 0;
  color: inherit; font-size: 16px; line-height: 1;
}
.flash-close:hover { opacity: 1; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
}

.modal::-webkit-scrollbar { width: 4px; }
.modal::-webkit-scrollbar-track { background: transparent; }
.modal::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

.modal-header {
  padding: 22px 24px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  position: sticky; top: 0;
  background: var(--bg-modal);
  z-index: 1;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body { padding: 20px 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

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

/* ─── PAGINAÇÃO ─── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 20px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  background: transparent;
  transition: all var(--transition);
  text-decoration: none;
}

.page-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.page-link.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

.page-link.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ─── SEARCH BAR ─── */
.search-bar {
  position: relative;
}

.search-bar svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 14px; height: 14px;
  pointer-events: none;
}

.search-bar input {
  padding-left: 32px;
}

/* ─── TIPO TOPICO SELECTOR ─── */
.tipo-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.tipo-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  min-width: 70px;
  flex: 1;
  background: var(--bg-input);
}

.tipo-option:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.tipo-option.active {
  border-color: var(--accent-blue);
  background: var(--accent-blue-dim);
}

.tipo-option svg { width: 20px; height: 20px; color: var(--text-secondary); }
.tipo-option.active svg { color: var(--accent-blue); }
.tipo-option-label {
  font-size: 11px; font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}
.tipo-option.active .tipo-option-label { color: var(--accent-blue); }

/* ─── MODO MONITORAMENTO ─── */
.modo-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.modo-option {
  padding: 12px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-input);
}

.modo-option.active {
  border-color: var(--accent-blue);
  background: var(--accent-blue-dim);
}

.modo-option-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.modo-radio {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.modo-option.active .modo-radio {
  border-color: var(--accent-blue);
  background: var(--accent-blue);
}
.modo-option.active .modo-radio::after {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
}

.modo-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.modo-desc { font-size: 11px; color: var(--text-muted); padding-left: 22px; }

/* ─── LOADING SPINNER ─── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border-default);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ─── EMPTY STATE ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-state-icon {
  width: 56px; height: 56px;
  background: var(--bg-hover);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.empty-state-icon svg { width: 24px; height: 24px; }

.empty-state-title {
  font-size: 15px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 13px; color: var(--text-muted);
  max-width: 280px; line-height: 1.5;
  margin-bottom: 20px;
}

/* ─── AVATAR ─── */
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-hover);
  border: 1px solid var(--border-default);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  color: var(--text-secondary);
  overflow: hidden; flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-xl { width: 80px; height: 80px; font-size: 28px; }

/* ─── TABLE CARD / TABLE LINK / TABLE COMPONENTS ─── */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.table-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.table-link:hover { text-decoration: none; }

.table-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #000;
  flex-shrink: 0;
}

.table-name {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
}
.table-sub {
  font-size: 11px; color: var(--text-muted);
}
.table-phone { font-size: 12px; font-family: var(--font-mono); }
.table-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.table-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.btn-icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none; cursor: pointer;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.btn-icon svg { width: 14px; height: 14px; }

.badge-count {
  display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
  font-size: 11px; font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 24px;
}

/* ─── PAGINAÇÃO (templates) ─── */
.pagination-btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  background: transparent;
  transition: all var(--transition);
  text-decoration: none;
}
.pagination-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.pagination-btn.active {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}
.pagination-ellipsis {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}

/* ─── EMPTY STATE (templates) ─── */
.empty-icon {
  width: 56px; height: 56px;
  background: var(--bg-hover);
  border-radius: var(--radius-xl);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-muted);
}

/* ─── SCROLLBAR GLOBAL ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ─── UTILITIES ─── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-green { color: var(--accent-green); }
.text-blue { color: var(--accent-blue); }
.text-red { color: var(--risk-crise); }
.text-orange { color: var(--risk-formacao); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── ALIASES DE FORMULÁRIO ─── */
/* form-input é alias de form-control */
.form-input {
  display: block;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(77,159,255,0.15);
}
.form-input::placeholder { color: var(--text-disabled); }
.form-textarea { resize: vertical; min-height: 80px; }

.form-select {
  display: block;
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b91a8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  transition: border-color var(--transition);
}
.form-select:focus { border-color: var(--accent-blue); }

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.form-section {
  padding: 24px;
  border-bottom: 1px solid var(--border-subtle);
}
.form-section:last-of-type { border-bottom: none; }

.form-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}

.required { color: var(--risk-crise); }

/* page-content: layout interno de páginas normais */
.page-content {
  padding: 28px 32px;
  flex: 1;
}
.page-content-narrow {
  max-width: 760px;
}

/* btn-outline */
.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-default);
}
.btn-outline:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}

/* ─── FILTROS ─── */
.filtros-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.filtros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}

.input-with-icon {
  position: relative;
}
.input-with-icon svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 14px; height: 14px;
  pointer-events: none;
}
.input-with-icon input { padding-left: 32px; }

/* ─── STAT CARD VARIANTE COMPACTA ─── */
.stat-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  font-feature-settings: 'tnum';
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* stat-card flex variant (para cards que usam stat-icon) */
.stat-card.flex {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}

/* ─── PROGRESS BAR ─── */
.progress-bar-wrap {
  height: 4px;
  background: var(--bg-hover);
  border-radius: 2px;
  overflow: hidden;
  flex: 1;
}

.progress-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-green);
  transition: width 0.3s ease;
}

.progress-bar.red { background: var(--risk-crise); }
.progress-bar.orange { background: var(--risk-formacao); }
.progress-bar.yellow { background: var(--risk-atencao); }
.progress-bar.blue { background: var(--accent-blue); }
