/* ==========================================================================
   Garimpo.ia — design system do painel
   Neutro (zinc), um acento dourado de marca, cores só pra status.
   Tipografia: Geist / Geist Mono. Sem dependência de build: CSS puro.
   Ordem: tokens → base → shell → componentes → telas específicas.
   ========================================================================== */

:root {
  /* superfícies */
  --bg: #fafafa;
  --card: #ffffff;
  --sunken: #f4f4f5;
  --hover: #f4f4f5;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  /* texto */
  --ink: #09090b;
  --ink-2: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  /* ação principal = tinta (botão preto, como a referência) */
  --primary: #18181b;
  --primary-ink: #fafafa;
  --primary-hover: #27272a;
  /* marca (garimpo = ouro) — usada com parcimônia: logo, destaques, foco */
  --brand: #b7862c;
  --brand-soft: #fbf3e2;
  --brand-ink: #7a5614;
  /* status */
  --ok: #16a34a;      --ok-soft: #f0fdf4;     --ok-ink: #15803d;     --ok-line: #bbf7d0;
  --warn: #d97706;    --warn-soft: #fffbeb;   --warn-ink: #b45309;   --warn-line: #fde68a;
  --danger: #dc2626;  --danger-soft: #fef2f2; --danger-ink: #b91c1c; --danger-line: #fecaca;
  --info: #2563eb;    --info-soft: #eff6ff;   --info-ink: #1d4ed8;   --info-line: #bfdbfe;
  /* compat com nomes antigos usados nos templates/JS */
  --code-bg: var(--sunken);
  --chip-bg: var(--sunken);
  --input-bg: #ffffff;
  --btn-hover: var(--sunken);
  --ring: color-mix(in srgb, var(--brand) 45%, transparent);
  --side-bg: #fafafa;
  --side-ink: var(--ink-2);
  --side-dim: var(--muted);
  --side-hover: #f0f0f2;
  --side-line: var(--line);
  --side-active-bg: #ececef;
  --side-active-ink: var(--ink);
  --menu-bg: var(--card);
  --menu-hover: var(--sunken);
  /* profundidade (sombras tintadas no cinza do fundo) */
  --shadow-xs: 0 1px 2px rgba(24, 24, 27, .04);
  --shadow-sm: 0 1px 2px rgba(24, 24, 27, .05), 0 1px 3px rgba(24, 24, 27, .04);
  --shadow: 0 12px 32px -12px rgba(24, 24, 27, .22), 0 2px 6px rgba(24, 24, 27, .05);
  /* forma */
  --radius-xs: 5px;
  --radius-sm: 7px;
  --radius-md: 10px;
  --radius-lg: 14px;
  /* gráficos */
  --viz-1: #10b981;
  --viz-2: #f59e0b;
  --viz-3: #0ea5e9;
  --viz-other: #a1a1aa;
  --viz-grid: #ececef;
  --viz-axis: #d4d4d8;
  --viz-tip-bg: #18181b;
  --viz-tip-ink: #fafafa;
  /* layout */
  --side-w: 252px;
  --top-h: 56px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --z-top: 40; --z-side: 50; --z-overlay: 90; --z-menu: 100;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #09090b;
  --card: #111113;
  --sunken: #18181b;
  --hover: #18181b;
  --line: #27272a;
  --line-strong: #3f3f46;
  --ink: #fafafa;
  --ink-2: #d4d4d8;
  --muted: #a1a1aa;
  --faint: #71717a;
  --primary: #fafafa;
  --primary-ink: #09090b;
  --primary-hover: #e4e4e7;
  --brand: #d9a547;
  --brand-soft: #2a2010;
  --brand-ink: #f0c873;
  --ok: #22c55e;      --ok-soft: #0f2418;     --ok-ink: #4ade80;     --ok-line: #14532d;
  --warn: #f59e0b;    --warn-soft: #2a1d07;   --warn-ink: #fbbf24;   --warn-line: #78350f;
  --danger: #f87171;  --danger-soft: #2a1011; --danger-ink: #fca5a5; --danger-line: #7f1d1d;
  --info: #60a5fa;    --info-soft: #0d1a2e;   --info-ink: #93c5fd;   --info-line: #1e3a8a;
  --input-bg: #0c0c0e;
  --side-bg: #0c0c0e;
  --side-hover: #18181b;
  --side-active-bg: #1f1f23;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow: 0 16px 40px -12px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .4);
  --viz-grid: #1f1f23;
  --viz-axis: #3f3f46;
  --viz-tip-bg: #fafafa;
  --viz-tip-ink: #09090b;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
a { color: var(--ink); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
.content a:where(:not(.btn):not(.nav-item):not([class*="pager"])) { text-decoration: underline; }
code, kbd, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--sunken); border: 1px solid var(--line); padding: 1px 6px; border-radius: var(--radius-xs); color: var(--ink-2); }
.num, .tabular { font-variant-numeric: tabular-nums; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--brand) 28%, transparent); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--ring); outline-offset: 2px;
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 200;
  background: var(--primary); color: var(--primary-ink); padding: 8px 12px; border-radius: var(--radius-sm);
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------------ ícones */
.ic { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 14px; height: 14px; }
.ic-lg { width: 20px; height: 20px; }

/* ================================================================== SHELL */

.layout { display: flex; min-height: 100dvh; }

/* --- barra lateral --- */
.sidebar {
  width: var(--side-w); flex: 0 0 auto;
  position: sticky; top: 0; height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--side-bg); border-right: 1px solid var(--side-line);
  transition: margin-left .28s cubic-bezier(.32, .72, 0, 1);
  z-index: var(--z-side);
}
:root[data-sidebar="off"] .sidebar { margin-left: calc(-1 * var(--side-w)); }

.workspace {
  display: flex; align-items: center; gap: 10px;
  height: var(--top-h); padding: 0 14px; border-bottom: 1px solid var(--side-line);
  flex: 0 0 auto;
}
.logo {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--primary); color: var(--primary-ink);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 1px 2px rgba(0, 0, 0, .18);
}
.logo svg { width: 18px; height: 18px; }
.workspace-txt { min-width: 0; flex: 1; line-height: 1.2; }
.workspace-name { display: block; font-weight: 600; font-size: 13.5px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-sub { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-sub .mono { font-size: 11px; }

.side-scroll { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-group { margin-bottom: 14px; }
.nav-label {
  padding: 8px 10px 6px; font-size: 11px; font-weight: 500; letter-spacing: .04em;
  text-transform: uppercase; color: var(--faint);
}
.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--side-ink); font-size: 13.5px; font-weight: 450; text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.nav-item .ic { color: var(--muted); transition: color .15s ease; }
.nav-item:hover { background: var(--side-hover); color: var(--ink); text-decoration: none; }
.nav-item:hover .ic { color: var(--ink-2); }
.nav-item.on { background: var(--side-active-bg); color: var(--side-active-ink); font-weight: 550; }
.nav-item.on .ic { color: var(--ink); }
.nav-count {
  margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 5px;
  display: inline-grid; place-items: center;
  font: 500 11px/1 var(--mono); color: var(--muted); background: var(--sunken); border: 1px solid var(--line);
}
.nav-count.is-warn { color: var(--warn-ink); background: var(--warn-soft); border-color: var(--warn-line); }

.side-foot { padding: 10px; border-top: 1px solid var(--side-line); flex: 0 0 auto; }

/* --- topo --- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-top);
  height: var(--top-h); flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 0 20px 0 14px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13.5px; color: var(--muted); }
.crumbs .sep { color: var(--faint); }
.crumbs b { color: var(--ink); font-weight: 550; white-space: nowrap; }
.crumbs span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.top-search {
  display: flex; align-items: center; gap: 8px; width: 260px; height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--muted);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.top-search:focus-within { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--ring); }
.top-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 13px; }
.top-search kbd { font-size: 10.5px; color: var(--faint); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.icon-btn {
  width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; position: relative;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2);
  cursor: pointer; transition: background .15s ease, color .15s ease, transform .1s ease;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn:active { transform: scale(.95); }
.icon-btn .pip { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--bg); }
.avatar {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--primary); color: var(--primary-ink); font: 600 11.5px/1 var(--font); letter-spacing: .02em;
}
.avatar-btn { display: flex; align-items: center; gap: 8px; padding: 2px; border: 0; background: none; cursor: pointer; border-radius: 9px; color: var(--ink); }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px var(--ring); }

.theme-ic-light, .theme-ic-dark { display: contents; }
.theme-ic-dark, :root[data-theme="dark"] .theme-ic-light { display: none; }
:root[data-theme="dark"] .theme-ic-dark { display: contents; }

/* --- conteúdo --- */
.content { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 26px 28px 72px; overflow-x: clip; }

/* cabeçalho de página */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1, h1 { font-size: 21px; font-weight: 600; letter-spacing: -.022em; line-height: 1.25; margin: 0; }
.page-desc { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 72ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -.012em; margin: 0; }
h3 { font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; margin: 0; }

/* sidebar no celular: overlay */
.side-scrim { display: none; }
.side-open { display: none; } /* legado: o botão de abrir agora fica no topo */
@media (max-width: 900px) {
  .top-search { display: none; }
  .content { padding: 20px 16px 64px; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; box-shadow: var(--shadow); }
  :root:not([data-sidebar="off"]) .side-scrim {
    display: block; position: fixed; inset: 0; z-index: calc(var(--z-side) - 1);
    background: rgba(9, 9, 11, .45); backdrop-filter: blur(2px);
  }
}
@media (prefers-reduced-motion: reduce) { .sidebar, html { transition: none; scroll-behavior: auto; } }

/* ============================================================ COMPONENTES */

/* --- botões --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: 500 13px/1 var(--font); letter-spacing: -.003em; white-space: nowrap; text-decoration: none;
  cursor: pointer; box-shadow: var(--shadow-xs);
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--hover); border-color: var(--line-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn .ic { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .14), inset 0 1px 0 rgba(255, 255, 255, .08); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { background: var(--hover); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--danger-ink); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }
.btn-ok, .btn.btn-ok { color: var(--ok-ink); border-color: var(--ok-line); background: var(--ok-soft); }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { filter: brightness(1.06); background: var(--brand); }
.btn.small, .btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn.small .ic, .btn-sm .ic { width: 14px; height: 14px; }
.btn-icon { width: 28px; padding: 0; }
.btn-icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-block { width: 100%; }
a.btn { text-decoration: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }
form.inline { display: inline-flex; }

/* --- badges (substituem os "chips" antigos; as classes antigas continuam) --- */
.badge, .chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font: 500 11.5px/1 var(--font); white-space: nowrap;
  color: var(--ink-2); background: var(--sunken); border: 1px solid var(--line);
}
.badge .ic { width: 12px; height: 12px; }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok, .chip-live, .chip-sent, .chip-sent_dm { color: var(--ok-ink); background: var(--ok-soft); border-color: var(--ok-line); }
.badge-warn, .chip-skipped_rate_limit, .chip-skipped_cooldown { color: var(--warn-ink); background: var(--warn-soft); border-color: var(--warn-line); }
.badge-danger, .chip-failed, .chip-off { color: var(--danger-ink); background: var(--danger-soft); border-color: var(--danger-line); }
.badge-info, .chip-shadow { color: var(--info-ink); background: var(--info-soft); border-color: var(--info-line); }
.badge-brand { color: var(--brand-ink); background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip b { margin-left: 2px; font-weight: 600; }

/* --- cartões --- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 18px 20px; margin-bottom: 16px; min-width: 0;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head, .card-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px;
}
.card.flush > .card-head, .card.flush > .card-header { padding: 16px 20px 0; }
.card-title { font-size: 15px; font-weight: 600; letter-spacing: -.012em; margin: 0; }
.card-desc { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.card-body { padding: 0 20px 18px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--sunken) 50%, transparent); }
.card-highlight { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 12%, transparent), var(--shadow-sm); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }

/* grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1100px) { .grid-main { grid-template-columns: minmax(0, 1fr); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* --- alertas / banners --- */
.alert, .banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; margin-bottom: 16px; border-radius: var(--radius-md);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-xs);
  font-size: 13px; line-height: 1.55;
}
.alert-ic {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center;
  background: var(--sunken); color: var(--ink-2);
}
.alert-body { flex: 1; min-width: 0; }
.alert-title { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.alert-text { color: var(--muted); margin-top: 1px; }
.alert-actions { flex: 0 0 auto; align-self: center; }
.alert-warn .alert-ic, .banner.warn .alert-ic { background: var(--warn-soft); color: var(--warn); }
.alert-ok .alert-ic { background: var(--ok-soft); color: var(--ok); }
.alert-danger .alert-ic { background: var(--danger-soft); color: var(--danger); }
.alert-info .alert-ic { background: var(--info-soft); color: var(--info); }
.alert-brand .alert-ic { background: var(--brand-soft); color: var(--brand); }
.banner.warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn-ink); }

/* aviso curto de ação (?msg=) */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; margin-bottom: 16px; border-radius: var(--radius-md);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  font-size: 13px; color: var(--ink);
  animation: flash-in .35s cubic-bezier(.32, .72, 0, 1);
}
.flash::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto;
  background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft);
}
.flash.is-error::before { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } }

#live-banner {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 11px 14px;
  border-radius: var(--radius-md); background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent);
  color: var(--brand-ink); font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer;
}
#live-banner[hidden] { display: none; }

/* --- estado vazio --- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 40px 20px; color: var(--muted);
}
.empty-ic {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 6px;
  background: var(--sunken); border: 1px solid var(--line); color: var(--ink-2);
}
.empty-ic .ic { width: 20px; height: 20px; }
.empty-title { font-weight: 600; color: var(--ink); font-size: 14px; }
.empty-text { font-size: 13px; max-width: 46ch; }
.empty .btn { margin-top: 10px; }

/* --- formulários --- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--muted); }
.content input[type="text"], .content input[type="url"], .content input[type="search"],
.content input[type="number"], .content input[type="password"], .content input[type="email"],
.content input[type="datetime-local"], .content input:not([type]), .content select, .content textarea, .input {
  height: 34px; padding: 0 10px; width: auto; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--ink);
  font: inherit; font-size: 13px; box-shadow: var(--shadow-xs);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.content textarea { height: auto; padding: 8px 10px; line-height: 1.5; resize: vertical; }
.content select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 16px;
}
.content input::placeholder, .content textarea::placeholder { color: var(--faint); }
.content input:focus-visible, .content select:focus-visible, .content textarea:focus-visible, .input:focus-visible {
  outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--ring);
}
.content input[type="file"] { height: auto; padding: 0; border: 0; box-shadow: none; color: var(--muted); font-size: 13px; background: none; }
.content input[type="file"]::file-selector-button {
  height: 32px; padding: 0 12px; margin-right: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); font: 500 13px var(--font); cursor: pointer;
}
.content input[type="file"]::file-selector-button:hover { background: var(--hover); }
:root[data-theme="dark"] input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 15px; height: 15px; margin: 0; }
.chk { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.chk[hidden] { display: none; }

/* switch (checkbox com cara de chave) */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--ink-2); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; flex: 0 0 auto;
  transition: background .2s ease;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .22s cubic-bezier(.32, .72, 0, 1);
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
:root[data-theme="dark"] .switch input:checked + .switch-track::after { background: var(--primary-ink); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--ring); }

.filters, .toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 220px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; align-items: start; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.form-grid label .small, .form-grid label .hint { font-weight: 400; }
.form-grid label input, .form-grid label select, .form-grid label textarea { width: 100%; }
.form-grid.compact { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-top: 10px; min-width: min(560px, 80vw); }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; grid-column: 1 / -1; }
.cfg { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cfg label { font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.targets-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* --- tabelas --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.card:not(.flush) > .table-wrap:last-child { margin-bottom: -18px; }
table { border-collapse: collapse; width: 100%; }
table.data th, table.data td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th {
  font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: .02em; text-transform: uppercase;
  padding-top: 9px; padding-bottom: 9px; background: color-mix(in srgb, var(--sunken) 55%, transparent); white-space: nowrap;
}
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:hover td { background: color-mix(in srgb, var(--sunken) 60%, transparent); }
table.data tbody tr:last-child td { border-bottom: 0; }
.card.flush table.data th:first-child, .card.flush table.data td:first-child { padding-left: 20px; }
.card.flush table.data th:last-child, .card.flush table.data td:last-child { padding-right: 20px; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.txt { max-width: 100%; overflow-wrap: break-word; word-break: break-word; }
.ellipsis-cell { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-title { font-weight: 500; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; color: var(--muted); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }

/* --- KPIs (estilo da referência: rótulo, número grande, variação + sparkline) --- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-height: 118px;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 11.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.kpi-icon { display: none; }
.kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi-of { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: -.01em; }
.kpi-foot { display: flex; align-items: center; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-delta {
  display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 6px; border-radius: 5px;
  font: 500 11.5px/1 var(--font); font-variant-numeric: tabular-nums;
  background: var(--sunken); color: var(--muted); border: 1px solid var(--line);
}
.kpi-delta svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.kpi-delta-up { color: var(--ok-ink); background: var(--ok-soft); border-color: var(--ok-line); }
.kpi-delta-down { color: var(--danger-ink); background: var(--danger-soft); border-color: var(--danger-line); }
.kpi-spark { width: 64px; height: 24px; flex: 0 0 auto; pointer-events: none; }
.kpi-spark svg { display: block; width: 100%; height: 100%; }

/* barra de progresso / medidor */
.meter { height: 6px; border-radius: 999px; background: var(--sunken); overflow: hidden; margin: 10px 0 4px; border: 1px solid var(--line); }
.meter-fill { display: block; height: 100%; background: var(--ok); border-radius: inherit; transition: width .6s cubic-bezier(.32, .72, 0, 1); }
.meter-fill.meter-warn { background: var(--warn); }
.meter-fill.meter-danger { background: var(--danger); }

/* lista de chave/valor */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; margin: 12px 0 0; align-items: center; }
.kv dt { font-size: 12.5px; color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }
.token-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.token { word-break: break-all; user-select: all; font-family: var(--mono); }

/* linha de lista (ex.: fila, timeline) */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-ic { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); }
.list-main { flex: 1; min-width: 0; }
.list-end { text-align: right; flex: 0 0 auto; }

/* passos numerados (instalação) */
.steps { list-style: none; counter-reset: s; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps > li { counter-increment: s; position: relative; padding-left: 40px; line-height: 1.55; color: var(--ink-2); }
.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center; font: 600 12px/1 var(--mono); color: var(--ink); background: var(--sunken); border: 1px solid var(--line);
}

/* tabs / segmentado */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: var(--sunken); border: 1px solid var(--line); }
.segmented a, .segmented button {
  height: 26px; padding: 0 10px; border-radius: 5px; border: 0; background: transparent; color: var(--muted);
  font: 500 12.5px/26px var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.segmented .on, .segmented [aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-xs); }

/* detalhes "editar" que abrem um popover */
.inline-details { display: inline-block; position: relative; }
.inline-details > summary { list-style: none; cursor: pointer; }
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-details[open] > form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow);
}

/* paginação */
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; }
.pager-btn {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--ink); box-shadow: var(--shadow-xs);
}
a.pager-btn:hover { background: var(--hover); }
.pager-btn[disabled] { opacity: .4; pointer-events: none; }
.pager-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pager-current { min-width: 32px; height: 32px; padding: 0 10px; border-radius: var(--radius-sm); display: inline-grid; place-items: center; background: var(--primary); color: var(--primary-ink); font: 600 12.5px/1 var(--mono); }

/* ============================================================ MASCOTE DO ROBÔ
   O "garimpeiro": rosto quadrado, antena com uma pepita.
   .is-run    garimpando  → olhos piscam, pepita brilha, feixe de varredura
   .is-sleep  dormindo    → olhos fechados, respira devagar, "z" sobem
   .is-pause  pausado     → olhos em traço, âmbar
   .is-new    aguardando  → contorno tracejado
   ======================================================================== */
.bot { --bot-c: var(--muted); --bot-face: var(--card); --bot-lamp: var(--bot-c); position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; }
.bot svg { width: 100%; height: 100%; overflow: visible; }
.bot .b-head, .bot .b-helmet { fill: var(--bot-face); stroke: var(--bot-c); stroke-width: 1.6; stroke-linejoin: round; }
.bot .b-ear { fill: var(--bot-face); stroke: var(--bot-c); stroke-width: 1.4; }
.bot .b-ant { stroke: var(--bot-c); stroke-width: 1.6; stroke-linecap: round; }
.bot .b-ridge { fill: none; stroke: var(--bot-c); stroke-width: 1.2; stroke-linecap: round; opacity: .55; }
.bot .b-brim { stroke: var(--bot-c); stroke-width: 2; stroke-linecap: round; }
.bot .b-lamp-ring { fill: var(--bot-face); stroke: var(--bot-c); stroke-width: 1.4; }
.bot .b-gem { fill: var(--bot-lamp); transform-box: fill-box; transform-origin: center; }  /* a lanterna */
.bot .b-lamp-bars { stroke: var(--bot-face); stroke-width: .9; stroke-linecap: round; opacity: 0; }
.bot .b-beam { fill: var(--brand); opacity: 0; transform-box: fill-box; transform-origin: center; }
.bot .b-cone { fill: url(#bot-cone-grad); opacity: 0; display: none; }
.bot .b-eye { fill: var(--bot-c); transform-box: fill-box; transform-origin: center; }
.bot .b-lid, .bot .b-flat { fill: none; stroke: var(--bot-c); stroke-width: 1.6; stroke-linecap: round; opacity: 0; }
.bot .b-scan { fill: url(#bot-scan-grad); opacity: 0; }
/* selo do canto: só um aparece por estado */
/* picareta: gira em torno da ponta do cabo (32.2, 8.6), como quem cava */
.bot .b-pick { opacity: 0; transform-box: view-box; transform-origin: 32.2px 8.6px; }
.bot .b-pick-handle { stroke: var(--bot-c); stroke-width: 1.5; stroke-linecap: round; }
.bot .b-pick-head { fill: none; stroke: var(--bot-c); stroke-width: 1.7; stroke-linecap: round; }
.bot .b-z { fill: var(--bot-c); font: 700 7px var(--font); opacity: 0; }
.bot .b-bars { stroke: var(--bot-c); stroke-width: 1.8; stroke-linecap: round; opacity: 0; }
.bot-lg { width: 56px; height: 56px; }
.bot-sm { width: 28px; height: 28px; }

/* garimpando: verde, lanterna dourada acesa, engrenagem girando */
.bot.is-run { --bot-c: var(--ok); --bot-lamp: var(--brand); }
.bot.is-run .b-lamp-ring { stroke: var(--brand); }
.bot.is-run .b-gem { animation: gem-glow 1.8s ease-in-out infinite; }
.bot.is-run .b-beam { animation: lamp-beam 1.8s ease-in-out infinite; }
.bot.is-run .b-eye { animation: eye-blink 4.2s infinite; }
.bot.is-run .b-scan { opacity: 1; animation: scan-sweep 2.4s cubic-bezier(.45, 0, .55, 1) infinite; }
.bot.is-run .b-pick { opacity: 1; animation: pick-swing 1.6s cubic-bezier(.5, 0, .3, 1) infinite; }
.bot-lg.is-run .b-cone { display: inline; animation: cone-glow 2.4s ease-in-out infinite; }
/* dormindo: cinza, lanterna apagada, zz */
.bot.is-sleep { --bot-c: var(--faint); }
.bot.is-sleep .b-eye { opacity: 0; }
.bot.is-sleep .b-lid { opacity: 1; }
.bot.is-sleep svg { animation: bot-breathe 3.6s ease-in-out infinite; transform-origin: 50% 90%; }
.bot.is-sleep .b-z { animation: z-float 3s ease-in infinite; }
.bot.is-sleep .b-z2 { animation-delay: 1s; }
.bot.is-sleep .b-z3 { animation-delay: 2s; }
/* pausado: laranja, olhos retos, "||" no canto e na lanterna */
.bot.is-pause { --bot-c: var(--warn); }
.bot.is-pause .b-eye { opacity: 0; }
.bot.is-pause .b-flat { opacity: 1; }
.bot.is-pause .b-bars, .bot.is-pause .b-lamp-bars { opacity: 1; }
/* nunca rodou: tracejado, lanterna apagada */
.bot.is-new { --bot-c: var(--faint); }
.bot.is-new .b-head { stroke-dasharray: 3 3; fill: transparent; }
.bot.is-new .b-eye { opacity: .45; }
/* tema escuro: os estados ativos brilham */
:root[data-theme="dark"] .bot.is-run svg { filter: drop-shadow(0 0 3px color-mix(in srgb, var(--ok) 55%, transparent)); }
:root[data-theme="dark"] .bot.is-pause svg { filter: drop-shadow(0 0 3px color-mix(in srgb, var(--warn) 50%, transparent)); }

@keyframes lamp-beam { 0%, 100% { opacity: .1; transform: scale(.75); } 50% { opacity: .32; transform: scale(1.05); } }
@keyframes lamp-beam-soft { 0%, 100% { opacity: .1; } 50% { opacity: .3; } }
@keyframes cone-glow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes pick-swing { 0%, 100% { transform: rotate(-28deg); } 45% { transform: rotate(-32deg); } 62% { transform: rotate(12deg); } 70% { transform: rotate(6deg); } 78% { transform: rotate(10deg); } }
@keyframes eye-blink { 0%, 44%, 50%, 100% { transform: scaleY(1); } 47% { transform: scaleY(.1); } }
@keyframes gem-glow { 0%, 100% { filter: drop-shadow(0 0 0 transparent); transform: scale(1); } 50% { filter: drop-shadow(0 0 3px var(--brand)); transform: scale(1.18); } }
@keyframes scan-sweep { 0% { transform: translateX(-14px); opacity: 0; } 15% { opacity: .9; } 85% { opacity: .9; } 100% { transform: translateX(14px); opacity: 0; } }
@keyframes bot-breathe { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(1px) rotate(-6deg) scale(.98); } }
@keyframes z-float { 0% { opacity: 0; transform: translate(0, 0) scale(.7); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -12px) scale(1.15); } }
/* "Reduzir movimento" do sistema (no Windows: Efeitos de animação desligado):
   o robozinho é o indicador de estado, então segue vivo — mas só com brilho,
   piscar e esmaecer, sem nada se deslocando, girando ou crescendo. */
@media (prefers-reduced-motion: reduce) {
  .bot *, .bot svg { animation: none !important; }
  .bot.is-run .b-gem { animation: gem-glow-soft 2.4s ease-in-out infinite !important; }
  .bot.is-run .b-beam { animation: lamp-beam-soft 2.4s ease-in-out infinite !important; }
  .bot.is-run .b-eye { animation: eye-blink 4.2s infinite !important; }
  .bot-lg.is-run .b-cone { animation: cone-glow 2.4s ease-in-out infinite !important; }
  .bot.is-run .b-pick { animation: pick-swing-soft 2.2s ease-in-out infinite !important; }
  .bot.is-sleep .b-z { animation: z-fade 3s ease-in-out infinite !important; }
  .bot.is-sleep .b-z2 { animation-delay: 1s !important; }
  .bot.is-sleep .b-z3 { animation-delay: 2s !important; }
}
@keyframes gem-glow-soft { 0%, 100% { filter: drop-shadow(0 0 0 transparent); } 50% { filter: drop-shadow(0 0 3px var(--brand)); } }
@keyframes pick-swing-soft { 0%, 100% { transform: rotate(-14deg); } 55% { transform: rotate(6deg); } }
@keyframes z-fade { 0%, 100% { opacity: 0; } 40% { opacity: 1; } }

/* cartão de status do robô (rodapé da barra lateral) */
.botcard {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 11px; border-radius: var(--radius-md);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow-xs);
}
.botcard-txt { flex: 1; min-width: 0; line-height: 1.3; }
.botcard-state { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.botcard-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.botcard-sub a { color: var(--brand-ink); font-weight: 500; }
.botcard-name {font: 500 10.5px/1 var(--mono); color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); position: relative; flex: 0 0 auto; }
.live-dot::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; background: var(--ok); opacity: .35; animation: live-pulse 1.8s ease-out infinite; }
@keyframes live-pulse { 0% { transform: scale(.6); opacity: .5; } 100% { transform: scale(2.2); opacity: 0; } }
.botcard + .botcard { margin-top: 8px; }
.botcard .icon-btn { width: 30px; height: 30px; color: var(--muted); }
.botcard .icon-btn:hover { color: var(--ink); }
.bots-more { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.bot-mini { display: flex; align-items: center; gap: 8px; padding: 4px 6px; font-size: 12px; color: var(--ink-2); }
.bot-mini .bot { width: 22px; height: 22px; }

/* cartão grande de status (Visão geral / Robôs) */
.bot-hero { display: flex; align-items: center; gap: 16px; }
.bot-hero .bot { width: 64px; height: 64px; }
.bot-hero-title { font-size: 16px; font-weight: 600; letter-spacing: -.012em; }
.bot-hero-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ============================================================ CONTA (drawer) */
.dw-overlay { position: fixed; inset: 0; z-index: var(--z-overlay); background: rgba(9, 9, 11, .42); backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s ease; }
.dw-overlay.open { opacity: 1; }
.dw {
  position: fixed; top: 12px; right: 12px; bottom: auto; left: auto; z-index: calc(var(--z-overlay) + 1);
  width: min(380px, calc(100vw - 24px));
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden;
  transform: translateY(-8px) scale(.98); opacity: 0; transform-origin: top right;
  transition: transform .28s cubic-bezier(.32, .72, 0, 1), opacity .2s ease;
}
.dw.open { transform: none; opacity: 1; }
.dw-grip { display: none; }
.dw-sheet { overflow: hidden; transition: height .3s cubic-bezier(.32, .72, 0, 1); }
.dw-view { padding: 14px; }
.dw-view[hidden] { display: none; }
.dw-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 32px; margin-bottom: 10px; }
.dw-head h2, .dw-view > h2 { font-size: 14.5px; font-weight: 600; margin: 0 0 4px; }
.dw-who { display: flex; align-items: center; gap: 10px; padding: 4px 4px 12px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.dw-who .avatar { width: 36px; height: 36px; font-size: 13px; }
.dw-who b { display: block; font-size: 13.5px; }
.dw-who span { font-size: 12px; color: var(--muted); }
.dw-x, .dw-back {
  width: 30px; height: 30px; flex: 0 0 auto; display: grid; place-items: center; padding: 0;
  border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.dw-x:hover, .dw-back:hover { background: var(--hover); color: var(--ink); }
.dw-x svg, .dw-back svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dw-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  height: 38px; padding: 0 10px; margin: 0; border-radius: var(--radius-sm);
  background: transparent; border: 0; color: var(--ink); font: 450 13.5px var(--font); cursor: pointer;
  transition: background .12s ease;
}
.dw-row:hover { background: var(--hover); }
.dw-row .ic { width: 16px; height: 16px; color: var(--muted); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dw-row > span { flex: 1; }
.dw-row .dw-caret { width: 15px; height: 15px; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dw-sep { height: 1px; background: var(--line); margin: 6px 0; }
.dw-check input { width: 15px; height: 15px; }
.dw-row.dw-danger { color: var(--danger-ink); }
.dw-row.dw-danger .ic { color: var(--danger); }
.dw-subhead { font-size: 11.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); margin: 10px 0 6px; }
.dw-view p { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 0 0 14px; }
.dw-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dw-inline { display: contents; }
.dw-btn {
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm); cursor: pointer;
  font: 500 13px var(--font); border: 1px solid var(--line); background: var(--card); color: var(--ink); box-shadow: var(--shadow-xs);
}
.dw-btn:hover { background: var(--hover); }
.dw-btn.ghost { box-shadow: none; }
.dw-btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.dw-btn.primary:hover { background: var(--primary-hover); }
.dw-btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.dw-btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.dw-form { display: flex; flex-direction: column; gap: 8px; }
.dw-form input {
  height: 36px; padding: 0 11px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--input-bg); color: var(--ink); font: inherit; font-size: 13.5px;
}
.dw-form input:focus-visible { outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--ring); }
.dw-form .dw-actions { margin-top: 6px; }
.dw-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 5px; background: var(--sunken); border: 1px solid var(--line); color: var(--muted); font: 500 11px/1 var(--mono); }
.dw-users { list-style: none; margin: 0 0 12px; padding: 0; }
.dw-users li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13.5px; }
.dw-users li:hover { background: var(--hover); }
.dw-me { font-size: 11px; font-weight: 500; color: var(--brand-ink); background: var(--brand-soft); padding: 2px 6px; border-radius: 5px; margin-left: 6px; }
@media (prefers-reduced-motion: reduce) { .dw, .dw-sheet, .dw-overlay { transition: none; } }

/* ================================================================ LOGIN */
.login-body {
  min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--bg);
}
.login-aside {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between;
  padding: 40px; color: #fafafa; background: #0b0b0d;
}
.login-aside::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(520px 380px at 18% 22%, rgba(217, 165, 71, .22), transparent 65%),
    radial-gradient(600px 420px at 85% 85%, rgba(16, 185, 129, .12), transparent 60%);
}
.login-aside::after {
  content: ""; position: absolute; inset: 0; opacity: .35;
  background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px); background-size: 22px 22px;
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
}
.login-aside > * { position: relative; z-index: 1; }
.login-logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.login-logo .logo { background: #fafafa; color: #09090b; }
.login-quote { max-width: 42ch; }
.login-quote h2 { font-size: 26px; line-height: 1.2; letter-spacing: -.03em; font-weight: 600; margin: 0 0 12px; color: #fafafa; }
.login-quote p { margin: 0; color: #a1a1aa; font-size: 14px; line-height: 1.6; }
.login-stats { display: flex; gap: 28px; }
.login-stats b { display: block; font: 600 20px/1.2 var(--font); letter-spacing: -.02em; }
.login-stats span { font-size: 12px; color: #a1a1aa; }
.login-main { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.login-card h1 { font-size: 22px; }
.login-card .page-desc { margin-top: 2px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.login-card input {
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--input-bg); color: var(--ink); font: inherit; font-size: 14px; box-shadow: var(--shadow-xs);
}
.login-card input:focus-visible { outline: none; border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--ring); }
.login-btn { height: 38px; width: 100%; margin-top: 4px; }
.login-erro { display: flex; gap: 8px; align-items: center; background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger-ink); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.login-hint { font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0 0; line-height: 1.6; }
.login-bot { margin-bottom: 22px; }
.login-aside .bot { --bot-face: #141417; }
.login-stats > div { min-width: 0; }
.login-logo-mobile { display: none; }
.login-erro .ic { flex: 0 0 auto; }
@media (max-width: 860px) {
  .login-body { grid-template-columns: minmax(0, 1fr); }
  .login-aside { display: none; }
  .login-logo-mobile { display: flex; }
}

/* ====================================================== TELAS ESPECÍFICAS */

/* tenant (superadmin "vendo como") */
.tenant-banner {
  display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 16px; border-radius: var(--radius-md);
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); color: var(--brand-ink); font-size: 13px;
}
.brand-tenant { display: block; }

/* --- gráfico de linhas (chart.js) --- */
.viz { position: relative; margin: 4px 0 0; }
.viz svg { display: block; }
.viz-empty { padding: 40px 0; text-align: center; }
.viz-legend { display: flex; gap: 14px; flex-wrap: wrap; }
.viz-key { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.viz-key i { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; stroke-dasharray: 3 4; }
.viz-baseline { stroke: var(--viz-axis); stroke-width: 1; }
.viz-axis { fill: var(--faint); font: 10.5px var(--mono); font-variant-numeric: tabular-nums; }
.viz-cross { stroke: var(--viz-axis); stroke-width: 1; stroke-dasharray: 3 3; }
.viz-dot { stroke: var(--card); stroke-width: 2; }
.viz-tip {
  position: absolute; top: 8px; pointer-events: none; z-index: 5;
  background: var(--viz-tip-bg); color: var(--viz-tip-ink);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12px; min-width: 128px; box-shadow: var(--shadow);
}
.viz-tip-h { font-weight: 600; margin-bottom: 4px; }
.viz-tip-r { display: flex; align-items: center; gap: 6px; line-height: 1.7; }
.viz-tip-r i { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.viz-tip-r b { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.viz-table-toggle { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.viz-table-toggle summary { cursor: pointer; }
.viz-table-toggle table { margin-top: 8px; }

/* --- donut --- */
.donut { margin: 4px 0 0; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-svg { width: 132px; height: 132px; flex: 0 0 auto; }
.donut-seg { transition: opacity .18s ease, stroke-width .18s ease; cursor: pointer; }
.donut.has-focus .donut-seg:not(.on) { opacity: .18; }
.donut.has-focus .donut-seg.on { stroke-width: 15; }
.donut-center-big { font: 600 15px var(--font); fill: var(--ink); }
.donut-center-sub { font-size: 8.5px; fill: var(--muted); }
.donut-legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; }
.donut-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 5px 8px; border-radius: 6px; list-style: none; transition: background .15s ease; }
.donut-legend li:hover, .donut-legend li.on { background: var(--hover); }
.donut-legend li.on { font-weight: 550; }
.donut.has-focus .donut-legend li:not(.on) { color: var(--muted); }
.donut-legend .dot2 { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.donut-legend .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .pct { color: var(--muted); font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.donut-empty { padding: 30px 0; color: var(--muted); }

/* --- barras divergentes --- */
.dbars { margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; }
.dbars-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.dbars-lbl { flex: 0 0 34%; max-width: 220px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.dbars-track { position: relative; flex: 1; height: 16px; border-radius: 4px; background: var(--sunken); }
.dbars-track::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--viz-axis); }
.dbars-neg, .dbars-pos { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; min-width: 0; }
.dbars-neg { right: 50%; }
.dbars-pos { left: 50%; }
.dbars-val { flex: 0 0 auto; min-width: 22px; font: 12px var(--mono); color: var(--muted); }

/* --- funil de etapas --- */
.stage-funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.stage-funnel li { display: grid; grid-template-columns: minmax(0, 12rem) 1fr 3rem 3rem; align-items: center; gap: 12px; font-size: 13px; }
.stage-funnel a { color: var(--ink-2); text-decoration: none !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-funnel a:hover { color: var(--ink); }
.stage-funnel b { text-align: right; font: 600 12.5px var(--mono); }
.stage-bar { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.stage-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--faint); }
.stage-bar .stage-respondido { background: var(--ok); }
.stage-bar .stage-shadow { background: var(--info); }
.stage-bar .stage-com_produto, .stage-bar .stage-na_fila { background: var(--viz-3); }
.stage-bar .stage-limite { background: var(--warn); }
.stage-bar .stage-falhou, .stage-bar .stage-reprovado_ia { background: var(--danger); }
@media (max-width: 640px) { .stage-funnel li { grid-template-columns: minmax(0, 8rem) 1fr 2.4rem; } .stage-funnel li > .small { display: none; } }

/* --- Pedidos --- */
#pedidos-table { table-layout: fixed; min-width: 980px; }
.conf { font: 600 12px var(--mono); }
.conf-hi { color: var(--ok-ink); }
.conf-mid { color: var(--warn-ink); }
.conf-lo { color: var(--danger-ink); }
.llm-tag { margin-top: 6px; font-size: 11.5px; color: var(--muted); padding: 2px 7px; border-radius: 5px; background: var(--sunken); border: 1px solid var(--line); display: inline-block; }
.llm-tag b { color: var(--ink); font-weight: 550; }
.llm-tag.llm-diff { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.llm-tag.llm-diff b { color: var(--warn-ink); }
.status-line { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--faint); display: inline-block; }
.dot-none { background: var(--line-strong); }
.dot-shadow { background: var(--info); }
.dot-queued, .dot-sending { background: var(--warn); }
.dot-sending { animation: dot-pulse 1s ease-in-out infinite; }
.dot-sent, .dot-sent_dm { background: var(--ok); }
.dot-failed { background: var(--danger); }
.dot-skipped_rate_limit, .dot-skipped_cooldown { background: var(--warn); }
@keyframes dot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.reply-txt { font-size: 12.5px; color: var(--muted); margin-top: 4px; max-width: 100%; overflow-wrap: break-word; word-break: break-word; }
.reply-err { font-size: 12px; color: var(--danger-ink); margin-top: 4px; max-width: 280px; }
.reply-edit { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.reply-edit[hidden] { display: none; }
.reply-edit textarea { width: 100%; font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--ink); resize: vertical; }
.reply-edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ctx-menu { position: fixed; z-index: var(--z-menu); min-width: 220px; max-width: 320px; max-height: 70vh; overflow-y: auto; background: var(--menu-bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow); padding: 4px; }
.ctx-menu[hidden] { display: none; }
.ctx-head { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); padding: 6px 8px 2px; }
.ctx-item { display: block; width: 100%; text-align: left; background: none; border: 0; color: inherit; font: inherit; font-size: 13px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.ctx-item:hover, .ctx-item:focus-visible { background: var(--hover); outline: none; }
.ctx-row { display: flex; align-items: center; }
.ctx-row .ctx-item:first-child { flex: 1; }
.ctx-del { width: auto; color: var(--muted); padding: 7px 10px; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* --- Respostas: venda --- */
.sale-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sale-form input { width: 7rem; }

/* --- Grupos (cartões) --- */
.glist { display: flex; flex-direction: column; gap: 10px; }
.gcard { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 14px 16px; background: var(--card); box-shadow: var(--shadow-xs); transition: border-color .15s ease; }
.gcard[hidden] { display: none; }
.gcard:hover { border-color: var(--line-strong); }
.gcard-head { display: flex; align-items: center; gap: 16px; }
.gcard-main { flex: 1 1 auto; min-width: 0; }
.gcard-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.gcard-title b { font-size: 14px; font-weight: 600; }
.gcard-sub { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.gcard-sub a { color: var(--muted); }
.gcard-stats { display: flex; gap: 22px; margin: 0; flex: 0 0 auto; }
.gcard-stats div { text-align: right; min-width: 56px; }
.gcard-stats dt { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.gcard-stats dd { margin: 2px 0 0; font: 600 15px var(--font); font-variant-numeric: tabular-nums; }
.gcard-stats dd.small { font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.gcard-toggle { flex: 0 0 auto; }
.gcard-cfg { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.gcard-cfg[hidden] { display: none; }
.gcard-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.gcard-label { font-size: 12px; font-weight: 500; color: var(--muted); min-width: 120px; }
.gcard-remove { margin-left: auto; }
@media (max-width: 720px) {
  .gcard-head { flex-wrap: wrap; }
  .gcard-main { flex-basis: 100%; }
  .gcard-stats div { text-align: left; min-width: 0; }
  .gcard-toggle { margin-left: auto; }
  .gcard-sub { white-space: normal; word-break: break-all; }
}

/* --- seletor de grupos (Publicitária) --- */
.group-picker { position: relative; display: inline-block; }
.group-picker > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); font: 500 13px var(--font); box-shadow: var(--shadow-xs);
}
.group-picker > summary::-webkit-details-marker, .group-picker > summary::marker { display: none; content: ""; }
.group-picker > summary:hover { background: var(--hover); }
.group-picker > summary::after { content: ""; width: 14px; height: 14px; background: currentColor; opacity: .5;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") center/contain no-repeat; }
.group-list { min-width: 260px; max-width: 90vw; max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--card); }
.group-list .chk { padding: 6px 8px; border-radius: 6px; }
.group-list .chk:hover { background: var(--hover); }
.group-list > div { display: flex; flex-direction: column; gap: 2px; }
.group-picker-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; box-shadow: var(--shadow); }

/* --- Publicitária: mídia e fila --- */
.ad-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); background: var(--sunken); border: 1px solid var(--line); }
.ad-media { display: flex; gap: 6px; }
.tsteps { display: flex; flex-direction: column; gap: 2px; min-width: 180px; }
.tstep { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12.5px; }
.tstep-ic { width: 18px; height: 18px; flex: 0 0 auto; border-radius: 6px; display: grid; place-items: center; }
.tstep-ic svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.tstep-ic.is-pending::before { content: ""; width: 5px; height: 5px; border-radius: 2px; background: var(--faint); }
.tstep-ic.is-done { background: var(--ok-soft); color: var(--ok); animation: tstep-pop .3s cubic-bezier(.34, 1.56, .64, 1); }
.tstep-ic.is-error { background: var(--danger-soft); color: var(--danger); animation: tstep-pop .3s cubic-bezier(.34, 1.56, .64, 1); }
.tstep-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--ink); animation: tstep-spin .8s linear infinite; }
.tstep-label { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tstep.is-done .tstep-label { color: var(--ink); }
.tstep.is-error .tstep-label { color: var(--danger-ink); font-weight: 500; }
.tstep.is-active .tstep-label { font-weight: 500; background: linear-gradient(90deg, var(--muted) 38%, var(--ink) 50%, var(--muted) 62%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: tstep-shimmer 1.6s linear infinite; }
.tstep-meta { flex: 0 0 auto; font-size: 11px; color: var(--muted); }
.tstep-extra { padding: 0 0 4px 26px; }
@keyframes tstep-spin { to { transform: rotate(360deg); } }
@keyframes tstep-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@keyframes tstep-pop { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .tstep-spin, .tstep.is-active .tstep-label, .tstep-ic.is-done, .tstep-ic.is-error { animation: none; } }

/* barras horizontais simples */
.bars td { padding: 4px 8px; border: 0; }
.bars .barcell { width: 60%; }
.bars .barcell i { display: block; height: 8px; background: var(--ink); border-radius: 999px; min-width: 2px; }
.bars .num { color: var(--muted); }

/* entrada escalonada do conteúdo */
.content > * { animation: rise .4s cubic-bezier(.32, .72, 0, 1) both; }
.content > *:nth-child(2) { animation-delay: .03s; }
.content > *:nth-child(3) { animation-delay: .06s; }
.content > *:nth-child(4) { animation-delay: .09s; }
.content > *:nth-child(n+5) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .content > * { animation: none; } }

/* --- Pedidos (redesign) --- */
.pedido-txt { margin: 8px 0 10px; color: var(--ink-2); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.ellipsis-line { display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-sub .ic { color: var(--faint); vertical-align: -2px; }
.product-link { display: block; font-weight: 500; color: var(--ink); line-height: 1.4; overflow-wrap: anywhere; }
.product-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.price { font: 600 13px var(--font); font-variant-numeric: tabular-nums; color: var(--ok-ink); }
#pedidos-table { min-width: 1000px; }
.segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.tiny .ic { vertical-align: -2px; color: var(--ok); }
.content .top-search input { height: auto; padding: 0; border: 0; box-shadow: none; background: transparent; }
.content .top-search input:focus-visible { box-shadow: none; }
.content a.product-link { text-decoration: none; }
.content a.product-link:hover { text-decoration: underline; }
#pedidos-table .reply-txt { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.content .segmented a { text-decoration: none; }

/* tabela que vira cartões no celular: <table class="data data-cards"> + td[data-label] */
@media (max-width: 760px) {
  table.data-cards, table.data-cards tbody, table.data-cards tr, table.data-cards td { display: block; width: 100%; }
  table.data-cards { min-width: 0 !important; table-layout: auto !important; }
  table.data-cards colgroup, table.data-cards thead { display: none; }
  table.data-cards tr { padding: 14px 16px; border-bottom: 1px solid var(--line); }
  table.data-cards tbody tr:hover td { background: none; }
  table.data-cards td { border: 0 !important; padding: 6px 0 !important; min-width: 0 !important; }
  table.data-cards td[data-label]::before {
    content: attr(data-label); display: block; margin-bottom: 3px;
    font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--faint);
  }
  table.data-cards td.nowrap { white-space: normal; }
}
.toolbar .top-search { display: flex; }
.form-grid label.chk, .form-grid label.switch { flex-direction: row; align-items: center; font-weight: 450; }
.form-grid .targets-group .chk { gap: 6px; }
.content .gcard-sub a { text-decoration: none; }
.content .gcard-sub a:hover { text-decoration: underline; }
.gcard-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); align-items: start; gap: 8px 14px; }
.gcard-row > .gcard-label { padding-top: 7px; }
.gcard-row-body { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.gcard-row-body > .form-grid { flex: 1 1 100%; }
@media (max-width: 640px) { .gcard-row { grid-template-columns: minmax(0, 1fr); } .gcard-row > .gcard-label { padding-top: 0; } }
.login-logo-mobile .logo { background: var(--primary); color: var(--primary-ink); }

/* ============================================================ ABAS (sublinhadas) */
.tabs {
  display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.content .tabs a { text-decoration: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto;
  height: 46px; padding: 0 10px; color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: color .15s ease;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); }
.tab.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--ink); }
.tab-n {
  min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  font: 500 11px/1 var(--mono); color: var(--muted); background: var(--sunken); border: 1px solid var(--line);
}
.tab.on .tab-n { color: var(--ink); background: var(--card); border-color: var(--line-strong); }
.tab-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; background: var(--faint); display: inline-block; }
.tone-ok { background: var(--ok); } .tone-info { background: var(--info); } .tone-warn { background: var(--warn); }
.tone-danger { background: var(--danger); } .tone-brand { background: var(--brand); }

/* ============================================================ PEDIDOS (caixa de entrada) */
.inbox-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--sunken) 40%, transparent); }
.inbox-bar .top-search { display: flex; min-width: 220px; background: var(--card); }
.inbox-bar select { max-width: 240px; }
.btn-active { border-color: var(--line-strong); background: var(--sunken); }
.filters-pop > summary { list-style: none; }
.filters-pop > summary::-webkit-details-marker { display: none; }
.filters-pop .pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 280px;
  display: flex; flex-direction: column; gap: 14px; padding: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.filters-pop .pop input[type="number"] { width: 100%; }

.req-list { list-style: none; margin: 0; padding: 0; }
.req {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 250px 176px; gap: 6px 18px; align-items: start;
  padding: 18px 20px; border-bottom: 1px solid var(--line); transition: background .15s ease;
}
.req:hover { background: color-mix(in srgb, var(--sunken) 45%, transparent); }
.req:last-child { border-bottom: 0; }

.req-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font: 600 14px/1 var(--font); color: #fff; background: #71717a;
}
.av-0 { background: #0f766e; } .av-1 { background: #7c3aed; } .av-2 { background: #c2410c; }
.av-3 { background: #2563eb; } .av-4 { background: #be185d; } .av-5 { background: #4d7c0f; }

.req-main { min-width: 0; }
.req-head { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.req-name { font-weight: 600; font-size: 14px; white-space: nowrap; }
.req-group { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.req-time { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 2px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.req-quote {
  margin: 10px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line-strong);
  font-size: 14px; line-height: 1.55; color: var(--ink); overflow-wrap: anywhere;
}
.req-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; color: var(--ink-2); background: var(--card); border: 1px solid var(--line); white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.tag .ic { color: var(--faint); }
.tag-strong { font-weight: 600; color: var(--ink); }
.content a.tag-link { text-decoration: none; color: var(--ink-2); }
.content a.tag-link:hover { background: var(--hover); color: var(--ink); }
.tag.llm-tag { margin: 0; background: var(--sunken); }
.tag.llm-diff { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.tag.conf { font-family: var(--mono); font-weight: 600; }
.conf-bar { width: 28px; height: 4px; border-radius: 999px; background: var(--sunken); overflow: hidden; display: inline-block; }
.conf-bar > span { display: block; height: 100%; border-radius: inherit; background: currentColor; }

.prod {
  display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow-xs);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.content a.prod { text-decoration: none; color: var(--ink); }
a.prod:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.prod-label { font-size: 11px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--faint); }
.prod-title { font-size: 13px; font-weight: 500; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod .price { font-size: 15px; }
.prod-none { background: transparent; border-style: dashed; box-shadow: none; }
.prod-none .prod-title { color: var(--muted); font-weight: 400; }

.req-status { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; border: 1px solid var(--line); background: var(--card); color: var(--ink-2); white-space: nowrap;
}
.status-pill.st-sent, .status-pill.st-sent_dm { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-ink); }
.status-pill.st-shadow { background: var(--info-soft); border-color: var(--info-line); color: var(--info-ink); }
.status-pill.st-queued, .status-pill.st-sending, .status-pill.st-skipped_rate_limit, .status-pill.st-skipped_cooldown { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-ink); }
.status-pill.st-failed { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }
.status-pill.st-none { color: var(--muted); }
.req-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.req-actions .btn-icon { width: 30px; height: 30px; }

.req-reply { grid-column: 2 / -1; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; min-width: 0; }
.req-reply .reply-err { max-width: none; display: flex; gap: 6px; align-items: flex-start; }
.reply-box { border: 1px solid var(--line); border-radius: var(--radius-md); background: color-mix(in srgb, var(--sunken) 55%, transparent); min-width: 0; }
.reply-box > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 8px 12px; font-size: 12.5px; color: var(--ink-2);
}
.reply-box > summary::-webkit-details-marker { display: none; }
.reply-box > summary .ic { color: var(--faint); flex: 0 0 auto; }
.reply-preview { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reply-chev { transition: transform .2s ease; }
.reply-box[open] .reply-chev { transform: rotate(180deg); }
.reply-box[open] .reply-preview { visibility: hidden; }
.reply-box .reply-txt { margin: 0; padding: 0 12px 12px 34px; font-size: 13px; color: var(--ink-2); line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }
.req .reply-edit { margin: 0; }
.req .reply-edit-actions { justify-content: flex-end; }

@media (max-width: 1100px) {
  .req { grid-template-columns: 36px minmax(0, 1fr) 220px; }
  .req-status { grid-column: 2 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; text-align: left; }
  .req-actions { margin: 0 0 0 auto; }
}
@media (max-width: 760px) {
  .req { grid-template-columns: 32px minmax(0, 1fr); padding: 16px; gap: 10px 12px; }
  .req-avatar { width: 32px; height: 32px; font-size: 13px; }
  .req-product, .req-status, .req-reply { grid-column: 1 / -1; }
  .inbox-bar select { max-width: none; flex: 1; }
  .inbox-bar .top-search { flex-basis: 100%; }
  .tabs { padding: 0 8px; }
}
.tag.conf-hi { color: var(--ok-ink); } .tag.conf-mid { color: var(--warn-ink); } .tag.conf-lo { color: var(--danger-ink); }
.content a.tab, .content a.prod, .content a.tag-link { text-decoration: none; }

/* ============================================================ GRUPOS (lista + ajustes) */
.add-pop > summary { list-style: none; }
.add-pop > summary::-webkit-details-marker { display: none; }
.add-pop .pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; width: min(380px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 14px; padding: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.add-pop .pop input { width: 100%; }
.add-pop .pop h3 { font-size: 14.5px; }

.stat-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden;
}
.stat { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-sub { font-size: 12px; color: var(--faint); }
@media (max-width: 900px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}

.list-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--sunken) 40%, transparent); }
.list-bar .top-search { display: flex; background: var(--card); }

.glist { gap: 0; }
.gcard { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 16px 20px; background: transparent; }
.gcard:last-child { border-bottom: 0; }
.gcard:hover { border-color: var(--line); background: color-mix(in srgb, var(--sunken) 45%, transparent); }
.gcard.is-open { background: color-mix(in srgb, var(--sunken) 55%, transparent); }
.gcard-head { gap: 14px; }
.g-avatar {
  width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center;
  font: 600 15px/1 var(--font); color: #fff;
}
.gcard-title b { font-size: 14px; }
.gcard-sub { font-size: 12.5px; color: var(--muted); }
.content .gcard-sub a { color: var(--muted); }
.g-note { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 12px; color: var(--ink-2); }
.g-note .ic { color: var(--faint); }
.gcard-stats { gap: 26px; }
.gcard-stats div { min-width: 60px; }
.gcard-stats dt { font-size: 11px; letter-spacing: .03em; }
.gcard-stats dd { font-size: 15px; }
.g-rate dd { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.rate-bar { width: 52px; height: 4px; border-radius: 999px; background: var(--sunken); overflow: hidden; display: block; }
.rate-bar > span { display: block; height: 100%; background: var(--ok); border-radius: inherit; }
.g-last dd { white-space: nowrap; color: var(--ink-2); }

.gcard-cfg { margin-top: 16px; padding: 0; border-top: 0; gap: 12px; }
.set-list { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-xs); overflow: hidden; }
.set-head { padding: 12px 16px 4px; font-size: 11.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--line); }
.set-head + .set-row, .set-list > .set-row:first-child { border-top: 0; }
.set-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-txt b { font-size: 13.5px; font-weight: 550; }
.set-txt span { font-size: 12.5px; color: var(--muted); }
.set-ctl { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.content .set-ctl select { min-width: 160px; }
.content input.num-in { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.set-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--sunken) 50%, transparent); }
.gcard-cfg > .set-foot { border: 1px solid var(--line); border-radius: var(--radius-md); }

@media (max-width: 900px) {
  .gcard-head { flex-wrap: wrap; }
  .gcard-main { flex: 1 1 calc(100% - 60px); }
  .gcard-stats { order: 3; flex-basis: 100%; padding-left: 52px; gap: 18px; }
  .gcard-stats div { text-align: left; min-width: 0; }
  .g-rate dd { align-items: flex-start; }
  .gcard-toggle { order: 2; }
}
@media (max-width: 640px) {
  .gcard { padding: 14px 16px; }
  .gcard-stats { padding-left: 0; }
  .gcard-toggle { margin-left: 52px; }
  .set-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .set-ctl { justify-content: flex-start; }
}
.g-avatar:not([class*="av-"]) { background: #71717a; }
.list-bar .top-search, .inbox-bar .top-search { flex: 1 1 260px; }
@media (max-width: 760px) {
  .content .inbox-bar select { flex: 1 1 100%; max-width: none; }
  .inbox-bar .filters-pop, .inbox-bar > .btn { flex: 1 1 0; }
  .inbox-bar .filters-pop > summary { width: 100%; }
  .inbox-bar .filters-pop .pop { left: 0; right: auto; }
  .gcard-head { align-items: flex-start; }
}

/* --- Visão geral do dono: servidores e robôs conectados --- */
.srv-total { display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 12px;
  border-radius: var(--radius-md); background: var(--ok-soft); color: var(--ok-ink); font-size: 13.5px; }
.srv-total b { font-size: 18px; }
.srv-total .ic { width: 16px; height: 16px; }
.srv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 900px) { .srv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .srv-grid { grid-template-columns: minmax(0, 1fr); } }
.srv-tile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-md); background: var(--card); min-width: 0; }
.srv-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.srv-dot.is-on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.srv-dot.is-off { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.srv-dot.is-idle { background: var(--muted); }
.srv-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-count { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.srv-count .ic { width: 14px; height: 14px; color: var(--muted); }
.srv-card .card-title .ic { width: 16px; height: 16px; vertical-align: -2px; }
