/* =============================================================================
   sdr-app — design system (tokens idênticos à referência "SDR Extremo", shadcn)
   Tema escuro e claro por tokens oklch. Fonte: Geist / system-ui.
   ============================================================================= */
:root {
  --radius: .75rem;
  --radius-sm: .5rem;
  --radius-md: .75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;

  --background: oklch(98.5% 0 0);
  --foreground: oklch(20.4% 0 0);
  --card: oklch(100% 0 0);
  --card-foreground: oklch(20.4% 0 0);
  --popover: oklch(100% 0 0);
  --primary: oklch(59.6% .127 163.23);
  --primary-foreground: oklch(100% 0 0);
  --secondary: oklch(97% 0 0);
  --secondary-foreground: oklch(27% 0 0);
  --muted: oklch(97% 0 0);
  --muted-foreground: oklch(43.7% 0 0);
  --accent: oklch(97% 0 0);
  --accent-foreground: oklch(20.4% 0 0);
  --destructive: oklch(50.5% .19 27.52);
  --destructive-foreground: oklch(100% 0 0);
  --destructive-soft: oklch(93.6% .031 17.72);
  --border: oklch(94.7% 0 0);
  --input: oklch(86.9% 0 0);
  --ring: oklch(59.6% .127 163.23);
  --success: oklch(50.8% .105 165.61);
  --success-soft: oklch(95% .051 163.05);
  --warning: oklch(55.5% .146 49);
  --warning-soft: oklch(96.2% .058 95.62);
  --info: oklch(48.8% .217 264.38);
  --info-soft: oklch(93.2% .032 255.59);
  --brand-from: oklch(69.6% .149 162.48);
  --brand-to: oklch(77.3% .153 163.22);
  --chart-grid: #0000000f;
  --chart-axis: #0000004d;
  --sidebar: oklch(98.5% 0 0);
  --sidebar-foreground: oklch(43.7% 0 0);
  --sidebar-primary: oklch(59.6% .127 163.23);
  --sidebar-primary-foreground: oklch(100% 0 0);
  --sidebar-accent: oklch(95.4% 0 0);
  --sidebar-accent-foreground: oklch(20.4% 0 0);
  --sidebar-border: oklch(94.7% 0 0);
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Menlo", "Roboto Mono", monospace;
}

html[data-theme="dark"] {
  --background: oklch(14.6% 0 0);
  --foreground: oklch(98.5% 0 0);
  --card: oklch(20.4% 0 0);
  --card-foreground: oklch(98.5% 0 0);
  --popover: oklch(20.4% 0 0);
  --primary: oklch(77.3% .153 163.22);
  --primary-foreground: oklch(20.4% 0 0);
  --secondary: oklch(27% 0 0);
  --secondary-foreground: oklch(86.1% 0 0);
  --muted: oklch(27% 0 0);
  --muted-foreground: oklch(73.3% 0 0);
  --accent: oklch(27% 0 0);
  --accent-foreground: oklch(98.5% 0 0);
  --destructive: oklch(63.7% .208 25.33);
  --destructive-soft: oklch(63.7% .208 25.33 / .16);
  --border: oklch(27% 0 0);
  --input: oklch(37.1% 0 0);
  --ring: oklch(77.3% .153 163.22);
  --success: oklch(77.3% .153 163.22);
  --success-soft: oklch(69.6% .149 162.48 / .16);
  --warning: oklch(83.7% .164 84.43);
  --warning-soft: oklch(78.1% .158 72.25 / .16);
  --info: oklch(71.4% .143 254.62);
  --info-soft: oklch(62.6% .186 259.6 / .16);
  --chart-grid: #ffffff0a;
  --chart-axis: #fff3;
  --sidebar: oklch(14.6% 0 0);
  --sidebar-foreground: oklch(73.3% 0 0);
  --sidebar-primary: oklch(77.3% .153 163.22);
  --sidebar-primary-foreground: oklch(20.4% 0 0);
  --sidebar-accent: oklch(23.8% 0 0);
  --sidebar-accent-foreground: oklch(98.5% 0 0);
  --sidebar-border: oklch(23.8% 0 0);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.root { height: 100%; }

/* ------------------------------- login ----------------------------------- */
.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in oklch, var(--primary) 16%, transparent), transparent 60%),
    var(--background);
}
.login__card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 24px 60px -30px rgb(0 0 0 / .5);
}
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login__logo { width: 44px; height: 44px; border-radius: 12px; }
.login__title { font-size: 18px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.login__sub { color: var(--muted-foreground); font-size: 13px; margin: 2px 0 0; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 550; margin-bottom: 6px; color: var(--muted-foreground); }
.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--input);
  background: color-mix(in oklch, var(--background) 60%, transparent);
  color: var(--foreground);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 25%, transparent); }
.login__error { color: var(--destructive); font-size: 13px; min-height: 18px; margin: 2px 0 10px; }

/* ------------------------------- botões ---------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-md);
  border: 1px solid transparent; background: transparent; color: var(--foreground);
  font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--primary); color: var(--primary-foreground); }
.btn--primary:hover { opacity: .92; }
.btn--outline { border-color: var(--border); background: var(--card); }
.btn--outline:hover { background: var(--accent); }
.btn--ghost { color: var(--muted-foreground); }
.btn--ghost:hover { background: var(--accent); color: var(--accent-foreground); }
.btn--block { width: 100%; }
.btn--sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn--icon { width: 36px; padding: 0; }
.btn svg { width: 16px; height: 16px; }

/* ------------------------------- shell ----------------------------------- */
.shell { display: grid; grid-template-columns: 256px 1fr; height: 100%; }
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column; min-height: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.brand__logo { width: 32px; height: 32px; border-radius: 9px; }
.brand__name { font-weight: 650; font-size: 14.5px; letter-spacing: -.01em; }
.brand__sub { font-size: 11px; color: var(--muted-foreground); display: block; }
.nav { padding: 6px 10px; overflow-y: auto; flex: 1; min-height: 0; }
.nav__group { padding: 14px 6px 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted-foreground); }
.nav__item {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px;
  border-radius: 999px; color: var(--muted-foreground); font-weight: 500; font-size: 13.5px;
  cursor: pointer; transition: background .15s, color .15s;
}
.nav__item svg { width: 18px; height: 18px; flex: none; }
.nav__item:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.nav__item.is-active { background: color-mix(in oklch, var(--primary) 12%, transparent); color: var(--primary); }
.sidebar__foot { border-top: 1px solid var(--sidebar-border); padding: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: var(--radius-md); }
.user-chip:hover { background: var(--sidebar-accent); }
.avatar {
  width: 30px; height: 30px; border-radius: 999px; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 650;
  background: linear-gradient(135deg, var(--brand-from), var(--brand-to)); color: #06251c;
}
.user-chip__meta { min-width: 0; text-align: left; }
.user-chip__name { font-size: 12.5px; font-weight: 600; }
.user-chip__mail { font-size: 11px; color: var(--muted-foreground); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--background); }
.topbar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 12px;
  padding: 0 20px; border-bottom: 1px solid var(--border); background: color-mix(in oklch, var(--background) 80%, transparent);
  backdrop-filter: blur(6px);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted-foreground); }
.crumbs b { color: var(--foreground); font-weight: 600; }
.crumbs svg { width: 14px; height: 14px; opacity: .6; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card);
  color: var(--muted-foreground); min-width: 200px;
}
.search input { border: 0; background: transparent; color: var(--foreground); outline: none; width: 100%; }
.search kbd { font-family: var(--font-mono); font-size: 10.5px; border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 5px; color: var(--muted-foreground); }
.content { padding: 22px 24px 40px; overflow-y: auto; min-height: 0; flex: 1; }

/* ------------------------------- cards ----------------------------------- */
.page-head { margin-bottom: 18px; }
.page-title { font-size: 20px; font-weight: 650; margin: 0; letter-spacing: -.015em; }
.page-sub { color: var(--muted-foreground); margin: 3px 0 0; font-size: 13.5px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px;
}
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi__label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted-foreground); font-weight: 500; }
.kpi__label svg { width: 15px; height: 15px; }
.kpi__value { font-family: var(--font-mono); font-size: 30px; font-weight: 600; margin-top: 10px; letter-spacing: -.02em; }
.kpi__hint { font-size: 11.5px; color: var(--muted-foreground); margin-top: 4px; }
.kpi__value.is-zero { opacity: .55; }
.alert {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-lg);
  border: 1px solid color-mix(in oklch, var(--warning) 35%, var(--border));
  background: var(--warning-soft); color: var(--foreground); margin-bottom: 16px;
}
.alert__icon { width: 20px; height: 20px; color: var(--warning); flex: none; }
.alert__title { font-weight: 600; font-size: 13.5px; }
.alert__text { font-size: 12.5px; color: var(--muted-foreground); }
.alert .btn { margin-left: auto; }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 256px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.is-open { transform: none; } .menu-btn { display: inline-flex !important; } }
.menu-btn { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-title { font-size: 14px; font-weight: 600; margin: 0; }
.chart { width: 100%; height: 180px; }
.list { display: flex; flex-direction: column; }
.list__row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.list__row:last-child { border-bottom: 0; }
.list__name { font-weight: 600; font-size: 13px; }
.list__msg { font-size: 12px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.list__time { margin-left: auto; font-size: 11.5px; color: var(--muted-foreground); font-family: var(--font-mono); }
.empty { color: var(--muted-foreground); font-size: 13px; padding: 26px 8px; text-align: center; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--secondary); color: var(--secondary-foreground); }
.badge--bot { background: var(--info-soft); color: var(--info); }
.badge--humano { background: var(--warning-soft); color: var(--warning); }
.badge--count { background: var(--primary); color: var(--primary-foreground); min-width: 20px; justify-content: center; }

.placeholder { color: var(--muted-foreground); }

/* ------------------------------- conversas ------------------------------- */
.conv { display: grid; grid-template-columns: 330px 1fr; gap: 0; height: calc(100vh - 56px - 64px);
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--card); }
.conv.has-mem { grid-template-columns: 300px 1fr 300px; }
.conv__list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.conv__search { padding: 10px; border-bottom: 1px solid var(--border); }
.conv__search .input { height: 34px; }
.conv__items { overflow-y: auto; flex: 1; min-height: 0; }
.conv__item { display: flex; gap: 10px; padding: 11px 12px; cursor: pointer; border-bottom: 1px solid var(--border);
  transition: background .15s; }
.conv__item:hover { background: var(--accent); }
.conv__item.is-active { background: color-mix(in oklch, var(--primary) 12%, transparent); }
.conv__item-main { min-width: 0; flex: 1; }
.conv__item-top { display: flex; align-items: center; gap: 6px; }
.conv__item-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv__item-time { margin-left: auto; font-size: 11px; color: var(--muted-foreground); font-family: var(--font-mono); }
.conv__item-msg { font-size: 12px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; margin-top: 2px; }
.conv__thread { display: flex; flex-direction: column; min-height: 0; background: color-mix(in oklch, var(--background) 55%, transparent); }
.conv__head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); flex: none; }
.conv__head-name { font-weight: 650; font-size: 14px; }
.conv__head-sub { font-size: 11.5px; color: var(--muted-foreground); font-family: var(--font-mono); }
.conv__head-actions { margin-left: auto; display: flex; gap: 8px; }
.conv__log { flex: 1; overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.conv__composer { border-top: 1px solid var(--border); padding: 10px 12px; flex: none; }
.conv__composer-row { display: flex; gap: 8px; align-items: flex-end; }
.conv__composer textarea { flex: 1; resize: none; min-height: 40px; max-height: 140px; padding: 10px 12px;
  border-radius: var(--radius-md); border: 1px solid var(--input); background: var(--background); color: var(--foreground);
  font-family: inherit; font-size: 13.5px; outline: none; }
.conv__composer textarea:focus { border-color: var(--ring); }
.conv__hint { font-size: 11px; color: var(--muted-foreground); margin-top: 6px; }
.conv__mem { border-left: 1px solid var(--border); padding: 14px; overflow-y: auto; min-height: 0; }
.conv__mem h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-foreground); margin: 14px 0 6px; }
.conv__mem h3:first-child { margin-top: 0; }
.mem-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; padding: 5px 0; border-bottom: 1px dashed var(--border); }
.mem-row span:first-child { color: var(--muted-foreground); }
.mem-text { font-size: 12.5px; line-height: 1.5; color: var(--foreground); white-space: pre-wrap; }

/* bolhas (mesma linguagem do simulador de treino) */
.msg { display: flex; gap: 10px; max-width: 100%; }
.msg__avatar { width: 30px; height: 30px; border-radius: 999px; flex: none; display: grid; place-items: center;
  font-size: 10px; font-weight: 700; background: var(--secondary); color: var(--secondary-foreground); }
.msg--bot .msg__avatar { background: linear-gradient(135deg, var(--brand-from), var(--brand-to)); color: #06251c; }
.msg__col { min-width: 0; max-width: min(76%, 640px); display: flex; flex-direction: column; gap: 4px; }
.msg__author { font-size: 11px; color: var(--muted-foreground); padding: 0 4px; }
.bubble { padding: 9px 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--card);
  font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.msg--lead { flex-direction: row-reverse; }
.msg--lead .msg__col { align-items: flex-end; }
.msg--lead .msg__author { text-align: right; }
.msg--lead .bubble { background: color-mix(in oklch, var(--primary) 20%, var(--card)); border-bottom-right-radius: 4px; }
.msg--bot .bubble { border-bottom-left-radius: 4px; }
.msg--human .msg__avatar { background: var(--warning-soft); color: var(--warning); }
.msg--human .bubble { background: var(--warning-soft); border-bottom-right-radius: 4px; }
.msg--sys { justify-content: center; }
.msg--sys .bubble { font-size: 11.5px; color: var(--muted-foreground); background: transparent; border: 0; padding: 2px; }
.msg--human { flex-direction: row-reverse; }
.msg--human .msg__col { align-items: flex-end; }
.msg--human .msg__author { text-align: right; }
.bubble.typing { display: inline-flex; gap: 4px; align-items: center; }
.bubble.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-foreground); animation: blink 1.2s infinite; }
.bubble.typing i:nth-child(2) { animation-delay: .2s; } .bubble.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,60%,100% { opacity: .25 } 30% { opacity: 1 } }
@media (max-width: 980px) { .conv, .conv.has-mem { grid-template-columns: 1fr; } .conv__list { display: none; }
  .conv.show-list .conv__list { display: flex; } .conv__mem { display: none; } .conv.show-mem .conv__mem { display: block; } }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 16px; font-size: 13px; box-shadow: 0 16px 40px -20px rgb(0 0 0 / .6); z-index: 50; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* -------------------------- toolbar / pills / seg ------------------------ */
.page-head--row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar__spacer { flex: 1; }
.search--wide { flex: 1; min-width: 240px; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--secondary); color: var(--secondary-foreground); }
.pill svg { width: 14px; height: 14px; }
.pill--ok { background: var(--success-soft); color: var(--success); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); }
.seg__btn { border: 0; background: transparent; color: var(--muted-foreground); font-weight: 550; font-size: 12.5px;
  height: 26px; padding: 0 12px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; }
.seg__btn:hover { color: var(--foreground); }
.seg__btn.is-active { background: color-mix(in oklch, var(--primary) 16%, transparent); color: var(--primary); }
.hint { font-size: 11.5px; color: var(--muted-foreground); line-height: 1.4; }

/* --------------------------------- kanban -------------------------------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; align-items: flex-start; padding-bottom: 8px; }
.kanban__col { flex: 0 0 264px; width: 264px; background: color-mix(in oklch, var(--card) 60%, var(--background));
  border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: calc(100vh - 300px); }
.kanban__head { display: flex; align-items: center; gap: 8px; padding: 11px 12px; border-bottom: 1px solid var(--border); }
.kanban__name { font-weight: 650; font-size: 13px; }
.kanban__sum { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); }
.kanban__head .btn--xs { margin-left: auto; }
.kanban__sum + .btn--xs { margin-left: 6px; }
.btn--xs { height: 26px; width: 26px; font-size: 16px; line-height: 1; padding: 0; }
.kanban__body { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 60px; }
.kanban__body.is-over { background: color-mix(in oklch, var(--primary) 10%, transparent); border-radius: var(--radius-md); }
.kanban__empty { font-size: 11.5px; color: var(--muted-foreground); text-align: center; padding: 14px 6px; border: 1px dashed var(--border); border-radius: var(--radius-md); }
.deal { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 11px;
  display: flex; flex-direction: column; gap: 5px; cursor: grab; transition: border-color .15s, box-shadow .15s; }
.deal:hover { border-color: color-mix(in oklch, var(--primary) 45%, var(--border)); box-shadow: 0 8px 22px -16px rgb(0 0 0 / .5); }
.deal.is-dragging { opacity: .5; }
.deal__title { font-weight: 600; font-size: 13px; line-height: 1.35; }
.deal__meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted-foreground); }
.deal__meta svg { width: 13px; height: 13px; flex: none; }
.deal__value { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--primary); }
.deal__foot { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.deal__move { flex: 1; min-width: 0; height: 28px; font-size: 11.5px; border-radius: var(--radius-sm);
  border: 1px solid var(--input); background: color-mix(in oklch, var(--background) 60%, transparent); color: var(--foreground); padding: 0 6px; cursor: pointer; }
.badge--ok { background: var(--success-soft); color: var(--success); }
.badge--open { background: var(--info-soft); color: var(--info); }
.badge--lost { background: var(--destructive-soft); color: var(--destructive); }
.badge--cancelled { background: var(--destructive-soft); color: var(--destructive); }
.badge--confirmed { background: var(--success-soft); color: var(--success); }
.badge--hold { background: var(--warning-soft); color: var(--warning); }
.badge--done { background: var(--success-soft); color: var(--success); }

/* --------------------------------- agenda -------------------------------- */
.appts { display: flex; flex-direction: column; gap: 10px; }
.appt { display: flex; align-items: stretch; gap: 14px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px 14px; }
.appt.is-cancelled { opacity: .6; }
.appt__when { flex: none; width: 92px; display: flex; flex-direction: column; justify-content: center; text-align: center;
  border-right: 1px solid var(--border); padding-right: 12px; }
.appt__when b { font-family: var(--font-mono); font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.appt__when span { font-size: 11px; color: var(--muted-foreground); text-transform: capitalize; }
.appt__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; justify-content: center; }
.appt__title { font-weight: 650; font-size: 14px; }
.appt__sub { font-size: 12.5px; color: var(--muted-foreground); }
.appt__note { font-size: 12px; color: var(--muted-foreground); font-style: italic; }
.appt__tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.appt__actions { flex: none; display: flex; flex-direction: column; gap: 6px; align-items: stretch; justify-content: center; }

/* --------------------------------- modal --------------------------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none !important; }
.modal__backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / .5); backdrop-filter: blur(2px); }
.modal__panel { position: relative; width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / .7); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.modal__head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.modal__body { padding: 6px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.grid-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid-fields { grid-template-columns: 1fr; } .appt { flex-wrap: wrap; }
  .appt__when { border-right: 0; padding-right: 0; width: auto; flex-direction: row; gap: 8px; align-items: baseline; }
  .appt__actions { flex-direction: row; flex-wrap: wrap; } }

@media (max-width: 980px) {
  .content { padding: 16px 14px 40px; }
  .search { min-width: 0; }
  .search--wide { min-width: 160px; }
}

/* ------------------------------- canais (P6) ----------------------------- */
.canais-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.canal { display: flex; flex-direction: column; gap: 12px; }
.canal__head { display: flex; align-items: center; gap: 10px; }
.canal__ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in oklch, var(--primary) 14%, transparent); color: var(--primary); flex: none; }
.canal__ico svg { width: 20px; height: 20px; }
.canal__id { min-width: 0; flex: 1; }
.canal__name { font-weight: 650; font-size: 14px; }
.canal__sub { font-size: 11.5px; color: var(--muted-foreground); }
.canal__rows { display: flex; flex-direction: column; }
.canal__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mono-sm { font-family: var(--font-mono); font-size: 11px; word-break: break-all; text-align: right; }
.copyline { display: flex; gap: 8px; }
.copyline .input { flex: 1; font-family: var(--font-mono); }
.qr { display: block; width: 232px; height: 232px; margin: 6px auto; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: #fff; padding: 8px; }

/* ------------------------------- agentes (P7) ---------------------------- */
.agents { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.agents__list { display: flex; flex-direction: column; gap: 8px; }
.agent-item { display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  transition: border-color .15s, background .15s; }
.agent-item:hover { border-color: color-mix(in oklch, var(--primary) 45%, var(--border)); }
.agent-item.is-active { border-color: var(--primary); background: color-mix(in oklch, var(--primary) 9%, var(--card)); }
.agent-item__ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: color-mix(in oklch, var(--primary) 14%, transparent); color: var(--primary); }
.agent-item__ico svg { width: 18px; height: 18px; }
.agent-item__main { min-width: 0; flex: 1; }
.agent-item__name { font-weight: 600; font-size: 13px; }
.agent-item__sub { font-size: 11px; color: var(--muted-foreground); }
.agents__detail { min-width: 0; }
.agent-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.agent-head__name { font-weight: 650; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agent-head__sub { font-size: 12.5px; color: var(--muted-foreground); margin-top: 3px; }
.agent-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.agent-tab { margin-top: 6px; }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.kbase { display: grid; grid-template-columns: 1fr 1.1fr; gap: 16px; }
@media (max-width: 1080px) { .kbase { grid-template-columns: 1fr; } .agents { grid-template-columns: 1fr; } }
.kver { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-md); margin-bottom: 8px; }
.kver.is-current { border-color: var(--primary); }
.kver__meta { font-size: 11px; color: var(--muted-foreground); }
.kbase__reply { margin-top: 14px; }
.kpreview { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 10px;
  margin-bottom: 8px; font-size: 12px; color: var(--muted-foreground); }
.kpreview b { color: var(--foreground); display: block; margin-bottom: 4px; }
.agtest { display: flex; flex-direction: column; gap: 12px; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.conv__agent { height: 30px; max-width: 190px; border-radius: var(--radius-md); border: 1px solid var(--input);
  background: var(--card); color: var(--foreground); font-size: 12px; padding: 0 8px; cursor: pointer; }
.badge--lost { background: var(--destructive-soft); color: var(--destructive); }
.badge--hold { background: var(--warning-soft); color: var(--warning); }
.badge--ok { background: var(--success-soft); color: var(--success); }

/* ========================================================================== */
/* P8/P9/P10 — componentes novos (templates, disparos, equipe, integrações)     */
/* ========================================================================== */
.grid-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:14px}
.tpl{padding:14px;display:flex;flex-direction:column;gap:8px}
.tpl__head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.tpl__name{font-weight:600;margin-left:auto}
.tpl__body{font-size:13px;line-height:1.5;color:var(--text);background:var(--surface-2, rgba(127,127,127,.08));border:1px solid var(--border);border-radius:8px;padding:10px;white-space:pre-wrap}
.tpl__vars{display:flex;gap:6px;flex-wrap:wrap}
.tpl__actions{display:flex;gap:6px;margin-top:auto}
.chip{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:11px;padding:2px 7px;border-radius:999px;background:var(--surface-2, rgba(127,127,127,.12));border:1px solid var(--border);color:var(--primary)}
.dim{color:var(--muted,#8b98a5)}
.mono-sm{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}
.tright{text-align:right}
.card.wide{grid-column:1/-1}

/* disparos */
.camps,.agents{display:grid;grid-template-columns:300px 1fr;gap:16px;align-items:start}
.camps__list{display:flex;flex-direction:column;gap:8px}
.camp-item{display:flex;flex-direction:column;gap:4px;text-align:left;padding:12px;border:1px solid var(--border);border-radius:10px;background:var(--card,transparent);cursor:pointer}
.camp-item.is-active{border-color:var(--primary);box-shadow:0 0 0 1px var(--primary) inset}
.camp-item__main{display:flex;justify-content:space-between;gap:8px;align-items:flex-start}
.camp-item__name{font-weight:600}
.camp-item__sub{font-size:12px;color:var(--muted,#8b98a5)}
.camp-actions,.intg__actions{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}
.sum-pills{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:8px}
@media(max-width:900px){.camps,.agents{grid-template-columns:1fr}}

/* tabelas */
.table-wrap{overflow-x:auto;margin-top:8px}
.table{width:100%;border-collapse:collapse;font-size:13px}
.table th,.table td{padding:9px 10px;border-bottom:1px solid var(--border);text-align:left;vertical-align:top}
.table th{font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted,#8b98a5);font-weight:600}
.table tr:hover td{background:var(--surface-2, rgba(127,127,127,.05))}

/* form helpers */
.checks{display:flex;gap:14px;flex-wrap:wrap}
.check{display:flex;align-items:center;gap:6px;font-size:13px}
.input--inline{width:auto;min-width:160px}

/* botões */
.btn--danger{color:#f87171;border-color:rgba(248,113,113,.4)}
.btn--danger:hover{background:rgba(248,113,113,.12)}

/* integrações */
.intg{padding:14px;display:flex;flex-direction:column;gap:8px}
.intg__cfg{margin:4px 0}
.code{background:var(--surface-2, rgba(127,127,127,.08));border:1px solid var(--border);border-radius:8px;padding:10px;font-size:11.5px;max-height:220px;overflow:auto;white-space:pre-wrap;word-break:break-word}

/* rodapé da marca (plataforma) — P/ADENDO E */
.appfoot{display:flex;gap:6px;align-items:center;justify-content:center;padding:14px 16px 18px;
  font-size:12px;color:var(--muted,#8b98a5)}
.appfoot span:first-child{font-weight:600;color:var(--text)}
.login__foot{margin-top:14px;text-align:center;font-size:12px;color:var(--muted,#8b98a5)}

/* =============================== P11 + P12 ================================ */
/* Acessibilidade: foco sempre visível e navegação por teclado */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 6px;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 50;
  background: var(--card); color: var(--foreground); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 10px; font-size: 13px; transition: top .15s;
}
.skip-link:focus { top: 12px; }

.badge--warn { background: var(--warning-soft); color: var(--warning); }
.badge--treino { background: color-mix(in oklch, var(--primary) 14%, transparent); color: var(--primary); }

/* Switch (usado no Bot) */
.switch { position: relative; width: 44px; height: 24px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--muted); cursor: pointer; flex: 0 0 auto; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px #0006; transition: transform .15s; }
.switch.is-on { background: var(--primary); border-color: var(--primary); }
.switch.is-on::after { transform: translateX(20px); }

/* Configurações do Bot */
.card--status { padding: 12px 16px; }
.bot-status { display: flex; align-items: center; gap: 14px; }
.bot-status__label { font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.bot-status__desc { font-size: 11.5px; color: var(--muted-foreground); flex: 1; }
.bot-panel { padding: 18px 20px; }
.bot-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px;
  padding: 14px 0; border-bottom: 1px solid var(--border); }
.bot-row:last-child { border-bottom: 0; }
.bot-row__title { font-size: 12.5px; font-weight: 700; letter-spacing: .03em; }
.bot-row__desc { font-size: 12px; color: var(--muted-foreground); margin-top: 3px; max-width: 560px; }
.bot-foot { display: flex; align-items: center; gap: 14px; margin-top: 16px; }

/* Memória do lead */
.mem__grid { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.mem__list { display: flex; flex-direction: column; gap: 10px; }
.mem__items { display: flex; flex-direction: column; gap: 6px; }
.mem__item { display: flex; gap: 10px; align-items: flex-start; text-align: left; width: 100%;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 12px; color: inherit; cursor: pointer; }
.mem__item:hover { border-color: var(--ring); }
.mem__item.is-active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.mem__item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.mem__item-top { display: flex; align-items: center; gap: 6px; }
.mem__item-sub { font-size: 11.5px; color: var(--muted-foreground); }
.mem__item-mem { font-size: 11.5px; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem__detail { padding: 18px 20px; min-height: 260px; }
.tl { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.tl__row { display: flex; gap: 10px; align-items: flex-start; }
.tl__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex: 0 0 auto; }
.tl__title { font-size: 13px; font-weight: 600; }
.tl__meta { font-size: 11.5px; color: var(--muted-foreground); }
.mem-actions { margin-top: 14px; }

/* Treino de IA (P12) */
.tr__grid { display: grid; grid-template-columns: 300px 1fr 320px; gap: 16px; align-items: start; }
.tr__list { display: flex; flex-direction: column; gap: 6px; }
.tr__item { text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 12px; cursor: pointer; color: inherit; display: flex; flex-direction: column; gap: 3px; }
.tr__item:hover { border-color: var(--ring); }
.tr__item.is-active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.tr__item-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tr__item-sub { font-size: 11.5px; color: var(--muted-foreground); }
.tr__chat { display: flex; flex-direction: column; min-height: 440px; padding: 14px; }
.tr__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tr__chat .conv__log { flex: 1; max-height: 420px; }
.tr__review { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 1100px) {
  .mem__grid { grid-template-columns: 1fr; }
  .tr__grid { grid-template-columns: 1fr; }
}

/* Canais: cartões de método de conexão (paridade com a referência) */
.canal-method { display: flex; align-items: flex-start; gap: 12px; padding: 18px; }
.canal-method__ico { width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--success-soft); color: var(--primary); }
.canal-method__ico svg { width: 20px; height: 20px; }
.canal-method__t { font-weight: 600; font-size: 14px; }
.canal-method__d { font-size: 12px; color: var(--muted-foreground); margin-top: 3px; max-width: 420px; }

/* ADENDO F — linha do tempo do contato */
.timeline{margin-top:6px;display:flex;flex-direction:column;gap:4px}
.tl-row{display:grid;grid-template-columns:92px 1fr auto;gap:8px;align-items:baseline;
  padding:6px 0;border-bottom:1px solid var(--border);font-size:12.5px}
.tl-kind{font-weight:600;color:var(--primary);font-size:11px;text-transform:uppercase;letter-spacing:.03em}
.tl-desc{color:var(--text)}
.tl-time{color:var(--muted,#8b98a5);font-size:11px}

/* ===================== P11 — provedores, cadastro e setup ==================== */
.login__tabs { display: flex; width: 100%; margin-bottom: 14px; }
.login__tabs .seg__btn { flex: 1; text-align: center; }
.login__alt { text-align: center; margin-top: 12px; font-size: 13px; }
.login__alt a { color: var(--primary); }
.prov .intg__cfg { margin-bottom: 8px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.setup-step { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.setup-step.is-done { border-color: color-mix(in oklch, var(--success) 45%, var(--border)); }
.setup-step__n { width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center;
  background: var(--secondary); color: var(--foreground); font-weight: 700; font-size: 13px; }
.setup-step.is-done .setup-step__n { background: var(--success-soft); color: var(--success); }
.setup-step__n svg { width: 16px; height: 16px; }
.setup-step__t { font-weight: 650; font-size: 14px; }
.setup-step__d { font-size: 12.5px; color: var(--muted-foreground); flex: 1; }
