/* =========================================================================
   Recircula CRM — Design System
   Tokens centralizados. Nunca hard-code cor/tipografia fora deste bloco.
   ========================================================================= */
:root {
  /* Brand — verde institucional (resíduos / sustentabilidade) */
  --brand-50:  #F1F8F4;
  --brand-100: #E4F1EA;
  --brand-200: #C6E3D1;
  --brand-400: #2E9B72;
  --brand-500: #12805E;
  --brand-600: #0E6B4F;
  --brand-700: #0B5540;
  --brand-900: #072B21;

  /* Sidebar (tema escuro próprio) */
  --nav-bg: #0B2E24;
  --nav-bg-2: #0E3A2D;
  --nav-text: #A9C6BA;
  --nav-text-strong: #EAF4EF;
  --nav-active: #12805E;

  /* Neutros */
  --ink: #0F172A;
  --muted: #475569;
  --faint: #64748B;
  --line: #E2E8F0;
  --line-2: #EDF1F5;
  --page: #F4F6F8;
  --panel: #FFFFFF;
  --panel-2: #FAFBFC;

  /* Semânticos */
  --success: #15803D;
  --success-bg: #E8F5EC;
  --warning: #B45309;
  --warning-bg: #FDF3E3;
  --danger: #B91C1C;
  --danger-bg: #FBECEC;
  --info: #1D4ED8;
  --info-bg: #E9EFFD;
  --ai: #7C3AED;
  --ai-bg: #F2ECFE;
  --amber: #B45309;
  --amber-bg: #FDF3E3;

  /* Raios e sombras */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --sh-2: 0 8px 24px rgba(15, 23, 42, .10), 0 2px 6px rgba(15, 23, 42, .06);
  --sh-3: 0 24px 60px rgba(15, 23, 42, .22);

  /* Tipografia */
  --font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: 32px;
  --lh: 1.6;

  /* Movimento */
  --dur-1: 160ms;
  --dur-2: 220ms;
  --dur-3: 320ms;
  --ease-out: cubic-bezier(.16, .84, .44, 1);
  --ease-in: cubic-bezier(.5, 0, .84, .2);

  /* Espaçamento — escala base 4/8 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Pesos de fonte */
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extra: 800;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--brand-600); }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand-200); }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--brand-600); color: #fff; padding: 10px 16px; border-radius: var(--r-sm);
  text-decoration: none; transition: top var(--dur-1) var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* ---------------------------------------------------------------- Layout */
.app { display: grid; grid-template-columns: 250px 1fr; height: 100vh; overflow: hidden; }

.sidebar {
  background: var(--nav-bg);
  color: var(--nav-text);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--brand-900);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-600));
  display: grid; place-items: center; color: #fff;
}
.brand__name { font-family: var(--font-display); font-weight: 700; color: var(--nav-text-strong); font-size: 15px; line-height: 1.1; }
.brand__sub { font-size: 11px; color: var(--nav-text); letter-spacing: .06em; text-transform: uppercase; }

.nav { padding: 6px 12px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav__label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6E8C80; padding: 16px 10px 6px; }
.nav__item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 10px; border-radius: var(--r-sm); border: 0; background: transparent;
  color: var(--nav-text); font-size: var(--fs-base); font-weight: 500; text-align: left;
  transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
}
.nav__item svg { flex: none; }
.nav__item:hover { background: rgba(255,255,255,.06); color: var(--nav-text-strong); }
.nav__item.is-active { background: var(--nav-active); color: #fff; }
.nav__item.is-active svg { color: #fff; }
.nav__badge { margin-left: auto; background: rgba(255,255,255,.14); color: var(--nav-text-strong); font-size: 11px; padding: 1px 7px; border-radius: var(--r-pill); }
.nav__item.is-active .nav__badge { background: rgba(255,255,255,.25); }

.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.userbox { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: var(--brand-500); }
.avatar--sm { width: 26px; height: 26px; font-size: 11px; }
.avatar--amber { background: var(--amber); }
.avatar--info { background: var(--info); }
.avatar--ai { background: var(--ai); }

.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; overflow: hidden; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 24px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-size: var(--fs-md); font-weight: 600; }
.topbar__crumb { color: var(--faint); font-size: var(--fs-sm); }
.topbar__search { flex: 1; max-width: 420px; position: relative; }
.topbar__search input { width: 100%; padding-left: 36px; }
.topbar__search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.spacer { flex: 1; }

.tenant-switch { position: relative; }
.tenant-switch__btn {
  display: flex; align-items: center; gap: 9px; padding: 7px 11px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md);
  font-weight: 600; color: var(--ink);
}
.tenant-switch__btn:hover { border-color: var(--brand-400); }
.tenant-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 290px; z-index: 60;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--sh-3); padding: 8px; animation: pop var(--dur-2) var(--ease-out);
}
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; border-radius: var(--r-sm); text-align: left; }
.menu-item:hover { background: var(--panel-2); }
.menu-item.is-active { background: var(--brand-50); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }

.content { padding: 24px; flex: 1; min-width: 0; overflow-y: auto; }
.content--flush { padding: 0; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head__text { min-width: 0; }
.page-head h1 { font-size: var(--fs-xl); }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-head__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-weight: 600; font-size: var(--fs-base); background: var(--panel); color: var(--ink);
  transition: background var(--dur-1) var(--ease-out), border-color var(--dur-1), transform var(--dur-1);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand-600); color: #fff; }
.btn--primary:hover { background: var(--brand-700); }
.btn--ghost { background: transparent; border-color: var(--line); }
.btn--ghost:hover { background: var(--panel-2); border-color: #CBD5E1; }
.btn--subtle { background: var(--brand-50); color: var(--brand-700); }
.btn--subtle:hover { background: var(--brand-100); }
.btn--danger { background: var(--danger-bg); color: var(--danger); }
.btn--danger:hover { background: #F6DADA; }
.btn--watch { background: #E9F7F0; color: var(--brand-700); border-color: #BEE3CF; }
.btn--sm { padding: 6px 10px; font-size: var(--fs-sm); }
.btn--icon { padding: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--muted);
  transition: background var(--dur-1), color var(--dur-1), border-color var(--dur-1);
}
.icon-btn:hover { background: var(--panel-2); color: var(--ink); border-color: #CBD5E1; }
.icon-btn--plain { border-color: transparent; background: transparent; }
.icon-btn--plain:hover { background: var(--panel-2); }
.icon-btn--danger { color: var(--danger); }
.icon-btn--danger:hover { background: #FEF2F2; border-color: #FECACA; color: #B91C1C; }
.icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn:disabled:hover { background: var(--panel); color: var(--muted); border-color: var(--line); }

/* ---------------------------------------------------------------- Inputs */
.field { display: block; margin-bottom: 14px; }
.field > label, .label { display: block; font-size: var(--fs-sm); font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.label .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--panel); transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }
.textarea { resize: vertical; min-height: 92px; line-height: 1.55; }
.field__hint { font-size: var(--fs-xs); color: var(--faint); margin-top: 5px; }
.field__error { font-size: var(--fs-xs); color: var(--danger); margin-top: 5px; display: flex; gap: 5px; align-items: center; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.check { display: flex; align-items: center; gap: 8px; font-size: var(--fs-base); }
.check input { width: 16px; height: 16px; accent-color: var(--brand-600); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .field--full { grid-column: 1 / -1; }

/* ---------------------------------------------------------------- Chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--line); white-space: nowrap;
}
.chip--brand { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }
.chip--amber { background: var(--amber-bg); color: var(--amber); border-color: #F3D9A8; }
.chip--success { background: var(--success-bg); color: var(--success); border-color: #C4E3CD; }
.chip--danger { background: var(--danger-bg); color: var(--danger); border-color: #F0C7C7; }
.chip--info { background: var(--info-bg); color: var(--info); border-color: #C9D6F7; }
.chip--ai { background: var(--ai-bg); color: var(--ai); border-color: #DDCDFB; }
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip__x { border: 0; background: transparent; color: inherit; display: inline-grid; place-items: center; margin-left: 2px; padding: 0; opacity: .65; }
.chip__x:hover { opacity: 1; }

/* ---------------------------------------------------------------- Cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card__head { padding: 16px 18px; border-bottom: 1px solid var(--line-2); display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.card__head h3 { font-size: var(--fs-md); }
.card__body { padding: 18px; overflow-x: auto; }
.card__foot { padding: 14px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--sh-1); }
.stat__label { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.stat__value { font-family: var(--font-display); font-size: 28px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.stat__delta { font-size: var(--fs-xs); margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.stat__delta--up { color: var(--success); }
.stat__delta--down { color: var(--danger); }

/* ---------------------------------------------------------------- Kanban */
.board-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.board {
  display: flex; gap: 16px; padding: 20px 24px 28px; overflow-x: auto; overflow-y: hidden; align-items: stretch;
  flex: 1; min-height: 0;
}
.col { width: 300px; flex: none; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.col__head { display: flex; align-items: center; gap: 8px; padding: 0 4px 10px; }
.col__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.col__title { font-weight: 700; font-size: var(--fs-base); }
.col__count { color: var(--faint); font-size: var(--fs-sm); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 8px; }
.col__sum { margin-left: auto; font-size: var(--fs-xs); color: var(--faint); font-weight: 600; }
.col__list { display: flex; flex-direction: column; gap: 10px; padding: 4px; border-radius: var(--r-lg); flex: 1 1 auto; min-height: 90px; overflow-y: auto; overscroll-behavior: contain; transition: background var(--dur-1); }
.col__list.is-over { background: var(--brand-50); outline: 2px dashed var(--brand-400); outline-offset: -2px; }
.col__add { margin-top: 8px; width: 100%; padding: 9px; border: 1px dashed var(--line); border-radius: var(--r-md); background: transparent; color: var(--faint); font-weight: 600; }
.col__add:hover { border-color: var(--brand-400); color: var(--brand-600); background: var(--brand-50); }

.lead-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; cursor: grab;
  box-shadow: var(--sh-1); transition: box-shadow var(--dur-1), border-color var(--dur-1), transform var(--dur-1);
  border-left: 3px solid var(--brand-400);
}
.lead-card:hover { box-shadow: var(--sh-2); border-color: #CBD5E1; }
.lead-card:active { cursor: grabbing; }
.lead-card.is-dragging { opacity: .45; transform: rotate(1.5deg); }
.lead-card__top { display: flex; align-items: flex-start; gap: 10px; }
.lead-card__name { font-weight: 600; font-size: var(--fs-base); }
.lead-card__meta { font-size: var(--fs-xs); color: var(--faint); margin-top: 2px; }
.lead-card__val { font-weight: 700; font-size: var(--fs-sm); color: var(--brand-700); white-space: nowrap; }
.lead-card__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* Próxima ação do card */
.lead-card__next { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; padding: 8px 9px; border-radius: var(--r-sm); background: var(--brand-50); border: 1px solid var(--brand-100); }
.lead-card__next-ico { flex: none; color: var(--brand-600); margin-top: 1px; }
.lead-card__next-body { display: grid; gap: 2px; min-width: 0; }
.lead-card__next-action { font-weight: 600; font-size: var(--fs-sm); color: var(--ink); }
.lead-card__next-due { font-size: 11px; color: var(--brand-700); font-weight: 600; }
.lead-card__next.is-overdue { background: var(--danger-bg); border-color: #F0C7C7; }
.lead-card__next.is-overdue .lead-card__next-ico,
.lead-card__next.is-overdue .lead-card__next-due { color: var(--danger); }
.lead-card__next.is-today { background: var(--amber-bg); border-color: #F3D9A8; }
.lead-card__next.is-today .lead-card__next-ico,
.lead-card__next.is-today .lead-card__next-due { color: var(--amber); }
.lead-card__next.is-empty { background: var(--panel-2); border-color: var(--line); }
.lead-card__next.is-empty .lead-card__next-ico { color: var(--faint); }
.lead-card__next.is-empty .lead-card__next-action { color: var(--muted); font-weight: 500; }
.lead-card__next.is-empty .lead-card__next-due { color: var(--faint); font-weight: 500; }
.lead-card__foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.lead-card__icons { margin-left: auto; display: flex; gap: 8px; color: var(--faint); }
.lead-card__icons span { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; }

/* ---------------------------------------------------------------- Lead detail */
.detail-head { background: var(--panel); border-bottom: 1px solid var(--line); padding: 16px 24px; }
.detail-head__row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.detail-title { font-size: var(--fs-lg); font-family: var(--font-display); font-weight: 700; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); background: var(--panel); padding: 0 24px; overflow-x: auto; }
.tab {
  padding: 12px 14px; border: 0; background: transparent; color: var(--muted); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--brand-700); border-bottom-color: var(--brand-600); }
.tab__count { font-size: 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 6px; }
.tab.is-active .tab__count { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-700); }
.detail-body { padding: 24px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.detail-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 78px; }

.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.data-item { min-width: 0; }
.data-item__label { font-size: var(--fs-xs); color: var(--faint); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.data-item__value { margin-top: 3px; font-weight: 500; word-break: break-word; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tl { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding-bottom: 18px; position: relative; }
.tl:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.tl__icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); z-index: 1; }
.tl__icon--mail { background: var(--info-bg); color: var(--info); border-color: #C9D6F7; }
.tl__icon--wa { background: var(--success-bg); color: var(--success); border-color: #C4E3CD; }
.tl__icon--ai { background: var(--ai-bg); color: var(--ai); border-color: #DDCDFB; }
.tl__icon--stage { background: var(--warning-bg); color: var(--warning); border-color: #F3D9A8; }
.tl__title { font-weight: 600; }
.tl__time { font-size: var(--fs-xs); color: var(--faint); }
.tl__body { font-size: var(--fs-sm); color: var(--muted); margin-top: 3px; }

/* tasks */
.task { display: flex; align-items: flex-start; gap: 11px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
.task + .task { margin-top: 8px; }
.task.is-done { background: var(--panel-2); }
.task.is-done .task__title { text-decoration: line-through; color: var(--faint); }
.task__check { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand-600); flex: none; }
.task__title { font-weight: 600; }
.task__note { font-size: var(--fs-sm); color: var(--muted); margin-top: 3px; }
.task__meta { font-size: var(--fs-xs); color: var(--faint); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.task__body { display: grid; gap: 0; }
.task__body { flex: 1; min-width: 0; }

/* chat (AI + WhatsApp) */
.chat { display: flex; flex-direction: column; height: 560px; }
.chat__head { display: flex; align-items: center; gap: 11px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.chat__log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; background: var(--panel-2); }
.msg { max-width: 78%; display: flex; flex-direction: column; gap: 4px; }
.msg__bubble { padding: 10px 13px; border-radius: 14px; font-size: var(--fs-base); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg--in { align-self: flex-start; }
.msg--in .msg__bubble { background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg--out { align-self: flex-end; align-items: flex-end; }
.msg--out .msg__bubble { background: var(--brand-600); color: #fff; border-bottom-right-radius: 4px; }
.msg--ai.msg--in .msg__bubble { background: var(--ai-bg); border-color: #DDCDFB; }
.msg__meta { font-size: 11px; color: var(--faint); }
.chat__input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--panel); }
.chat__input textarea { flex: 1; min-height: 42px; max-height: 120px; resize: none; }
.typing { display: inline-flex; gap: 3px; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ai); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
.wa-head { display: flex; align-items: center; gap: 11px; padding: 13px 16px; background: #0B3D2E; color: #fff; }
.wa-head .chat__sub { color: #A9C6BA; font-size: var(--fs-xs); }
.wa-owner-pick { display: flex; flex-direction: column; gap: 3px; flex-shrink: 0; }
.wa-owner-pick__lbl { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #A9C6BA; }
.wa-head__select { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.28); border-radius: var(--r-sm); padding: 6px 8px; font: inherit; font-size: var(--fs-xs); max-width: 190px; cursor: pointer; }
.wa-head__select:hover { background: rgba(255,255,255,.18); }
.wa-head__select option { color: var(--ink); }
.wa-head__select:focus-visible { outline: 2px solid #7FD8B8; outline-offset: 1px; }

/* proposal */
.proposal { border: 1px solid var(--brand-200); border-radius: var(--r-lg); overflow: hidden; }
.proposal__head { background: var(--brand-50); padding: 13px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--brand-200); }
.prop-line { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
.prop-line__desc { min-width: 0; }
.prop-line__sub { font-size: var(--fs-xs); color: var(--faint); }
.prop-line__val { font-weight: 600; white-space: nowrap; }
.prop-total { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: var(--panel-2); }
.prop-total__value { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--brand-700); }
.prop-obs { padding: 12px 16px; border-bottom: 1px solid var(--line-2); background: var(--panel-2); }
.prop-obs .small { margin-top: 4px; }
.prop-group + .prop-group { border-top: 1px solid var(--line); }
.prop-group__title { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 10px 16px 2px; }
.prop-group__title + .prop-line { border-top: 0; }
.prop-blocked { border-color: #F0C7C7 !important; background: var(--danger-bg); }
.dump-line { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; background: var(--panel-2); }
.dump-line + .dump-line { margin-top: 10px; }
.dump-line__head { display: flex; align-items: center; margin-bottom: 8px; }
.dump-line .form-grid { gap: 10px; }
.sim-section + .sim-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.sim-section__title { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.esboco-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
.esboco-row > div:first-child { flex: 1; }
.esboco-row__val { font-weight: 700; color: var(--brand-700); white-space: nowrap; }

/* files */
.file-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
.file-row + .file-row { margin-top: 8px; }
.file-ico { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--panel-2); color: var(--muted); flex: none; border: 1px solid var(--line); }
.file-row__name { font-weight: 600; }
.file-row__meta { font-size: var(--fs-xs); color: var(--faint); }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 700; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:hover td { background: var(--panel-2); }
.table__actions { display: flex; gap: 6px; justify-content: flex-end; }

/* settings bits */
.setting-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.setting-row:last-child { border-bottom: 0; }
.setting-row__text { flex: 1; min-width: 0; }
.setting-row__title { font-weight: 600; }
.setting-row__desc { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.stage-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
.stage-row + .stage-row { margin-top: 8px; }
.stage-row__grip { color: var(--faint); cursor: grab; }
.stage-color { width: 26px; height: 26px; border-radius: var(--r-sm); border: 1px solid var(--line); padding: 0; }

.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track { position: absolute; inset: 0; background: #CBD5E1; border-radius: var(--r-pill); transition: background var(--dur-2); pointer-events: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform var(--dur-2) var(--ease-out); box-shadow: var(--sh-1); }
.switch input:checked + .switch__track { background: var(--brand-500); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }

/* segmented */
.segmented { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; padding: 6px 12px; border-radius: var(--r-sm); font-weight: 600; color: var(--muted); }
.segmented button.is-active { background: var(--panel); color: var(--ink); box-shadow: var(--sh-1); }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); z-index: 100; display: grid; place-items: center; padding: 24px; animation: fade var(--dur-2) var(--ease-out); }
.modal { background: var(--panel); border-radius: var(--r-lg); box-shadow: var(--sh-3); width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; animation: pop var(--dur-2) var(--ease-out); }
.modal--lg { max-width: 760px; }
.modal--sm { max-width: 420px; }
.modal__head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal__head h2 { font-size: var(--fs-md); }
.modal__close { margin-left: auto; }
.modal__body { padding: 20px; overflow-y: auto; }
.modal__foot { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* toast */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 12px 15px; border-radius: var(--r-md); box-shadow: var(--sh-3); animation: slidein var(--dur-2) var(--ease-out); font-size: var(--fs-base); max-width: 380px; }
.toast--success { background: #0E5A32; }
.toast--error { background: #7F1D1D; }
.toast--info { background: #1E3A8A; }

/* misc */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty__ico { width: 48px; height: 48px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 50%; background: var(--panel-2); color: var(--faint); border: 1px solid var(--line); }
.empty h3 { font-size: var(--fs-md); color: var(--ink); margin-bottom: 4px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.bold { font-weight: 600; }
.divider { height: 1px; background: var(--line-2); margin: 16px 0; }
.skeleton { background: linear-gradient(90deg, #EEF2F6 25%, #F6F9FB 50%, #EEF2F6 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-sm); }

.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-hero { background: radial-gradient(900px 500px at 20% 0%, #12805E 0%, #0B5540 45%, #072B21 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; }
.login-hero__feat { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; }
.login-hero__feat .chip { color: #fff; }
.login-form { display: grid; place-items: center; padding: 40px; }
.login-form__inner { width: 100%; max-width: 380px; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* city picker (motor do precificador) */
.city-picker { position: relative; min-width: 210px; }
.city-picker__btn { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel); color: var(--ink); text-align: left; font: inherit; }
.city-picker__btn:hover { border-color: #CBD5E1; }
.city-picker__btn .city-picker__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.city-picker.is-open .city-picker__btn { border-color: var(--brand-400); box-shadow: 0 0 0 3px var(--brand-100); }
.city-picker__pop { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); box-shadow: var(--sh-2); padding: 8px; }
.city-picker__search { display: flex; align-items: center; gap: 8px; padding: 0 4px 8px; border-bottom: 1px solid var(--line-2); color: var(--faint); }
.city-picker__search .input { border: 0; padding: 6px 2px; background: transparent; }
.city-picker__search .input:focus { box-shadow: none; }
.city-picker__list { max-height: 240px; overflow-y: auto; margin: 8px 0; display: grid; gap: 2px; }
.city-opt { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: var(--r-sm); font-size: var(--fs-sm); cursor: pointer; }
.city-opt:hover { background: var(--panel-2); }
.city-opt input { width: 16px; height: 16px; accent-color: var(--brand-600); flex: none; }
.city-opt[hidden] { display: none; }
.city-opt--empty { color: var(--faint); justify-content: center; cursor: default; }
.city-picker__group { display: grid; gap: 2px; }
.city-picker__group[hidden] { display: none; }
.city-picker__group + .city-picker__group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line-2); }
.city-picker__group-title { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 4px 8px; }
.city-picker__foot { display: flex; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line-2); }

/* ---------------------------------------------------------------- Utilities */
.nowrap { white-space: nowrap; }
.print-only { display: none; }
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ---------------------------------------------------------------- Logos / identidade */
.logo-edit { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.logo-preview { flex: none; }
.logo-preview img { width: 56px; height: 56px; object-fit: contain; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); padding: 4px; display: block; }
.brand__mark.has-logo { background: transparent; }
.brand__mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 7px; }
.tenant-switch__btn .avatar, .menu-item .avatar { overflow: hidden; }

/* ---------------------------------------------------------------- Campos do cadastro */
.field-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
.field-row + .field-row { margin-top: 8px; }
.field-row__label { font-weight: 600; }
.field-row .icon-btn { width: 30px; height: 30px; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ---------------------------------------------------------------- Kanban: grip + menu de coluna */
.col__head { position: relative; }
.col__grip { border: 0; background: transparent; color: var(--faint); cursor: grab; padding: 2px; display: inline-grid; place-items: center; border-radius: var(--r-sm); }
.col__grip:hover { color: var(--ink); background: var(--panel-2); }
.col__grip:active { cursor: grabbing; }
.col__menu-wrap { position: relative; margin-left: 2px; }
.col__menu { position: absolute; right: 0; top: calc(100% + 6px); width: 192px; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-3); padding: 6px; animation: pop var(--dur-2) var(--ease-out); }
.col__menu .menu-item { font-size: var(--fs-sm); padding: 8px 10px; }
.menu-item--danger { color: var(--danger); }
.menu-item--danger:hover { background: var(--danger-bg); }
.col.is-col-dragging { opacity: .5; }
.col.is-col-over { outline: 2px dashed var(--brand-400); outline-offset: 3px; border-radius: var(--r-lg); }
.col.has-menu { z-index: 25; }

/* ---------------------------------------------------------------- Card: ações rápidas + sem ação */
.lead-card { position: relative; }
.lead-card.is-no-action { background: #FEF7F7; border-color: #F3D6D6; }
.lead-card__quick { display: flex; gap: 2px; opacity: 0; transition: opacity var(--dur-1) var(--ease-out); }
.lead-card:hover .lead-card__quick, .lead-card:focus-within .lead-card__quick { opacity: 1; }
.quick-btn { border: 1px solid transparent; background: transparent; color: var(--faint); width: 26px; height: 26px; border-radius: var(--r-sm); display: inline-grid; place-items: center; }
.quick-btn:hover { background: var(--panel-2); color: var(--ink); border-color: var(--line); }
.quick-btn--up:hover { background: var(--success-bg); color: var(--success); border-color: #C4E3CD; }
.quick-btn--down:hover { background: var(--danger-bg); color: var(--danger); border-color: #F0C7C7; }
.lead-card__flag { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11px; font-weight: 600; color: var(--amber); background: var(--amber-bg); border: 1px solid #F3D9A8; border-radius: var(--r-sm); padding: 4px 8px; }

/* ---------------------------------------------------------------- Agenda (calendário) */
.cal-wrap { position: relative; }
.cal-badge { position: absolute; top: -5px; right: -5px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: var(--r-pill); display: grid; place-items: center; padding: 0 4px; }
.cal-panel { position: absolute; right: 0; top: calc(100% + 10px); width: 340px; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-3); animation: pop var(--dur-2) var(--ease-out); overflow: hidden; }
.cal-panel__head { display: flex; align-items: center; gap: 9px; padding: 13px 14px; border-bottom: 1px solid var(--line-2); background: var(--panel-2); }
.cal-panel__body { padding: 10px; max-height: 380px; overflow-y: auto; }
.cal-panel__foot { padding: 10px; border-top: 1px solid var(--line-2); }
.cal-group + .cal-group { margin-top: 10px; }
.cal-group__title { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 4px 6px; }
.cal-item { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: 0; background: transparent; border-radius: var(--r-sm); padding: 8px; }
.cal-item:hover { background: var(--panel-2); }
.cal-item__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--brand-400); }
.cal-item.is-overdue .cal-item__dot { background: var(--danger); }
.cal-item.is-today .cal-item__dot { background: var(--amber); }
.cal-item__t { font-weight: 600; font-size: var(--fs-sm); display: block; }
.cal-item__c { font-size: 11px; color: var(--faint); display: block; }

/* ---------------------------------------------------------------- Dashboard: gráficos */
.dash-themes { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.dash-compare { gap: 8px; }
.leads-filters { flex-wrap: wrap; row-gap: 10px; }
.chart-bars { display: flex; align-items: flex-end; gap: 12px; min-height: 210px; padding-top: 10px; }
.chart-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; height: 200px; justify-content: flex-end; }
.chart-bar__val { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.chart-bar__col { width: 100%; max-width: 42px; flex: 1; display: flex; align-items: flex-end; background: var(--line-2); border-radius: 8px; overflow: hidden; }
.chart-bar__fill { width: 100%; border-radius: 8px; min-height: 3px; opacity: .92; }
.chart-bar__label { font-size: 11px; color: var(--muted); max-width: 100%; text-align: center; }
.pie-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.pie { width: 170px; height: 170px; border-radius: 50%; flex: none; position: relative; }
.pie__hole { position: absolute; inset: 22%; border-radius: 50%; background: var(--panel); display: grid; place-content: center; text-align: center; }
.pie__num { font-family: var(--font-display); font-weight: 700; font-size: 22px; display: block; }
.pie__cap { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.pie-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 8px; }
.pie-legend li { display: flex; align-items: center; gap: 9px; font-size: var(--fs-sm); }
.pie-legend__dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.lead-mini { display: block; width: 100%; transition: box-shadow var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out); }
.lead-mini:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
.lead-mini svg { flex: none; }
.lead-mini__next { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding: 7px 9px; border-radius: var(--r-sm); background: var(--brand-50); border: 1px solid var(--brand-100); font-size: var(--fs-xs); color: var(--brand-700); font-weight: 600; }
.lead-mini__next.is-overdue { background: var(--danger-bg); border-color: #F0C7C7; color: var(--danger); }
.lead-mini__next.is-today { background: var(--amber-bg); border-color: #F3D9A8; color: var(--amber); }
.lead-mini__next.is-empty { background: var(--panel-2); border-color: var(--line); color: var(--faint); font-weight: 500; }

/* ---------------------------------------------------------------- Tarefas (lista cross-lead) */
.task__link { border: 0; background: transparent; color: var(--brand-700); font-weight: 600; font-size: var(--fs-xs); display: inline-flex; align-items: center; gap: 4px; padding: 0; }
.task__link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- Impressão */
@media print {
  .sidebar, .topbar, .page-head, .board-toolbar, .dash-themes, .toasts, .modal, .overlay, .cal-panel, .tenant-menu { display: none !important; }
  body { background: #fff; }
  .app { grid-template-columns: 1fr; }
  .content, .content--flush { padding: 0; overflow: visible; }
  .card { box-shadow: none; break-inside: avoid; }
  .stat { break-inside: avoid; }
  .lead-mini { break-inside: avoid; }
  .print-only { display: block !important; }
  .print-head { margin-bottom: 18px; }
  .print-head h1 { font-size: 22px; color: var(--brand-700); }
  .print-head p { color: var(--muted); margin-top: 4px; }
}

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1100px) {
  .detail-body { grid-template-columns: 1fr; }
  .detail-side { position: static; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 250px; z-index: 90; transform: translateX(-100%); transition: transform var(--dur-3) var(--ease-out); }
  .sidebar.is-open { transform: none; box-shadow: var(--sh-3); }
  .menu-toggle { display: inline-grid !important; }
  .scrim { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 80; }
}
@media (min-width: 901px) { .menu-toggle { display: none; } }
@media (max-width: 720px) {
  .content { padding: 16px; }
  .form-grid, .data-grid { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .page-head__actions { width: 100%; }
  .topbar { padding: 10px 16px; }
  .board { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------- Conector de canal (WhatsApp) */
.select--sm { padding: 6px 10px; font-size: var(--fs-sm); }
.msg__tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; opacity: .85; margin-right: 6px; vertical-align: 1px; }
.msg--template .msg__bubble, .msg--flow .msg__bubble { border-left: 3px solid rgba(255,255,255,.5); }
.msg--out.msg--template .msg__bubble, .msg--out.msg--flow .msg__bubble { border-left-color: rgba(255,255,255,.55); }
.msg--in.msg--template .msg__bubble, .msg--in.msg--flow .msg__bubble { border-left-color: var(--brand-400); }
.msg__ticks { display: inline-flex; vertical-align: -2px; }
.msg__ticks--read { color: #7FE3FF; }
.msg--in .msg__ticks--read { color: var(--info); }

.wa-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px 0; background: var(--panel); border-top: 1px solid var(--line); }
.wa-tools .select { min-width: 150px; }
.wa-window { margin: 10px 12px 0; padding: 9px 12px; border-radius: var(--r-md); font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px; }
.wa-window--closed { background: var(--amber-bg); color: var(--amber); border: 1px solid #F3D9A8; }
.wa-off { margin: 0; padding: 16px; font-size: var(--fs-sm); color: var(--muted); display: flex; align-items: center; gap: 8px; background: var(--panel); border-top: 1px solid var(--line); }

.diag { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.diag__title { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 10px 12px; background: var(--panel-2); border-bottom: 1px solid var(--line-2); }
.diag__row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
.diag__row:last-child { border-bottom: 0; }
.diag__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.diag__dot.is-ok { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.diag__dot.is-pending { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); }

.ev-list { display: flex; flex-direction: column; }
.ev { display: flex; align-items: flex-start; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line-2); }
.ev:last-child { border-bottom: 0; }
.ev__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 5px; }
.ev__dot--in { background: var(--success); }
.ev__dot--out { background: var(--brand-500); }
.ev__dot--sys { background: var(--faint); }
.ev__json { display: block; margin-top: 5px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 11px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 6px 8px; overflow-wrap: anywhere; }

/* Central de Conversas */
.wa-inbox { display: grid; grid-template-columns: minmax(280px, 340px) 1fr; overflow: hidden; min-height: 600px; }
.wa-list { display: flex; flex-direction: column; border-right: 1px solid var(--line); max-height: 680px; min-height: 0; }
.wa-list__head { padding: 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.wa-search { display: flex; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 0 10px; }
.wa-search .input { border: 0; background: transparent; padding: 8px 0; min-width: 0; }
.wa-search .input:focus { box-shadow: none; }
.wa-search > svg { color: var(--faint); flex: none; }
.wa-owner { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.wa-owner__label { font-size: var(--fs-xs); font-weight: 600; color: var(--faint); }
.wa-owner .select { width: 100%; }
.wa-seg { display: flex; gap: 4px; margin-top: 10px; overflow-x: auto; }
.wa-seg__btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; padding: 6px 10px; border-radius: var(--r-pill); cursor: pointer; font-family: inherit; }
.wa-seg__btn:hover { background: var(--panel-2); color: var(--ink); }
.wa-seg__btn.is-active { background: var(--brand-600); color: #fff; }
.wa-seg__n { font-size: 11px; opacity: .85; }
.wa-list__body { flex: 1; padding: 6px; }
.wa-list__foot { padding: 10px 14px; border-top: 1px solid var(--line); background: var(--panel); }
.wa-list__row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px; border: 0; background: transparent; border-radius: var(--r-md); cursor: pointer; font-family: inherit; }
.wa-list__row:hover { background: var(--panel-2); }
.wa-list__row.is-active { background: var(--brand-50); }
.wa-list__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wa-list__top { display: flex; align-items: center; gap: 8px; }
.wa-list__name { flex: 1; min-width: 0; font-weight: 700; font-size: var(--fs-sm); color: var(--ink); }
.wa-list__sub { font-size: var(--fs-xs); color: var(--faint); }
.wa-list__row.is-unread .wa-list__sub { color: var(--ink); font-weight: 500; }
.wa-list__side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.wa-list__badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--success); color: #fff; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.wa-list__lock { color: var(--amber); display: inline-flex; }
.wa-pane { min-width: 0; display: flex; flex-direction: column; }
.wa-pane .od-screen { flex: 1; }
@media (max-width: 900px) {
  .wa-inbox { grid-template-columns: 1fr; }
  .wa-list { max-height: 320px; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ============================ Caixa de Entrada de Oportunidades ============ */
.inbox { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; overflow: hidden; min-height: 600px; }
.inbox-list { display: flex; flex-direction: column; border-right: 1px solid var(--line); max-height: 680px; min-height: 0; }
.inbox-list__head { padding: 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.inbox-list__body { flex: 1; padding: 6px; }
.inbox-list__foot { padding: 10px 14px; border-top: 1px solid var(--line); background: var(--panel); }
.inbox-row { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 10px; border: 0; background: transparent; border-radius: var(--r-md); cursor: pointer; font-family: inherit; }
.inbox-row:hover { background: var(--panel-2); }
.inbox-row.is-active { background: var(--brand-50); }
.inbox-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inbox-row__top { display: flex; align-items: center; gap: 8px; }
.inbox-row__name { flex: 1; min-width: 0; font-weight: 700; font-size: var(--fs-sm); color: var(--ink); }
.inbox-row__sub { font-size: var(--fs-xs); color: var(--faint); }
.inbox-row__side { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.inbox-score { min-width: 34px; text-align: center; font-weight: 800; font-size: 11px; padding: 2px 6px; border-radius: var(--r-pill); }
.inbox-score--hi { background: var(--success-bg); color: var(--success); }
.inbox-score--mid { background: var(--amber-bg); color: var(--amber); }
.inbox-score--lo { background: var(--line-2); color: var(--faint); }
.inbox-detail { min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.inbox-head { padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.inbox-mail { flex: 1; overflow-y: auto; padding: 18px; background: var(--panel-2); }
.inbox-mail__body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; }
.inbox-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.agent-box { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: var(--panel); }
.agent-box__head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--ai-bg); color: var(--ai); font-weight: 700; font-size: var(--fs-sm); }
.agent-box__body { padding: 12px; }
.agent-meter { height: 8px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; margin: 6px 0 10px; }
.agent-meter__fill { height: 100%; border-radius: var(--r-pill); background: var(--brand-500); transition: width var(--dur-2) var(--ease-out); }
.agent-meter__fill--lo { background: var(--faint); }
.agent-reasons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.agent-reasons li { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-sm); }
.agent-reasons svg { flex: none; margin-top: 2px; }
.agent-reasons .is-pos { color: var(--success); }
.agent-reasons .is-neg { color: var(--danger); }
.agent-reasons .is-neu { color: var(--faint); }
.agent-extract { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox-list { max-height: 320px; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* =========================================================================
   Design System — página de referência viva
   ========================================================================= */
.ds-wrap { display: flex; flex-direction: column; gap: 18px; }
.ds-card { }
.ds-card .card__body { overflow: visible; }
.ds-sub { margin-bottom: 18px; }
.ds-sub:last-child { margin-bottom: 0; }
.ds-sub > h4 { font-family: var(--font-display); font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 0 0 10px; }
.ds-note { color: var(--muted); font-size: var(--fs-sm); margin-top: 14px; }
.ds-note code, .ds-sub code, .ds-swatch code, .ds-typo code, .ds-bar code, .ds-radius code, .ds-shadow code, .ds-motion code { font-size: var(--fs-xs); color: var(--brand-700); background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--r-sm); padding: 1px 5px; }
kbd { font-family: var(--font-body); font-size: 11px; background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--ink); }

.ds-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.ds-swatch { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); }
.ds-swatch__dot { width: 30px; height: 30px; border-radius: 8px; flex: none; border: 1px solid rgba(15, 23, 42, .10); box-shadow: inset 0 0 0 1px rgba(255,255,255,.35); }
.ds-swatch__meta { display: flex; flex-direction: column; min-width: 0; }
.ds-swatch__meta small { color: var(--faint); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .03em; }

.ds-type-family { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.ds-type-family > div { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; background: var(--panel-2); }
.ds-type-family small { display: block; color: var(--faint); font-size: var(--fs-xs); margin-top: 6px; }
.ds-type-sample { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.ds-typo { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.ds-typo__row { display: flex; align-items: baseline; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); background: var(--panel); }
.ds-typo__row:last-child { border-bottom: 0; }
.ds-typo__row code { flex: none; width: 76px; }
.ds-typo__row span { flex: 1 1 auto; min-width: 0; color: var(--ink); }
.ds-typo__row small { flex: none; color: var(--faint); font-size: var(--fs-xs); }

.ds-bars { display: flex; flex-direction: column; gap: 8px; }
.ds-bar { display: flex; align-items: center; gap: 12px; }
.ds-bar code { flex: none; width: 64px; }
.ds-bar__fill { height: 16px; border-radius: 4px; background: linear-gradient(90deg, var(--brand-400), var(--brand-600)); min-width: 4px; }
.ds-bar small { color: var(--faint); font-size: var(--fs-xs); width: 40px; text-align: right; }

.ds-radii { display: flex; flex-wrap: wrap; gap: 12px; }
.ds-radius { width: 92px; height: 72px; border: 1px solid var(--line); background: var(--panel-2); display: grid; place-items: center; gap: 4px; align-content: center; }
.ds-radius small { color: var(--faint); font-size: var(--fs-xs); }

.ds-shadows { display: flex; flex-wrap: wrap; gap: 20px; padding: 8px 0; }
.ds-shadow { width: 110px; height: 68px; border-radius: var(--r-md); background: var(--panel); display: grid; place-items: center; }

.ds-motion { display: flex; flex-wrap: wrap; gap: 14px; }
.ds-motion__row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 12px; background: var(--panel); }
.ds-motion__row span { font-weight: 600; }
.ds-motion__row small { color: var(--faint); font-size: var(--fs-xs); }

.ds-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ds-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 18px; }
.ds-grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

.is-focus-demo { border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--brand-100); }

.ds-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.ds-icon { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); color: var(--ink); }
.ds-icon small { color: var(--faint); font-size: 10px; letter-spacing: .02em; }

.ds-sidenav { width: 232px; max-width: 100%; background: var(--nav-bg); border-radius: var(--r-md); padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.ds-sidenav .nav__item { color: var(--nav-text); }
.ds-sidenav .brand { padding: 8px 8px 12px; }

@media (max-width: 640px) {
  .ds-typo__row { flex-wrap: wrap; }
  .ds-typo__row span { flex-basis: 100%; }
}


