/* V2 Design Tokens — extracted from Claude Design share on 2026-05-13 */
/* Source: https://claude.ai/design/p/019e0389-6e16-7b32-8a5a-2f572263c1d4 (IA Meu Atendente.html) */
/* Method: DevTools getComputedStyle() walk over iframe DOM. */
/* Do not edit by hand — re-extract via Phase 0.5 plan if design changes upstream. */

/* Fonts (Inter + JetBrains Mono) are loaded via <link rel="stylesheet">
   in the HTML <head> of each V2 page — pre-discoverable by the preload
   scanner. Loading them here via @import forced a serial waterfall
   (parse this CSS → fetch Inter CSS → fetch Mono CSS → parse) that
   blocked first paint by ~200-500ms per navigation. The HTML <link>
   path achieves the same result without the waterfall. */

/* Cross-document view transitions for smoother navigation between V2 admin
   pages. Progressive enhancement: browsers without support (Safari <18,
   Firefox, older Chrome) ignore this rule silently and fall back to the
   standard full-page reload. Modern Chromium ≥126 and Safari ≥18 will fade
   the next document in instead of flashing white. */
@view-transition { navigation: auto; }

/* General Sans — self-hosted (Fontshare). Variable axis covers weights 200–700. */
@font-face {
  font-family: 'General Sans';
  src: url('/admin/fonts/general-sans/GeneralSans-Variable.woff2') format('woff2');
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'General Sans';
  src: url('/admin/fonts/general-sans/GeneralSans-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'General Sans';
  src: url('/admin/fonts/general-sans/GeneralSans-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'General Sans';
  src: url('/admin/fonts/general-sans/GeneralSans-Semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'General Sans';
  src: url('/admin/fonts/general-sans/GeneralSans-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ─── Neutrals ─────────────────────────────────────── */
  --ds-n-0:   #ffffff;
  --ds-n-25:  #fbfbfc;
  --ds-n-50:  #f6f7f9;
  --ds-n-100: #eceef2;
  --ds-n-150: #e1e4ea;
  --ds-n-200: #d3d7df;
  --ds-n-300: #b8bdc8;
  --ds-n-400: #8b919e;
  --ds-n-500: #656b78;
  --ds-n-600: #4a4f5a;
  --ds-n-700: #353944;
  --ds-n-800: #23262e;
  --ds-n-850: #1a1c22;
  --ds-n-900: #121419;
  --ds-n-950: #0a0b0e;

  /* ─── Surfaces & Text ─────────────────────────────── */
  --ds-canvas:        #f6f7f9;
  --ds-surface:       #ffffff;
  --ds-border:        #e1e4ea;
  --ds-border-soft:   #f0f1f4;
  --ds-border-strong: #d3d7df;
  --ds-text:          #121419;
  --ds-text-muted:    #656b78;
  --ds-text-subtle:   #8b919e;

  /* ─── Accent ──────────────────────────────────────── */
  --ds-accent:       #1d6c5c;
  --ds-accent-fg:    #0c3a32;
  --ds-accent-hover: #185a4d;
  --ds-accent-soft:  #e6f1ee;
  --ds-accent-rgb:   31, 138, 91;

  /* ─── Semantic ────────────────────────────────────── */
  --ds-info:       #2563eb;
  --ds-info-fg:    #1e3a8a;
  --ds-info-bg:    #eff6ff;
  --ds-success:    #16a34a;
  --ds-success-fg: #14532d;
  --ds-success-bg: #ecfdf3;
  --ds-warning:    #d97706;
  --ds-warning-fg: #7c2d12;
  --ds-warning-bg: #fff7ed;
  --ds-danger:     #dc2626;
  --ds-danger-fg:  #7f1d1d;
  --ds-danger-bg:  #fef2f2;
  --ds-amber:      #d97706;

  /* ─── Sidebar ─────────────────────────────────────── */
  --ds-sb-bg:           #121419;
  --ds-sb-bg-hover:     rgba(255, 255, 255, 0.06);
  --ds-sb-bg-active:    rgba(255, 255, 255, 0.08);
  --ds-sb-border:       rgba(255, 255, 255, 0.08);
  --ds-sb-text:         rgba(255, 255, 255, 0.82);
  /* Bumped from 0.45 → 0.62 for ~6.5:1 contrast against #121419 — clears AA-normal
     comfortably even at the 10.5–11px sizes used by `.ds-sb-section` and
     `.ds-sb-tenant-plan`. */
  --ds-sb-text-muted:   rgba(255, 255, 255, 0.62);
  --ds-sb-text-active:  #ffffff;
  --ds-sb-accent:       #1d6c5c;

  /* ─── Badges ──────────────────────────────────────── */
  --ds-badge-ia-bg:           #ecfdf5;
  --ds-badge-ia-fg:           #166534;
  --ds-badge-ia-dot:          #10b981;
  --ds-badge-aguardando-bg:   #fff1ec;
  --ds-badge-aguardando-fg:   #b3431a;
  --ds-badge-aguardando-dot:  #ea580c;
  --ds-badge-convertido-bg:   #eef2ff;
  --ds-badge-convertido-fg:   #3730a3;
  --ds-badge-convertido-dot:  #6366f1;
  --ds-badge-parado-bg:       #f3f4f6;
  --ds-badge-parado-fg:       #4b5563;
  --ds-badge-parado-dot:      #9ca3af;
  --ds-badge-encerrado-bg:    #f3f4f6;
  --ds-badge-encerrado-fg:    #111827;
  --ds-badge-encerrado-dot:   #374151;

  /* ─── Radius ──────────────────────────────────────── */
  --ds-r-sm:   6px;
  --ds-r-md:   8px;
  --ds-r-lg:   12px;
  --ds-r-xl:   16px;
  --ds-r-pill: 999px;

  /* ─── Shadows ─────────────────────────────────────── */
  --ds-shadow-xs: 0 1px 2px rgba(15, 18, 25, 0.04);
  --ds-shadow-sm: 0 1px 3px rgba(15, 18, 25, 0.06), 0 1px 2px rgba(15, 18, 25, 0.04);
  --ds-shadow-md: 0 4px 12px rgba(15, 18, 25, 0.06), 0 2px 4px rgba(15, 18, 25, 0.04);
  --ds-shadow-lg: 0 16px 40px rgba(15, 18, 25, 0.10), 0 4px 12px rgba(15, 18, 25, 0.06);

  /* ─── Spacing ─────────────────────────────────────── */
  --ds-space-1:  4px;
  --ds-space-2:  8px;
  --ds-space-3:  12px;
  --ds-space-4:  16px;
  --ds-space-5:  20px;
  --ds-space-6:  24px;
  --ds-space-8:  32px;
  --ds-space-10: 40px;
  --ds-space-12: 48px;

  /* ─── Typography — Fonts ──────────────────────────── */
  /* NOTE: 'General Sans' is the design intent (Fontshare, not on Google Fonts).
     Self-host required for full fidelity. Inter is the fallback. */
  --ds-font-sans:    'General Sans', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ds-font-display: 'General Sans', 'Inter', system-ui, sans-serif;
  --ds-font-mono:    'JetBrains Mono', ui-monospace, "SF Mono", Menlo, monospace;

  /* ─── Typography — Sizes ──────────────────────────── */
  --ds-fs-display:  28px;
  --ds-fs-h1:       18px;
  --ds-fs-h2:       15px;
  --ds-fs-h3:       13px;
  --ds-fs-body:     14px;
  --ds-fs-small:    13px;
  --ds-fs-label:    12px;
  --ds-fs-caption:  11px;
  --ds-fs-overline: 11px;

  /* ─── Typography — Line heights ───────────────────── */
  --ds-lh-tight: 1.2;
  --ds-lh-snug:  1.35;
  --ds-lh-body:  1.5;

  /* ─── App framing ─────────────────────────────────── */
  --ds-topbar-height:  64px;

  /* ─── Modal ───────────────────────────────────────── */
  --ds-modal-w-sm:     400px;
  --ds-modal-w-md:     520px;
  --ds-modal-w-lg:     720px;
  --ds-modal-w-xl:     920px;
  --ds-modal-radius:   12px;
  --ds-modal-pad-x:    20px;
  --ds-modal-pad-y:    16px;
  --ds-modal-body-pad: 20px;
  --ds-modal-gap:      14px;
  --ds-modal-overlay:  rgba(15, 18, 25, 0.45);
  --ds-modal-shadow:   0 24px 60px rgba(15, 18, 25, 0.28), 0 8px 20px rgba(15, 18, 25, 0.12);
}

/* ─── Theme variants ─────────────────────────────────────── */
[data-sb="light"] {
  --ds-sb-bg: var(--ds-n-25);
  --ds-sb-bg-hover: var(--ds-n-100);
  --ds-sb-bg-active: var(--ds-accent-soft);
  --ds-sb-text: var(--ds-n-700);
  --ds-sb-text-muted: var(--ds-n-500);
  --ds-sb-text-active: var(--ds-accent-fg);
  --ds-sb-border: var(--ds-n-150);
}
[data-identity="indigo"] {
  --ds-accent: #4f46e5;
  --ds-accent-hover: #4338ca;
  --ds-accent-soft: #eef2ff;
  --ds-accent-fg: #1e1b4b;
}
[data-identity="amber"] {
  --ds-accent: #b45309;
  --ds-accent-hover: #92400e;
  --ds-accent-soft: #fef3c7;
  --ds-accent-fg: #451a03;
}

/* ─── Root scope & typography ────────────────────────────── */
.ds-root, .ds-root * { box-sizing: border-box; }
.ds-root {
  font-family: var(--ds-font-sans);
  font-feature-settings: "cv11", "ss01";
  color: var(--ds-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizelegibility;
}
.ds-display { font-size: var(--ds-fs-display); font-weight: 600; line-height: var(--ds-lh-tight); letter-spacing: -0.02em; }
.ds-h1 { font-size: var(--ds-fs-h1); font-weight: 600; line-height: var(--ds-lh-snug); letter-spacing: -0.01em; }
.ds-h2 { font-size: var(--ds-fs-h2); font-weight: 600; line-height: var(--ds-lh-snug); }
.ds-h3 { font-size: var(--ds-fs-h3); font-weight: 600; line-height: var(--ds-lh-snug); }
.ds-body { font-size: var(--ds-fs-body); line-height: var(--ds-lh-body); }
.ds-small { font-size: var(--ds-fs-small); line-height: var(--ds-lh-body); color: var(--ds-text-muted); }
.ds-label { font-size: var(--ds-fs-label); font-weight: 500; line-height: var(--ds-lh-snug); }
.ds-caption { font-size: var(--ds-fs-caption); line-height: var(--ds-lh-snug); color: var(--ds-text-muted); }
.ds-overline { font-size: var(--ds-fs-overline); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ds-text-muted); }
.ds-mono { font-family: var(--ds-font-mono); font-feature-settings: "zero", "ss02"; }
.ds-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* The HTML `[hidden]` attribute MUST always hide the element. Browser UA sheets
   declare `[hidden] { display: none }` but its (0,1,0) specificity loses to any
   author rule that sets `display: …` on the same element (a known pitfall with
   `<svg>` defaults and flex children). The `!important` enforces the hidden
   contract globally so we can hide elements declaratively across the admin.

   ⚠ Restriction: NEVER combine `hidden` with `x-show` / `x-cloak` / any JS that
   reveals via inline `style="display: …"`. The `!important` here wins over
   inline styles, so Alpine's `x-show=true` would silently fail to reveal the
   element. Pattern accepted in this codebase: `hidden` only as a static
   default toggled via `setAttribute('hidden')` / `removeAttribute('hidden')`
   (see login.js `setLoading` for the canonical example). For Alpine-driven
   visibility, use `x-show` WITHOUT `hidden`. */
[hidden] { display: none !important; }

/* ─── Buttons ────────────────────────────────────────────── */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--ds-r-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
  white-space: nowrap;
}
.ds-btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.ds-btn-lg { height: 42px; padding: 0 18px; font-size: 14px; }
.ds-btn-icon { width: 32px; padding: 0; }
.ds-btn-primary { background: var(--ds-accent); color: white; border-color: var(--ds-accent); }
.ds-btn-primary:hover { background: var(--ds-accent-hover); border-color: var(--ds-accent-hover); }
.ds-btn-secondary { background: var(--ds-n-0); color: var(--ds-n-800); border-color: var(--ds-border-strong); box-shadow: var(--ds-shadow-xs); }
/* Branded hover: --ds-accent-soft picks up the tenant's primaryColor via the
   bridge in admin-api.js#applyV2BrandPaletteCssVariables (rule 113). On default
   branding, --ds-accent-soft is the DS green wash (#e6f1ee). */
.ds-btn-secondary:hover { background: var(--ds-accent-soft); }
.ds-btn-ghost { background: transparent; color: var(--ds-n-700); }
.ds-btn-ghost:hover { background: var(--ds-accent-soft); }
.ds-btn-danger { background: var(--ds-danger); color: white; border-color: var(--ds-danger); }
.ds-btn-danger:hover { background: rgb(185, 28, 28); border-color: rgb(185, 28, 28); }
.ds-btn:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }
.ds-btn:disabled, .ds-btn[disabled] {
  cursor: not-allowed; box-shadow: none;
  background: var(--ds-n-100) !important;
  color: var(--ds-n-400) !important;
  border-color: var(--ds-n-150) !important;
}
.ds-btn:disabled:hover, .ds-btn[disabled]:hover { background: var(--ds-n-100) !important; }

/* ─── Inputs ─────────────────────────────────────────────── */
.ds-input, .ds-select, .ds-textarea {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--ds-n-0);
  border: 1px solid var(--ds-border-strong);
  border-radius: var(--ds-r-md);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ds-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ds-textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; line-height: 1.5; }
.ds-input:focus, .ds-select:focus, .ds-textarea:focus {
  outline: none;
  border-color: var(--ds-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-accent) 18%, transparent);
}
.ds-input::placeholder { color: var(--ds-text-subtle); }
.ds-input-sm, .ds-select-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }

/* ─── Badges & chips ─────────────────────────────────────── */
.ds-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: var(--ds-r-pill);
  font-size: 11.5px; font-weight: 500; line-height: 1;
  white-space: nowrap;
}
.ds-badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.ds-badge-aguardando { background: var(--ds-badge-aguardando-bg); color: var(--ds-badge-aguardando-fg); }
.ds-badge-aguardando .ds-badge-dot { background: var(--ds-badge-aguardando-dot); }
.ds-badge-ia { background: var(--ds-badge-ia-bg); color: var(--ds-badge-ia-fg); }
.ds-badge-ia .ds-badge-dot { background: var(--ds-badge-ia-dot); }
.ds-badge-parado { background: var(--ds-badge-parado-bg); color: var(--ds-badge-parado-fg); }
.ds-badge-parado .ds-badge-dot { background: var(--ds-badge-parado-dot); }
.ds-badge-convertido { background: var(--ds-badge-convertido-bg); color: var(--ds-badge-convertido-fg); }
.ds-badge-convertido .ds-badge-dot { background: var(--ds-badge-convertido-dot); }
.ds-badge-encerrado { background: var(--ds-badge-encerrado-bg); color: var(--ds-badge-encerrado-fg); }
.ds-badge-encerrado .ds-badge-dot { background: var(--ds-badge-encerrado-dot); }
.ds-badge-neutral { background: var(--ds-n-100); color: var(--ds-n-700); }
.ds-badge-soft { background: var(--ds-accent-soft); color: var(--ds-accent-fg); }
.ds-badge-info { background: var(--ds-info-bg); color: var(--ds-info-fg); }
.ds-badge-success { background: var(--ds-success-bg); color: var(--ds-success-fg); }
.ds-badge-danger { background: var(--ds-danger-bg); color: var(--ds-danger-fg); }
.ds-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  background: var(--ds-n-100); color: var(--ds-n-700);
  border-radius: var(--ds-r-pill);
  font-size: 11px; font-weight: 500;
  white-space: nowrap;
}
.ds-badge-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--ds-danger); color: white;
  border-radius: var(--ds-r-pill);
  font-size: 11px; font-weight: 600; line-height: 1;
}

/* ─── Cards & KPIs ───────────────────────────────────────── */
.ds-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-r-lg);
  box-shadow: var(--ds-shadow-xs);
}
.ds-kpi {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-r-lg);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 6px;
}
.ds-kpi-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ds-n-500); }
.ds-kpi-value { font-size: 28px; font-weight: 600; line-height: 1.1; letter-spacing: -0.02em; color: var(--ds-n-900); }
.ds-kpi-meta { font-size: 12px; color: var(--ds-n-500); display: flex; align-items: center; gap: 6px; }
.ds-kpi-delta-up { color: var(--ds-success); font-weight: 500; }
.ds-kpi-delta-down { color: var(--ds-danger); font-weight: 500; }

/* ─── Alerts ─────────────────────────────────────────────── */
.ds-alert { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid; border-radius: var(--ds-r-md); font-size: 13px; }
.ds-alert-icon { flex-shrink: 0; width: 20px; height: 20px; display: grid; place-items: center; }
.ds-alert-body { flex: 1 1 0%; min-width: 0; }
.ds-alert-title { font-weight: 600; margin-bottom: 2px; }
.ds-alert-desc { color: inherit; opacity: 0.85; }
.ds-alert-info { background: var(--ds-info-bg); border-color: rgb(199, 215, 254); color: var(--ds-info-fg); }
.ds-alert-warning { background: var(--ds-warning-bg); border-color: rgb(254, 215, 170); color: var(--ds-warning-fg); }
.ds-alert-urgent { background: var(--ds-danger-bg); border-color: rgb(254, 202, 202); color: var(--ds-danger-fg); }
.ds-alert-success { background: var(--ds-success-bg); border-color: rgb(187, 247, 208); color: var(--ds-success-fg); }

/* ─── Tables ─────────────────────────────────────────────── */
.ds-table { width: 100%; border-collapse: collapse; background: var(--ds-surface); font-size: 13px; }
.ds-table thead th {
  text-align: left; padding: 10px 16px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ds-n-500);
  border-bottom: 1px solid var(--ds-border);
  background: var(--ds-n-25);
}
.ds-table tbody tr { border-bottom: 1px solid var(--ds-border); transition: background 0.12s; }
.ds-table tbody tr:hover { background: var(--ds-n-25); }
.ds-table tbody tr:last-child { border-bottom: none; }
.ds-table tbody td { padding: 12px 16px; vertical-align: middle; }
.ds-tr-actionable .ds-row-actions { opacity: 0; transition: opacity 0.12s; }
.ds-tr-actionable:hover .ds-row-actions { opacity: 1; }
.ds-tr-actionable:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: -2px; }
.ds-tr-actionable:focus-visible .ds-row-actions { opacity: 1; }
.ds-name-link { color: inherit; transition: color 0.12s; }
.ds-tr-actionable:hover .ds-name-link,
.ds-card:hover .ds-name-link { color: var(--ds-accent-fg); }

/* ─── Avatars ────────────────────────────────────────────── */
.ds-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--ds-n-100); color: var(--ds-n-700);
  font-weight: 600; flex-shrink: 0;
}
.ds-avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.ds-avatar-md { width: 36px; height: 36px; font-size: 13px; }
.ds-avatar-lg { width: 44px; height: 44px; font-size: 15px; }
.ds-avatar-xl { width: 56px; height: 56px; font-size: 18px; }
.ds-avatar-online { position: relative; }
.ds-avatar-online::after {
  content: ""; position: absolute; bottom: 0; right: 0;
  width: 10px; height: 10px; background: var(--ds-success);
  border: 2px solid white; border-radius: 50%;
}

/* ─── Sidebar ────────────────────────────────────────────── */
.ds-sidebar {
  background: var(--ds-sb-bg);
  color: var(--ds-sb-text);
  border-right: 1px solid var(--ds-sb-border);
  display: flex; flex-direction: column; height: 100%;
  font-size: 13px;
}
.ds-sb-brand { padding: 18px 16px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--ds-sb-border); }
.ds-sb-logo { width: 32px; height: 32px; border-radius: 8px; background: var(--ds-sb-accent); color: white; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.ds-sb-tenant { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1 1 0%; }
.ds-sb-tenant-name { font-weight: 600; font-size: 13px; color: var(--ds-sb-text-active); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-sb-tenant-plan { font-size: 11px; color: var(--ds-sb-text-muted); }
/* Semantic <h2> for screen-reader heading navigation (rule 113 a11y) — visual
   weight is the section eyebrow, not a real heading, but the markup is `<h2>`. */
.ds-sb-section { margin: 0; padding: 14px 12px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ds-sb-text-muted); }
.ds-sb-nav { display: flex; flex-direction: column; gap: 1px; padding: 0 8px; }
.ds-sb-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--ds-sb-text);
  cursor: pointer; font-size: 13px;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}
.ds-sb-item:hover { background: var(--ds-sb-bg-hover); color: var(--ds-sb-text-active); }
/* Keyboard focus must remain visible on the dark sidebar — the browser default
   outline is often invisible at this contrast. */
.ds-sb-item:focus-visible {
  outline: 2px solid var(--ds-sb-text-active);
  outline-offset: -2px;
}
/* Pre-paint active nav state — CSS-only mirror of `applyActiveNav` from
   admin-shell-v2.js. Each page declares <body data-admin-nav="<slug>">,
   and every sidebar item carries `data-nav-key`. By enumerating the slug
   pairs here we can highlight the current item on FIRST PAINT, before
   the deferred `admin-shell-v2.js` runs `applyActiveNav` and writes
   `aria-current="page"`. Without this rule there is a perceptible
   "no item highlighted" frame between body parse and DOMContentLoaded
   that the user reads as "the sidebar just reloaded". The JS path still
   runs and writes the actual `aria-current` attribute — that remains the
   single source of truth for screen readers; this rule only mirrors its
   visual effect ahead of time. The selector pairs must stay in sync with
   the 13 nav slugs in `scripts/sidebar-v2-rebuild.py`. */
body[data-admin-nav="attendances"]    .ds-sb-item[data-nav-key="attendances"],
body[data-admin-nav="conversations"]  .ds-sb-item[data-nav-key="conversations"],
body[data-admin-nav="proactive-chat"] .ds-sb-item[data-nav-key="proactive-chat"],
body[data-admin-nav="scheduling"]     .ds-sb-item[data-nav-key="scheduling"],
body[data-admin-nav="dashboard"]      .ds-sb-item[data-nav-key="dashboard"],
body[data-admin-nav="radar"]          .ds-sb-item[data-nav-key="radar"],
body[data-admin-nav="prospecting"]    .ds-sb-item[data-nav-key="prospecting"],
body[data-admin-nav="broadcasts"]     .ds-sb-item[data-nav-key="broadcasts"],
body[data-admin-nav="reports"]        .ds-sb-item[data-nav-key="reports"],
body[data-admin-nav="contacts"]       .ds-sb-item[data-nav-key="contacts"],
body[data-admin-nav="templates"]      .ds-sb-item[data-nav-key="templates"],
body[data-admin-nav="documents"]      .ds-sb-item[data-nav-key="documents"],
body[data-admin-nav="billing"]        .ds-sb-item[data-nav-key="billing"],
.ds-sb-item[aria-current="page"] { background: var(--ds-sb-bg-active); color: var(--ds-sb-text-active); font-weight: 500; position: relative; }
body[data-admin-nav="attendances"]    .ds-sb-item[data-nav-key="attendances"]::before,
body[data-admin-nav="conversations"]  .ds-sb-item[data-nav-key="conversations"]::before,
body[data-admin-nav="proactive-chat"] .ds-sb-item[data-nav-key="proactive-chat"]::before,
body[data-admin-nav="scheduling"]     .ds-sb-item[data-nav-key="scheduling"]::before,
body[data-admin-nav="dashboard"]      .ds-sb-item[data-nav-key="dashboard"]::before,
body[data-admin-nav="radar"]          .ds-sb-item[data-nav-key="radar"]::before,
body[data-admin-nav="prospecting"]    .ds-sb-item[data-nav-key="prospecting"]::before,
body[data-admin-nav="broadcasts"]     .ds-sb-item[data-nav-key="broadcasts"]::before,
body[data-admin-nav="reports"]        .ds-sb-item[data-nav-key="reports"]::before,
body[data-admin-nav="contacts"]       .ds-sb-item[data-nav-key="contacts"]::before,
body[data-admin-nav="templates"]      .ds-sb-item[data-nav-key="templates"]::before,
body[data-admin-nav="documents"]      .ds-sb-item[data-nav-key="documents"]::before,
body[data-admin-nav="billing"]        .ds-sb-item[data-nav-key="billing"]::before,
.ds-sb-item[aria-current="page"]::before {
  content: ""; position: absolute; left: 0;
  width: 3px; height: 16px;
  /* Use the always-white sidebar-active text token so the accent bar stays
     visible even when a tenant customizes `primaryColor` (which also fills
     `--ds-sb-bg` AND `--ds-sb-accent` — they'd collapse to the same color). */
  background: var(--ds-sb-text-active);
  border-radius: 0 3px 3px 0;
}
.ds-sb-item-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.ds-sb-item-label { flex: 1 1 0%; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-sb-user { margin-top: auto; padding: 12px; border-top: 1px solid var(--ds-sb-border); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ds-sb-user__avatar { flex-shrink: 0; }
.ds-sb-user__info { flex: 1 1 0%; min-width: 0; }
.ds-sb-user__name { font-size: 12.5px; font-weight: 500; color: var(--ds-sb-text-active); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-sb-user__email { font-size: 11px; color: var(--ds-sb-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-sb-user__actions { display: inline-flex; gap: 2px; align-items: center; }
/* Icon action button used by Personalização, Manual de uso, and Logout in the
   sidebar footer — matches the visual weight of `.ds-btn-icon` but uses the
   sidebar-specific text color tokens so it reads correctly on dark themes. */
.ds-sb-user-action {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  border: 0; background: transparent;
  border-radius: var(--ds-r-sm);
  color: var(--ds-sb-text-muted);
  cursor: pointer; text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.ds-sb-user-action:hover { background: var(--ds-sb-bg-hover); color: var(--ds-sb-text-active); }
.ds-sb-user-action:focus-visible {
  outline: 2px solid var(--ds-sb-text-active);
  outline-offset: -2px;
}

/* Honor reduced-motion: disable the 120ms hover/active transitions on sidebar
   items + footer actions for users with the OS preference set. Also gates the
   mobile slide-in transition on the 4 pages that use it (`.ds-app__sidebar`)
   so vestibular-sensitive users don't get the 200ms transform on toggle.
   `!important` is required because the mobile MQ below redeclares
   `transition: transform 0.2s ease` on `.ds-app__sidebar` at the same
   specificity (0,1,0) and later source order — without `!important`, the
   reduced-motion reset is shadowed by the MQ declaration. */
@media (prefers-reduced-motion: reduce) {
  .ds-sb-item,
  .ds-sb-user-action,
  .ds-app__sidebar { transition: none !important; }
}

/* ─── Mobile nav (shared) ───────────────────────────────────
   Hamburger trigger button + backdrop + sidebar slide-in behavior at ≤768px.
   Every V2 page must include `<button class="ds-mobile-nav-trigger">` in its
   topbar and `<div class="ds-mobile-nav-backdrop">` near the layout root,
   plus bind `mobileNavOpen ? 'is-open' : ''` on the `<aside class="ds-app__sidebar">`.
   Without these, mobile users have no way to reach the navigation. */
.ds-mobile-nav-trigger {
  display: none;
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: var(--ds-r-sm);
  border: 1px solid var(--ds-border);
  background: var(--ds-surface);
  color: var(--ds-text);
  cursor: pointer; flex-shrink: 0;
}
.ds-mobile-nav-trigger:hover { background: var(--ds-n-50); }
.ds-mobile-nav-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-accent) 18%, transparent);
}
.ds-mobile-nav-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 40;
}
/* ─── Tablet collapsed sidebar (769–1023px) ─────────────────
   Matches the prototype variant "Sidebar Colapsada · tablet · 64px":
   icon-only rail at 64px width with hidden labels, group headers, tenant
   block, user info, and footer buttons. Active item shows background only
   (the 3×16 lateral indicator is hidden because there's no room for it on
   a 64px rail). The Fila handoff badge collapses from "12" / "99+" to an
   8×8 red dot in the top-right of the icon to preserve the alert signal.
   Native `title` attrs on each `.ds-sb-item` provide tooltips since the
   label text is hidden. Page-local `<style>` inline rules declare
   `.ds-app__sidebar { width: 248px }` (specificity 0,1,0); using
   `aside.ds-app__sidebar` here (0,1,1) wins the cascade without `!important`
   or page edits. */
@media (min-width: 769px) and (max-width: 1023px) {
  aside.ds-app__sidebar {
    width: 64px;
    /* Lift the sidebar above `<main>` in the parent flex's stacking order
       so the user-menu popover, which renders absolutely-positioned at
       `left: calc(100% + 6px)` and visually overflows into the main area,
       intercepts pointer events on its own buttons instead of being
       painted-over by the later DOM sibling. Without this, the popover
       appears visible (alpha-composited above main) but every click on
       Manual / Personalização / Logout is captured by main.
       z-index 25 sits above page-local `.ds-topbar { z-index: 20 }`
       (declared inline in radar/scheduling/etc.) so the popover, painted
       within the aside's stacking context, isn't visually clipped or
       eclipsed by a sticky topbar when the user has scrolled main.
       Still below the modal scrim (50) and confirm-scrim (60) — any modal
       opened while the popover is showing trumps it as expected. */
    z-index: 25;
  }
  aside.ds-app__sidebar .ds-sb-brand {
    padding: 18px 16px 14px;
    justify-content: center;
  }
  aside.ds-app__sidebar .ds-sb-tenant,
  aside.ds-app__sidebar .ds-sb-section,
  aside.ds-app__sidebar .ds-sb-item-label,
  aside.ds-app__sidebar .ds-sb-user__info,
  aside.ds-app__sidebar .ds-sb-user__actions { display: none; }
  aside.ds-app__sidebar .ds-sb-nav { padding: 0 8px; }
  aside.ds-app__sidebar .ds-sb-item {
    justify-content: center;
    gap: 0;
    padding: 10px 0;
    position: relative;
  }
  /* The 3×16 lateral indicator on active state has no room on a 64px rail;
     the background is enough to communicate "you are here". */
  aside.ds-app__sidebar .ds-sb-item[aria-current="page"]::before { display: none; }
  /* Numeric/"99+" badge collapses to an 8×8 red dot so the alert signal
     stays visible without breaking the 64px width. Position mirrors the
     prototype: top:4px right:8px relative to the item. */
  aside.ds-app__sidebar .ds-sb-item .ds-badge-count {
    position: absolute;
    top: 4px; right: 8px;
    width: 8px; height: 8px;
    min-width: 8px; padding: 0;
    border-radius: 50%;
    font-size: 0;
    line-height: 0;
    color: transparent;
  }
  /* Footer block on a 64px rail: avatar acts as a toggle that opens a
     popover (Manual / Personalização / Logout) anchored to the right of
     the rail. Horizontal-row layout doesn't fit (~92px against ~40px of
     usable width) and a vertical stack of 4 round buttons wasted too much
     vertical space without proper hover context. `wireSidebarUserMenu`
     in admin-shell-v2.js adds role="button"/aria-expanded/keyboard handlers
     scoped to this breakpoint via matchMedia. */
  aside.ds-app__sidebar .ds-sb-user {
    position: relative;
    padding: 12px;
    justify-content: center;
  }
  aside.ds-app__sidebar .ds-sb-user__avatar { cursor: pointer; }
  /* Focus ring uses the sidebar's white text token (#fff) instead of the
     tenant accent because the accent can drop to 3:1 against the dark
     sidebar bg (or below, when a grandfathered tenant color is set —
     rule 113 allows luminance up to 0.18). White vs #121419 is 16.7:1,
     safely clears WCAG 1.4.11 for non-text contrast. Matches the
     `.ds-sb-item:focus-visible` pattern earlier in this file. */
  aside.ds-app__sidebar .ds-sb-user__avatar:focus-visible {
    outline: 2px solid var(--ds-sb-text-active);
    outline-offset: 2px;
  }
  aside.ds-app__sidebar .ds-sb-user.is-open .ds-sb-user__actions {
    display: flex;
    position: absolute;
    left: calc(100% + 6px);
    bottom: 8px;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    background: var(--ds-sb-bg);
    border: 1px solid var(--ds-sb-border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    /* z-index 10 sits above sidebar nav items (natural stacking) but well
       below the modal scrim (50) and confirm-scrim (60) — if a modal opens
       while the popover is showing, the modal must always trump it. */
    z-index: 10;
    /* Defensive ceiling for short viewports (e.g. 769×400 landscape on
       a small tablet): without this, the 3-button popover could push
       past the top of the viewport and become unreachable. The 24px
       budget covers the `bottom: 8px` anchor + 16px breathing room. */
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }
}

@media (max-width: 768px) {
  .ds-mobile-nav-trigger { display: inline-flex; }
  .ds-mobile-nav-backdrop.is-open { display: block; }
  /* Topbar actions overflow the viewport on narrow screens because the
     page-local `.ds-topbar` is a single-line flex (no wrap) holding the title +
     spacer + action buttons. Promote the wrap fix to the DS so every admin page
     (proactive-chat, templates, broadcasts, prospecting, scheduling, radar,
     documents, contacts) drops its actions to a full-width second row with the
     buttons sharing the width. Page topbars don't declare flex-wrap/flex-basis,
     so these add cleanly without !important despite the page <style> loading
     after this file. */
  .ds-topbar { flex-wrap: wrap; row-gap: 10px; }
  /* `flex: 0 1 auto` keeps each button at its intrinsic width (so a lone action
     doesn't stretch full-bleed) while still allowing 2+ buttons to shrink to
     fit. justify-content/center + white-space:nowrap already come from .ds-btn.
     The spacer stays on row 1 (it has no flex-basis:100%), pushing the actions
     to their own row below the title. */
  .ds-topbar__actions { flex-basis: 100%; flex-wrap: wrap; }
  .ds-topbar__actions > .ds-btn { flex: 0 1 auto; }
  /* Slide-in sidebar at mobile breakpoint — overrides page-local
     `position: sticky` and `display: none` patterns that some pages still
     declare. `.is-open` is bound from `mobileNavOpen` in each factory.
     z-index 45 sits ABOVE the mobile-nav backdrop (40) and BELOW any modal
     scrim (50) — modals always trump the sidebar without ambiguous DOM-order
     stacking.
     `!important` on `position` is required because every page declares its
     own `.ds-app__sidebar { position: sticky }` in a page-local `<style>`
     block that loads AFTER design-tokens.v2.css. Same specificity (0,1,0)
     means cascade order wins; without `!important`, page-local `sticky`
     defeats DS `fixed`, leaving the sidebar in flex flow (taking its 248px
     of layout width) while `transform: translateX(-100%)` only slides the
     visual off-screen — producing a 248px blank gap where the sidebar
     "would" have sat. */
  .ds-app__sidebar {
    position: fixed !important;
    top: 0; left: 0; height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 45;
    display: flex !important;
  }
  /* Width capped at 85vw for very narrow phones (e.g. 320px wide), where
     the default 248px would consume 78% of the viewport and crowd out
     touch targets in the page content visible behind a partially-open
     state. `aside.` (0,1,1) beats the page-local `.ds-app__sidebar`
     (0,1,0) without needing `!important`. */
  aside.ds-app__sidebar { width: min(248px, 85vw); }
  /* Box-shadow only when slid in — at closed state (`translateX(-100%)`)
     the 32px shadow leaks past the right edge into the visible viewport,
     showing a faint gray seam on the left side of mobile pages. */
  .ds-app__sidebar.is-open {
    transform: translateX(0);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.16);
  }
}

/* ─── Sidebar nav permission pre-hydration (V2 flicker fix) ─
 * admin-api.js sets is-tenant-admin / has-broadcasts / has-prospecting on
 * <html> from cached user metadata in <head>, before Alpine boots. The
 * rules below match the same items Alpine eventually shows via x-show, so
 * the sidebar renders its final state on first paint instead of "growing"
 * 50–150 ms later when Alpine initializes. Selectors are scoped with
 * [x-cloak] so the override only applies during the pre-Alpine phase —
 * once Alpine removes x-cloak, the rules stop matching and Alpine's
 * inline x-show style is authoritative. */
:root.is-tenant-admin .ds-sb-item[data-nav-perm="admin"][x-cloak],
:root.has-broadcasts  .ds-sb-item[data-nav-perm="broadcasts"][x-cloak],
:root.has-prospecting .ds-sb-item[data-nav-perm="prospecting"][x-cloak] {
  display: flex !important;
}
:root.is-tenant-admin .ds-btn[data-nav-perm="admin"][x-cloak] {
  display: inline-flex !important;
}
/* `.ds-sb-user-action` is the footer button used by Personalização (admin-only),
   Manual de uso (everyone), and Logout. Same pre-paint pattern as the sidebar
   nav items above — eliminates the flicker when an admin lands on a page and
   Alpine takes a beat to remove `x-cloak`. */
:root.is-tenant-admin .ds-sb-user-action[data-nav-perm="admin"][x-cloak] {
  display: inline-grid !important;
}

/* ─── Empty state ────────────────────────────────────────── */
.ds-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; text-align: center; gap: 12px; }
.ds-empty-icon { width: 56px; height: 56px; border-radius: 14px; background: var(--ds-n-50); border: 1px solid var(--ds-border); display: grid; place-items: center; color: var(--ds-n-400); }
.ds-empty-title { font-size: 14px; font-weight: 600; color: var(--ds-n-800); }
.ds-empty-desc { font-size: 13px; color: var(--ds-n-500); max-width: 320px; line-height: 1.5; }

/* ─── Tabs ───────────────────────────────────────────────── */
.ds-tabs { display: flex; gap: 4px; padding: 4px; background: var(--ds-n-100); border-radius: var(--ds-r-md); width: max-content; }
.ds-tab {
  padding: 6px 12px;
  border-radius: var(--ds-r-sm);
  font-size: 12.5px; font-weight: 500;
  color: var(--ds-n-600);
  background: transparent; border: none;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background 0.12s, color 0.12s;
}
.ds-tab:hover { color: var(--ds-n-800); }
.ds-tab:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }
.ds-tab-active { background: white; color: var(--ds-n-900); box-shadow: var(--ds-shadow-xs); }
.ds-tab-count { background: var(--ds-n-200); color: var(--ds-n-700); padding: 1px 6px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.ds-tab-active .ds-tab-count { background: var(--ds-n-100); }

/* ─── Modal ──────────────────────────────────────────────── */
.ds-modal-scrim {
  position: fixed; inset: 0;
  background: var(--ds-modal-overlay);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 50;
  animation: ds-modal-fade-in 0.16s ease-out;
}
.ds-modal {
  background: var(--ds-surface);
  border-radius: var(--ds-modal-radius);
  box-shadow: var(--ds-modal-shadow);
  display: flex; flex-direction: column;
  width: 100%; max-height: calc(100% - 48px);
  overflow: hidden;
  animation: ds-modal-rise 0.18s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.ds-modal-sm { max-width: var(--ds-modal-w-sm); }
.ds-modal-md { max-width: var(--ds-modal-w-md); }
.ds-modal-lg { max-width: var(--ds-modal-w-lg); }
.ds-modal-xl { max-width: var(--ds-modal-w-xl); }
.ds-modal-header { padding: var(--ds-modal-pad-y) var(--ds-modal-pad-x); border-bottom: 1px solid var(--ds-border); display: flex; align-items: flex-start; gap: 12px; flex-shrink: 0; }
.ds-modal-header-icon { flex-shrink: 0; width: 32px; height: 32px; border-radius: var(--ds-r-md); display: grid; place-items: center; background: var(--ds-accent-soft); color: var(--ds-accent-fg); }
.ds-modal-header-icon-danger { background: var(--ds-danger-bg); color: var(--ds-danger-fg); }
.ds-modal-header-icon-warning { background: var(--ds-warning-bg); color: var(--ds-warning-fg); }
.ds-modal-header-icon-info { background: var(--ds-info-bg); color: var(--ds-info-fg); }
.ds-modal-header-text { flex: 1 1 0%; min-width: 0; }
.ds-modal-title { font-size: var(--ds-fs-h2); font-weight: 600; line-height: 1.3; margin: 0; color: var(--ds-n-900); }
.ds-modal-desc { font-size: 12.5px; color: var(--ds-n-500); margin-top: 3px; line-height: 1.45; }
.ds-modal-close { width: 28px; height: 28px; flex-shrink: 0; border: none; background: transparent; border-radius: var(--ds-r-sm); color: var(--ds-n-500); cursor: pointer; display: grid; place-items: center; transition: background 0.12s, color 0.12s; }
.ds-modal-close:hover { background: var(--ds-n-100); color: var(--ds-n-800); }
.ds-modal-body { flex: 1 1 0%; min-height: 0; overflow: auto; padding: var(--ds-modal-body-pad); display: flex; flex-direction: column; gap: var(--ds-modal-gap); }
.ds-modal-body-flush { padding: 0; gap: 0; }
.ds-modal-footer { padding: 12px var(--ds-modal-pad-x); border-top: 1px solid var(--ds-border); background: var(--ds-n-25); display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.ds-modal-footer-end { justify-content: flex-end; }
.ds-modal-footer-spread { justify-content: space-between; }
.ds-modal-footer-help { font-size: 12px; color: var(--ds-n-500); flex: 1 1 0%; }

/* ─── Confirmation modal (lightweight) ───────────────────────
   Single-decision dialogs (delete, cancel, archive, close). Smaller and flatter
   than `.ds-modal-*` — no header/body/footer split. Pair with `role="dialog"` +
   `aria-modal="true"` + `aria-labelledby`. Default focus belongs on the SAFE
   button (Cancelar) per WCAG/UX for destructive confirms. Z-index 60 sits
   above `.ds-modal-scrim` (50), so it stacks correctly when opened from a
   modal/drawer. */
.ds-confirm-scrim { position: fixed; inset: 0; background: rgba(15, 18, 25, 0.32); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
/* position: relative is load-bearing — the canonical .ds-confirm-scrim markup
   places `<div style="position:absolute; inset:0;" @click="cancel()">` backdrop
   BEFORE the panel. Without `position: relative` the panel paints as a static
   in-flow descendant (CSS 2.1 §E.2 step 3) while the backdrop paints as a
   positioned descendant with z-index auto (step 6), i.e. ON TOP of the panel.
   The backdrop is transparent so the panel still renders, but it intercepts
   every click on the confirm/cancel buttons and routes them all to cancel(). */
.ds-confirm-panel { position: relative; background: var(--ds-surface); border-radius: var(--ds-r-lg); box-shadow: var(--ds-shadow-lg); max-width: 440px; width: 100%; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.ds-confirm-title { font-size: var(--ds-fs-h3); font-weight: 600; color: var(--ds-text); margin: 0; }
.ds-confirm-body { font-size: var(--ds-fs-body); color: var(--ds-text-muted); line-height: var(--ds-lh-normal); margin: 0; }
.ds-confirm-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

/* ─── Form fields ────────────────────────────────────────── */
/* Global brand tint for native form controls. Tints the checkmark/dot of
   native checkboxes and radios. Tenants customizing primaryColor see their
   brand here automatically; tenants on the default see the DS green. The
   custom-styled `.ds-radio input[type="radio"]` overrides this via
   `appearance: none` below — no conflict. */
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--ds-accent);
}

.ds-field { display: flex; flex-direction: column; gap: 6px; }
.ds-field-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ds-n-500); }
.ds-field-required { color: var(--ds-danger); margin-left: 2px; }
.ds-field-hint { font-size: 11.5px; color: var(--ds-n-500); }
.ds-field-row { display: flex; gap: 8px; }
.ds-radio { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; min-height: 36px; padding: 6px 4px; color: var(--ds-n-800); }
.ds-radio input[type="radio"] {
  appearance: none; width: 16px; height: 16px;
  border: 1.5px solid var(--ds-border-strong);
  border-radius: 50%; background: var(--ds-surface);
  cursor: pointer; flex-shrink: 0; position: relative;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ds-radio input[type="radio"]:hover { border-color: var(--ds-n-400); }
.ds-radio input[type="radio"]:checked { border-color: var(--ds-accent); border-width: 5px; }
.ds-radio input[type="radio"]:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ds-accent) 25%, transparent); }
.ds-radio input[type="radio"]:disabled { background: var(--ds-n-100); border-color: var(--ds-n-200); cursor: not-allowed; }
.ds-char-counter { font-family: var(--ds-font-mono); font-size: 11px; color: var(--ds-n-500); transition: color 0.12s; }
.ds-char-counter[data-state="warn"] { color: var(--ds-warning-fg); }
.ds-char-counter[data-state="danger"] { color: var(--ds-danger); font-weight: 600; }
.ds-form-helper { font-size: 12px; color: var(--ds-n-500); line-height: 1.45; margin-top: 6px; display: flex; align-items: flex-start; gap: 6px; }
.ds-form-helper-icon { color: var(--ds-n-400); flex-shrink: 0; margin-top: 1px; }

/* ─── Accordion ──────────────────────────────────────────── */
.ds-accordion { background: var(--ds-surface); border-top: 1px solid var(--ds-border); }
.ds-accordion-toggle {
  width: 100%; padding: 14px 20px;
  background: transparent; border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600;
  color: var(--ds-n-800);
  transition: background 0.12s;
}
.ds-accordion-toggle:hover { background: var(--ds-n-25); }
.ds-accordion-toggle:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: -2px; }
.ds-accordion-chevron { display: inline-flex; transition: transform 0.18s; color: var(--ds-n-500); }
.ds-accordion-toggle[aria-expanded="true"] .ds-accordion-chevron { transform: rotate(180deg); }
.ds-accordion-body { padding: 4px 20px 18px; display: flex; flex-direction: column; gap: 14px; }

/* ─── Drawer ─────────────────────────────────────────────── */
.ds-drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 100%;
  background: var(--ds-surface);
  border-left: 1px solid var(--ds-border);
  box-shadow: var(--ds-shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.ds-drawer-header { padding: 16px 20px; border-bottom: 1px solid var(--ds-border); display: flex; align-items: center; gap: 12px; }
.ds-drawer-body { flex: 1 1 0%; overflow: auto; padding: 20px; }
.ds-drawer-footer { padding: 16px 20px; border-top: 1px solid var(--ds-border); display: flex; gap: 8px; justify-content: flex-end; }

/* ─── Chat bubbles ───────────────────────────────────────── */
.ds-bubble-row { display: flex; margin-bottom: 4px; }
.ds-bubble-row-cliente { justify-content: flex-start; }
.ds-bubble-row-atendente, .ds-bubble-row-ia { justify-content: flex-end; }
.ds-bubble { max-width: 65%; padding: 8px 12px 6px; border-radius: 14px; font-size: 13.5px; line-height: 1.4; position: relative; box-shadow: rgba(0, 0, 0, 0.04) 0px 1px 1px; }
.ds-bubble-cliente { background: white; color: var(--ds-n-900); border: 1px solid var(--ds-border); border-bottom-left-radius: 4px; }
.ds-bubble-atendente { background: var(--ds-accent-soft); color: var(--ds-accent-fg); border-bottom-right-radius: 4px; }
.ds-bubble-ia { background: rgb(238, 244, 255); color: rgb(30, 58, 138); border-bottom-right-radius: 4px; border: 1px solid rgb(219, 232, 255); }
.ds-bubble-meta { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 10.5px; opacity: 0.6; justify-content: flex-end; }
.ds-bubble-row-cliente .ds-bubble-meta { justify-content: flex-start; }
.ds-chat-date { display: flex; align-items: center; justify-content: center; margin: 16px 0 12px; }
.ds-chat-date-pill { background: rgba(255, 255, 255, 0.85); border: 1px solid var(--ds-border); border-radius: 999px; padding: 4px 12px; font-size: 11.5px; font-weight: 500; color: var(--ds-n-500); backdrop-filter: blur(6px); }
.ds-chat-canvas {
  background-color: var(--ds-n-25);
  background-image: radial-gradient(circle at 1px 1px, rgba(0,0,0,0.04) 1px, transparent 0);
  background-size: 24px 24px;
}

/* ─── Misc utilities ─────────────────────────────────────── */
.ds-divider { height: 1px; background: var(--ds-border); border: none; margin: 0; }
.ds-divider-v { width: 1px; background: var(--ds-border); }
.ds-skeleton {
  background: linear-gradient(90deg, var(--ds-n-100) 0%, var(--ds-n-50) 50%, var(--ds-n-100) 100%);
  background-size: 200% 100%;
  animation: ds-skeleton 1.4s ease-in-out infinite;
  border-radius: 4px;
}
.ds-toast {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 60;
  min-width: 280px;
  padding: 12px 16px;
  border-radius: var(--ds-r-md);
  box-shadow: var(--ds-shadow-lg);
  font-size: var(--ds-fs-small);
}
.ds-toast-success { background: var(--ds-success-bg); color: var(--ds-success-fg); border: 1px solid color-mix(in srgb, var(--ds-success) 35%, transparent); }
.ds-toast-error { background: var(--ds-danger-bg); color: var(--ds-danger-fg); border: 1px solid color-mix(in srgb, var(--ds-danger) 35%, transparent); }
.ds-menu {
  min-width: 168px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-r-md);
  box-shadow: var(--ds-shadow-lg);
  padding: 4px;
  display: flex; flex-direction: column; gap: 2px;
}
.ds-menu-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border: none; background: transparent;
  border-radius: var(--ds-r-sm);
  font-size: var(--ds-fs-small);
  color: var(--ds-text);
  cursor: pointer; text-align: left;
}
.ds-menu-item:hover { background: var(--ds-n-50); }
.ds-menu-item:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: -2px; }
.ds-menu-item--danger { color: var(--ds-danger-fg); }
.ds-menu-item--danger:hover { background: var(--ds-danger-bg); }
.ds-menu-item:disabled { opacity: 0.6; cursor: progress; }
.ds-filter-chip {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--ds-r-pill);
  border: 1px solid var(--ds-border);
  background: var(--ds-surface);
  font-size: var(--ds-fs-label);
  color: var(--ds-text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
/* Unpressed chip hover: branded soft fill. The pressed state
   (`[aria-pressed="true"]`) already uses --ds-accent-hover (defined nearby). */
.ds-filter-chip:hover { background: var(--ds-accent-soft); }
.ds-filter-chip[aria-pressed="true"] { background: var(--ds-accent); border-color: var(--ds-accent); color: #fff; }
.ds-filter-chip[aria-pressed="true"]:hover { background: var(--ds-accent-hover); border-color: var(--ds-accent-hover); }
.ds-filter-chip:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }
.ds-filter-chip-count { font-size: var(--ds-fs-caption); color: var(--ds-text-muted); }
.ds-filter-chip[aria-pressed="true"] .ds-filter-chip-count { color: rgba(255, 255, 255, 0.85); }
.ds-frame { background: var(--ds-canvas); font-family: var(--ds-font-sans); color: var(--ds-text); overflow: hidden; position: relative; }
.ds-stars { display: inline-flex; gap: 2px; align-items: center; }
.ds-stars button { width: 32px; height: 32px; display: grid; place-items: center; background: transparent; border: none; cursor: pointer; color: var(--ds-n-300); border-radius: 6px; transition: color 0.12s, background 0.12s; }
.ds-stars button:hover { background: var(--ds-n-50); }
.ds-stars button[data-filled="true"] { color: oklch(0.75 0.16 80); }
.ds-stars button:focus-visible { outline: 2px solid var(--ds-accent); outline-offset: 2px; }

/* ─── Responsive modal (mobile) ──────────────────────────── */
@media (max-width: 520px) {
  .ds-modal-scrim { padding: 0; align-items: flex-end; }
  .ds-modal { border-radius: 14px 14px 0 0; max-height: 92%; animation: ds-modal-slide-up 0.22s cubic-bezier(0.2, 0.7, 0.2, 1); max-width: 100% !important; }
  .ds-modal::before { content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 36px; height: 4px; background: var(--ds-n-200); border-radius: 2px; }
  .ds-modal-header { padding-top: 22px; }
}
[data-device="mobile"] .ds-modal-scrim { padding: 0; align-items: flex-end; }
[data-device="mobile"] .ds-modal { border-radius: 14px 14px 0 0; max-height: 92%; animation: ds-modal-slide-up 0.22s cubic-bezier(0.2, 0.7, 0.2, 1); position: relative; max-width: 100% !important; }
[data-device="mobile"] .ds-modal::before { content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 36px; height: 4px; background: var(--ds-n-200); border-radius: 2px; }
[data-device="mobile"] .ds-modal-header { padding-top: 22px; }
[data-device="tablet"] .ds-modal-lg { max-width: 600px; }
[data-device="tablet"] .ds-modal-xl { max-width: 720px; }

/* ─── Keyframes ──────────────────────────────────────────── */
@keyframes ds-modal-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ds-modal-rise { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes ds-modal-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes ds-skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
