/* wave — UI/UX v3 (Moss Green B2B SaaS) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Plus+Jakarta+Sans:wght@500;600;700&display=swap');

/* ============================================================
   DESIGN TOKENS — tema escuro (padrão)
   ============================================================ */
:root {
  /* Cores base */
  --background:          85 15% 8%;
  --foreground:          85 10% 90%;
  --card:                85 14% 11%;
  --card-foreground:     85 10% 90%;

  /* Marca */
  --primary:             85 38% 44%;
  --primary-foreground:  0 0% 100%;

  /* Superfícies de apoio */
  --secondary:           85 15% 18%;
  --muted:               85 14% 15%;
  --muted-foreground:    85 10% 58%;
  --accent:              85 22% 20%;

  /* Destrutivo */
  --destructive:         0 60% 45%;
  --destructive-foreground: 0 0% 100%;

  /* Bordas e inputs */
  --border:              85 14% 19%;
  --input:               85 14% 22%;
  --ring:                85 38% 44%;
  --radius:              0.375rem;

  /* Tipografia */
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Plus Jakarta Sans', sans-serif;

  /* Sidebar */
  --sidebar-background: 85 16% 9%;
  --sidebar-foreground: 85 10% 80%;
  --sidebar-primary:    85 38% 44%;
  --sidebar-accent:     85 14% 18%;
  --sidebar-border:     85 14% 14%;

  /* Elevação */
  --elevate-1: rgba(255,255,255,0.04);
  --elevate-2: rgba(255,255,255,0.08);

  /* Status semânticos */
  --success:        hsl(142 45% 22%);
  --success-text:   hsl(142 50% 65%);
  --warning:        hsl(38 55% 24%);
  --warning-text:   hsl(38 90% 58%);
  --danger:         hsl(var(--destructive));
  --danger-text:    hsl(var(--destructive-foreground));

  /* Sombras */
  --shadow:    0 1px 3px rgba(0,0,0,0.22);
  --shadow-lg: 0 4px 14px rgba(0,0,0,0.28);
  --shadow-xl: 0 8px 24px rgba(0,0,0,0.36);

  /* Aliases de compatibilidade */
  --bg-primary:       hsl(var(--background));
  --bg-secondary:     hsl(var(--card));
  --bg-tertiary:      hsl(var(--muted));
  --border-color:     hsl(var(--border));
  --text-primary:     hsl(var(--foreground));
  --text-secondary:   hsl(var(--muted-foreground));
  --text-muted:       hsl(85 10% 48%);
  --btn-border:       hsl(85 12% 24%);
  --bg:               var(--bg-primary);
  --fg:               var(--text-primary);
  --card-fg:          hsl(var(--card-foreground));
  --primary-fg:       hsl(var(--primary-foreground));
  --destructive-fg:   hsl(var(--destructive-foreground));
  --font:             var(--font-sans);
  --font-head:        var(--font-heading);
  --sidebar-bg:       hsl(var(--sidebar-background));
  --sidebar-fg:       hsl(var(--sidebar-foreground));
  --muted-fg:         var(--text-secondary);
  --elevate:          var(--elevate-1);
}

/* ============================================================
   DESIGN TOKENS — tema claro
   ============================================================ */
[data-theme="light"] {
  --background:          85 20% 98%;
  --foreground:          85 15% 14%;
  --card:                0 0% 100%;
  --card-foreground:     85 15% 14%;
  --primary:             85 45% 38%;
  --primary-foreground:  0 0% 100%;
  --secondary:           85 20% 93%;
  --muted:               85 18% 93%;
  --muted-foreground:    85 14% 44%;
  --accent:              85 18% 90%;
  --destructive:         0 65% 44%;
  --destructive-foreground: 0 0% 100%;
  --border:              85 18% 87%;
  --input:               85 18% 84%;
  --ring:                85 45% 38%;
  --sidebar-background:  85 20% 96%;
  --sidebar-foreground:  85 15% 24%;
  --sidebar-primary:     85 45% 38%;
  --sidebar-accent:      85 18% 89%;
  --sidebar-border:      85 18% 86%;
  --elevate-1:           rgba(0,0,0,0.04);
  --elevate-2:           rgba(0,0,0,0.08);

  --bg-primary:     hsl(var(--background));
  --bg-secondary:   hsl(var(--card));
  --bg-tertiary:    hsl(var(--muted));
  --border-color:   hsl(var(--border));
  --text-primary:   hsl(var(--foreground));
  --text-secondary: hsl(var(--muted-foreground));
  --text-muted:     hsl(85 15% 40%);
  --success:        hsl(142 45% 90%);
  --success-text:   hsl(142 55% 28%);
  --warning:        hsl(38 90% 93%);
  --warning-text:   hsl(38 78% 30%);
  --danger:         hsl(0 70% 95%);
  --danger-text:    hsl(0 68% 35%);
  --shadow:         0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg:      0 4px 14px rgba(0,0,0,0.11);
  --shadow-xl:      0 8px 24px rgba(0,0,0,0.14);
  --btn-border:     hsl(85 15% 83%);
  --fg:             var(--text-primary);
  --muted-fg:       var(--text-secondary);
  --elevate:        var(--elevate-1);
}

/* ============================================================
   RESET & BASE — escala legível (branding: 13px corpo, h1 18–20px)
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; }

body {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background-color 0.15s, color 0.15s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  line-height: 1.3;
}
h1 { font-size: 1.36rem; font-weight: 700; }   /* ~19px */
h2 { font-size: 1.1rem; margin-top: 1.5rem; }   /* ~15.4px */
h3 { font-size: 1rem; }                         /* ~14px */
p  { margin: 0 0 0.75rem; color: var(--text-secondary); font-size: 13px; }
a  { color: hsl(var(--primary)); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; color: var(--text-primary); }
code {
  font-size: 0.85em;
  padding: 1px 5px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  font-family: 'Menlo', 'Monaco', monospace;
}
kbd {
  font-size: 0.82em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  font-family: var(--font-sans);
}

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

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 16rem;
  min-width: 16rem;
  max-width: 16rem;
  background: hsl(var(--sidebar-background));
  color: hsl(var(--sidebar-foreground));
  border-right: 1px solid hsl(var(--sidebar-border) / 0.9);
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 100;
  transition: background-color 0.15s, border-color 0.15s, width 0.2s ease, transform 0.2s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--sidebar-border)) transparent;
}
.sidebar-body::-webkit-scrollbar { width: 4px; }
.sidebar-body::-webkit-scrollbar-track { background: transparent; }
.sidebar-body::-webkit-scrollbar-thumb {
  background: hsl(var(--sidebar-border));
  border-radius: 2px;
}

/* ── Brand ─────────────────────────────────────────────────── */
.sidebar-header {
  padding: 0.9rem 1rem 0.75rem;
  border-bottom: 1px solid hsl(var(--sidebar-border) / 0.6);
  border-left: 3px solid hsl(var(--primary));
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
  text-decoration: none;
}
.sidebar-brand:hover { opacity: 0.9; text-decoration: none; }

.brand-icon {
  width: 1.75rem;
  height: 1.75rem;
  background: transparent;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-icon svg,
.brand-icon img {
  width: 18px;
  height: 18px;
  display: block;
  object-fit: contain;
}

.logo-text {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: hsl(var(--sidebar-foreground));
}

/* ── Nav sections ────────────────────────────────────────────── */
.nav-section {
  padding: 0.6rem 0;
  border-bottom: 1px solid hsl(var(--sidebar-border) / 0.45);
}
.nav-section:last-child { border-bottom: none; }

.nav-title {
  font-family: var(--font-heading);
  padding: 0 1rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: hsl(var(--sidebar-foreground) / 0.5);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  margin: 1px 0.375rem;
  min-height: 2.25rem;
  color: hsl(var(--sidebar-foreground) / 0.85);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  border-radius: var(--radius);
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
  border-left: 2px solid transparent;
  position: relative;
}
.nav-item:hover {
  background: hsl(var(--sidebar-accent) / 0.6);
  color: hsl(var(--sidebar-foreground));
  text-decoration: none;
}
.nav-item.active {
  background: hsl(var(--sidebar-accent));
  color: hsl(var(--sidebar-foreground));
  font-weight: 500;
  border-left-color: hsl(var(--primary));
}

.nav-icon {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  flex-shrink: 0;
  opacity: 0.8;
}
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

/* ── Sidebar footer ─────────────────────────────────────────── */
.sidebar-footer {
  margin-top: auto;
  flex-shrink: 0;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid hsl(var(--sidebar-border) / 0.5);
  background: hsl(var(--sidebar-background) / 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.sidebar-footer .sidebar-update-notice {
  border-radius: var(--radius);
  order: -1;
}

.sidebar-update-notice {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-radius: 0;
  background: hsl(142 55% 35% / 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  border-top: 1px solid hsl(142 45% 45% / 0.4);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
  padding: 0.4rem 0.6rem;
}

.sidebar-update-notice-text {
  font-size: 0.7rem;
  font-weight: 500;
  color: hsl(142 30% 98%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.sidebar-update-notice-cta {
  padding: 0 8px;
  height: 26px;
  min-height: 26px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid hsl(142 45% 22%);
  border-radius: var(--radius);
  cursor: pointer;
  background: hsl(142 55% 28%);
  color: #fff;
  flex-shrink: 0;
  box-sizing: border-box;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.sidebar-update-notice-cta:hover {
  background: hsl(142 55% 22%);
  border-color: hsl(142 45% 18%);
}

.sidebar-version {
  display: block;
  padding: 0.4rem 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 400;
  color: hsl(var(--sidebar-foreground) / 0.5);
  border-radius: var(--radius);
  background: hsl(var(--sidebar-foreground) / 0.06);
  text-align: center;
  flex-shrink: 0;
}

/* ── Sidebar colapsada (desktop) ────────────────────────────── */
.layout.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right-width: 0;
}
.layout.sidebar-collapsed .main-content { margin-left: 0; }

/* ── Sidebar backdrop (mobile) ──────────────────────────────── */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  backdrop-filter: blur(2px);
  z-index: 99;
  cursor: pointer;
}
.sidebar-backdrop.active { display: block; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  flex: 1;
  margin-left: 16rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.2s ease;
  min-width: 0;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  background: hsl(var(--background) / 0.92);
  border-bottom: 1px solid hsl(var(--border) / 0.8);
  padding: 0 1.25rem 0 1.5rem;
  min-height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  gap: 0.75rem;
}

/* ── Breadcrumb ─────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-family: var(--font-sans);
  min-width: 0;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.875rem;
  height: 1.875rem;
  min-width: 1.875rem;
  padding: 0;
  margin-right: 0.25rem;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.12s, color 0.12s;
  flex-shrink: 0;
}
.sidebar-toggle:hover {
  background: var(--elevate-1);
  color: var(--text-primary);
}
.sidebar-toggle svg { flex-shrink: 0; }

.breadcrumb-item {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumb-item:hover { color: var(--text-primary); text-decoration: none; }
.breadcrumb-item.active { color: var(--text-primary); font-weight: 500; }
.breadcrumb-separator { color: var(--text-muted); }

/* ── Header actions ─────────────────────────────────────────── */
.header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* ── Theme switcher ─────────────────────────────────────────── */
.theme-switcher { position: relative; }

.theme-dropdown-btn {
  background: transparent;
  border: none;
  border-radius: var(--radius);
  padding: 0 6px;
  height: 34px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 34px;
  transition: background 0.12s, color 0.12s;
}
.theme-dropdown-btn:hover {
  background: var(--elevate-1);
  color: var(--text-primary);
}

.theme-current-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
.theme-chevron {
  width: 11px;
  height: 11px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform 0.18s;
}
.theme-switcher.open .theme-chevron { transform: rotate(180deg); }

.theme-dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  min-width: 138px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 1200;
}
.theme-switcher.open .theme-dropdown-content { display: block; }

.theme-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  width: 100%;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  font-family: inherit;
  text-align: left;
}
.theme-option:hover { background: var(--elevate-1); color: var(--text-primary); border-left-color: hsl(var(--primary)); }
.theme-option.active { background: var(--bg-tertiary); color: var(--text-primary); border-left-color: hsl(var(--primary)); font-weight: 600; }
.theme-option-icon { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }

/* ── User menu ──────────────────────────────────────────────── */
.user-menu { position: relative; }

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  min-height: 36px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  background: transparent;
  color: var(--text-primary);
  transition: background 0.12s, border-color 0.12s;
}
.user-menu-trigger:hover { background: var(--bg-tertiary); }
.user-menu.open .user-menu-chevron { transform: rotate(180deg); }
.user-menu-chevron {
  color: var(--text-muted);
  transition: transform 0.18s;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  font-family: var(--font-heading);
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.user-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.user-menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  min-width: 142px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 1100;
}
.user-menu.open .user-menu-dropdown { display: block; }

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-left: 3px solid transparent;
  background: transparent;
  width: 100%;
  cursor: pointer;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  font-family: inherit;
}
.user-menu-item:hover {
  background: var(--elevate-1);
  color: var(--text-primary);
  border-left-color: hsl(var(--primary));
  text-decoration: none;
}
.user-menu-item svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; }

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content {
  padding: 1.25rem 1.5rem;
  width: 100%;
  max-width: 80rem;
  margin: 0 auto;
  box-sizing: border-box;
  min-height: calc(100vh - 3.5rem);
  flex: 1;
}
@media (min-width: 768px) { .content { padding: 1.5rem 2rem; } }
@media (min-width: 1280px) { .content { max-width: 96rem; padding: 1.75rem 2.25rem; } }

/* ── Page header ─────────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}
.page-header h1 {
  font-size: 1.36rem;
  font-weight: 700;
  margin-bottom: 0.375rem;
  letter-spacing: -0.03em;
}
.page-header > p {
  margin: 0.25rem 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============================================================
   SECTIONS & CARDS
   ============================================================ */
.section { margin-bottom: 1.5rem; }

.section-header { margin-bottom: 0.875rem; }
.section-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.2rem;
  letter-spacing: -0.025em;
}
.section-description { font-size: 13px; color: var(--text-secondary); margin: 0; }

.card {
  background: var(--bg-secondary);
  border: 1px solid hsl(var(--border) / 0.7);
  border-radius: 0.625rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.card h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  letter-spacing: -0.015em;
}
.card-actions { margin-top: 1rem; }

/* ============================================================
   DASHBOARD STATS
   ============================================================ */
.dashboard-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (min-width: 600px) {
  .dashboard-stats { grid-template-columns: 1fr auto; align-items: stretch; }
}

.dashboard-card {
  background: var(--bg-secondary);
  border: 1px solid hsl(var(--border) / 0.6);
  border-radius: 0.625rem;
  padding: 0.875rem 1rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow);
}
.dashboard-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: hsl(var(--primary) / 0.55);
}

.dashboard-card-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: var(--font-heading);
}

.dashboard-card-valor-main,
.dashboard-card-num {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.dashboard-card-tags { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.dashboard-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  font-size: 0.72rem;
}
.dashboard-tag-label { font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.9; }
.dashboard-tag--up  { background: hsl(var(--primary) / 0.12); color: hsl(var(--primary)); }
.dashboard-tag--down { background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive)); }
.dashboard-tag--up  .dashboard-breakdown-value { font-family: var(--font-heading); font-size: 0.85rem; font-weight: 700; color: hsl(var(--primary)); }
.dashboard-tag--down .dashboard-breakdown-value { font-family: var(--font-heading); font-size: 0.85rem; font-weight: 700; color: hsl(var(--destructive)); }

.dashboard-card-faturado-body {
  display: flex; flex-direction: column; gap: 0.75rem;
}
@media (min-width: 600px) {
  .dashboard-card-faturado-body { flex-direction: row; align-items: center; gap: 1rem; flex-wrap: wrap; }
}
.dashboard-card-stats { justify-content: center; }
.dashboard-stats-grid {
  display: flex; flex-direction: row; flex-wrap: wrap;
  align-items: center; gap: 0 0.75rem;
}
.dashboard-stat-item {
  display: flex; align-items: baseline; gap: 0.35rem;
  padding: 0 0.75rem;
  border-right: 1px solid hsl(var(--border) / 0.5);
}
.dashboard-stat-item:first-child { padding-left: 0; }
.dashboard-stat-item:last-child  { border-right: none; padding-right: 0; }
.dashboard-stat-item-label {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
  font-family: var(--font-heading);
}
.dashboard-stat-value {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================================
   CHART CARDS
   ============================================================ */
.dashboard-charts,
.dashboard-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.dashboard-charts-grid--stacked { grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .dashboard-charts-grid--stacked { grid-template-columns: repeat(2, 1fr); }
}

.chart-card {
  overflow: hidden;
  border: 1px solid hsl(var(--border) / 0.6);
  border-radius: 0.625rem;
  background: var(--bg-secondary);
  box-shadow: var(--shadow);
}
.chart-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  background: hsl(var(--muted) / 0.2);
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}
.chart-title-single {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}
.chart-legend-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.chart-legend-item {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.25rem 0.55rem;
  min-height: 28px;
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, opacity 0.12s;
  border: 1px solid transparent;
}
.chart-legend-item:hover { background: hsl(var(--muted) / 0.4); color: var(--text-primary); }
.chart-legend-item.is-off { opacity: 0.38; }
.chart-legend-item__box { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.chart-legend-item__label { white-space: nowrap; }

.chart-subtitle { font-size: 0.68rem; color: var(--text-muted); margin: 0.15rem 0 0; }
.chart-card-body { padding: 0.875rem 1rem; }
.chart-canvas {
  width: 100%; height: 220px;
  display: block; position: relative; min-height: 220px;
}
.chart-canvas canvas { max-width: 100%; display: block; }
.chart-wrap { position: relative; height: 220px; width: 100%; }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.field { margin-bottom: 0.875rem; }
.field label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  font-family: var(--font-heading);
}
.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field input[type="email"],
.field input[type="file"],
.field input[type="date"],
.field input[type="datetime-local"],
.field select,
.field textarea {
  width: 100%;
  max-width: 420px;
  padding: 0.5rem 0.75rem;
  font-size: 13px;
  min-height: 36px;
  background: hsl(var(--input));
  border: 1px solid hsl(var(--border) / 0.9);
  border-radius: 4px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field textarea { min-height: 88px; resize: vertical; max-width: 100%; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2.5px hsl(var(--ring) / 0.2);
}
.field input[type="file"] { padding: 0.25rem 0.5rem; cursor: pointer; min-height: auto; }

.field-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.field-row label { margin-bottom: 0; display: inline; text-transform: none; font-size: 13px; font-weight: 400; letter-spacing: 0; }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 0.25rem; line-height: 1.4; }

/* Editor toolbar */
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 3px;
  margin-bottom: 6px; align-items: center;
  background: hsl(var(--muted) / 0.35);
  border: 1px solid hsl(var(--border) / 0.7);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 4px 6px;
}
.editor-toolbar + .field textarea,
.editor-toolbar + textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  max-width: 100%;
  font-family: 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 12px;
  line-height: 1.6;
}
.toolbar-sep { width: 1px; height: 18px; background: hsl(var(--border) / 0.8); margin: 0 3px; }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0 0.875rem;
  height: 32px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 4px;
  border: 1px solid var(--btn-border);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.1s, border-color 0.1s, color 0.1s, box-shadow 0.1s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(85 38% 34%);
}
.btn-primary:hover { background: hsl(85 40% 51%); border-color: hsl(85 38% 42%); }
.btn-primary:active { background: hsl(85 40% 38%); }

.btn-danger {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  border-color: hsl(0 60% 36%);
}
.btn-danger:hover { background: hsl(0 60% 52%); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: hsl(var(--border) / 0.9);
}
.btn-ghost:hover { background: var(--elevate-1); color: var(--text-primary); }

.btn-sm { height: 28px; font-size: 12px; padding: 0 0.6rem; }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex; gap: 0.125rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}
.tab {
  padding: 0.5rem 0.875rem;
  font-size: 13px;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: inherit;
  transition: color 0.1s, border-color 0.1s;
}
.tab:hover { color: var(--text-primary); }
.tab.active {
  color: hsl(var(--primary));
  border-bottom-color: hsl(var(--primary));
  font-weight: 500;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   TABELAS
   ============================================================ */
.table-wrap {
  background: var(--bg-secondary);
  border: 1px solid hsl(var(--border) / 0.7);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table-wrap--overflow { overflow-x: auto; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll .data-table { min-width: 400px; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: hsl(var(--muted) / 0.5);
  padding: 0.55rem 0.8rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid hsl(var(--border) / 0.8);
  color: var(--text-muted);
  font-family: var(--font-heading);
  white-space: nowrap;
}
.data-table td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid hsl(var(--border) / 0.4);
  color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: hsl(var(--muted) / 0.25); }
.data-table tr.empty td { text-align: center; color: var(--text-muted); font-style: italic; padding: 1.5rem; }

.th-configs, .th-olho { cursor: default; user-select: none; }

/* Sortable headers */
.th-sortable { cursor: pointer; user-select: none; }
.th-sortable:hover { color: var(--text-primary); }
.th-sortable::after { content: ' ↕'; opacity: 0.35; font-size: 0.6rem; }
.th-sortable.sort-asc::after  { content: ' ↑'; opacity: 0.8; }
.th-sortable.sort-desc::after { content: ' ↓'; opacity: 0.8; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 4px;
  font-family: var(--font-heading);
  white-space: nowrap;
}

/* dark theme */
.badge-success { background: hsl(142 45% 20%); color: hsl(142 55% 68%); }
.badge-danger  { background: hsl(0 60% 28%); color: hsl(0 70% 78%); }
.badge-info    { background: hsl(85 30% 22%); color: hsl(85 50% 72%); }
.badge-muted   { background: hsl(0 0% 28%); color: hsl(0 0% 68%); }

/* light theme overrides */
[data-theme="light"] .badge-success { background: hsl(142 55% 88%); color: hsl(142 65% 26%); }
[data-theme="light"] .badge-danger  { background: hsl(0 80% 93%); color: hsl(0 70% 35%); }
[data-theme="light"] .badge-info    { background: hsl(85 45% 88%); color: hsl(85 50% 30%); }
[data-theme="light"] .badge-muted   { background: hsl(0 0% 88%); color: hsl(0 0% 38%); }

/* ============================================================
   MESSAGES / STATUS
   ============================================================ */
.msg { margin-top: 0.5rem; font-size: 13px; }
.msg.ok  { color: var(--success-text); }
.msg.err { color: hsl(var(--destructive) / 0.9); }
[data-theme="light"] .msg.err { color: hsl(0 68% 35%); }

/* ============================================================
   MODAL OVERLAY
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.52);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay .card { width: 100%; box-shadow: var(--shadow-xl); }

.modal-overlay--dark {
  background: rgba(0,0,0,0.76);
  z-index: 300;
  color: #fff;
  flex-direction: column;
  text-align: center;
  gap: 0.75rem;
  padding: 2rem;
}
.modal-overlay--dark p { color: hsl(0 0% 90%); margin: 0; }
.modal-overlay--dark strong { color: #fff; }

/* ============================================================
   NOTIFICAÇÕES (TOASTS)
   ============================================================ */
.notifications-container {
  position: fixed;
  bottom: 18px; right: 22px;
  z-index: 9000;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  max-width: 320px;
  pointer-events: none;
}
.notification {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  transition: opacity 0.25s;
  animation: toast-in 0.22s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.notification-icon { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.5; fill: none; flex-shrink: 0; }
.notification-message { font-size: 13px; color: var(--text-primary); flex: 1; }
.notification-close {
  background: transparent; border: none; color: var(--text-muted);
  width: 24px; height: 24px; cursor: pointer; font-size: 16px;
  margin-left: auto; border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.notification-close:hover { background: var(--elevate-1); color: var(--text-primary); }

.notification-success { border-left: 3px solid var(--success-text); }
.notification-success .notification-icon { color: var(--success-text); }
.notification-error   { border-left: 3px solid hsl(var(--destructive)); }
.notification-error   .notification-icon { color: hsl(var(--destructive)); }
.notification-info    { border-left: 3px solid hsl(var(--primary)); }
.notification-info    .notification-icon { color: hsl(var(--primary)); }
.notification-warning { border-left: 3px solid var(--warning-text); }
.notification-warning .notification-icon { color: var(--warning-text); }

/* ============================================================
   LIVE INDICATOR
   ============================================================ */
.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: hsl(142 55% 50%);
  animation: pulse-dot 1.4s ease-in-out infinite;
  margin-right: 3px;
  vertical-align: middle;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.75); }
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar-wrap {
  background: hsl(var(--muted));
  border-radius: 4px;
  overflow: hidden;
  height: 6px;
  margin: 0.5rem 0;
}
.progress-bar {
  height: 100%;
  background: hsl(var(--primary));
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 3px;
}
.progress-bar--success { background: var(--success-text); }
.progress-bar--danger  { background: hsl(var(--destructive)); }

/* ============================================================
   RUNNING STATUS CARD
   ============================================================ */
.running-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.running-stat {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 0.1rem;
}
.running-stat-label {
  font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); font-family: var(--font-heading);
}
.running-stat-value {
  font-family: var(--font-heading);
  font-size: 1.15rem; font-weight: 700;
  color: var(--text-primary);
}

/* ============================================================
   CONFIGURAÇÕES: BOT LIST
   ============================================================ */
.bots-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.75rem; }
.bot-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: hsl(var(--muted) / 0.25);
  border: 1px solid hsl(var(--border) / 0.6);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.bot-item:has(input:checked) {
  background: hsl(var(--primary) / 0.08);
  border-color: hsl(var(--primary) / 0.4);
}
.bot-item input[type="radio"] { accent-color: hsl(var(--primary)); }
.bot-item-name { font-size: 13px; font-weight: 500; color: var(--text-primary); flex: 1; }
.bot-item-remove { margin-left: auto; }

/* ============================================================
   SPINNER DE CARREGAMENTO
   ============================================================ */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid hsl(var(--border));
  border-top-color: hsl(var(--primary));
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   RESPONSIVO — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 16rem;
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }

  .main-content { margin-left: 0; }

  .breadcrumb { font-size: 12px; gap: 4px; }
  .user-info { display: none; }

  .content { padding: 1rem 1.25rem; }

  .dashboard-stats { grid-template-columns: 1fr; }
  .dashboard-charts, .dashboard-charts-grid, .dashboard-charts-grid--stacked {
    grid-template-columns: 1fr;
  }
  .chart-card-header { padding: 9px 12px; }
  .chart-card-body  { padding: 8px 12px; }
  .chart-canvas { height: 180px; min-height: 180px; }

  .card { padding: 0.875rem 1rem; }

  /* inputs 16px no mobile para evitar zoom iOS */
  .field input[type="text"],
  .field input[type="number"],
  .field input[type="password"],
  .field input[type="datetime-local"],
  .field input[type="date"],
  .field input[type="email"],
  .field select,
  .field textarea { font-size: 16px; min-height: 44px; max-width: 100%; }

  .btn { height: 36px; }
  .btn-sm { height: 30px; font-size: 12px; }
  .notifications-container { right: 12px; bottom: 12px; max-width: calc(100vw - 24px); }
}

@media (max-width: 600px) {
  .page-header h1 { font-size: 1.1rem; }
  .dashboard-stat-item { padding: 0 0.5rem; }
}

/* ============================================================
   UTILITÁRIOS
   ============================================================ */
.text-muted    { color: var(--text-muted); }
.text-success  { color: var(--success-text); }
.text-danger   { color: hsl(var(--destructive)); }
.text-primary  { color: hsl(var(--primary)) !important; }
.font-mono     { font-family: 'Menlo', 'Monaco', monospace; }
.font-heading  { font-family: var(--font-heading); }
.truncate      { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap-sm        { gap: 0.5rem; }
.mt-0          { margin-top: 0 !important; }
.mb-0          { margin-bottom: 0 !important; }
.sr-only       { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }


/* ============================================================
   NEW COMPONENTS v3 — Real-time, bulk actions, status tracking
   ============================================================ */

/* ── Progress bar ── */
.progress-track {
  height: 3px;
  background: hsl(var(--muted) / 0.45);
  border-radius: 99px;
  overflow: hidden;
  margin: 0.5rem 0 0.75rem;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, hsl(var(--primary)), hsl(85 55% 52%));
  border-radius: 99px;
  transition: width 0.65s cubic-bezier(.4,0,.2,1);
  min-width: 1.5%;
}

/* ── Live bar ── */
.live-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: hsl(142 45% 16% / 0.4);
  border: 1px solid hsl(142 40% 28% / 0.45);
  border-radius: 0.5rem;
  margin-bottom: 0;
  font-size: 13px;
  flex-wrap: nowrap;
}
.live-bar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-shrink: 0;
  margin-left: auto;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: hsl(142 55% 55%);
  flex-shrink: 0;
  animation: pulse-live 1.4s ease-in-out infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.65); }
}
.live-bar-main { display: flex; align-items: center; gap: 0.65rem; flex: 1; min-width: 0; }
.live-bar-text { color: hsl(142 38% 72%); font-weight: 500; flex: 1; min-width: 0; font-size: 13px; }
.live-bar-counts { display: flex; gap: 0.75rem; color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.live-count-ok  { color: hsl(142 50% 58%); font-weight: 700; }
.live-count-err { color: hsl(var(--destructive)); font-weight: 700; }
.live-action-slot { min-width: 0; }
.live-action-slot:has(button.is-live-slot-hidden) { display: none !important; }

/* ── Stats strip ── */
.stat-strip {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border: 1px solid hsl(var(--border) / 0.65);
  border-radius: 0.625rem;
  overflow: hidden;
  background: var(--bg-secondary);
  box-shadow: var(--shadow);
}
.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 0.375rem;
  border-right: 1px solid hsl(var(--border) / 0.5);
  min-width: 0;
  gap: 0.1rem;
}
.stat-item:last-child { border-right: none; }
.stat-item-val {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--text-primary);
}
.stat-item-val--green { color: hsl(142 52% 56%); }
.stat-item-val--red   { color: hsl(var(--destructive)); }
.stat-item-val--amber { color: hsl(38 88% 58%); }
.stat-item-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

/* ── Global activity bar ── */
.global-activity-bar {
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.85rem;
  padding: 0.45rem 1rem 0.5rem;
  font-size: 12px;
  line-height: 1.4;
  background: hsl(210 38% 16% / 0.92);
  border-bottom: 1px solid hsl(var(--border) / 0.45);
  color: var(--text-secondary);
}
.global-activity-bar.global-activity-bar--active { border-bottom-color: hsl(142 35% 28% / 0.4); }
.global-activity-bar__sep { opacity: 0.35; user-select: none; }
.global-activity-bar a { color: hsl(var(--primary)); font-weight: 600; text-decoration: none; }
.global-activity-bar a:hover { text-decoration: underline; }
.global-activity-bar__del { color: hsl(38 80% 72%); }
html[data-theme="light"] .global-activity-bar { background: hsl(210 25% 94% / 0.98); }

/* ── Filter tabs ── */
.filter-tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid hsl(var(--border) / 0.65);
  border-radius: 99px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  font-family: inherit;
  white-space: nowrap;
}
.filter-tab:hover { background: hsl(var(--muted) / 0.5); color: var(--text-primary); }
.filter-tab.active {
  background: hsl(var(--primary) / 0.13);
  border-color: hsl(var(--primary) / 0.45);
  color: hsl(var(--primary));
  font-weight: 600;
}
.filter-tab .tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 3px;
  border-radius: 99px; background: hsl(var(--muted) / 0.55);
  font-size: 9.5px; font-weight: 700; color: var(--text-muted);
}
.filter-tab.active .tab-count { background: hsl(var(--primary) / 0.18); color: hsl(var(--primary)); }

/* ── Bulk action bar ── */
.bulk-bar {
  display: none;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.75rem;
  background: hsl(var(--primary) / 0.07);
  border: 1px solid hsl(var(--primary) / 0.22);
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 13px;
}
.bulk-bar.visible { display: flex; }
.bulk-bar-count { font-weight: 600; color: hsl(var(--primary)); flex-shrink: 0; }
.bulk-bar-sep { width: 1px; height: 16px; background: hsl(var(--border)); flex-shrink: 0; }
.bulk-bar-spacer { flex: 1; }

/* ── Message status pills ── */
.msg-status {
  display: inline-flex; align-items: center; gap: 0.2rem;
  padding: 0.18rem 0.48rem; border-radius: 99px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap;
}
.msg-status-sent    { background: hsl(142 45% 16% / 0.55); color: hsl(142 55% 60%); }
.msg-status-edited  { background: hsl(38 55% 18% / 0.55); color: hsl(38 88% 62%); }
.msg-status-deleted { background: hsl(0 50% 18% / 0.5); color: hsl(0 68% 62%); text-decoration: line-through; }
.msg-status-error   { background: hsl(0 50% 18% / 0.5); color: hsl(0 68% 62%); }
.msg-status-pending { background: hsl(var(--muted) / 0.5); color: var(--text-muted); }

/* ── Checkbox table column ── */
.cb-col { width: 36px !important; min-width: 36px; padding: 0 8px !important; text-align: center !important; }
.cb-col input[type="checkbox"] { width: 15px; height: 15px; accent-color: hsl(var(--primary)); cursor: pointer; }
tr.row-selected > td { background: hsl(var(--primary) / 0.055) !important; }

/* ── Row animation ── */
@keyframes row-in {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: none; }
}
.row-new { animation: row-in 0.3s ease forwards; }

/* ── Config accordion ── */
.config-accordion {
  border: 1px solid hsl(var(--border) / 0.65);
  border-radius: 0.625rem;
  margin-bottom: 1rem;
  overflow: hidden;
  background: var(--bg-secondary);
  box-shadow: var(--shadow);
}
.config-accordion-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.25rem;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  color: var(--text-primary);
  font-family: inherit;
  transition: background 0.12s;
  justify-content: space-between;
}
.config-accordion-header:hover { background: var(--elevate-1); }
.config-accordion-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-heading); font-size: 0.9375rem;
  font-weight: 600; letter-spacing: -0.015em;
}
.config-accordion-chevron { transition: transform 0.2s ease; flex-shrink: 0; }
.config-accordion.open .config-accordion-chevron { transform: rotate(180deg); }
.config-accordion-body {
  display: none;
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid hsl(var(--border) / 0.4);
}
.config-accordion.open .config-accordion-body { display: block; }

/* ── Action strip ── */
.action-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.875rem 1.25rem !important;
}
.action-strip.action-strip--hidden {
  display: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  min-height: 0 !important;
}
.action-strip-sep { width: 1px; height: 22px; background: hsl(var(--border)); flex-shrink: 0; }

/* ── Edit history badge ── */
.edit-history-badge {
  display: inline-flex; align-items: center; gap: 0.2rem;
  padding: 0.12rem 0.38rem; border-radius: 4px;
  font-size: 9.5px; font-weight: 700;
  background: hsl(38 55% 18% / 0.45); color: hsl(38 90% 60%);
  cursor: help;
}

/* ── Messages table ── */
.msgs-table td { vertical-align: middle; }
.msgs-table .text-cell {
  max-width: 220px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 12px; color: var(--text-secondary);
}
.msgs-table .name-cell { font-weight: 500; color: var(--text-primary); font-size: 13px; }
.msgs-table .time-cell { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.msgs-table tr.deleted-row td { opacity: 0.52; }

/* ── Btn icon ── */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0; border: none;
  background: transparent; border-radius: 5px; cursor: pointer;
  color: var(--text-muted); transition: background .12s, color .12s; flex-shrink: 0;
}
.btn-icon:hover { background: hsl(var(--muted) / 0.65); color: var(--text-primary); }
.btn-icon--danger:hover { color: hsl(var(--destructive)) !important; background: hsl(var(--destructive) / 0.1) !important; }

/* ── Btn danger ── */
.btn-danger {
  background: hsl(var(--destructive) / 0.12);
  border: 1px solid hsl(var(--destructive) / 0.3);
  color: hsl(var(--destructive));
}
.btn-danger:hover {
  background: hsl(var(--destructive) / 0.22);
  border-color: hsl(var(--destructive) / 0.45);
  color: hsl(var(--destructive));
}

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state svg { opacity: 0.22; margin-bottom: 0.75rem; }
.empty-state p   { font-size: 13px; margin: 0; }

/* ── Page header meta row ── */
.page-header-row {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
}
.page-header-meta {
  display: flex; align-items: center; gap: 0.45rem;
  flex-wrap: wrap; margin-top: 0.35rem;
}

/* ── Toast notifications ── */
.notifications-container {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 9999;
  display: flex; flex-direction: column-reverse; gap: 0.45rem;
  max-width: min(360px, calc(100vw - 2rem)); pointer-events: none;
}
.notification {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.7rem 0.9rem; border-radius: 0.6rem;
  background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  box-shadow: var(--shadow-xl); font-size: 13px; line-height: 1.45;
  color: var(--text-primary); pointer-events: auto;
  transition: opacity 0.25s ease; opacity: 1;
  animation: toast-in 0.22s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(10px) translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.notification-success { border-left: 3px solid hsl(142 52% 44%); }
.notification-error   { border-left: 3px solid hsl(var(--destructive)); }
.notification-warning { border-left: 3px solid hsl(38 88% 52%); }
.notification-info    { border-left: 3px solid hsl(var(--primary)); }
.notification-icon { width: 15px; height: 15px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; margin-top: 1px; }
.notification-success .notification-icon { color: hsl(142 52% 55%); }
.notification-error   .notification-icon { color: hsl(var(--destructive)); }
.notification-warning .notification-icon { color: hsl(38 88% 58%); }
.notification-info    .notification-icon { color: hsl(var(--primary)); }
.notification-content { flex: 1; min-width: 0; }
.notification-message { word-break: break-word; }
.notification-close {
  flex-shrink: 0; background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 15px; line-height: 1; padding: 0;
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 4px; transition: background .1s, color .1s;
}
.notification-close:hover { background: var(--elevate-2); color: var(--text-primary); }

/* ── Modal overlay ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  z-index: 1000; display: flex; align-items: center;
  justify-content: center; padding: 1rem;
  animation: overlay-in 0.18s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay .card { animation: modal-in 0.2s ease; max-height: 90vh; overflow-y: auto; }
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.modal-overlay--dark { flex-direction: column; gap: 0.875rem; color: #fff; text-align: center; }

/* ── Global loading overlay (ações pesadas) ── */
.app-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  justify-content: center;
  background: hsl(86 13% 7%);
}
.app-loading-overlay.is-visible { display: flex; }
.app-loading-card {
  width: min(92vw, 360px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 0;
  text-align: center;
}
.app-loading-ring { width: 5.5em; height: 5.5em; }
.app-loading-ring__arc {
  fill: none;
  stroke-width: 20;
  stroke-dasharray: 0 660;
  stroke-linecap: round;
  animation: ringA 2s linear infinite;
}
.app-loading-ring__arc--a { stroke: hsl(85 36% 32%); }
.app-loading-ring__arc--b { stroke: hsl(85 44% 48%); animation-name: ringB; }
.app-loading-ring__arc--c { stroke: hsl(85 8% 50%); animation-name: ringC; }
.app-loading-ring__arc--d { stroke: hsl(85 44% 48%); animation-name: ringD; }
@keyframes ringA {
  from,4%{stroke-dasharray:0 660;stroke-width:20;stroke-dashoffset:-330;}
  12%{stroke-dasharray:60 600;stroke-width:30;stroke-dashoffset:-335;}
  32%{stroke-dasharray:60 600;stroke-width:30;stroke-dashoffset:-595;}
  40%,54%{stroke-dasharray:0 660;stroke-width:20;stroke-dashoffset:-660;}
  62%{stroke-dasharray:60 600;stroke-width:30;stroke-dashoffset:-665;}
  82%{stroke-dasharray:60 600;stroke-width:30;stroke-dashoffset:-925;}
  90%,to{stroke-dasharray:0 660;stroke-width:20;stroke-dashoffset:-990;}
}
@keyframes ringB {
  from,12%{stroke-dasharray:0 220;stroke-width:20;stroke-dashoffset:-110;}
  20%{stroke-dasharray:20 200;stroke-width:30;stroke-dashoffset:-115;}
  40%{stroke-dasharray:20 200;stroke-width:30;stroke-dashoffset:-195;}
  48%,62%{stroke-dasharray:0 220;stroke-width:20;stroke-dashoffset:-220;}
  70%{stroke-dasharray:20 200;stroke-width:30;stroke-dashoffset:-225;}
  90%{stroke-dasharray:20 200;stroke-width:30;stroke-dashoffset:-305;}
  98%,to{stroke-dasharray:0 220;stroke-width:20;stroke-dashoffset:-330;}
}
@keyframes ringC {
  from{stroke-dasharray:0 440;stroke-width:20;stroke-dashoffset:0;}
  8%{stroke-dasharray:40 400;stroke-width:30;stroke-dashoffset:-5;}
  28%{stroke-dasharray:40 400;stroke-width:30;stroke-dashoffset:-175;}
  36%,58%{stroke-dasharray:0 440;stroke-width:20;stroke-dashoffset:-220;}
  66%{stroke-dasharray:40 400;stroke-width:30;stroke-dashoffset:-225;}
  86%{stroke-dasharray:40 400;stroke-width:30;stroke-dashoffset:-395;}
  94%,to{stroke-dasharray:0 440;stroke-width:20;stroke-dashoffset:-440;}
}
@keyframes ringD {
  from,8%{stroke-dasharray:0 440;stroke-width:20;stroke-dashoffset:0;}
  16%{stroke-dasharray:40 400;stroke-width:30;stroke-dashoffset:-5;}
  36%{stroke-dasharray:40 400;stroke-width:30;stroke-dashoffset:-175;}
  44%,50%{stroke-dasharray:0 440;stroke-width:20;stroke-dashoffset:-220;}
  58%{stroke-dasharray:40 400;stroke-width:30;stroke-dashoffset:-225;}
  78%{stroke-dasharray:40 400;stroke-width:30;stroke-dashoffset:-395;}
  86%,to{stroke-dasharray:0 440;stroke-width:20;stroke-dashoffset:-440;}
}
.app-loading-text {
  font-size: 12px;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.05em;
  color: hsl(85 8% 62%);
  line-height: 1.4;
}
