/* =====================================================================
   Painel ADM Cerrado Pedras — Corporate Design System
   Primary: #3B82F6 · Open Sans + Poppins · 8pt grid
   Tema claro + tema escuro via [data-theme="dark"]
   ===================================================================== */

:root {
  /* Brand */
  --c-primary: #3b82f6;
  --c-primary-600: #2563eb;
  --c-primary-700: #1d4ed8;
  --c-primary-50: #eff6ff;
  --c-primary-100: #dbeafe;
  --c-secondary: #8b5cf6;
  --c-success: #16a34a;
  --c-success-50: #f0fdf4;
  --c-warning: #d97706;
  --c-warning-50: #fffbeb;
  --c-danger: #dc2626;
  --c-danger-50: #fef2f2;
  --c-info: #0284c7;

  /* Neutrals (claro) */
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-muted: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #111827;
  --text-soft: #475569;
  --text-muted: #64748b;
  --text-on-primary: #ffffff;

  /* Layout */
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 72px;
  --header-h: 64px;

  /* Tipografia */
  --font-body: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-display: "Poppins", "Open Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Radius (8pt) */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  /* Sombra */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.07), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.12);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 120ms;
  --t: 180ms;

  /* Z */
  --z-sidebar: 20;
  --z-header: 25;
  --z-overlay: 40;
  --z-drawer: 50;
  --z-modal: 60;
  --z-toast: 100;
  --z-popover: 70;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --bg-elevated: #111827;
  --bg-muted: #1f2937;
  --surface: #111827;
  --surface-2: #0f172a;
  --border: #1f2937;
  --border-strong: #334155;
  --text: #f1f5f9;
  --text-soft: #cbd5e1;
  --text-muted: #94a3b8;
  --c-primary-50: rgba(59, 130, 246, 0.12);
  --c-primary-100: rgba(59, 130, 246, 0.18);
  --c-success-50: rgba(22, 163, 74, 0.14);
  --c-warning-50: rgba(217, 119, 6, 0.16);
  --c-danger-50: rgba(220, 38, 38, 0.16);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.55);
}

/* Reset --------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

::selection { background: var(--c-primary-100); color: var(--c-primary-700); }

/* Scrollbar (Webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Icons ---------------------------------------------------------------
   Usamos elementos <svg> com stroke=currentColor pra herdar a cor.       */
.icn {
  width: 18px; height: 18px;
  display: inline-block;
  vertical-align: middle;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icn-sm { width: 14px; height: 14px; }
.icn-lg { width: 22px; height: 22px; }

/* =====================================================================
   LOGIN
   ===================================================================== */
.adm-login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
.adm-login-side {
  background: linear-gradient(135deg, var(--c-primary-700) 0%, var(--c-primary) 60%, var(--c-secondary) 110%);
  color: #fff;
  padding: 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.adm-login-side::before {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18), transparent 50%);
  pointer-events: none;
}
.adm-login-side-brand { position: relative; z-index: 1; }
.adm-login-side-brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-family: var(--font-display);
}
.adm-login-side-brand-logo {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.16);
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
  backdrop-filter: blur(4px);
}
.adm-login-side-hero { position: relative; z-index: 1; max-width: 420px; }
.adm-login-side-hero h2 {
  font-size: 2.1rem;
  margin-bottom: 1rem;
  color: #fff;
  line-height: 1.15;
}
.adm-login-side-hero p {
  color: rgba(255,255,255,0.88);
  font-size: 0.95rem;
  margin: 0;
}
.adm-login-side-footer {
  position: relative;
  z-index: 1;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.72);
}
.adm-login-form-side {
  display: grid;
  place-items: center;
  padding: 2rem;
}
.adm-login-card {
  width: 100%;
  max-width: 400px;
}
.adm-login-card h1 {
  font-size: 1.7rem;
  margin-bottom: 0.35rem;
}
.adm-login-card .adm-login-subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0 0 2rem;
}

@media (max-width: 880px) {
  .adm-login { grid-template-columns: 1fr; }
  .adm-login-side { display: none; }
}

/* =====================================================================
   APP SHELL
   ===================================================================== */
.adm-app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background: var(--bg);
}

/* Sidebar ------------------------------------------------------------- */
.adm-sidebar {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: var(--z-sidebar);
}
.adm-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.2rem 1.25rem;
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
}
.adm-sidebar-brand-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-secondary) 100%);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 16px;
  flex-shrink: 0;
}
.adm-sidebar-brand-text { line-height: 1.2; }
.adm-sidebar-brand-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.adm-sidebar-brand-sub {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.adm-nav-section {
  padding: 0.5rem 0.6rem;
}
.adm-nav-section-title {
  color: var(--text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  padding: 0.75rem 0.7rem 0.35rem;
}
.adm-nav { list-style: none; padding: 0; margin: 0; }
.adm-nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: var(--r);
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
  margin-bottom: 2px;
}
.adm-nav-item:hover {
  background: var(--bg-muted);
  color: var(--text);
}
.adm-nav-item.is-active {
  background: var(--c-primary-50);
  color: var(--c-primary-700);
  font-weight: 600;
}
[data-theme="dark"] .adm-nav-item.is-active { color: #93c5fd; }
.adm-nav-item-badge {
  margin-left: auto;
  background: var(--c-primary);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  min-width: 18px;
  text-align: center;
}

.adm-sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.adm-sidebar-footer-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-success);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
}

/* Header -------------------------------------------------------------- */
.adm-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.adm-header {
  height: var(--header-h);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  backdrop-filter: blur(8px);
}
.adm-header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}
.adm-header-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
}
.adm-header-search {
  position: relative;
  margin-left: 0.5rem;
  display: none;
}
@media (min-width: 880px) {
  .adm-header-search { display: block; }
}
.adm-header-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.8rem;
  background: var(--bg-muted);
  border: 1px solid transparent;
  border-radius: var(--r);
  color: var(--text-muted);
  font-size: 0.85rem;
  min-width: 260px;
  cursor: pointer;
  transition: all var(--t-fast);
}
.adm-header-search-trigger:hover { background: var(--bg); border-color: var(--border-strong); }
.adm-kbd {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-left: auto;
  color: var(--text-muted);
}

.adm-header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.adm-icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: var(--text-soft);
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.adm-icon-btn:hover { background: var(--bg-muted); color: var(--text); }
.adm-icon-btn-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-danger);
  border: 2px solid var(--bg-elevated);
}

/* User chip */
.adm-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.3rem 0.55rem 0.3rem 0.4rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
  cursor: pointer;
}
.adm-user-chip:hover { background: var(--bg-muted); border-color: var(--border); }
.adm-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-secondary) 100%);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.adm-avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }
.adm-user-chip-text { display: none; line-height: 1.15; text-align: left; }
@media (min-width: 768px) {
  .adm-user-chip-text { display: block; }
}
.adm-user-chip-name { font-weight: 600; font-size: 0.85rem; color: var(--text); }
.adm-user-chip-role { font-size: 0.72rem; color: var(--text-muted); text-transform: capitalize; }
.adm-user-chip-caret {
  color: var(--text-muted);
  margin-left: 0.1rem;
}

/* Popover do usuário */
.adm-popover {
  position: absolute;
  top: calc(var(--header-h) - 8px);
  right: 1rem;
  min-width: 240px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-popover);
  padding: 0.5rem;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity var(--t-fast), transform var(--t-fast);
}
.adm-popover.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.adm-popover-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.35rem;
}
.adm-popover-header-name { font-weight: 600; font-size: 0.9rem; color: var(--text); line-height: 1.2; }
.adm-popover-header-email { font-size: 0.78rem; color: var(--text-muted); }
.adm-popover-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: var(--r-sm);
  color: var(--text-soft);
  font-size: 0.88rem;
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
}
.adm-popover-item:hover { background: var(--bg-muted); color: var(--text); }
.adm-popover-item-danger { color: var(--c-danger); }
.adm-popover-item-danger:hover { background: var(--c-danger-50); }
.adm-popover-divider {
  height: 1px;
  background: var(--border);
  margin: 0.35rem 0;
}

.adm-content {
  padding: 1.75rem;
  flex: 1;
  min-width: 0;
}
@media (max-width: 720px) { .adm-content { padding: 1.25rem 1rem; } }

/* =====================================================================
   FORM CONTROLS
   ===================================================================== */
.adm-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.adm-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
  letter-spacing: 0.01em;
}
.adm-input, .adm-select, .adm-textarea {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 0.55rem 0.75rem;
  width: 100%;
  font-size: 0.92rem;
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.adm-input::placeholder, .adm-textarea::placeholder { color: var(--text-muted); }
.adm-input:focus, .adm-select:focus, .adm-textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
.adm-select { cursor: pointer; padding-right: 2rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  appearance: none;
}
.adm-textarea { min-height: 90px; resize: vertical; }
.adm-input-inline { min-width: 180px; max-width: 280px; }

/* =====================================================================
   BUTTONS
   ===================================================================== */
.adm-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: var(--c-primary);
  color: var(--text-on-primary);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
}
.adm-btn:hover { background: var(--c-primary-600); }
.adm-btn:active { transform: translateY(1px); }
.adm-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.adm-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.28);
}
.adm-btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.adm-btn-outline:hover { background: var(--bg-muted); }
.adm-btn-ghost {
  background: transparent;
  color: var(--text-soft);
  padding: 0.45rem 0.7rem;
}
.adm-btn-ghost:hover { background: var(--bg-muted); color: var(--text); }
.adm-btn-danger { background: var(--c-danger); }
.adm-btn-danger:hover { background: #b91c1c; }
.adm-btn-success { background: var(--c-success); }
.adm-btn-sm { padding: 0.4rem 0.7rem; font-size: 0.8rem; }
.adm-btn-block { width: 100%; justify-content: center; padding: 0.75rem; }

/* =====================================================================
   CARDS / KPIs
   ===================================================================== */
.adm-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t-fast), border-color var(--t-fast);
}
.adm-card-hoverable:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.adm-card-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.adm-card-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.02em;
}
.adm-card-meta {
  margin-top: 0.55rem;
  font-size: 0.82rem;
  color: var(--text-soft);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.adm-delta {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}
.adm-delta-up { background: var(--c-success-50); color: var(--c-success); }
.adm-delta-down { background: var(--c-danger-50); color: var(--c-danger); }
.adm-delta-flat { background: var(--bg-muted); color: var(--text-muted); }

.adm-grid { display: grid; gap: 1rem; }
.adm-grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.adm-grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.adm-grid-2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }

.adm-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 1.75rem 0 1rem;
}
.adm-section-title h3 { font-size: 1.1rem; font-weight: 600; }
.adm-section-title .adm-subtle { font-size: 0.82rem; color: var(--text-muted); }

.adm-chart-card { padding: 1.25rem 1.4rem 1.5rem; }
.adm-chart-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.adm-chart-card h4 { font-size: 0.95rem; font-weight: 600; }
.adm-chart-wrap {
  position: relative;
  height: 280px;
}
.adm-chart-wrap-sm { height: 240px; }

/* =====================================================================
   TABLE
   ===================================================================== */
.adm-table-wrap {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.adm-table-scroll { overflow-x: auto; }
.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.adm-table th, .adm-table td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.adm-table th {
  background: var(--surface-2);
  font-weight: 600;
  font-size: 0.74rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.adm-table tbody tr { transition: background var(--t-fast); }
.adm-table tbody tr:hover { background: var(--surface-2); }
.adm-table tbody tr:last-child td { border-bottom: 0; }
.adm-table td.adm-td-strong { font-weight: 600; color: var(--text); }
.adm-table td.adm-td-muted { color: var(--text-muted); }
.adm-table-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.adm-table-actions { display: inline-flex; gap: 0.3rem; }

/* Densidade */
.adm-table-density-compact th, .adm-table-density-compact td { padding: 0.5rem 1rem; }
.adm-table-density-cozy th, .adm-table-density-cozy td { padding: 1.05rem 1.1rem; }

/* Input inline (peso / ordem na tabela) */
.adm-inline-input {
  width: 64px;
  padding: 0.3rem 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  text-align: center;
  font: inherit;
  color: var(--text);
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.adm-inline-input:hover { border-color: var(--border-strong); background: var(--surface-2); }
.adm-inline-input:focus {
  outline: none;
  border-color: var(--c-primary);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
.adm-inline-input-saving {
  border-color: var(--c-primary);
  opacity: 0.7;
}
.adm-inline-input-ok {
  border-color: var(--c-success);
  background: var(--c-success-50);
}
/* esconder spinners do number input */
.adm-inline-input::-webkit-outer-spin-button,
.adm-inline-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.adm-inline-input[type=number] { -moz-appearance: textfield; }

/* =====================================================================
   Tags coloridas
   ===================================================================== */
.adm-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.adm-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.adm-tag-close {
  margin-left: 0.2rem;
  cursor: pointer;
  opacity: 0.6;
  font-weight: 700;
  line-height: 1;
}
.adm-tag-close:hover { opacity: 1; }

/* Cores tag - presets */
.adm-tag-red    { background: #fee2e2; color: #b91c1c; }
.adm-tag-orange { background: #ffedd5; color: #c2410c; }
.adm-tag-yellow { background: #fef3c7; color: #a16207; }
.adm-tag-green  { background: #dcfce7; color: #15803d; }
.adm-tag-teal   { background: #ccfbf1; color: #0f766e; }
.adm-tag-blue   { background: #dbeafe; color: #1d4ed8; }
.adm-tag-indigo { background: #e0e7ff; color: #4338ca; }
.adm-tag-purple { background: #ede9fe; color: #6d28d9; }
.adm-tag-pink   { background: #fce7f3; color: #be185d; }
.adm-tag-gray   { background: #e5e7eb; color: #374151; }

[data-theme="dark"] .adm-tag-red    { background: rgba(220, 38, 38, 0.16); color: #fca5a5; }
[data-theme="dark"] .adm-tag-orange { background: rgba(234, 88, 12, 0.18); color: #fdba74; }
[data-theme="dark"] .adm-tag-yellow { background: rgba(202, 138, 4, 0.18); color: #fde68a; }
[data-theme="dark"] .adm-tag-green  { background: rgba(22, 163, 74, 0.18); color: #86efac; }
[data-theme="dark"] .adm-tag-teal   { background: rgba(13, 148, 136, 0.18); color: #5eead4; }
[data-theme="dark"] .adm-tag-blue   { background: rgba(37, 99, 235, 0.20); color: #93c5fd; }
[data-theme="dark"] .adm-tag-indigo { background: rgba(67, 56, 202, 0.20); color: #a5b4fc; }
[data-theme="dark"] .adm-tag-purple { background: rgba(109, 40, 217, 0.22); color: #c4b5fd; }
[data-theme="dark"] .adm-tag-pink   { background: rgba(190, 24, 93, 0.22); color: #f9a8d4; }
[data-theme="dark"] .adm-tag-gray   { background: rgba(75, 85, 99, 0.22); color: #d1d5db; }

.adm-tags-stack { display: flex; flex-wrap: wrap; gap: 0.3rem; }

/* Color picker */
.adm-color-picker { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.adm-color-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.1s, border-color 0.15s;
}
.adm-color-dot:hover { transform: scale(1.1); }
.adm-color-dot.is-selected { border-color: var(--text); transform: scale(1.1); }
.adm-color-dot[data-cor="red"]    { background: #ef4444; }
.adm-color-dot[data-cor="orange"] { background: #f97316; }
.adm-color-dot[data-cor="yellow"] { background: #eab308; }
.adm-color-dot[data-cor="green"]  { background: #22c55e; }
.adm-color-dot[data-cor="teal"]   { background: #14b8a6; }
.adm-color-dot[data-cor="blue"]   { background: #3b82f6; }
.adm-color-dot[data-cor="indigo"] { background: #6366f1; }
.adm-color-dot[data-cor="purple"] { background: #a855f7; }
.adm-color-dot[data-cor="pink"]   { background: #ec4899; }
.adm-color-dot[data-cor="gray"]   { background: #6b7280; }

/* Tags chooser dentro do drawer */
.adm-tag-chooser {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.5rem 0;
}
.adm-tag-chooser button.adm-tag {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-weight: 500;
  opacity: 0.6;
  transition: opacity 0.15s, background 0.15s;
}
.adm-tag-chooser button.adm-tag:hover { opacity: 1; }
.adm-tag-chooser button.adm-tag.is-applied { opacity: 1; border-color: transparent; font-weight: 600; }
.adm-tag-chooser button.adm-tag.is-applied.adm-tag-red    { background: #fee2e2; color: #b91c1c; }
.adm-tag-chooser button.adm-tag.is-applied.adm-tag-orange { background: #ffedd5; color: #c2410c; }
.adm-tag-chooser button.adm-tag.is-applied.adm-tag-yellow { background: #fef3c7; color: #a16207; }
.adm-tag-chooser button.adm-tag.is-applied.adm-tag-green  { background: #dcfce7; color: #15803d; }
.adm-tag-chooser button.adm-tag.is-applied.adm-tag-teal   { background: #ccfbf1; color: #0f766e; }
.adm-tag-chooser button.adm-tag.is-applied.adm-tag-blue   { background: #dbeafe; color: #1d4ed8; }
.adm-tag-chooser button.adm-tag.is-applied.adm-tag-indigo { background: #e0e7ff; color: #4338ca; }
.adm-tag-chooser button.adm-tag.is-applied.adm-tag-purple { background: #ede9fe; color: #6d28d9; }
.adm-tag-chooser button.adm-tag.is-applied.adm-tag-pink   { background: #fce7f3; color: #be185d; }
.adm-tag-chooser button.adm-tag.is-applied.adm-tag-gray   { background: #e5e7eb; color: #374151; }

/* =====================================================================
   Vendedores: cards de ranking
   ===================================================================== */
.adm-vendor-card {
  position: relative;
  padding: 1.25rem 1.3rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.adm-vendor-card.is-off { opacity: 0.55; }
.adm-vendor-rank {
  position: absolute;
  top: 0.7rem; right: 0.9rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-muted);
}
.adm-vendor-header { display: flex; gap: 0.7rem; align-items: center; }
.adm-avatar-vendor { width: 44px; height: 44px; font-size: 0.92rem; }
.adm-vendor-name { font-weight: 600; font-size: 0.98rem; color: var(--text); }
.adm-vendor-phone { font-size: 0.78rem; color: var(--text-muted); }
.adm-vendor-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.adm-vendor-metric { text-align: center; }
.adm-vendor-metric-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--text);
}
.adm-vendor-metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.adm-vendor-bar {
  height: 6px;
  background: var(--bg-muted);
  border-radius: 999px;
  overflow: hidden;
}
.adm-vendor-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), var(--c-secondary));
  border-radius: 999px;
  transition: width 0.4s var(--ease);
}
.adm-vendor-foot-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.45rem;
}

/* =====================================================================
   Drawer: actions, timeline, WhatsApp button
   ===================================================================== */
.adm-drawer-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.adm-drawer-actions .adm-btn { flex: 1; justify-content: center; }
.adm-btn-success { background: #25D366; color: #fff; }
.adm-btn-success:hover { background: #20bd5a; }

.adm-wa-btn { color: #25D366; }
.adm-wa-btn:hover { background: rgba(37, 211, 102, 0.12); color: #20bd5a; }

.adm-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 360px;
  overflow-y: auto;
}
.adm-timeline li {
  position: relative;
  padding: 0.6rem 0.75rem 0.6rem 1.5rem;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border-left: 3px solid var(--c-primary);
  font-size: 0.85rem;
}
.adm-timeline li::before {
  content: "";
  position: absolute;
  left: -7px; top: 16px;
  width: 11px; height: 11px;
  background: var(--c-primary);
  border-radius: 50%;
  border: 2px solid var(--bg-elevated);
}
.adm-timeline-title { font-weight: 600; color: var(--text); }
.adm-timeline-body { color: var(--text-soft); margin-top: 0.2rem; }
.adm-timeline-when {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Export menu (dropdown) */
.adm-export-wrap { position: relative; display: inline-block; }
.adm-popover-static {
  display: none;
  position: absolute;
  z-index: var(--z-popover);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
  animation: fadeIn 0.12s ease-out;
}
.adm-popover-static.is-open { display: block; }

/* Modal de Google Sheets - copy area */
.adm-sheets-modal-csv {
  width: 100%;
  min-height: 200px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 0.6rem;
  color: var(--text-soft);
  resize: vertical;
}

/* =====================================================================
   ANALYTICS: funil, heatmap, real-time
   ===================================================================== */
.adm-funnel { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.25rem 0; }
.adm-funnel-step {
  display: grid;
  grid-template-columns: 160px 1fr 80px;
  gap: 0.85rem;
  align-items: center;
  font-size: 0.88rem;
}
.adm-funnel-step .adm-funnel-label { color: var(--text-soft); font-weight: 500; }
.adm-funnel-step .adm-funnel-bar {
  height: 28px;
  background: var(--bg-muted);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}
.adm-funnel-step .adm-funnel-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--c-primary) 0%, var(--c-secondary) 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding-left: 0.7rem;
  color: #fff;
  font-weight: 600;
  font-size: 0.82rem;
  transition: width 0.4s var(--ease);
}
.adm-funnel-step .adm-funnel-pct { text-align: right; color: var(--text-muted); font-size: 0.82rem; }

.adm-heatmap {
  display: grid;
  grid-template-columns: 50px repeat(24, minmax(28px, 1fr));
  gap: 2px;
  font-size: 0.7rem;
  min-width: 720px;
}
.adm-heatmap-cell { aspect-ratio: 1; border-radius: 3px; background: var(--bg-muted); }
.adm-heatmap-label { color: var(--text-muted); font-weight: 600; text-align: center; line-height: 28px; }
.adm-heatmap-row-label { color: var(--text-muted); font-weight: 600; padding-right: 0.5rem; text-align: right; align-self: center; }

.adm-realtime { display: flex; flex-direction: column; gap: 0.3rem; max-height: 240px; overflow-y: auto; padding-top: 0.5rem; }
.adm-realtime-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}
.adm-realtime-row:last-child { border-bottom: 0; }
.adm-realtime-type {
  font-size: 0.66rem;
  padding: 0.18rem 0.45rem;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.adm-realtime-type-form_submit_success { background: var(--c-success-50); color: var(--c-success); }
.adm-realtime-type-cta_click { background: var(--c-primary-50); color: var(--c-primary-700); }
.adm-realtime-when { color: var(--text-muted); margin-left: auto; font-size: 0.78rem; }

/* Drag handle + drop target */
.adm-drag-handle {
  width: 32px;
  color: var(--text-muted);
  cursor: grab;
  user-select: none;
  text-align: center;
  padding-left: 0.5rem !important;
  padding-right: 0.25rem !important;
}
.adm-drag-handle:active { cursor: grabbing; }
.adm-drag-handle:hover { color: var(--text); }
.adm-row-dragging {
  opacity: 0.45;
  background: var(--bg-muted) !important;
}
.adm-row-drop-target {
  box-shadow: inset 0 -2px 0 var(--c-primary);
  background: var(--c-primary-50) !important;
}

/* =====================================================================
   BADGES
   ===================================================================== */
.adm-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.adm-badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.adm-badge-novo { background: var(--c-primary-50); color: var(--c-primary-700); }
.adm-badge-contatado { background: var(--c-warning-50); color: var(--c-warning); }
.adm-badge-convertido { background: var(--c-success-50); color: var(--c-success); }
.adm-badge-descartado { background: var(--bg-muted); color: var(--text-muted); }
.adm-badge-on { background: var(--c-success-50); color: var(--c-success); }
.adm-badge-off { background: var(--bg-muted); color: var(--text-muted); }

/* =====================================================================
   PAGINATION
   ===================================================================== */
.adm-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}
.adm-pagination-info { color: var(--text-muted); }
.adm-pagination-ctrl { display: flex; gap: 0.4rem; }

/* =====================================================================
   TOOLBAR (filtros)
   ===================================================================== */
.adm-toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-xs);
}
.adm-toolbar-spacer { flex: 1; }
.adm-toolbar-simple {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

/* =====================================================================
   DRAWER (detalhe lead)
   ===================================================================== */
.adm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: var(--z-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
  backdrop-filter: blur(2px);
}
.adm-overlay.is-open { opacity: 1; pointer-events: auto; }
.adm-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100%;
  width: min(540px, 100%);
  background: var(--bg-elevated);
  z-index: var(--z-drawer);
  box-shadow: -16px 0 48px rgba(15, 23, 42, 0.18);
  transform: translateX(100%);
  transition: transform var(--t) var(--ease);
  display: flex;
  flex-direction: column;
}
.adm-drawer.is-open { transform: translateX(0); }
.adm-drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.adm-drawer-header h3 { font-size: 1.15rem; }
.adm-drawer-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}
.adm-drawer-section { margin-bottom: 1.5rem; }
.adm-drawer-section h4 {
  font-family: var(--font-body);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
  font-weight: 700;
}
.adm-kv {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0.45rem 1rem;
  font-size: 0.88rem;
  margin: 0;
}
.adm-kv dt { color: var(--text-muted); }
.adm-kv dd { margin: 0; color: var(--text); word-break: break-word; }

/* =====================================================================
   MODAL
   ===================================================================== */
.adm-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
}
.adm-modal.is-open { display: flex; animation: fadeIn var(--t) var(--ease); }
.adm-modal-card {
  background: var(--bg-elevated);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 520px;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: scaleIn var(--t) var(--ease);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
.adm-modal-card h3 { margin-bottom: 0.4rem; font-size: 1.2rem; }
.adm-modal-card .adm-modal-sub { color: var(--text-soft); margin: 0 0 1.5rem; font-size: 0.92rem; }
.adm-modal-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}
.adm-form-row { display: grid; gap: 0.85rem; }
.adm-form-row-2 { grid-template-columns: 1fr 1fr; }

/* =====================================================================
   ALERTS
   ===================================================================== */
.adm-alert {
  padding: 0.75rem 1rem;
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.adm-alert-error { background: var(--c-danger-50); border-color: rgba(220, 38, 38, 0.22); color: #991b1b; }
.adm-alert-success { background: var(--c-success-50); border-color: rgba(22, 163, 74, 0.22); color: #166534; }
.adm-alert-info { background: var(--c-primary-50); border-color: rgba(59, 130, 246, 0.22); color: var(--c-primary-700); }
[data-theme="dark"] .adm-alert-error { color: #fca5a5; }
[data-theme="dark"] .adm-alert-success { color: #86efac; }
[data-theme="dark"] .adm-alert-info { color: #93c5fd; }

/* =====================================================================
   TOAST
   ===================================================================== */
.adm-toast-stack {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.adm-toast {
  background: #0f172a;
  color: #f1f5f9;
  padding: 0.75rem 1rem;
  border-radius: var(--r);
  font-size: 0.88rem;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
  border: 1px solid rgba(255,255,255,0.08);
  animation: toastIn var(--t) var(--ease);
}
.adm-toast-success { background: var(--c-success); border-color: transparent; }
.adm-toast-error { background: var(--c-danger); border-color: transparent; }
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* =====================================================================
   LOADER / SKELETON
   ===================================================================== */
.adm-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.adm-skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--surface-2) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
  display: inline-block;
  color: transparent;
  user-select: none;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.adm-skeleton-line { height: 1em; width: 100%; }
.adm-skeleton-value { height: 2rem; width: 60%; }

/* =====================================================================
   COMMAND PALETTE (Cmd+K)
   ===================================================================== */
.adm-cmdk {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 6rem 1.5rem 1.5rem;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
}
.adm-cmdk.is-open { display: flex; animation: fadeIn var(--t) var(--ease); }
.adm-cmdk-card {
  background: var(--bg-elevated);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: scaleIn var(--t) var(--ease);
}
.adm-cmdk-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.adm-cmdk-input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: 1rem;
  color: var(--text);
}
.adm-cmdk-list {
  max-height: 360px;
  overflow-y: auto;
  padding: 0.4rem;
}
.adm-cmdk-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--text);
}
.adm-cmdk-item:hover, .adm-cmdk-item.is-focus { background: var(--bg-muted); }
.adm-cmdk-item-meta { color: var(--text-muted); font-size: 0.78rem; margin-left: auto; }
.adm-cmdk-section-title {
  padding: 0.6rem 0.85rem 0.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
}

/* =====================================================================
   PAGES SWITCH
   ===================================================================== */
.adm-page { display: none; animation: fadePage var(--t); }
.adm-page.is-active { display: block; }
@keyframes fadePage { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
.adm-mobile-toggle {
  display: none;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--border-strong);
  align-items: center;
  justify-content: center;
}
@media (max-width: 900px) {
  .adm-app { grid-template-columns: 1fr; }
  .adm-sidebar {
    position: fixed;
    transform: translateX(-100%);
    transition: transform var(--t) var(--ease);
    width: 260px;
  }
  .adm-sidebar.is-open { transform: translateX(0); }
  .adm-header { padding: 0 1rem; }
  .adm-mobile-toggle { display: inline-flex; }
  .adm-header-search-trigger { min-width: auto; }
  .adm-header-search-trigger > span { display: none; }
  .adm-header-search-trigger .adm-kbd { display: none; }
}
