/* ============================================================
   MAYA CLEAN — Portal Premium | Design System
   Paleta OKLCH, utilitários assinatura, componentes.
   Tradução fiel do DESIGN_SYSTEM_PROMPT (Tailwind v4 -> CSS).
   ============================================================ */

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

/* ---------- Tokens (Light :root) ---------- */
:root {
  --background: oklch(0.98 0.005 270);
  --foreground: oklch(0.13 0.02 270);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.13 0.02 270);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.13 0.02 270);
  --primary: oklch(0.55 0.25 265);          /* azul/índigo vibrante */
  --primary-foreground: oklch(0.98 0 0);
  --secondary: oklch(0.96 0.01 270);
  --secondary-foreground: oklch(0.25 0.03 270);
  --muted: oklch(0.96 0.008 270);
  --muted-foreground: oklch(0.5 0.02 270);
  --accent: oklch(0.65 0.22 180);           /* ciano/teal */
  --accent-foreground: oklch(0.98 0 0);
  --destructive: oklch(0.58 0.22 25);
  --destructive-foreground: oklch(0.98 0 0);
  --border: oklch(0.92 0.01 270);
  --input: oklch(0.92 0.01 270);
  --ring: oklch(0.55 0.25 265);

  --chart-1: oklch(0.55 0.25 265);  /* azul */
  --chart-2: oklch(0.65 0.22 180);  /* ciano */
  --chart-3: oklch(0.68 0.18 145);  /* verde */
  --chart-4: oklch(0.72 0.18 85);   /* amarelo */
  --chart-5: oklch(0.58 0.22 25);   /* vermelho */

  --radius: 0.75rem;

  --sidebar: oklch(0.12 0.03 270);          /* sidebar escura sempre */
  --sidebar-foreground: oklch(0.95 0.005 270);
  --sidebar-primary: oklch(0.65 0.22 180);
  --sidebar-accent: oklch(0.18 0.035 270);
  --sidebar-border: oklch(0.2 0.03 270);

  /* tokens premium extras */
  --success: oklch(0.68 0.18 145);
  --warning: oklch(0.75 0.18 85);
  --gradient-start: oklch(0.55 0.25 265);
  --gradient-end: oklch(0.65 0.22 180);

  /* hex fallbacks p/ Chart.js (canvas não lê CSS vars facilmente) */
  --hx-primary: #5b4be8;
  --hx-accent: #14b8c4;
  --hx-success: #34c270;
  --hx-warning: #e6a93b;
  --hx-destructive: #e0533d;
}

/* ---------- Tokens (Dark) ---------- */
.dark {
  --background: oklch(0.1 0.02 270);
  --foreground: oklch(0.95 0.005 270);
  --card: oklch(0.14 0.025 270);
  --card-foreground: oklch(0.95 0.005 270);
  --popover: oklch(0.14 0.025 270);
  --popover-foreground: oklch(0.95 0.005 270);
  --primary: oklch(0.65 0.22 180);   /* no dark, primary vira ciano */
  --primary-foreground: oklch(0.1 0.02 270);
  --secondary: oklch(0.2 0.03 270);
  --secondary-foreground: oklch(0.95 0.005 270);
  --muted: oklch(0.2 0.025 270);
  --muted-foreground: oklch(0.65 0.02 270);
  --accent: oklch(0.55 0.25 265);
  --accent-foreground: oklch(0.98 0 0);
  --destructive: oklch(0.62 0.22 25);
  --border: oklch(0.22 0.03 270);
  --input: oklch(0.24 0.03 270);
  --ring: oklch(0.65 0.22 180);

  --sidebar: oklch(0.08 0.015 270);
  --sidebar-foreground: oklch(0.95 0.005 270);
  --sidebar-primary: oklch(0.65 0.22 180);
  --sidebar-accent: oklch(0.16 0.03 270);
  --sidebar-border: oklch(0.18 0.025 270);

  --success: oklch(0.7 0.18 145);
  --warning: oklch(0.78 0.18 85);
  --gradient-start: oklch(0.65 0.22 180);
  --gradient-end: oklch(0.55 0.25 265);

  --hx-primary: #14b8c4;
  --hx-accent: #5b4be8;
  --hx-success: #3ad07a;
  --hx-warning: #efb44a;
  --hx-destructive: #ec5f48;
}

/* ============================================================
   Reset / base
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html { background: var(--background); -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
svg { width: 1em; height: 1em; flex-shrink: 0; vertical-align: -0.16em; }
img { max-width: 100%; }
.mono { font-family: 'Geist Mono', ui-monospace, monospace; }

h1,h2,h3,h4 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.text-balance { text-wrap: balance; }

/* ============================================================
   Utilitários assinatura
   ============================================================ */
.glass {
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.18);
}
.dark .glass {
  background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.06);
}

.gradient-text {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.gradient-bg {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.card-gradient {
  background: linear-gradient(135deg, var(--card), var(--secondary));
}

.shadow-premium {
  box-shadow:
    0 1px 2px rgba(0,0,0,0.04),
    0 4px 8px rgba(0,0,0,0.04),
    0 8px 16px rgba(0,0,0,0.04);
}
.dark .shadow-premium {
  box-shadow:
    0 1px 2px rgba(0,0,0,0.2),
    0 4px 8px rgba(0,0,0,0.2),
    0 8px 16px rgba(0,0,0,0.2);
}

.transition-premium { transition: all 0.3s cubic-bezier(0.4,0,0.2,1); }

.scrollbar-thin::-webkit-scrollbar { width: 5px; height: 5px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.scrollbar-thin::-webkit-scrollbar-thumb:hover { background: var(--muted-foreground); }

/* ---------- Animações ---------- */
@keyframes count-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-count { animation: count-up 0.6s cubic-bezier(0.4,0,0.2,1) both; }

@keyframes pulse-glow {
  0%,100% { box-shadow: 0 0 0 0 rgba(52,194,112,0.5); opacity: 1; }
  50%     { box-shadow: 0 0 0 5px rgba(52,194,112,0); opacity: 0.85; }
}
.animate-pulse-glow { animation: pulse-glow 2s ease-in-out infinite; }

@keyframes blob-float {
  0%,100% { transform: translate(0,0) scale(1); }
  50%     { transform: translate(12px,-12px) scale(1.08); }
}

@keyframes typing-bounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30%         { transform: translateY(-4px); opacity: 1; }
}

/* ============================================================
   App shell
   ============================================================ */
.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 264px;
  flex-shrink: 0;
  background: var(--sidebar);
  color: var(--sidebar-foreground);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 40;
}

.sidebar-header {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
}
.brand-logo {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 8px 20px -6px color-mix(in oklch, var(--primary) 60%, transparent);
}
.brand-logo svg { width: 21px; height: 21px; vertical-align: middle; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: color-mix(in oklch, var(--sidebar-foreground) 45%, transparent);
  font-weight: 600;
}

.sidebar-nav {
  flex: 1; overflow-y: auto; padding: 12px 12px 8px;
}
.nav-group { margin-bottom: 14px; }
.nav-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.16em; padding: 8px 10px 4px;
  color: color-mix(in oklch, var(--sidebar-foreground) 40%, transparent);
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 44px; padding: 0 10px; border-radius: 12px;
  color: color-mix(in oklch, var(--sidebar-foreground) 78%, transparent);
  margin-bottom: 2px;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  position: relative;
}
.nav-item:hover { background: var(--sidebar-accent); color: var(--sidebar-foreground); }
.nav-ico {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in oklch, var(--sidebar-accent) 50%, transparent);
  transition: all 0.2s ease;
}
.nav-ico svg { width: 17px; height: 17px; }
.nav-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.nav-title { font-size: 13.5px; font-weight: 500; }
.nav-desc { font-size: 10px; color: color-mix(in oklch, var(--sidebar-foreground) 40%, transparent); }
.nav-chevron { margin-left: auto; opacity: 0; transition: opacity 0.2s; }
.nav-chevron svg { width: 15px; height: 15px; }

.nav-item.active {
  background: var(--sidebar-accent);
  color: #fff;
}
.nav-item.active .nav-ico {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 8px 18px -6px color-mix(in oklch, var(--primary) 70%, transparent);
}
.nav-item.active .nav-chevron { opacity: 0.7; }
.nav-item.active .nav-desc { color: color-mix(in oklch, var(--sidebar-foreground) 55%, transparent); }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--sidebar-border); }
.theme-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--sidebar-accent); border-radius: 12px; padding: 4px;
  margin-bottom: 10px;
}
.theme-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; border-radius: 9px; font-size: 12px; font-weight: 500;
  color: color-mix(in oklch, var(--sidebar-foreground) 60%, transparent);
  transition: all 0.2s ease;
}
.theme-btn svg { width: 15px; height: 15px; }
.theme-btn.on { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; }

.user-card {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--sidebar-accent), color-mix(in oklch, var(--sidebar-accent) 40%, transparent));
  border: 1px solid var(--sidebar-border);
}
.user-avatar {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--sidebar-primary) 25%, transparent);
}
.user-meta { min-width: 0; flex: 1; }
.user-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-id { font-size: 10px; color: color-mix(in oklch, var(--sidebar-foreground) 45%, transparent); }
.user-out { color: var(--destructive); padding: 6px; border-radius: 8px; transition: background 0.2s; }
.user-out:hover { background: color-mix(in oklch, var(--destructive) 12%, transparent); }
.user-out svg { width: 16px; height: 16px; }

/* ---------- Conteúdo ---------- */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.header {
  height: 64px; flex-shrink: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--background) 75%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 30;
}
.menu-trigger {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-foreground); transition: all 0.2s;
}
.menu-trigger:hover { background: var(--secondary); color: var(--foreground); }
.menu-trigger svg { width: 19px; height: 19px; }
.header-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.header-spacer { flex: 1; }

.header-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--secondary); border: 1px solid var(--border);
  border-radius: 10px; padding: 0 12px; height: 38px; width: 240px;
  color: var(--muted-foreground);
}
.header-search svg { width: 16px; height: 16px; flex-shrink: 0; }
.header-search input {
  background: none; border: none; outline: none; color: var(--foreground);
  font-size: 13px; width: 100%;
}
.header-search input::placeholder { color: var(--muted-foreground); }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; position: relative;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-foreground); border: 1px solid var(--border);
  background: var(--secondary); transition: all 0.2s;
}
.icon-btn:hover { color: var(--foreground); border-color: var(--primary); }
.icon-btn svg { width: 17px; height: 17px; }
.badge-dot {
  position: absolute; top: -5px; right: -5px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--destructive); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--background);
}
.header-avatar {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0;
}

.main {
  flex: 1; padding: 26px 26px 60px;
  max-width: 1400px; width: 100%; margin: 0 auto;
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative; overflow: hidden;
  border-radius: 22px; padding: 30px 32px;
  background: linear-gradient(135deg,
    color-mix(in oklch, var(--primary) 12%, var(--card)),
    color-mix(in oklch, var(--accent) 10%, var(--card)));
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.hero-blob {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.4;
  pointer-events: none; animation: blob-float 9s ease-in-out infinite;
}
.hero-blob.b1 { width: 280px; height: 280px; background: var(--primary); top: -120px; right: -60px; }
.hero-blob.b2 { width: 230px; height: 230px; background: var(--accent); bottom: -130px; right: 160px; animation-delay: 2s; }
.hero-content { position: relative; z-index: 2; }
.hero h1 { font-size: 27px; margin-bottom: 6px; }
.hero p { color: var(--muted-foreground); font-size: 14px; max-width: 540px; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ============================================================
   Badges & pills
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1;
}
.badge svg { width: 13px; height: 13px; }
.badge-ok   { background: color-mix(in oklch, var(--success) 14%, transparent); color: var(--success); }
.badge-warn { background: color-mix(in oklch, var(--warning) 16%, transparent); color: var(--warning); }
.badge-crit { background: color-mix(in oklch, var(--destructive) 14%, transparent); color: var(--destructive); }
.badge-info { background: color-mix(in oklch, var(--primary) 13%, transparent); color: var(--primary); }
.badge-muted{ background: var(--secondary); color: var(--muted-foreground); }
.badge-accent{ background: color-mix(in oklch, var(--accent) 14%, transparent); color: var(--accent); }

.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  position: relative;
}
.live-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  background: var(--success); opacity: 0.35; animation: pulse-glow 2s infinite;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: 18px;
}
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; }
.card-head .sub { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.link-all {
  font-size: 12px; font-weight: 600; color: var(--primary);
  display: inline-flex; align-items: center; gap: 4px; transition: gap 0.2s;
}
.link-all:hover { gap: 7px; }
.link-all svg { width: 13px; height: 13px; }

/* ---------- Grids ---------- */
.grid { display: grid; gap: 18px; }
.kpi-grid { grid-template-columns: repeat(1, 1fr); margin-bottom: 22px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }
.span-2 { grid-column: span 1; }

@media (min-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .span-2 { grid-column: span 2; }
}

/* ---------- KPI card ---------- */
.kpi {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 20px;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.04),
    0 4px 8px rgba(0,0,0,0.04),
    0 8px 16px rgba(0,0,0,0.04);
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}
.dark .kpi { box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 4px 8px rgba(0,0,0,0.2); }
.kpi:hover { transform: translateY(-4px); border-color: color-mix(in oklch, var(--primary) 35%, var(--border)); }
.kpi-blob {
  position: absolute; top: -40px; right: -40px;
  width: 130px; height: 130px; border-radius: 50%; filter: blur(34px);
  opacity: 0.14; transition: opacity 0.3s, transform 0.3s;
}
.kpi:hover .kpi-blob { opacity: 0.3; transform: scale(1.15); }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; position: relative; z-index: 2; }
.kpi-ico {
  width: 44px; height: 44px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
}
.kpi-ico svg { width: 21px; height: 21px; }
.kpi-label { font-size: 12.5px; color: var(--muted-foreground); font-weight: 500; position: relative; z-index: 2; }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; margin: 2px 0 4px; position: relative; z-index: 2; }
.kpi-value small { font-size: 16px; font-weight: 600; color: var(--muted-foreground); }
.kpi-foot { position: relative; z-index: 2; margin-top: 12px; }

.ico-primary { background: color-mix(in oklch, var(--primary) 12%, transparent); color: var(--primary); }
.ico-accent  { background: color-mix(in oklch, var(--accent) 14%, transparent); color: var(--accent); }
.ico-success { background: color-mix(in oklch, var(--success) 14%, transparent); color: var(--success); }
.ico-warning { background: color-mix(in oklch, var(--warning) 16%, transparent); color: var(--warning); }
.ico-destructive { background: color-mix(in oklch, var(--destructive) 13%, transparent); color: var(--destructive); }
.blob-primary { background: var(--primary); }
.blob-accent  { background: var(--accent); }
.blob-success { background: var(--success); }
.blob-warning { background: var(--warning); }
.blob-destructive { background: var(--destructive); }

.trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.trend svg { width: 13px; height: 13px; }
.trend.up { color: var(--success); }
.trend.down { color: var(--destructive); }

/* ---------- Progress ---------- */
.progress { height: 7px; border-radius: 999px; background: var(--secondary); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.6s ease; }
.progress-bar.s { background: var(--success); }
.progress-bar.w { background: var(--warning); }
.progress-bar.d { background: var(--destructive); }

/* segmentos válido/vencendo/vencido */
.segbar { display: flex; gap: 3px; height: 7px; }
.segbar > span { border-radius: 999px; }
.seg-ok { background: var(--success); }
.seg-warn { background: var(--warning); }
.seg-crit { background: var(--destructive); }

/* barrinhas de prioridade */
.prio-bars { display: flex; gap: 4px; align-items: flex-end; height: 24px; }
.prio-bars > span { width: 6px; border-radius: 3px; background: var(--secondary); }

/* ============================================================
   Score ring (SVG)
   ============================================================ */
.score-ring { position: relative; width: 168px; height: 168px; }
.score-ring svg { width: 100%; height: 100%; vertical-align: middle; transform: rotate(-90deg); }
.score-ring .center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.score-ring .big { font-size: 40px; font-weight: 800; line-height: 1; }
.score-ring .lbl { font-size: 11px; color: var(--muted-foreground); margin-top: 4px; }

.legend { display: flex; flex-direction: column; gap: 10px; }
.legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend-row .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-row .val { margin-left: auto; font-weight: 700; }
.dot-ok { background: var(--success); }
.dot-warn { background: var(--warning); }
.dot-crit { background: var(--destructive); }
.dot-1 { background: var(--chart-1); }
.dot-2 { background: var(--chart-2); }
.dot-3 { background: var(--chart-3); }
.dot-4 { background: var(--chart-4); }
.dot-5 { background: var(--chart-5); }

/* estrelas */
.stars { display: inline-flex; gap: 2px; color: var(--warning); }
.stars svg { width: 17px; height: 17px; }

/* ============================================================
   Listas (chamados recentes, alertas, timeline)
   ============================================================ */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px; border-bottom: 1px solid var(--border);
  transition: background 0.2s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--secondary); }
.row-ico {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.row-ico svg { width: 17px; height: 17px; }
.row-main { min-width: 0; flex: 1; }
.row-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.row-side { text-align: right; flex-shrink: 0; }

/* timeline */
.timeline { padding: 8px 20px 18px; }
.tl-item { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: 18px; top: 38px; bottom: 0; width: 2px;
  background: var(--border);
}
.tl-item:last-child::before { display: none; }
.tl-ico {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
}
.tl-ico svg { width: 16px; height: 16px; }
.tl-body { padding-top: 2px; }
.tl-title { font-size: 13.5px; font-weight: 600; }
.tl-desc { font-size: 12.5px; color: var(--muted-foreground); margin-top: 2px; }
.tl-time { font-size: 11px; color: var(--muted-foreground); margin-top: 4px; }

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--secondary); border-radius: 12px; margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab {
  padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 500;
  color: var(--muted-foreground); transition: all 0.2s; white-space: nowrap;
}
.tab:hover { color: var(--foreground); }
.tab.active { background: var(--card); color: var(--foreground); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.dark .tab.active { background: var(--card); }

/* ============================================================
   Botões / inputs
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 11px;
  font-size: 13.5px; font-weight: 600; transition: all 0.2s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 8px 20px -8px color-mix(in oklch, var(--primary) 60%, transparent); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost { background: var(--secondary); color: var(--foreground); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--primary); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 600; }
.input, .select, .textarea {
  width: 100%; background: var(--secondary); border: 1px solid var(--border);
  border-radius: 11px; padding: 10px 13px; font-size: 13.5px; color: var(--foreground);
  outline: none; transition: border 0.2s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.textarea { resize: vertical; min-height: 90px; }

/* switch */
.switch { width: 42px; height: 24px; border-radius: 999px; background: var(--border); position: relative; transition: background 0.2s; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.switch.on { background: linear-gradient(135deg, var(--primary), var(--accent)); }
.switch.on::after { transform: translateX(18px); }

.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-row .st-title { font-size: 13.5px; font-weight: 600; }
.setting-row .st-desc { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }

/* ============================================================
   Tabela
   ============================================================ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted-foreground); font-weight: 600; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 0.2s; }
.tbl tbody tr:hover { background: var(--secondary); }

/* ============================================================
   Funcionários
   ============================================================ */
.emp-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  padding: 18px; transition: all 0.3s cubic-bezier(0.4,0,0.2,1); cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 8px rgba(0,0,0,0.04);
}
.emp-card:hover { transform: translateY(-3px); border-color: color-mix(in oklch, var(--primary) 30%, var(--border)); }
.emp-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.emp-avatar {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
}
.emp-name { font-size: 14.5px; font-weight: 700; }
.emp-role { font-size: 12px; color: var(--muted-foreground); }
.emp-meta { display: flex; flex-direction: column; gap: 9px; }
.emp-line { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; }
.emp-line .k { color: var(--muted-foreground); display: inline-flex; align-items: center; gap: 6px; }
.emp-line .k svg { width: 14px; height: 14px; }

/* ============================================================
   Chat
   ============================================================ */
.chat-wrap { display: grid; grid-template-columns: 1fr; gap: 18px; height: calc(100vh - 150px); }
@media (min-width: 1024px) { .chat-wrap { grid-template-columns: 1fr 300px; } }
.chat-box { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.chat-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.chat-stream { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 72%; }
.msg.me { align-self: flex-end; }
.bubble { padding: 11px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.5; }
.msg.them .bubble { background: var(--secondary); border-bottom-left-radius: 5px; }
.msg.me .bubble { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-bottom-right-radius: 5px; }
.msg-time { font-size: 10.5px; color: var(--muted-foreground); margin-top: 4px; padding: 0 4px; }
.msg.me .msg-time { text-align: right; }
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; background: var(--secondary); border-radius: 16px; border-bottom-left-radius: 5px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-foreground); animation: typing-bounce 1.4s infinite; }
.typing span:nth-child(2){ animation-delay: 0.2s; }
.typing span:nth-child(3){ animation-delay: 0.4s; }
.chat-input { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.chat-input .input { border-radius: 999px; }

/* ============================================================
   Dialog / modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); display: none;
  align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  width: 100%; max-width: 540px; max-height: 88vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
}
.modal-head { padding: 20px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: var(--muted-foreground); }
.modal-close:hover { background: var(--secondary); }

/* ============================================================
   Chart helpers
   ============================================================ */
.chart-wrap { position: relative; width: 100%; }
.chart-h-sm { height: 200px; }
.chart-h-md { height: 260px; }
.chart-h-lg { height: 300px; }

/* ============================================================
   Misc
   ============================================================ */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.muted { color: var(--muted-foreground); }
.text-sm { font-size: 13px; } .text-xs { font-size: 11.5px; }
.font-bold { font-weight: 700; } .font-semibold { font-weight: 600; }
.section-title { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.section-sub { color: var(--muted-foreground); font-size: 13.5px; margin-top: 2px; }
.page-head { margin-bottom: 22px; }
.wfull { width: 100%; }

/* big score number */
.big-score { font-size: 56px; font-weight: 800; line-height: 1; letter-spacing: -0.04em; }

/* responsivo sidebar (preview/mobile) */
.sidebar-backdrop { display: none; }
@media (max-width: 1023px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 0 60px rgba(0,0,0,0.4);
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .sidebar-backdrop {
    display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 39; backdrop-filter: blur(2px);
  }
  .header-search { display: none; }
  .main { padding: 18px 16px 50px; }
}
@media (min-width: 1024px) { .menu-trigger { display: none; } }

/* ============================================================
   Suplemento de páginas (helpers usados pelas telas)
   ============================================================ */
/* dot autônomo (fora de .legend-row) */
.dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

/* estado vazio */
.empty {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  padding: 28px 20px; color: var(--muted-foreground); font-size: 13px;
}
.empty svg { width: 16px; height: 16px; }

/* barra de ferramentas (filtros + busca) */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--secondary); border: 1px solid var(--border);
  border-radius: 11px; padding: 0 12px; height: 40px; min-width: 200px;
  color: var(--muted-foreground);
}
.search-box svg { width: 16px; height: 16px; flex-shrink: 0; }
.search-box input { background: none; border: none; outline: none; color: var(--foreground); font-size: 13.5px; width: 100%; }
.search-box input::placeholder { color: var(--muted-foreground); }

/* legenda horizontal de segmentos */
.seg-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: var(--muted-foreground); }
.seg-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* prioridade — pip vertical */
.prio-pip { width: 4px; align-self: stretch; border-radius: 3px; flex-shrink: 0; }

/* nota por área (barra horizontal) */
.area-row { display: grid; grid-template-columns: 130px 1fr 38px; align-items: center; gap: 12px; padding: 9px 0; }
.area-name { font-size: 13px; font-weight: 500; }
.area-bar { height: 9px; border-radius: 999px; background: var(--secondary); overflow: hidden; }
.area-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.area-val { font-size: 13px; font-weight: 700; text-align: right; }

/* cartão de comentário (histórico de pesquisas) */
.comment-card { border: 1px solid var(--border); border-radius: 14px; padding: 16px; background: var(--card); }
.comment-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.comment-name { font-size: 13.5px; font-weight: 600; }
.comment-date { font-size: 11.5px; color: var(--muted-foreground); }
.comment-text { font-size: 13px; color: var(--muted-foreground); line-height: 1.55; }

/* status online (chat) */
.online { width: 9px; height: 9px; border-radius: 50%; background: var(--success); position: relative; flex-shrink: 0; }
.online::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; background: var(--success); opacity: 0.3; animation: pulse-glow 2s infinite; }

/* key/value (modais de detalhe) */
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--muted-foreground); }
.kv-row .v { font-weight: 600; }

/* destaque (fatura atual) */
.hl-current { border: 1.5px solid color-mix(in oklch, var(--primary) 45%, var(--border)); position: relative; }
.hl-current::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(135deg, color-mix(in oklch, var(--primary) 7%, transparent), transparent);
}

/* grid de documentos / cards genéricos 2-col */
.grid-docs { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) { .grid-docs { grid-template-columns: repeat(2, 1fr); } }

/* item de documento */
.doc-item { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); transition: all 0.2s; }
.doc-item:hover { border-color: color-mix(in oklch, var(--primary) 30%, var(--border)); }
.doc-main { flex: 1; min-width: 0; }
.doc-name { font-size: 13.5px; font-weight: 600; }
.doc-sub { font-size: 12px; color: var(--muted-foreground); margin-top: 2px; }
.icon-act { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--muted-foreground); background: var(--secondary); border: 1px solid var(--border); transition: all 0.2s; flex-shrink: 0; }
.icon-act:hover { color: var(--primary); border-color: var(--primary); }
.icon-act svg { width: 16px; height: 16px; }

/* contadores resumo (linha de mini-stats) */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.stat-box { border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; background: var(--card); }
.stat-num { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.stat-lbl { font-size: 11.5px; color: var(--muted-foreground); margin-top: 2px; }

/* thread de mensagens do ticket */
.thread { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; max-height: 320px; overflow-y: auto; padding-right: 4px; }

/* avatar de mensagem / atendimento */
.mini-avatar { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 12.5px; }

/* divisória sutil */
.hr { height: 1px; background: var(--border); border: none; margin: 16px 0; }
