/* ============================================================
   Masters Admin — CSS unificado
   Base: WM10 CEP v2 (dark-mode, tokens, responsive)
   Adições: módulo mkfErro (tabelas, badges, filtros, ranking)
   ============================================================ */

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

/* ── DESIGN TOKENS ────────────────────────────────────────── */
:root {
  --accent:       #2563eb;
  --accent-2:     #1d4ed8;
  --accent-soft:  #dbeafe;
  --accent-ring:  rgba(37, 99, 235, 0.18);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 20px;

  --pad-x: 20px;
  --pad-y: 18px;
  --gap:   16px;

  --bg:           #f5f7fb;
  --bg-elev:      #ffffff;
  --bg-subtle:    #eef2f8;
  --card:         #ffffff;
  --surface:      #ffffff;
  --surface-2:    #f8fafc;
  --text:         #0b1220;
  --text-soft:    #475569;
  --muted:        #94a3b8;
  --text-muted:   #94a3b8;
  --border:       #e5e9f2;
  --border-light: #eef1f7;
  --border-soft:  #eef1f7;
  --shadow-sm:    0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.02);
  --shadow:       0 4px 24px -8px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg:    0 24px 60px -20px rgba(15, 23, 42, 0.18), 0 8px 20px -8px rgba(15, 23, 42, 0.08);
  --sidebar-bg:                #ffffff;
  --sidebar-text:              #475569;
  --sidebar-muted:             #94a3b8;
  --sidebar-text-strong:       #0b1220;
  --sidebar-border:            #e5e9f2;
  --sidebar-hover-bg:          rgba(0,0,0,0.04);
  --sidebar-footer-border:     #e5e9f2;
  --sidebar-user-hover:        rgba(0,0,0,0.03);
  --sidebar-active-text:       var(--accent);
  --sidebar-logout-hover-color:#0b1220;
  --sidebar-logout-hover-bg:   rgba(0,0,0,0.05);
  --sidebar-w:    248px;

  --ok:        #10b981;
  --ok-soft:   #d1fae5;
  --warn:      #f59e0b;
  --warn-soft: #fef3c7;
  --err:       #ef4444;
  --err-soft:  #fee2e2;
  --info:      #3b82f6;
  --info-soft: #dbeafe;

  --success:    #16a34a;
  --success-bg: #dcfce7;
  --warning:    #d97706;
  --warning-bg: #fef3c7;
  --danger:     #dc2626;
  --danger-bg:  #fee2e2;
}

body.theme-dark {
  --bg:           #070b15;
  --bg-elev:      #0d1322;
  --bg-subtle:    #0f1628;
  --card:         #111a30;
  --surface:      #111a30;
  --surface-2:    #0d1424;
  --text:         #e7ecf5;
  --text-soft:    #a3aec5;
  --muted:        #64748b;
  --text-muted:   #64748b;
  --border:       #1c2540;
  --border-light: #15192c;
  --border-soft:  #15192c;
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow:       0 8px 32px -12px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg:    0 32px 80px -20px rgba(0, 0, 0, 0.8);
  --sidebar-bg:                #050810;
  --sidebar-text:              rgba(255,255,255,0.72);
  --sidebar-muted:             rgba(255,255,255,0.42);
  --sidebar-text-strong:       #ffffff;
  --sidebar-border:            rgba(255,255,255,0.04);
  --sidebar-hover-bg:          rgba(255,255,255,0.05);
  --sidebar-footer-border:     rgba(255,255,255,0.05);
  --sidebar-user-hover:        rgba(255,255,255,0.04);
  --sidebar-active-text:       #ffffff;
  --sidebar-logout-hover-color:#ffffff;
  --sidebar-logout-hover-bg:   rgba(255,255,255,0.06);

  --ok-soft:   rgba(16, 185, 129, 0.14);
  --warn-soft: rgba(245, 158, 11, 0.14);
  --err-soft:  rgba(239, 68, 68, 0.14);
  --info-soft: rgba(59, 130, 246, 0.14);
  --accent-soft: rgba(37, 99, 235, 0.18);
  --success-bg: rgba(22, 163, 74, 0.14);
  --warning-bg: rgba(217, 119, 6, 0.14);
  --danger-bg:  rgba(220, 38, 38, 0.14);
}

/* ── RESET ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.3s ease, color 0.2s ease;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
hr { border: none; border-top: 1px solid var(--border); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── APP SHELL ────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; background: var(--bg); }

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 100;
  border-right: 1px solid var(--sidebar-border);
}
.sidebar-brand {
  padding: 22px 20px 18px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px var(--accent-ring), inset 0 1px 0 rgba(255,255,255,0.15);
}
.brand-text { line-height: 1.15; min-width: 0; }
.sidebar-brand-name { color: var(--sidebar-text-strong); font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; }
.sidebar-brand-tag {
  display: block;
  color: var(--sidebar-muted);
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 8px 10px 14px; }
.nav-section {
  color: var(--sidebar-muted);
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em;
  padding: 14px 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
  position: relative;
}
.nav-link:hover { background: var(--sidebar-hover-bg); color: var(--sidebar-text-strong); }
.nav-link.active {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent) 22%, transparent),
    color-mix(in srgb, var(--accent) 8%, transparent));
  color: var(--sidebar-active-text);
}
.nav-link.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; background: var(--accent); border-radius: 0 4px 4px 0;
}
.nav-icon {
  width: 18px; height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.85;
}
.nav-link.active .nav-icon { opacity: 1; color: var(--accent); }

.sidebar-footer {
  padding: 14px 14px 16px;
  border-top: 1px solid var(--sidebar-footer-border);
}
.user-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: 10px;
  transition: background 0.15s;
}
.user-row:hover { background: var(--sidebar-user-hover); }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 12px;
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  color: var(--sidebar-text-strong); font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-role, .user-session { color: var(--sidebar-muted); font-size: 11px; }
.logout-btn {
  color: var(--sidebar-muted);
  font-size: 12px;
  padding: 6px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.logout-btn:hover { color: var(--sidebar-logout-hover-color); background: var(--sidebar-logout-hover-bg); }

/* ── MAIN CONTENT ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── HEADER ───────────────────────────────────────────────── */
.page-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border-soft);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.menu-btn {
  display: none;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  align-items: center; justify-content: center;
  color: var(--text-soft);
  font-size: 16px;
  transition: background 0.15s;
}
.menu-btn:hover { background: var(--surface-2); }

.page-title-block { flex: 1; min-width: 0; }
.page-eyebrow {
  font-size: 11px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}
.page-header h1, .page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  margin: 0;
}

.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-soft);
  font-size: 16px;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }

.content-area { padding: 24px 28px 32px; flex: 1; min-width: 0; }

/* ── BOTTOM TABS (mobile) ─────────────────────────────────── */
.bottom-tabs {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
  z-index: 40;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.bottom-tabs-inner { display: flex; max-width: 540px; margin: 0 auto; }
.bottom-tab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  padding: 8px 4px;
  color: var(--muted);
  font-size: 10.5px; font-weight: 500;
  text-decoration: none;
  position: relative;
  transition: color 0.15s;
}
.bottom-tab i { font-size: 22px; line-height: 1; }
.bottom-tab.active { color: var(--accent); }
.bottom-tab.active::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
}

/* ── MOBILE DRAWER ───────────────────────────────────────── */
.drawer-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 110;
  opacity: 0;
  transition: opacity 0.2s;
}
.drawer-backdrop.open { display: block; opacity: 1; }
.mobile-drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 280px; max-width: 85vw;
  background: var(--sidebar-bg);
  z-index: 111;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.mobile-drawer.open { transform: translateX(0); }

/* ── CARDS ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
  overflow: hidden;
}
.card.hoverable:hover,
.menu-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border);
  transform: translateY(-2px);
}
.card-body { padding: var(--pad-y) var(--pad-x); }
.card-header {
  padding: 14px var(--pad-x);
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  font-size: 13.5px; font-weight: 600;
}
.card-header h3 { font-size: 14px; font-weight: 600; color: var(--text); margin: 0; }

/* ── HERO BANNER (dashboard) ─────────────────────────────── */
.hero-banner {
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 24px 26px;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
  box-shadow: 0 16px 40px -16px var(--accent-ring);
}
.hero-banner::before, .hero-banner::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.hero-banner::before { right: -40px; top: -40px; width: 200px; height: 200px; background: rgba(255,255,255,0.1); }
.hero-banner::after  { right: 40px; bottom: -60px; width: 160px; height: 160px; background: rgba(255,255,255,0.06); }
.hero-eyebrow { font-size: 12px; font-weight: 600; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.1em; }
.hero-value { font-size: 40px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hero-sub { font-size: 13px; opacity: 0.9; margin-top: 4px; }
.hero-row { display: flex; gap: 20px; margin-top: 18px; flex-wrap: wrap; position: relative; }
.hero-stat-label { font-size: 11px; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.hero-stat-value { font-size: 18px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hero-sep { width: 1px; background: rgba(255,255,255,0.2); }

/* ── STAT CARDS ───────────────────────────────────────────── */
.stats-grid, .stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--gap);
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card .stat-glow {
  position: absolute;
  top: -40%; right: -20%;
  width: 60%; height: 120%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
  pointer-events: none;
  opacity: 0.7;
}
.stat-icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 8px;
  font-size: 17px;
}
.stat-icon.ok,    .stat-icon-success { background: var(--ok-soft);    color: var(--ok); }
.stat-icon.warn,  .stat-icon-warning { background: var(--warn-soft);  color: var(--warn); }
.stat-icon.err,   .stat-icon-danger  { background: var(--err-soft);   color: var(--err); }
.stat-icon.info,  .stat-icon-primary { background: var(--info-soft);  color: var(--info); }
.stat-icon.gray  { background: var(--bg-subtle); color: var(--text-soft); }

.stat-label {
  font-size: 11.5px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.stat-value {
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-top: 6px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat-value.ok,    .stat-value.color-success { color: var(--ok); }
.stat-value.warn,  .stat-value.color-warning { color: var(--warn); }
.stat-value.err,   .stat-value.color-danger  { color: var(--err); }
.stat-value.color-primary { color: var(--accent); }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── MENU / QUICK ACTION CARDS ───────────────────────────── */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--gap);
}
.menu-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
.menu-card .menu-icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 18px;
  margin-bottom: 4px;
}
.menu-card.tone-ok   .menu-icon { background: var(--ok-soft);    color: var(--ok); }
.menu-card.tone-warn .menu-icon { background: var(--warn-soft);  color: var(--warn); }
.menu-card.tone-err  .menu-icon { background: var(--err-soft);   color: var(--err); }
.menu-card.tone-gray .menu-icon { background: var(--bg-subtle);  color: var(--text-soft); }
.menu-card.tone-bug  .menu-icon { background: var(--err-soft);   color: var(--err); }
.menu-card h3 { font-size: 14.5px; font-weight: 600; color: var(--text); margin: 0; letter-spacing: -0.01em; }
.menu-card p  { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.menu-card .menu-arrow { color: var(--accent); font-size: 12.5px; font-weight: 600; margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; }

/* ── ALERTS ───────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid;
  line-height: 1.45;
}
.alert-success, .alert-ok   { background: var(--ok-soft);   color: var(--ok);   border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.alert-error,   .alert-err  { background: var(--err-soft);  color: var(--err);  border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.alert-info                 { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert-warn, .alert-warning { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
body.theme-dark .alert-success, body.theme-dark .alert-ok { color: #6ee7b7; }
body.theme-dark .alert-warn, body.theme-dark .alert-warning { color: #fcd34d; }
body.theme-dark .alert-error, body.theme-dark .alert-err  { color: #fca5a5; }
body.theme-dark .alert-info { color: #93c5fd; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.2;
  user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn i { font-size: 14px; line-height: 1; }
.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.btn-primary   { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.18); }
.btn-primary:hover { filter: brightness(1.06); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--muted); }

.btn-danger    { background: var(--surface); color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, var(--border)); box-shadow: var(--shadow-sm); }
.btn-danger:hover { background: var(--err-soft); border-color: var(--err); }

.btn-ghost     { background: transparent; color: var(--accent); border: none; padding: 9px 10px; }
.btn-ghost:hover { background: var(--accent-soft); }

.btn-success   { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { filter: brightness(0.9); }

.btn-warning   { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-warning:hover { filter: brightness(0.9); }

.btn-sm   { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg   { padding: 12px 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; justify-content: center; }

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ── TABLE ────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

/* data-table (CEP module) */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table thead th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
  padding: 11px 14px;
  text-align: left;
  font-size: 11.5px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.data-table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--surface-2); }

/* generic table (mkfErro module) */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
  padding: 9px 12px;
  text-align: left;
  font-weight: 600; font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

.col-check   { width: 36px; }
.col-actions { width: 80px; text-align: right; white-space: nowrap; }
.truncate     { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.truncate-desc{ max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.cell-main   { font-weight: 500; }
.cell-sub    { font-size: 11px; color: var(--muted); margin-top: 2px; }
.row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: nowrap;
}
.badge-amber,   .badge-warn       { background: var(--warn-soft); color: var(--warn); }
.badge-red,     .badge-err        { background: var(--err-soft);  color: var(--err); }
.badge-green,   .badge-ok         { background: var(--ok-soft);   color: var(--ok); }
.badge-gray                       { background: var(--bg-subtle); color: var(--text-soft); }
.badge-info,    .badge-primary    { background: var(--info-soft); color: var(--info); }
.badge-pendente                   { background: var(--bg-subtle); color: var(--text-soft); }
.badge-analisando                 { background: var(--warn-soft); color: var(--warn); }
.badge-solucionado                { background: var(--ok-soft);   color: var(--ok); }
.badge-ia                         { background: var(--info-soft); color: var(--info); }
body.theme-dark .badge-amber, body.theme-dark .badge-warn { color: #fcd34d; }
body.theme-dark .badge-red, body.theme-dark .badge-err   { color: #fca5a5; }
body.theme-dark .badge-green, body.theme-dark .badge-ok  { color: #6ee7b7; }
body.theme-dark .badge-info { color: #93c5fd; }
body.theme-dark .badge-analisando { color: #fcd34d; }
body.theme-dark .badge-solucionado { color: #6ee7b7; }

/* ── FORMS (mkfErro module) ───────────────────────────────── */
.filters-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group label { font-size: 12px; font-weight: 500; color: var(--muted); }
.form-control {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  min-width: 120px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; font-family: inherit; }

/* CEP module inputs */
input[type=text],
input[type=password],
input[type=email],
input[type=number],
input[type=date],
select, textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  line-height: 1.4;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
input::placeholder, textarea::placeholder { color: var(--muted); }

/* ── PAGINATION (mkfErro module) ──────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.pagination span { font-size: 13px; color: var(--muted); padding: 0 8px; }
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px; height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
  transition: all 0.15s;
}
.page-link:hover { background: var(--surface-2); }
.page-link.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-link.disabled { opacity: 0.4; pointer-events: none; }

/* ── PARAMS TABLE (mkfErro detalhe) ──────────────────────── */
.params-table {
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  border-collapse: collapse;
}
.params-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.params-table td:first-child, .params-table th { font-weight: 600; color: var(--muted); width: 200px; background: var(--surface-2); white-space: nowrap; }
.params-table tr:last-child td { border-bottom: none; }
.params-table thead th { padding: 7px 10px; }

/* ── RANKING TABS ─────────────────────────────────────────── */
.tab-bar { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab-link {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.tab-link:hover { color: var(--text); }
.tab-link.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ── SUGGESTION BOX (mkfErro IA) ─────────────────────────── */
.suggestion-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 13px;
  word-break: break-word;
  color: var(--text);
  margin-bottom: 8px;
}
.suggestion-box-md h1, .suggestion-box-md h2, .suggestion-box-md h3, .suggestion-box-md h4 { font-weight: 700; margin: 1em 0 .4em; line-height: 1.3; }
.suggestion-box-md h1 { font-size: 1.25em; border-bottom: 1px solid var(--border); padding-bottom: .3em; }
.suggestion-box-md h2 { font-size: 1.1em; }
.suggestion-box-md h3 { font-size: 1em; }
.suggestion-box-md p  { margin: .5em 0; line-height: 1.7; }
.suggestion-box-md ul, .suggestion-box-md ol { margin: .5em 0 .5em 1.4em; }
.suggestion-box-md li { margin: .2em 0; }
.suggestion-box-md strong { font-weight: 700; }
.suggestion-box-md em    { font-style: italic; }
.suggestion-box-md code  { font-family: 'JetBrains Mono', monospace; font-size: .9em; background: var(--bg-subtle); border-radius: 3px; padding: 1px 5px; }
.suggestion-box-md pre   { background: #1e293b; color: #e2e8f0; border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; margin: .6em 0; }
.suggestion-box-md pre code { background: none; padding: 0; }
.suggestion-box-md blockquote { border-left: 3px solid var(--accent); margin: .6em 0; padding: .3em .8em; color: var(--muted); background: var(--bg-subtle); border-radius: 0 var(--radius) var(--radius) 0; }
.suggestion-box-md a { color: var(--accent); }
.suggestion-box-md hr { margin: .8em 0; }

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
  font-size: 14px;
}
.empty-state i { font-size: 32px; margin-bottom: 8px; display: block; }

.empty, .search-empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--muted);
  font-size: 14px;
}
.empty-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--bg-subtle);
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: 26px;
}
.empty-title  { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.empty-text   { font-size: 13px; color: var(--muted); }

/* ── SECTION TITLE / DIVIDER ─────────────────────────────── */
.section-title {
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  margin-top: 8px;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── CEP CARDS ───────────────────────────────────────────── */
.cep-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.cep-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}
.cep-card:hover { box-shadow: var(--shadow); border-color: var(--border); }
.cep-card-row  { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cep-card-id   { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cep-num       { font-size: 14.5px; font-weight: 600; letter-spacing: 0.01em; }
.cep-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.cep-card-body { display: flex; flex-direction: column; gap: 3px; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.cep-addr-main { font-size: 13.5px; color: var(--text); font-weight: 500; }
.cep-addr-detail   { font-size: 12.5px; color: var(--muted); }
.cep-addr-location { font-size: 12.5px; color: var(--text-soft); margin-top: 1px; }
.results-count { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.viacep-result-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-soft);
  padding: 8px 0 12px;
}
.viacep-result-header i { color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SEARCH BAR ──────────────────────────────────────────── */
.search-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.search-input-wrap { position: relative; flex: 1; min-width: 200px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 16px; }
.search-input {
  width: 100%;
  padding: 11px 38px 11px 40px !important;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.search-spinner {
  position: absolute;
  right: 14px; top: 50%;
  width: 16px; height: 16px;
  margin-top: -8px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
.inline-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── GEOCODE CONTROLS ────────────────────────────────────── */
.proc-controls { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.proc-field    { display: flex; align-items: center; gap: 7px; }
.proc-label    { font-size: 12.5px; font-weight: 500; color: var(--text-soft); white-space: nowrap; }
.proc-input    { width: 86px !important; padding: 7px 11px !important; font-variant-numeric: tabular-nums; }
.proc-unit     { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.proc-pending  { font-size: 12.5px; color: var(--muted); padding-left: 18px; border-left: 1px solid var(--border); white-space: nowrap; }
.proc-pending strong { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }
.proc-btns     { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.progress-track { height: 10px; background: var(--bg-subtle); border-radius: 999px; overflow: hidden; }
.progress-bar   { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 999px; transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1); }

/* ── TERMINAL LOG ────────────────────────────────────────── */
.terminal {
  background: #0a0e1a;
  color: #cbd5e1;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  padding: 16px 18px;
  border-radius: 0 0 var(--radius) var(--radius);
  height: 380px;
  overflow-y: auto;
  border-top: 1px solid #1e293b;
}
.terminal div { display: flex; gap: 10px; align-items: flex-start; }
.terminal .t-time { color: #475569; flex-shrink: 0; font-size: 11.5px; padding-top: 1px; }
.terminal .t-tag  { padding: 0 6px; font-size: 10.5px; font-weight: 700; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.06em; align-self: flex-start; margin-top: 2px; flex-shrink: 0; }
.terminal .t-tag.ok   { background: rgba(16,185,129,0.18); color: #34d399; }
.terminal .t-tag.nf   { background: rgba(148,163,184,0.18); color: #94a3b8; }
.terminal .t-tag.err  { background: rgba(239,68,68,0.2);   color: #fca5a5; }
.terminal .t-tag.info { background: rgba(59,130,246,0.18); color: #93c5fd; }
.terminal .t-msg { color: #e2e8f0; flex: 1; min-width: 0; word-break: break-word; }
.terminal .t-cursor { display: inline-block; width: 8px; height: 14px; background: var(--accent); vertical-align: text-bottom; animation: blink 1s steps(2) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }

/* ── FORM LAYOUT ──────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: start;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.form-row:first-child { padding-top: 0; }
.form-row:last-child  { border-bottom: none; padding-bottom: 0; }
.form-label { font-size: 13px; font-weight: 500; color: var(--text-soft); padding-top: 10px; text-align: right; }
.form-value-static { font-size: 14px; font-weight: 600; color: var(--text); padding-top: 10px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-page::before, .login-page::after {
  content: "";
  position: absolute;
  width: 460px; height: 460px;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.login-page::before { background: var(--accent); opacity: 0.30; top: -120px; left: -120px; animation: float-a 10s ease-in-out infinite; }
.login-page::after  { background: var(--accent-2); opacity: 0.22; bottom: -160px; right: -120px; animation: float-b 14s ease-in-out infinite; }
body.theme-dark .login-page::before { opacity: 0.22; }
body.theme-dark .login-page::after  { opacity: 0.14; }
@keyframes float-a { 0%, 100% { transform: translate(0,0) scale(1); } 50% { transform: translate(40px, 60px) scale(1.15); } }
@keyframes float-b { 0%, 100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-60px, -40px) scale(1.08); } }

.login-card {
  position: relative;
  z-index: 1;
  width: 100%; max-width: 380px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 32px 32px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo-icon {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 14px;
  font-size: 24px;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px var(--accent-ring), inset 0 1px 0 rgba(255,255,255,0.18);
}
.login-logo h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.login-logo p  { font-size: 13px; color: var(--muted); margin-top: 4px; }
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-soft); margin-bottom: 6px; }
.login-field .input-group { position: relative; }
.login-field .input-icon  { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 16px; display: flex; align-items: center; }
.login-field input { padding-left: 38px; width: 100%; }
.input-group { position: relative; }
.input-group .input-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; pointer-events: none; }
.input-group input, .input-group .form-control { padding-left: 36px; width: 100%; }

/* ── UTILS ───────────────────────────────────────────────── */
.text-muted   { color: var(--muted); }
.text-soft    { color: var(--text-soft); }
.text-sm      { font-size: 12.5px; }
.text-xs      { font-size: 11.5px; }
.text-center  { text-align: center; }
.code { font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace; font-size: 12px; }
.font-mono { font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', ui-monospace, monospace; font-size: 13px; }
.mt-1  { margin-top:  4px; }  .mb-1  { margin-bottom:  4px; }
.mt-2  { margin-top:  8px; }  .mb-2  { margin-bottom:  8px; }
.mt-3  { margin-top: 12px; }  .mb-3  { margin-bottom: 12px; }
.mt-4  { margin-top: 16px; }  .mb-4  { margin-bottom: 16px; }
.mt-6  { margin-top: 24px; }  .mb-6  { margin-bottom: 24px; }
.row   { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.w-full { width: 100%; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.ms-auto { margin-left: auto; }

/* ── ANIMATIONS ──────────────────────────────────────────── */
@keyframes fadeIn    { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn   { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.fade-in  { animation: fadeIn 0.4s ease both; }
.fade-up  { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.scale-in { animation: scaleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both; }
.stagger > * { animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.06s; }
.stagger > *:nth-child(3) { animation-delay: 0.10s; }
.stagger > *:nth-child(4) { animation-delay: 0.14s; }
.stagger > *:nth-child(5) { animation-delay: 0.18s; }
.stagger > *:nth-child(6) { animation-delay: 0.22s; }
.stagger > *:nth-child(7) { animation-delay: 0.26s; }
.stagger > *:nth-child(8) { animation-delay: 0.30s; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .page-header { padding: 12px 16px; }
  .content-area { padding: 16px 16px 96px; }
  .bottom-tabs { display: block; }
  .page-header h1, .page-title { font-size: 18px; }
  .hero-banner { padding: 20px 22px; }
  .hero-value { font-size: 34px; }
  .form-row { grid-template-columns: 1fr; gap: 4px; padding: 10px 0; }
  .form-label, .form-value-static { text-align: left; padding-top: 0; }
}
@media (max-width: 540px) {
  .stats-grid, .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-value { font-size: 22px; }
  .menu-grid { grid-template-columns: 1fr; }
  .cep-cards { grid-template-columns: 1fr; }
}
