/* ============================================================
   ZapDin — Design System v2
   ============================================================ */

/* ── Variables ───────────────────────────────────────────── */
:root {
  --primary:        #25d366;
  --primary-strong: color-mix(in srgb, var(--primary) 100%, #000 16%);
  --primary-deep:   color-mix(in srgb, var(--primary) 100%, #000 34%);
  --primary-soft:   color-mix(in srgb, var(--primary) 14%, #fff);
  --primary-ghost:  color-mix(in srgb, var(--primary) 8%, transparent);
  --on-primary: #ffffff;

  --bg:        #eef1f4;
  --bg-grad-a: #eef1f4;
  --bg-grad-b: #e7ecef;
  --surface:   #ffffff;
  --surface-2: #f6f8fa;
  --surface-3: #eef1f4;
  --border:    #e6eaee;
  --border-2:  #eef1f4;
  --text:      #0f1b22;
  --text-2:    #5b6b75;
  --text-3:    #93a1ab;
  /* legacy aliases (preserve module compat) */
  --text-mid:   #5b6b75;
  --text-light: #93a1ab;
  --text-muted: #5b6b75;
  --surface2:   #f6f8fa;
  --shadow-sm: 0 1px 2px rgba(15,27,34,.05);
  --shadow-md: 0 6px 22px -8px rgba(15,27,34,.14);
  --shadow-lg: 0 22px 60px -28px rgba(15,27,34,.28);
  --shadow-nav: 0 1px 0 rgba(15,27,34,.04);

  --chat-bg:    #e5ddd5;
  --bubble-in:  #ffffff;
  --bubble-out: #d9fdd3;

  --blue:      #2f80ed;
  --blue-bg:   #eaf2fe;
  --amber:     #e8930c;
  --amber-bg:  #fdf3e2;
  --red:       #e5484d;
  --red-bg:    #fdecec;
  --violet:    #7b61ff;
  --violet-bg: #efeafe;
  --star:      #f5b50a;

  --pad:      22px;
  --gap:      20px;
  --card-pad: 22px;
  --fs:       15px;
  --row-h:    56px;
  --side-w:   264px;
  --radius:   16px;

  --font: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* legacy compat */
  --accent:      #25d366;
  --accent-soft: #e8fdf0;
  --accent-mid:  #bbf7d0;
  --sidebar-w:   264px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: var(--fs);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--primary-soft); }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-3) 38%, transparent);
  border-radius: 20px; border: 3px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text-3) 60%, transparent);
  background-clip: padding-box;
}

/* ── Shell ───────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  height: 100vh;
  overflow: hidden;
}
.app.nav-collapsed { --side-w: 72px; }

/* ── Sidebar ─────────────────────────────────────────────── */
.side {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  z-index: 5;
}
.side-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 20px 14px;
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 13px;
  background: linear-gradient(150deg, var(--primary), var(--primary-strong));
  display: grid; place-items: center; color: #fff; flex: none;
  box-shadow: 0 6px 16px -6px var(--primary);
}
.brand-logo img {
  width: 30px; height: 30px; object-fit: contain;
}
.brand-name { font-weight: 800; font-size: 21px; letter-spacing: -.02em; }
.brand-name b { color: var(--primary); }

.nav-collapsed .brand-name,
.nav-collapsed .nav-group-label,
.nav-collapsed .nav-item > span:not(.nav-icon),
.nav-collapsed .side-foot small { display: none; }
.nav-collapsed .side-brand { justify-content: center; padding: 20px 0 14px; }
.nav-collapsed .nav-item { justify-content: center; padding: 11px 0; }

.side-scroll { flex: 1; overflow-y: auto; padding: 6px 12px 14px; min-height: 0; }
.nav-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em;
  color: var(--text-3); text-transform: uppercase;
  padding: 16px 12px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 13px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--text-2); font-weight: 550; font-size: 14.5px;
  border: none; background: transparent; width: 100%; text-align: left;
  transition: background .15s, color .15s;
  position: relative;
  cursor: pointer; user-select: none;
}
.nav-item svg { width: 19px; height: 19px; flex: none; }
.nav-item .nav-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 19px; height: 19px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-ghost); color: var(--primary-deep); font-weight: 650; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 20px; border-radius: 0 4px 4px 0; background: var(--primary);
}
.nav-collapsed .nav-item.active::before { left: 0; }

.side-foot { padding: 12px; border-top: 1px solid var(--border); }
.side-foot small { display: block; padding: 8px 12px 0; color: var(--text-3); font-size: 11.5px; }

/* ── Main ────────────────────────────────────────────────── */
.main {
  display: flex; flex-direction: column; min-width: 0;
  background:
    radial-gradient(1200px 480px at 88% -8%, var(--primary-ghost), transparent 60%),
    linear-gradient(180deg, var(--bg-grad-a), var(--bg-grad-b));
  overflow: hidden;
}

/* ── Topbar ──────────────────────────────────────────────── */
.top {
  display: flex; align-items: center; gap: 12px;
  padding: 14px var(--pad);
  flex: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.top-menu-btn {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-2); display: grid; place-items: center;
  transition: .15s; cursor: pointer;
}
.top-menu-btn:hover { color: var(--text); border-color: var(--text-3); }
.top-menu-btn svg { width: 19px; height: 19px; }
.top-title { display: flex; align-items: center; gap: 11px; min-width: 0; flex-shrink: 1; }
.top-title .bar { width: 4px; height: 28px; border-radius: 4px; background: var(--primary); flex: none; }
.top-title h1 {
  margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.025em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.top-spacer { flex: 1 1 16px; min-width: 0; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); display: grid; place-items: center;
  box-shadow: var(--shadow-sm); transition: .15s; cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--text-3); }
.icon-btn svg { width: 18px; height: 18px; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 13px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.chip .dot.on { background: var(--primary); box-shadow: 0 0 0 3px var(--primary-ghost); }

/* License chip */
.chip.license { padding: 4px 14px 4px 10px; height: 44px; gap: 10px; }
.chip.license .lic-ic {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--primary-soft); color: var(--primary-deep);
  display: grid; place-items: center;
}
.chip.license .lic-t { display: flex; flex-direction: column; line-height: 1.15; }
.chip.license .lic-t .k { font-size: 9px; font-weight: 700; letter-spacing: .1em; color: var(--text-3); }
.chip.license .lic-t .v { font-size: 13px; font-weight: 800; color: var(--text); }
.chip.license .lic-t .c { font-size: 10.5px; color: var(--text-3); }

/* IA chip */
.chip.ai {
  background: linear-gradient(120deg, #0e1f17, #0a2c1d);
  color: #c8f7d8; border-color: transparent;
}
.chip.ai .dot { background: var(--primary); box-shadow: 0 0 8px var(--primary); }
.chip.violet { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 30%, var(--border)); background: var(--violet-bg); }

/* User chip */
.chip.user {
  padding: 4px 13px 4px 5px; height: 40px;
  background: linear-gradient(135deg, #4ea825, var(--primary-strong));
  border-color: transparent; color: #fff;
}
.chip.user .av { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.chip.user .av-init {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #fff;
}

/* WA status chip */
.chip.wa-off { color: var(--text-3); }
.chip.wa-on  { color: var(--primary-deep); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); background: var(--primary-soft); }

/* ── Content ──────────────────────────────────────────────── */
.content { flex: 1; overflow-y: auto; padding: 20px var(--pad) 40px; min-height: 0; }
.page { max-width: 1480px; margin: 0 auto; display: none; animation: fade .3s ease both; transition: max-width .2s ease; }
.nav-collapsed .page { max-width: none; }
.nav-collapsed .wa-tabs { max-width: none; }
/* Chatbot: sempre full-width pra aproveitar espaço de chat */
#page-chatbot { max-width: none; width: 100%; }
#page-chatbot.active { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
#page-chatbot #cb-panel-conversas { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.page.active { display: block; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card.pad { padding: var(--card-pad); }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.card-head .ci {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; flex: none;
}
.card-head h2 { margin: 0; font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
.card-head .sub { font-size: 12.5px; color: var(--text-3); }
.card-head .grow { flex: 1; }

.grid { display: grid; gap: var(--gap); }

/* ── Color helpers ───────────────────────────────────────── */
.t-green  { background: var(--primary-soft); color: var(--primary-deep); }
.t-blue   { background: var(--blue-bg);      color: var(--blue); }
.t-amber  { background: var(--amber-bg);     color: var(--amber); }
.t-red    { background: var(--red-bg);       color: var(--red); }
.t-violet { background: var(--violet-bg);    color: var(--violet); }
.t-star   { background: #fff7e0;             color: var(--star); }

/* ── Stat tiles ──────────────────────────────────────────── */
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px;
  position: relative; overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat .si { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.stat .num { font-size: 34px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat .lbl { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }

.stat-mini {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow-sm);
}
.stat-mini .si { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.stat-mini .num { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.stat-mini .lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); margin-top: 2px; }
.stat-mini .sub-mini { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 12px; border: none; white-space: nowrap;
  font-family: var(--font); font-weight: 700; font-size: 14.5px; color: var(--on-primary);
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  box-shadow: 0 8px 20px -10px var(--primary); transition: .16s; cursor: pointer;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 17px; height: 17px; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.btn.ghost:hover { border-color: var(--text-3); filter: none; }
.btn.amber { background: linear-gradient(180deg, #f5a623, var(--amber)); box-shadow: 0 8px 20px -10px var(--amber); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn.danger, .btn.btn-danger, .btn-red {
  background: linear-gradient(180deg, #ef5055, var(--red));
  box-shadow: 0 8px 20px -10px var(--red);
}

/* Segmented */
.seg {
  display: inline-flex; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px;
}
.seg button {
  border: none; background: transparent; color: var(--text-2);
  font-family: var(--font); font-weight: 600; font-size: 13px;
  padding: 6px 13px; border-radius: 8px; transition: .14s; cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg.green button.on { background: var(--primary); color: #fff; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.badge.ok    { background: var(--primary-soft); color: var(--primary-deep); }
.badge.fail  { background: var(--red-bg);       color: var(--red); }
.badge.queue { background: var(--amber-bg);     color: var(--amber); }
.badge.info  { background: var(--blue-bg);      color: var(--blue); }
.badge.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Form fields ─────────────────────────────────────────── */
.field {
  width: 100%; height: 42px; padding: 0 14px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-family: var(--font); font-size: 14px; transition: .14s;
}
.field.sm { height: 36px; font-size: 13px; border-radius: 9px; }
textarea.field { height: auto; padding: 12px 14px; resize: vertical; }
.field:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ghost); background: var(--surface); }
select.field { cursor: pointer; }
.flbl { display: block; font-size: 13px; font-weight: 650; color: var(--text-2); margin-bottom: 7px; }
.fhint { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* Switch */
.sw { width: 46px; height: 26px; border-radius: 999px; border: none; background: var(--surface-3); padding: 3px; flex: none; transition: .2s; cursor: pointer; }
.sw > span { display: block; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: .2s; }
.sw[data-on="true"] { background: var(--primary); }
.sw[data-on="true"] > span { transform: translateX(20px); }

/* ── Tables ──────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-3);
  padding: 0 16px 12px; border-bottom: 1px solid var(--border);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border-2); font-size: 14px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.mono { font-family: var(--mono); font-size: 13px; color: var(--text-2); }

/* ── Notes / banners ─────────────────────────────────────── */
.note {
  display: flex; gap: 11px; padding: 14px 16px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.55; border: 1px solid; align-items: flex-start;
}
.note.info { background: var(--blue-bg);    border-color: color-mix(in srgb, var(--blue)   22%, transparent); }
.note.warn { background: var(--amber-bg);   border-color: color-mix(in srgb, var(--amber)  28%, transparent); }
.note.ok   { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 28%, transparent); }
.note .ni  { flex: none; margin-top: 1px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: transparent;
  display: grid; place-items: center;
  z-index: 1000; padding: 24px; animation: mfade .18s ease;
  pointer-events: auto;
}
@keyframes mfade { from { opacity: 0; } }
.modal {
  width: 100%; background: var(--surface); border-radius: 20px;
  box-shadow: 0 30px 80px -20px rgba(15,27,34,.35), 0 8px 24px -8px rgba(15,27,34,.2), 0 0 0 1px var(--border);
  max-height: 90vh;
  display: flex; flex-direction: column; overflow: hidden;
  animation: mpop .22s cubic-bezier(.2,.8,.3,1);
}
@keyframes mpop { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; }
.modal-head.plain { border-bottom: 1px solid var(--border); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface); }

/* ── Empty states ────────────────────────────────────────── */
.empty-box {
  border: 1.5px dashed color-mix(in srgb, var(--primary) 38%, transparent);
  border-radius: 16px; padding: 34px; text-align: center;
  background: var(--primary-ghost);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-ic { width: 60px; height: 60px; border-radius: 16px; background: var(--surface); display: grid; place-items: center; color: var(--primary); box-shadow: var(--shadow-sm); }

/* ── Tabs (group tabs for pages) ─────────────────────────── */
.wa-tabs { display: grid; gap: 12px; max-width: 1480px; margin: 0 auto 20px; }
.wa-tabs.cols-2 { grid-template-columns: repeat(2, 1fr); }
.wa-tabs.cols-3 { grid-template-columns: repeat(3, 1fr); }
.wa-tabs.cols-4 { grid-template-columns: repeat(4, 1fr); }
.wa-tabs.cols-5 { grid-template-columns: repeat(5, 1fr); }
.wa-tab {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-family: var(--font); font-weight: 650; font-size: 14px;
  box-shadow: var(--shadow-sm); text-align: left; cursor: pointer;
  transition: border-color .16s, transform .16s, box-shadow .16s;
}
.wa-tab:hover { color: var(--text); border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.wa-tab-ic {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--surface-2); color: var(--text-3); transition: .16s;
}
.wa-tab:hover .wa-tab-ic { background: var(--primary-soft); color: var(--primary-deep); }
.wa-tab-label { flex: 1; min-width: 0; }
.wa-tab-go {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-3); background: var(--surface-2); transition: .16s;
}
.wa-tab:hover .wa-tab-go { color: #fff; background: var(--primary); transform: translateX(3px); }
.wa-tab.on {
  border-color: transparent; color: #fff;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  box-shadow: 0 10px 24px -12px var(--primary);
}
.wa-tab.on .wa-tab-ic { background: rgba(255,255,255,.22); color: #fff; }
.wa-tab.on .wa-tab-go { background: rgba(255,255,255,.25); color: #fff; }
.wa-tab.on:hover .wa-tab-go { transform: none; }

/* ── Sistema sub-nav ─────────────────────────────────────── */
.sys-topnav {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 10px 16px;
}
.sys-navgroup { display: flex; align-items: center; gap: 8px; }
.sys-navgroup:not(:last-child) { padding-right: 12px; border-right: 1px solid var(--border); }
.sys-navgroup-label {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-3); white-space: nowrap;
}
.sys-navgroup-items { display: flex; flex-wrap: wrap; gap: 4px; }
.sys-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--text-2);
  font-family: var(--font); font-weight: 600; font-size: 12.5px; white-space: nowrap;
  transition: .14s; cursor: pointer;
}
.sys-tab svg { flex: none; }
.sys-tab:hover { background: var(--surface-2); color: var(--text); }
.sys-tab.on {
  background: var(--primary-ghost); color: var(--primary-deep);
  border-color: color-mix(in srgb, var(--primary) 22%, transparent);
}
.sys-sep {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3); margin: 24px 0 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.toggle-box {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); margin: 16px 0;
}

/* ── Chatbot 3-pane ──────────────────────────────────────── */
.cb-wrap { display: grid; grid-template-columns: 300px 1fr 300px; gap: var(--gap); flex: 1; min-height: 0; height: 100%; padding-bottom: 8px; }
.cb-wrap.no-detail { grid-template-columns: 280px 1fr; }
.cb-list, .cb-chat, .cb-detail { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.cb-list-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 12px; }
.cb-search { display: flex; align-items: center; gap: 10px; margin: 0 16px 8px; padding: 0 12px; height: 40px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); }
.cb-search input { flex: 1; border: none; background: transparent; outline: none; font-family: var(--font); font-size: 14px; color: var(--text); }
.cb-convos { flex: 1; overflow-y: auto; padding: 6px 10px; }
.cb-convo { display: flex; gap: 12px; width: 100%; text-align: left; border: none; background: transparent; padding: 11px; border-radius: 13px; transition: .12s; align-items: center; cursor: pointer; }
.cb-convo:hover { background: var(--surface-2); }
.cb-convo.on { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.cb-ava { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: none; font-size: 18px; }
.cb-convo-body { flex: 1; min-width: 0; }
.cb-convo-top { display: flex; justify-content: space-between; gap: 8px; }
.cb-convo-time { font-size: 11.5px; color: var(--text-3); flex: none; }
.cb-convo-bot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; }
.cb-convo-last { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-chat-head { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.cb-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.cb-bubble { max-width: 74%; padding: 9px 13px 20px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.cb-bubble.in { background: var(--surface); border: 1px solid var(--border); border-top-left-radius: 3px; }
.cb-bubble.out { background: var(--bubble-out); border-top-right-radius: 3px; color: #0b3b22; }
.cb-iatag { font-size: 11px; font-weight: 700; color: var(--primary-deep); display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.cb-time { position: absolute; right: 11px; bottom: 5px; font-size: 10px; color: var(--text-3); display: flex; align-items: center; gap: 3px; }
.cb-input { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface); }
.cb-input input { flex: 1; height: 42px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); padding: 0 18px; outline: none; font-family: var(--font); font-size: 14px; color: var(--text); }
.cb-send { width: 44px; height: 44px; border-radius: 50%; border: none; background: linear-gradient(180deg, var(--primary), var(--primary-strong)); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px -8px var(--primary); flex: none; cursor: pointer; }
.cb-empty { align-items: center; justify-content: center; text-align: center; gap: 6px; }
.cb-empty-ic { width: 80px; height: 80px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); margin-bottom: 8px; }
.cb-empty-img {
  width: 100%; max-width: 460px; height: auto;
  object-fit: contain;
  -webkit-mask-image: radial-gradient(ellipse 48% 44% at 50% 50%, #000 88%, transparent 100%);
          mask-image: radial-gradient(ellipse 48% 44% at 50% 50%, #000 88%, transparent 100%);
  filter: drop-shadow(0 14px 30px rgba(15,27,34,.18));
}
.cb-detail-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); font-size: 15px; }
.cb-detail-body { flex: 1; overflow-y: auto; padding: 20px 18px; }
.cb-detail-ava { width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 14px; background: linear-gradient(150deg, var(--primary), var(--primary-strong)); color: #fff; display: grid; place-items: center; font-size: 28px; font-weight: 800; }
.cb-sect { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin: 20px 0 10px; }
.cb-kv { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border-2); font-size: 13.5px; }
.cb-kv span { color: var(--text-2); }
.cb-action { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-family: var(--font); font-weight: 600; font-size: 13.5px; margin-top: 8px; transition: .12s; cursor: pointer; }
.cb-action:hover { background: var(--surface-3); }
.cb-action.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); background: var(--red-bg); }

/* ── Sessions / QR ───────────────────────────────────────── */
.sess-card { display: flex; align-items: flex-start; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); }
.qr-box { width: 64px; height: 64px; border-radius: 11px; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; flex: none; padding: 6px; }
.qr-fake { width: 100%; height: 100%; border-radius: 4px; background-color: #fff; opacity: .85;
  background:
    conic-gradient(#0f1b22 0 25%, transparent 0 50%, #0f1b22 0 75%, transparent 0) 0 0 / 14px 14px,
    linear-gradient(#0f1b22, #0f1b22) center / 60% 60% no-repeat; }
.sess-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.btn.ghost.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.btn.ghost.danger:hover { background: var(--red-bg); border-color: var(--red); }

/* Purpose modal */
.purpose-row { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); transition: .14s; text-align: left; cursor: pointer; width: 100%; }
.purpose-row:hover { border-color: var(--text-3); background: var(--surface-2); }
.purpose-row.on { border-color: var(--primary); background: var(--primary-ghost); }
.purpose-chk { width: 24px; height: 24px; border-radius: 7px; flex: none; border: 2px solid var(--border); background: var(--surface); display: grid; place-items: center; color: #fff; transition: .14s; }
.purpose-chk.on { background: var(--primary); border-color: var(--primary); }
.purpose-emoji { font-size: 20px; flex: none; }

/* Advanced evo host */
.adv-toggle { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 14px; padding: 11px 14px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-family: var(--font); font-size: 13.5px; transition: .14s; text-align: left; cursor: pointer; }
.adv-toggle:hover { border-color: var(--text-3); color: var(--text); }
.adv-toggle[aria-expanded="true"] { border-color: var(--primary); color: var(--text); background: var(--primary-ghost); }
.adv-current { color: var(--text-3); font-weight: 600; }
.adv-panel { margin-top: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); animation: advdrop .2s ease both; }
@keyframes advdrop { from { transform: translateY(-6px); } }
.adv-radios { display: flex; flex-wrap: wrap; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 6px; }
.adv-radio { display: inline-flex; align-items: center; gap: 9px; padding: 9px 13px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: .14s; }
.adv-radio:hover { background: var(--surface-3); }
.adv-radio.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.adv-radio input { position: absolute; opacity: 0; pointer-events: none; }
.adv-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); flex: none; transition: .14s; position: relative; }
.adv-radio.on .adv-dot { border-color: var(--primary); }
.adv-radio.on .adv-dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--primary); }

/* ── Config Envio ────────────────────────────────────────── */
.cfg-banner { display: flex; gap: 16px; padding: 22px; border-radius: var(--radius); background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); }
.cfg-active { box-shadow: 0 0 0 2px var(--primary), var(--shadow-md); }
.cfg-desc { font-size: 13px; color: var(--text-2); line-height: 1.55; margin: 0 0 14px; }
.cfg-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.cfg-inline .field { width: 80px; }

/* ── Help link ───────────────────────────────────────────── */
.help-link { display: inline-flex; align-items: center; gap: 6px; border: none; background: transparent; color: var(--text-3); font-family: var(--font); font-weight: 600; font-size: 12.5px; padding: 6px 9px; border-radius: 9px; transition: .14s; white-space: nowrap; cursor: pointer; }
.help-link:hover { color: var(--primary-deep); background: var(--primary-ghost); }

/* ── Alert button (avaliação) ────────────────────────────── */
.alert-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid color-mix(in srgb, var(--red) 32%, transparent); background: var(--red-bg); color: var(--red); font-family: var(--font); font-weight: 700; font-size: 12.5px; padding: 6px 12px; border-radius: 999px; transition: .14s; white-space: nowrap; cursor: pointer; }
.alert-btn:hover { background: var(--red); color: #fff; border-color: transparent; }
.alert-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 22%, transparent); }

/* ── Phone preview ───────────────────────────────────────── */
.phone { width: 280px; border-radius: 40px; padding: 12px; flex: none; background: linear-gradient(160deg, #1c1c1e, #000); box-shadow: 0 30px 70px -30px rgba(0,0,0,.6), inset 0 0 0 2px #2a2a2c; position: relative; }
.phone .notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 88px; height: 22px; background: #000; border-radius: 14px; z-index: 3; }
.phone-screen { border-radius: 30px; overflow: hidden; background: var(--chat-bg); height: 500px; display: flex; flex-direction: column; }
.wa-status { display: flex; align-items: center; justify-content: space-between; padding: 8px 20px 4px; font-size: 13px; font-weight: 700; color: #fff; background: #075e54; }
.wa-head { display: flex; align-items: center; gap: 11px; padding: 8px 14px; background: #075e54; color: #fff; }
.wa-head .ava { width: 36px; height: 36px; border-radius: 50%; background: #ffffff2a; display: grid; place-items: center; }
.wa-head .nm { font-weight: 700; font-size: 14px; line-height: 1.1; }
.wa-head .st { font-size: 11px; opacity: .8; }
.wa-body { flex: 1; overflow-y: auto; padding: 12px; background-color: #e5ddd5; }
.wa-bubble { max-width: 92%; background: var(--bubble-out); border-radius: 10px; padding: 8px 10px 18px; font-size: 12.5px; line-height: 1.5; color: #111b21; box-shadow: 0 1px .5px rgba(0,0,0,.13); position: relative; white-space: pre-wrap; word-break: break-word; }
.wa-bubble .tick { position: absolute; right: 9px; bottom: 5px; font-size: 10px; color: #667781; display: flex; gap: 4px; align-items: center; }

/* Review card */
.review-card { background: linear-gradient(160deg, var(--primary-deep), var(--primary-strong)); border-radius: 20px; padding: 20px; color: #fff; text-align: center; }
.review-inner { background: #fff; border-radius: 14px; padding: 20px 16px; color: #0f1b22; }
.review-inner .tag { display: inline-flex; padding: 4px 11px; border-radius: 999px; border: 1.5px solid var(--primary); color: var(--primary-deep); font-weight: 700; font-size: 11.5px; }
.stars { display: flex; justify-content: center; gap: 7px; margin: 14px 0 6px; }
.stars svg { width: 32px; height: 32px; color: #e3e7ea; transition: .12s; cursor: pointer; }
.stars svg.lit { color: var(--star); }
.review-inner .cmt { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px; font-size: 13px; margin-top: 12px; color: var(--text-2); background: var(--surface-2); }

/* ── Editor ──────────────────────────────────────────────── */
.var-row { display: flex; flex-wrap: wrap; gap: 8px; }
.varchip { border: 1px solid; border-radius: 8px; padding: 6px 11px; font-family: var(--mono); font-size: 12.5px; font-weight: 600; background: var(--surface); transition: .14s; cursor: pointer; }
.varchip:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.editor-area { width: 100%; min-height: 220px; resize: vertical; border-radius: 13px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); padding: 14px; font-family: var(--mono); font-size: 13px; line-height: 1.7; }
.editor-area:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ghost); }
.locked-field { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border-radius: 12px; background: var(--primary-soft); border: 1px dashed color-mix(in srgb, var(--primary) 40%, transparent); font-family: var(--mono); font-weight: 700; color: var(--primary-deep); }
.locked-field .lk { margin-left: auto; font-size: 11px; background: var(--surface); padding: 3px 8px; border-radius: 6px; color: var(--text-2); }
.editor-actions { display: flex; gap: 12px; align-items: center; position: sticky; bottom: 0; z-index: 2; margin: 14px -1px -1px; padding: 12px 2px 4px; background: linear-gradient(180deg, transparent, var(--surface) 28%); }
.phone-prefix { display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 13px; border-radius: 11px; font-weight: 700; font-size: 14px; background: var(--primary-soft); color: var(--primary-deep); flex: none; }
.phone-prefix.red { background: var(--red-bg); color: var(--red); }
.crit-toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 17px; border-radius: 12px; background: var(--red-bg); border: 1px solid color-mix(in srgb, var(--red) 22%, transparent); }

/* ── Review config (color picker) ───────────────────────── */
.review-cfg { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); margin-bottom: 14px; }
.tw-swatch-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tw-swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--border); cursor: pointer; transition: .12s; }
.tw-swatch.on { border-color: var(--text); transform: scale(1.1); }

/* ── Alerts (telegram) ───────────────────────────────────── */
.alerts-card-btn { display: flex; align-items: center; gap: 14px; width: 100%; padding: 17px 20px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); transition: .15s; text-align: left; cursor: pointer; }
.alerts-card-btn:hover { border-color: var(--text-3); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.alert-row { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-2); }
.alert-row:last-child { border-bottom: none; }

/* ── How-to steps ────────────────────────────────────────── */
.howto-step { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; padding: 11px 13px; border-radius: 11px; background: var(--surface-2); }
.howto-n { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }

/* ── IA provider cards ───────────────────────────────────── */
.ia-card { transition: opacity .16s; }
.ia-card.ia-off { opacity: .7; }
.usepill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--border); color: var(--text-3); background: var(--surface-2); }
.usepill.on-green { color: var(--primary-deep); border-color: color-mix(in srgb, var(--primary) 40%, transparent); background: var(--primary-soft); }
.usepill.on-blue { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 40%, transparent); background: var(--blue-bg); }
.kb-item { display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); }
.codeblock { margin-top: 14px; background: #0d1117; color: #c9d1d9; border-radius: 11px; padding: 13px; font-family: var(--mono); font-size: 12px; line-height: 1.7; overflow-x: auto; }
.codeblock b { color: #7ee787; }

/* ── Home specials ───────────────────────────────────────── */
.clock-card {
  background:
    linear-gradient(110deg, rgba(18,140,74,.0) 0%, rgba(18,140,74,.0) 45%, rgba(18,140,74,.35) 75%, rgba(18,140,74,.62) 100%),
    url('/logo/clock-bg.png') left center / auto 105% no-repeat,
    linear-gradient(155deg, var(--primary), var(--primary-deep));
  border-radius: var(--radius);
  padding: 22px 22px 18px 22px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 40px -22px var(--primary);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-end;
  text-align: right;
  min-height: 200px;
}
.clock-card .time {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.clock-card .date {
  margin-top: 6px;
  opacity: .96;
  font-weight: 600;
  font-size: 12px;
  text-shadow: 0 1px 6px rgba(0,0,0,.3);
  letter-spacing: .01em;
}
.clock-card .glow { display: none; }
.weather { display: flex; align-items: center; gap: 16px; }
.weather .big { font-size: 46px; font-weight: 800; letter-spacing: -.03em; }
.fcast { display: flex; gap: 8px; }
.fcast .d { flex: 1; text-align: center; padding: 10px 5px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.fcast .d .dl { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--text-3); }
.fcast .d .em { font-size: 22px; margin: 4px 0; }
.fcast .d .hi { font-weight: 800; }
.fcast .d .lo { color: var(--text-3); font-size: 12px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal .h { text-align: center; font-size: 10px; font-weight: 700; color: var(--text-3); padding-bottom: 6px; }
.cal .c { aspect-ratio: 1; display: grid; place-items: center; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--text-2); position: relative; transition: .12s; }
.cal.cal-wide .c { aspect-ratio: auto; height: 44px; }
.cal .c:hover { background: var(--surface-2); }
.cal .c.dim { color: var(--text-3); opacity: .5; }
.cal .c.today { background: var(--primary); color: #fff; font-weight: 800; }
.cal .c .ev { position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--blue); }
.add-tile { border: 2px dashed var(--border); border-radius: 13px; min-height: 120px; display: grid; place-items: center; color: var(--text-3); transition: .15s; background: var(--surface-2); }
.add-tile:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-ghost); }
.avis { border-left: 3px solid var(--primary); padding: 4px 0 4px 13px; }
.avis .t { font-weight: 700; font-size: 14px; }
.avis .d { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.avis .m { color: var(--text-3); font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.dist-row { display: grid; grid-template-columns: 120px 1fr 70px; align-items: center; gap: 12px; padding: 8px 0; }
.dist-row .lab { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 4px; }
.dist-row .val { text-align: right; font-weight: 700; font-size: 13px; color: var(--text-2); }
.bar-track { height: 8px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.bar-track > i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--blue))); }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-2); }
.rank-row:last-child { border-bottom: none; }
.rank-row .rn { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: 12px; flex: none; }
.rank-row .rn.g1 { background: #fff3cf; color: #b7860b; }
.rank-row .rn.g2 { background: #eef1f4; color: #6b7c89; }
.rank-row .rn.g3 { background: #fbe6d6; color: #c0651f; }
.rank-row .rn.gx { background: var(--surface-3); color: var(--text-3); }

/* ── Agenda modal ────────────────────────────────────────── */
.agenda-block { border: 1px solid var(--border); border-radius: 13px; padding: 15px 17px; background: var(--surface-2); }
.agenda-user { display: flex; align-items: flex-start; gap: 12px; padding: 13px; border: 1px solid var(--border); border-radius: 13px; margin-bottom: 10px; background: var(--surface); }
.agenda-add { border: 1.5px dashed color-mix(in srgb, var(--primary) 40%, transparent); border-radius: 13px; padding: 15px 17px; background: var(--primary-ghost); margin-top: 4px; }

/* ── Campaign cards ──────────────────────────────────────── */
.camp-card { border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 13px; padding: 15px 17px; background: var(--surface); }
.upload-box { border: 2px dashed var(--border); border-radius: 13px; padding: 26px; text-align: center; color: var(--text-3); display: flex; flex-direction: column; align-items: center; gap: 7px; transition: .14s; cursor: pointer; }
.upload-box:hover { border-color: var(--primary); color: var(--primary); }
.choice { border: 2px solid var(--border); border-radius: 13px; padding: 15px; text-align: center; background: var(--surface); display: flex; flex-direction: column; align-items: center; gap: 5px; position: relative; transition: .14s; cursor: pointer; }
.choice.on { border-color: var(--primary); background: var(--primary-ghost); }
.choice-chk { position: absolute; top: 10px; right: 10px; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; }
.wa-mini { background-color: #e5ddd5; border-radius: 13px; padding: 14px; min-height: 120px; display: flex; }
.wa-mini .wa-bubble { background: var(--bubble-out); }

/* ── Empresa form ────────────────────────────────────────── */
.emp-row { display: flex; align-items: center; gap: 14px; padding: 15px 4px; border-bottom: 1px solid var(--border-2); }
.emp-row:last-child { border-bottom: none; }
.modal-empresa { width: min(1040px, 95vw); max-height: 95vh; }
.emp-form { display: flex; flex-direction: column; gap: 10px; padding: 18px 22px; }
.form-sec { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary-deep); margin-top: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.frow { display: grid; gap: 12px; }
.field-wrap { position: relative; }
.field-wrap .field { padding-right: 38px; }
.field-ic { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--primary); pointer-events: none; }

/* ── Progress bar ────────────────────────────────────────── */
.bar { height: 8px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--primary), var(--primary-strong)); }

/* ── Loading overlay ─────────────────────────────────────── */
.g-loading-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(238,241,244,.75); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.g-loading-overlay.visible { opacity: 1; pointer-events: all; }
.g-loading-card {
  background: #fff; border-radius: 18px;
  box-shadow: 0 8px 40px rgba(61,127,31,.13), 0 2px 12px rgba(0,0,0,.08);
  padding: 2.2rem 2.8rem 2rem;
  display: flex; flex-direction: column; align-items: center; gap: .9rem;
  min-width: 190px; border: 1px solid rgba(61,127,31,.1);
  transform: translateY(6px) scale(.97);
  transition: transform .18s, opacity .18s;
}
.g-loading-overlay.visible .g-loading-card { transform: none; }
.g-loading-spinner { width: 46px; height: 46px; }
.g-loading-spinner svg { width: 100%; height: 100%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.g-loading-dots { display: flex; gap: .4rem; }
.g-loading-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); animation: ldot .8s ease-in-out infinite; }
.g-loading-dots span:nth-child(2) { animation-delay: .15s; }
.g-loading-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes ldot { 0%,80%,100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
.g-loading-msg { margin: 0; font-size: .9rem; font-weight: 600; color: var(--text-2); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1280px) {
  .top { gap: 8px; }
  .chip { height: 32px; padding: 0 10px; font-size: 12px; }
  .chip.license { height: 40px; }
  .chip.wa-txt { display: none; }
}
@media (max-width: 1100px) {
  .chip.violet, .chip.ai span:not(.dot) { display: none; }
  .sys-navgroup:not(:last-child) { border-right: none; padding-right: 0; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 72px 1fr; }
  .nav-item > span:not(.nav-icon), .nav-group-label, .brand-name, .side-foot small { display: none; }
  .side-brand { justify-content: center; padding: 20px 0 14px; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .nav-item.active::before { left: 0; }
  .cb-wrap { grid-template-columns: 280px 1fr; }
  .cb-detail { display: none; }
}
@media (max-width: 720px) {
  .wa-tab-label, .wa-tab-go { display: none; }
}

/* ── Backward compat (pages not yet migrated) ────────────── */
/* Old button variants */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 10px; border: none; white-space: nowrap;
  font-family: var(--font); font-weight: 700; font-size: 14px; color: #fff; cursor: pointer;
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 80%, #fff 10%), var(--primary-strong));
  box-shadow: 0 6px 16px -8px var(--primary); transition: .15s;
}
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  font-family: var(--font); font-weight: 600; font-size: 14px; color: var(--text); cursor: pointer;
  box-shadow: var(--shadow-sm); transition: .15s;
}
.btn-ghost:hover { border-color: var(--text-3); }
.btn-sm { height: 34px !important; padding: 0 12px !important; font-size: 12.5px !important; border-radius: 8px !important; }
.btn-danger-outline {
  display: inline-flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--red) 40%, transparent);
  background: var(--red-bg); color: var(--red);
  font-family: var(--font); font-weight: 600; font-size: 13px; cursor: pointer; transition: .15s;
}
.btn-danger-outline:hover { background: var(--red); color: #fff; border-color: transparent; }

/* Old card variants */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}

/* Old section header */
.section-header {
  display: flex; align-items: center; gap: .7rem;
  margin-bottom: 1.1rem;
}
.section-header h2, .section-header h3 {
  margin: 0; font-size: 1rem; font-weight: 700; color: var(--text); letter-spacing: -.01em;
}
.section-header-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; flex-shrink: 0;
}
.shi-green  { background: var(--primary-soft); color: var(--primary-deep); }
.shi-blue   { background: var(--blue-bg);      color: var(--blue); }
.shi-teal   { background: #e0f7f4;             color: #0d7c6c; }
.shi-orange { background: var(--amber-bg);     color: var(--amber); }
.shi-purple { background: var(--violet-bg);    color: var(--violet); }
.shi-yellow { background: #fef9c3;             color: #ca8a04; }
.shi-red    { background: var(--red-bg);       color: var(--red); }

/* Old form-group */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--text-2); margin-bottom: .35rem;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-family: var(--font); font-size: .875rem; transition: .14s;
}
.form-group textarea { height: auto; padding: 10px 12px; resize: vertical; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ghost); background: var(--surface);
}

/* Old alert/info boxes */
.alert { padding: .75rem 1rem; border-radius: 9px; font-size: .84rem; margin-bottom: .75rem; display: none; }
.alert.show { display: block; }
.alert.info  { background: var(--blue-bg);    border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent); color: var(--text); }
.alert.ok    { background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); color: var(--text); }
.alert.err   { background: var(--red-bg);     border: 1px solid color-mix(in srgb, var(--red) 25%, transparent);  color: var(--red); }
.alert.warn  { background: var(--amber-bg);   border: 1px solid color-mix(in srgb, var(--amber) 25%, transparent); color: var(--text); }

/* Old chip variants */
.chip-green  { background: var(--primary-soft); color: var(--primary-deep); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.chip-gray   { background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.chip-yellow { background: var(--amber-bg); color: var(--amber); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }

/* Old step-list */
.step-list { display: flex; flex-direction: column; gap: .5rem; }
.step-item { display: flex; gap: .75rem; align-items: flex-start; font-size: .84rem; line-height: 1.5; }
.step-num { width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .72rem; flex-shrink: 0; margin-top: .05rem; }
.step-body { flex: 1; padding-top: .15rem; color: var(--text-2); }
.step-body strong { color: var(--text); }

/* Old info-banner */
.info-banner { display: flex; align-items: flex-start; gap: .75rem; padding: .875rem 1.1rem; border-radius: 10px; font-size: .84rem; line-height: 1.5; margin-bottom: 1rem; }
.info-banner-blue   { background: var(--blue-bg);    border: 1px solid color-mix(in srgb, var(--blue) 22%, transparent); }
.info-banner-yellow { background: var(--amber-bg);   border: 1px solid color-mix(in srgb, var(--amber) 22%, transparent); }
.info-banner-green  { background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent); }

/* Old toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--surface-3); border-radius: 999px; transition: .2s; }
.toggle-slider::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Old confirm modal */
.confirm-modal { display: none; position: fixed; inset: 0; z-index: 1001; background: transparent; align-items: center; justify-content: center; }
.confirm-modal.show { display: flex; }
.confirm-card { background: var(--surface); border-radius: 18px; padding: 2rem; box-shadow: 0 30px 80px -20px rgba(15,27,34,.35), 0 8px 24px -8px rgba(15,27,34,.2), 0 0 0 1px var(--border); max-width: 400px; width: 90%; }
.confirm-card h3 { margin: 0 0 .5rem; font-size: 1.1rem; }
.confirm-card p { margin: 0 0 1.5rem; color: var(--text-2); font-size: .9rem; }
.confirm-buttons { display: flex; gap: .75rem; justify-content: flex-end; }
.confirm-btn-ok, .confirm-btn-cancel { padding: .55rem 1.3rem; border-radius: 9px; font-size: .875rem; font-weight: 700; cursor: pointer; border: none; font-family: var(--font); }
.confirm-btn-ok { background: var(--primary); color: #fff; }
.confirm-btn-cancel { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

/* Hidden utility */
.hidden { display: none !important; }

/* ── Legacy / Component CSS (Option C migration) ────────────────────────────── */

/* stat-card tiles (dashboard, avaliacoes, ctb-*) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: .3rem;
  transition: transform .15s, box-shadow .15s; cursor: default;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; margin-bottom: .25rem; flex-shrink: 0; }
.stat-card .value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--text); }
.stat-card .label { font-size: .72rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.stat-card .kpi-sub { font-size: .72rem; color: var(--text-3); }
.stat-card.card-blue  .stat-icon { background: var(--blue-bg);      color: var(--blue); }
.stat-card.card-green .stat-icon { background: var(--primary-soft);  color: var(--primary-deep); }
.stat-card.card-red   .stat-icon { background: var(--red-bg);        color: var(--red); }
.stat-card.card-red   .value     { color: var(--red); }
.stat-card.card-purple.stat-icon { background: var(--violet-bg);     color: var(--violet); }
.stat-card.card-purple .stat-icon{ background: var(--violet-bg);     color: var(--violet); }

/* WA connect banner (dashboard) */
.wa-connect-banner { display: none; align-items: center; gap: 1rem; background: var(--amber-bg); border: 1.5px solid color-mix(in srgb, var(--amber) 40%, transparent); border-radius: var(--radius); padding: .875rem 1.25rem; margin-bottom: 1.25rem; }
.wa-connect-banner.visible { display: flex; }
.wa-connect-banner-icon { width: 36px; height: 36px; background: var(--amber); border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.wa-connect-banner-text { flex: 1; min-width: 0; }
.wa-connect-banner-title { font-size: .9rem; font-weight: 700; color: var(--amber); margin-bottom: .15rem; }
.wa-connect-banner-sub { font-size: .78rem; color: color-mix(in srgb, var(--amber) 80%, var(--text)); }
.wa-connect-banner-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem 1rem; background: var(--amber); color: #fff; font-size: .8rem; font-weight: 700; border: none; border-radius: 8px; cursor: pointer; white-space: nowrap; transition: background .15s; text-decoration: none; }
.wa-connect-banner-btn:hover { filter: brightness(.9); }

/* Chip badges (status) */
.chip-green  { display:inline-flex;align-items:center;gap:.35rem;padding:.2rem .7rem;font-size:.78rem;font-weight:700;border-radius:999px;background:var(--primary-soft);color:var(--primary-deep); }
.chip-yellow { display:inline-flex;align-items:center;gap:.35rem;padding:.2rem .7rem;font-size:.78rem;font-weight:700;border-radius:999px;background:var(--amber-bg);color:var(--amber); }
.chip-gray   { display:inline-flex;align-items:center;gap:.35rem;padding:.2rem .7rem;font-size:.78rem;font-weight:700;border-radius:999px;background:var(--surface-3);color:var(--text-2); }
.chip-red    { display:inline-flex;align-items:center;gap:.35rem;padding:.2rem .7rem;font-size:.78rem;font-weight:700;border-radius:999px;background:var(--red-bg);color:var(--red); }
.chip-blue   { display:inline-flex;align-items:center;gap:.35rem;padding:.2rem .7rem;font-size:.78rem;font-weight:700;border-radius:999px;background:var(--blue-bg);color:var(--blue); }

/* Session cards (whatsapp.js dynamic HTML) */
.sessao-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: .875rem; transition: box-shadow .15s; }
.sessao-card:hover { box-shadow: var(--shadow-md); }
.sessao-card.status-connected { border-left: 4px solid var(--primary); }
.sessao-card.status-qr { border-left: 4px solid var(--amber); }
.sessao-card.status-disconnected, .sessao-card.status-error { border-left: 4px solid var(--red); }
.sessao-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: .5rem; }
.sessao-nome { font-size: 1rem; font-weight: 700; color: var(--text); display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.sessao-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.sessao-meta { font-size: .78rem; color: var(--text-3); font-family: var(--mono); margin-bottom: .75rem; }
.sessao-phone-badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 600; padding: .2rem .65rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary-deep); }

/* QR code area */
.qr-area { display: none; margin-top: .75rem; }
.qr-area.visible { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.qr-connected-msg { display: none; align-items: center; gap: .75rem; padding: .75rem 1rem; background: var(--primary-soft); border-radius: 10px; border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); }
.qr-connected-msg.visible { display: flex; }
.qr-connected-icon { font-size: 1.5rem; }
.phone-mockup { width: 210px; flex-shrink: 0; background: linear-gradient(160deg,#1c1c1e,#000); border-radius: 26px; padding: 10px; box-shadow: 0 20px 50px -20px rgba(0,0,0,.6), inset 0 0 0 1.5px #2a2a2c; }
.phone-notch { display: flex; align-items: center; justify-content: center; gap: 5px; height: 18px; margin-bottom: 5px; }
.phone-camera { width: 8px; height: 8px; background: #222; border-radius: 50%; border: 1px solid #333; }
.phone-speaker { width: 36px; height: 6px; background: #222; border-radius: 3px; }
.phone-screen { background: #fff; border-radius: 18px; overflow: hidden; }
.phone-screen-header { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: #075e54; color: #fff; font-size: .72rem; font-weight: 600; }
.phone-wa-icon { width: 16px; height: 16px; flex-shrink: 0; fill: #fff; }
.phone-qr-wrap { display: flex; align-items: center; justify-content: center; padding: 10px; min-height: 130px; }
.phone-qr-wrap img { border-radius: 6px; }
.phone-qr-label { text-align: center; font-size: .63rem; color: #555; padding: 4px 8px 10px; line-height: 1.4; }
.phone-home { width: 38px; height: 4px; background: #333; border-radius: 2px; margin: 8px auto 2px; }
.qr-instrucoes { flex: 1; min-width: 200px; font-size: .82rem; color: var(--text-2); line-height: 1.6; }
.qr-instrucoes strong { color: var(--text); }
.qr-instrucoes ol { margin: .5rem 0 0 1.1rem; padding: 0; }
.qr-instrucoes li { margin-bottom: .25rem; }
.qr-spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }

/* QR clean layout — no phone mockup, just QR + 3 steps */
.qr-area-clean.visible { display: flex !important; justify-content: center; margin-top: 1rem; }
.qr-card { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); max-width: 360px; width: 100%; }
.qr-card .qr-img-wrap { width: 240px; height: 240px; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.qr-card .qr-img-wrap img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }
.qr-card .qr-loading { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text-3); font-size: .78rem; }
.qr-card .qr-steps { display: flex; flex-direction: column; gap: .4rem; font-size: .82rem; color: var(--text-2); line-height: 1.45; text-align: center; }
.qr-card .qr-steps b { color: var(--text); font-weight: 600; }

/* Sistema — sidebar layout */
.sys-layout { display: grid; grid-template-columns: 220px 1fr; gap: 0; min-height: 600px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.sys-sidebar { background: var(--surface-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 1rem 0; }
.sys-sidebar-title { font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); padding: 0 1.1rem .75rem; }
.sys-sidebar-section { font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: 1rem 1.1rem .35rem; margin-top: .25rem; border-top: 1px solid var(--border); }
.sys-menu-item { display: flex; align-items: center; gap: .6rem; padding: .52rem 1.1rem; font-size: .84rem; font-weight: 500; color: var(--text-2); cursor: pointer; transition: background .12s, color .12s; border-left: 3px solid transparent; }
.sys-menu-item:hover { background: var(--surface-3); color: var(--text); }
.sys-menu-item.active { background: var(--primary-ghost); color: var(--primary-deep); font-weight: 700; border-left-color: var(--primary); }
.sys-menu-icon { display: flex; align-items: center; justify-content: center; width: 16px; flex-shrink: 0; }
.sys-content { flex: 1; overflow-y: auto; min-width: 0; }
.sys-panel { display: none; padding: 1.5rem; }
.sys-panel.active { display: block; }
.sys-panel-header { margin-bottom: 1.5rem; }
.sys-panel-title { font-size: 1.1rem; font-weight: 800; color: var(--text); margin-bottom: .35rem; letter-spacing: -.01em; }
.sys-panel-sub { font-size: .84rem; color: var(--text-2); line-height: 1.55; }
.sys-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .875rem 1rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); margin-bottom: .625rem; }
.sys-row-info { flex: 1; min-width: 0; }
.sys-row-title { font-size: .9rem; font-weight: 600; color: var(--text); }
.sys-row-desc { font-size: .78rem; color: var(--text-2); margin-top: .15rem; }
.sys-divider { height: 1px; background: var(--border); margin: 1.25rem 0; }

/* AI provider cards (sistema.html) */
.ai-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 1rem; margin-top: 1rem; }
.ai-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow-sm); transition: box-shadow .15s; }
.ai-card:hover { box-shadow: var(--shadow-md); }
.ai-card.disabled { opacity: .6; }
.ai-card-head { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .875rem; }
.ai-card-logo { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: #f3f4f6; color: #111; }
.ai-card-logo.openai { background: #10a37f; color: #fff; }
.ai-card-logo.gemini { background: #4285f4; color: #fff; }
.ai-card-logo.anthropic { background: #c96442; color: #fff; }
.ai-card-logo.groq { background: #f55036; color: #fff; }
.ai-card-name { font-size: .9rem; font-weight: 700; color: var(--text); }
.ai-card-model { font-size: .72rem; color: var(--text-3); margin-top: .1rem; }
.ai-card-status { display: inline-flex; align-items: center; gap: .35rem; font-size: .72rem; font-weight: 600; margin-top: .35rem; }
.ai-card-status.ok { color: var(--primary-deep); }
.ai-card-status.err { color: var(--text-3); }
.ai-card-status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ai-card-body { display: flex; flex-direction: column; gap: .75rem; }
.ai-card-field-label { font-size: .72rem; font-weight: 600; color: var(--text-2); margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .06em; }
.ai-key-wrap { display: flex; gap: .4rem; }
.ai-key-wrap input { flex: 1; height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-family: var(--mono); font-size: .82rem; }
.ai-key-wrap input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ghost); }
.btn-eye { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.btn-eye:hover { background: var(--surface-3); color: var(--text); }
.ai-model-select { width: 100%; height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-family: var(--font); font-size: .84rem; cursor: pointer; }
.ai-uso-pills { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .25rem; }
.ai-uso-pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600; padding: .25rem .6rem; border-radius: 7px; border: 1px solid var(--border); color: var(--text-3); background: var(--surface-2); cursor: pointer; transition: .12s; }
.ai-uso-pill.active.ocr  { color: var(--primary-deep); border-color: color-mix(in srgb,var(--primary) 40%,transparent); background: var(--primary-soft); }
.ai-uso-pill.active.chat { color: var(--blue); border-color: color-mix(in srgb,var(--blue) 40%,transparent); background: var(--blue-bg); }
.ai-card-actions { display: flex; gap: .5rem; margin-top: .25rem; }

/* IA Central */
.ia-central-layout { display: flex; flex-direction: column; height: calc(100vh - 130px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.ia-central-header { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); background: linear-gradient(135deg, rgba(61,127,31,.06), transparent); flex-shrink: 0; }
.ia-header-info { flex: 1; min-width: 0; }
.ia-msgs { flex: 1; overflow-y: auto; padding: 1.5rem; display: flex; flex-direction: column; gap: .875rem; }
.ia-loading { display: flex; align-items: center; gap: .75rem; padding: 1.5rem; color: var(--text-2); font-size: .875rem; }
.ia-loading-text { font-style: italic; }
.ia-sugestoes { padding: .75rem 1.5rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.ia-sugestoes-label { font-size: .7rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; margin-bottom: .5rem; }
.ia-sug-btn { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .9rem; border: 1px solid var(--border); background: var(--surface); border-radius: 20px; font-size: .82rem; font-weight: 500; color: var(--text-2); cursor: pointer; margin: .2rem .2rem 0 0; transition: .12s; }
.ia-sug-btn:hover { border-color: var(--primary); color: var(--primary-deep); background: var(--primary-ghost); }
.ia-input-bar { display: flex; align-items: flex-end; gap: .75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border); flex-shrink: 0; }
.ia-textarea { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 14px; padding: .65rem 1rem; font-family: var(--font); font-size: .9rem; color: var(--text); background: var(--surface-2); line-height: 1.5; max-height: 130px; overflow-y: auto; transition: border-color .15s; }
.ia-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ghost); background: var(--surface); }
.ia-send-btn { width: 46px; height: 46px; border-radius: 50%; border: none; background: linear-gradient(180deg, var(--primary), var(--primary-strong)); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 16px -8px var(--primary); flex-shrink: 0; transition: .15s; }
.ia-send-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.ia-clear-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: .12s; }
.ia-clear-btn:hover { background: var(--red-bg); color: var(--red); border-color: color-mix(in srgb,var(--red) 30%,transparent); }
.ia-avatar-wrap { position: relative; width: 48px; height: 48px; flex-shrink: 0; }
.ia-avatar-ring { position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid rgba(61,127,31,.4); animation: ia-ring-spin 3s linear infinite; }
.ia-avatar-ring::before { content: ''; position: absolute; top: -2px; left: 50%; width: 4px; height: 4px; border-radius: 50%; background: var(--primary); transform: translateX(-50%); }
.ia-avatar-ring2 { position: absolute; inset: -8px; border-radius: 50%; border: 1px solid rgba(59,130,246,.2); animation: ia-ring-spin 6s linear infinite reverse; }
.ia-avatar-core { position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(135deg, #2d6016, var(--primary)); display: grid; place-items: center; color: #fff; box-shadow: 0 0 16px rgba(61,127,31,.4); }
@keyframes ia-ring-spin { to { transform: rotate(360deg); } }
.ia-neural-loader { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; gap: 1rem; color: var(--text-3); font-size: .875rem; }
.ia-neural-ring, .ia-neural-orbit, .ia-neural-orbit2, .ia-neural-core { /* simplified */ }

/* IA Central — light theme polish */
#page-ia-central .ia-central-layout { background: var(--surface); }
#page-ia-central .ia-central-header h3 { margin: 0; font-size: 16px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
#page-ia-central .ia-central-header p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }
#page-ia-central .ia-msgs { background: var(--surface-2); }
#page-ia-central .ia-input-bar { background: var(--surface); }

/* Thinking dots (substitui neural loader escuro) */
.ia-thinking { display: inline-flex; gap: 5px; align-items: center; }
.ia-think-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
  animation: ia-bounce 1.2s infinite ease-in-out;
  opacity: .65;
}
.ia-think-dot:nth-child(2) { animation-delay: .15s; }
.ia-think-dot:nth-child(3) { animation-delay: .3s; }
@keyframes ia-bounce { 0%,80%,100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* IA Central — mensagens light */
.ia-msg-user { display: flex; justify-content: flex-end; }
.ia-msg-ia   { display: flex; align-items: flex-start; gap: 10px; max-width: 85%; }
.ia-mini-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  display: grid; place-items: center; color: #fff; flex: none;
  box-shadow: 0 6px 14px -6px var(--primary);
}
.ia-msg-user .ia-bubble,
.ia-msg-ia   .ia-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px; line-height: 1.55;
  word-break: break-word;
  max-width: 100%;
}
.ia-msg-user .ia-bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 6px 18px -10px var(--primary);
}
.ia-msg-ia .ia-bubble {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}
.ia-cursor {
  display: inline-block; width: 2px; height: 14px;
  background: var(--primary);
  vertical-align: middle;
  animation: ia-blink 1s infinite;
}
@keyframes ia-blink { 50% { opacity: 0; } }

/* cb-wa-* classes (chatbot.html legacy — uses chatbot.js + cbx classes via chat.css) */
.cb-wa-layout { display: flex; height: 100%; }
.cb-wa-sidebar { width: 320px; flex-shrink: 0; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface); }
.cb-wa-sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1rem .75rem; }
.cb-wa-search { padding: 0 .875rem .75rem; }
.cb-wa-search input { width: 100%; height: 38px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface-2); font-family: var(--font); font-size: .84rem; color: var(--text); }
.cb-wa-contacts { flex: 1; overflow-y: auto; }
.cb-wa-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.cb-wa-chat-header { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); }
.cb-wa-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-strong)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.cb-wa-chat-info { flex: 1; min-width: 0; }
.cb-wa-chat-name { font-weight: 700; font-size: .9rem; color: var(--text); }
.cb-wa-chat-phone { font-size: .75rem; color: var(--text-3); }
.cb-wa-chat-actions { display: flex; align-items: center; gap: .5rem; }
.cb-pausar-wrap { display: flex; align-items: center; gap: .5rem; }
.cb-pausar-label { font-size: .78rem; font-weight: 600; color: var(--text-2); }
.cb-pausar-toggle { width: 44px; height: 24px; border-radius: 999px; border: none; background: var(--primary); cursor: pointer; position: relative; transition: .2s; }
.cb-pausar-toggle::after { content: ''; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.cb-pausar-toggle.paused { background: var(--amber); }
.cb-pausar-toggle.paused::after { right: auto; left: 3px; }

/* Header pill: Pausado (amber) com estrela */
.cb-pill-status {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--amber) 18%, #fff);
  color: var(--amber);
  font-size: 13.5px; font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  flex: none;
}
.cb-pill-status svg { color: var(--amber); flex: none; }

/* Botão verde Retomar IA / amber Assumir conversa */
.cb-btn-retomar {
  height: 38px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 13.5px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(180deg, var(--primary), var(--primary-strong));
  color: #fff;
  box-shadow: 0 8px 18px -10px var(--primary);
  flex: none;
}
.cb-btn-retomar svg { flex: none; }
.cb-btn-retomar.warn {
  background: linear-gradient(180deg, var(--amber), color-mix(in srgb, var(--amber) 85%, #000));
  box-shadow: 0 8px 18px -10px var(--amber);
}

/* Code-block (token API doc snippet) */
.code-block {
  font-family: var(--mono);
  background: #0d1117;
  color: #c9d1d9;
  padding: 14px 16px;
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.55;
  border: 1px solid #161b22;
}
.code-block .cb-method { color: #d2a8ff; font-weight: 700; }
.code-block .cb-path   { color: #79c0ff; }
.code-block .cb-header { color: #ff7b72; font-weight: 600; }
.code-block .cb-string { color: #a5d6ff; }
.code-block .cb-key    { color: #79c0ff; }

/* Gerenciar Usuários (Sistema > Usuário) */
.usr-section-label {
  font-size: 11px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 12px;
}
.usr-add-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
/* Inline row pra adicionar usuário (compacto) */
.usr-add-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.usr-add-row .field { flex: 1; min-width: 0; height: 40px; }
@media (max-width: 920px) { .usr-add-row { flex-direction: column; align-items: stretch; } .usr-add-row .btn { width: 100%; } }
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group .flbl { margin: 0; }
.field-hint { font-size: 12px; color: var(--text-3); line-height: 1.4; }
@media (max-width: 920px) { .usr-add-grid { grid-template-columns: 1fr; } }

/* AI provider — toggle ativa/desativa */
.ai-card-enable {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-2);
}
.ai-card-enable.on { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); color: var(--primary-deep); }
.ai-card-enable .toggle-switch { flex: none; }

/* Central IA — master switches + shortcuts */
.iac-master { padding: 16px 18px; transition: border-color .15s, box-shadow .15s; }
.iac-master.on  { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); box-shadow: 0 6px 22px -14px var(--primary); }
.iac-master.off { background: var(--surface-2); }
.iac-shortcut {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  text-decoration: none;
  color: inherit;
}
.iac-shortcut:hover { border-color: var(--primary); box-shadow: 0 6px 18px -10px var(--primary); transform: translateY(-1px); }
.iac-sc-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.iac-sc-desc { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.iac-sc-desc b { color: var(--primary-deep); }
.cb-wa-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-3); gap: .75rem; padding: 2rem; text-align: center; }
.cb-wa-messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .625rem; background: var(--surface-2); }
.cb-wa-input { display: flex; align-items: flex-end; gap: .75rem; padding: .875rem 1rem; border-top: 1px solid var(--border); }
.cb-wa-input textarea { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 12px; padding: .6rem .875rem; font-family: var(--font); font-size: .875rem; color: var(--text); background: var(--surface-2); line-height: 1.4; }
.cb-wa-send { width: 42px; height: 42px; border-radius: 50%; border: none; background: linear-gradient(180deg, var(--primary), var(--primary-strong)); color: #fff; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }

/* ctb / dominio legacy */
.ctb-toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.ctb-toggle input { opacity: 0; width: 0; height: 0; }
.ctb-toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--surface-3); border-radius: 999px; transition: .2s; }
.ctb-toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: .2s; }
.ctb-toggle input:checked + .ctb-toggle-slider { background: var(--primary); }
.ctb-toggle input:checked + .ctb-toggle-slider::before { transform: translateX(20px); }

/* Modal result */
.modal-result { padding: .65rem 1rem; border-radius: 9px; font-size: .84rem; margin-top: .875rem; display: none; }
.modal-result.ok  { display: block; background: var(--primary-soft); color: var(--primary-deep); border: 1px solid color-mix(in srgb,var(--primary) 25%,transparent); }
.modal-result.err { display: block; background: var(--red-bg); color: var(--red); border: 1px solid color-mix(in srgb,var(--red) 25%,transparent); }

/* Modal tabs (teste de envio) */
.modal-tab { border: none; background: transparent; padding: .5rem 1rem; font-family: var(--font); font-size: .875rem; font-weight: 600; color: var(--text-2); cursor: pointer; border-bottom: 2.5px solid transparent; margin-bottom: -1px; transition: .14s; }
.modal-tab.active { color: var(--primary-deep); border-bottom-color: var(--primary); }
.modal-panel { display: none; padding-top: 1rem; }
.modal-panel.active { display: block; }

/* Mis legacy */
.var-tag { display: inline-flex; align-items: center; padding: .2rem .6rem; border-radius: 7px; font-family: var(--mono); font-size: .78rem; font-weight: 600; cursor: pointer; border: 1px solid; transition: .12s; }
.var-tag:hover { opacity: .8; transform: translateY(-1px); }
.var-tag-green  { color: #15803d; border-color: #86efac; background: #f0fdf4; }
.var-tag-blue   { color: #1e40af; border-color: #93c5fd; background: #eff6ff; }
.var-tag-purple { color: #6d28d9; border-color: #c4b5fd; background: #f5f3ff; }
.var-tag-orange { color: #c2410c; border-color: #fdba74; background: #fff7ed; }
.var-tag-teal   { color: #0f766e; border-color: #5eead4; background: #f0fdfa; }
.var-tag-red    { color: #b91c1c; border-color: #fca5a5; background: #fef2f2; }
.var-tag-yellow { color: #92400e; border-color: #fcd34d; background: #fffbeb; }

/* dash-kpi / dm-dashboard */
.dash-kpi-card { padding: .875rem 1rem !important; cursor: default; }
.dkpi-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; margin-bottom: .5rem; }
.dkpi-val { font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.dkpi-label { font-size: .72rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-top: .15rem; }
.dkpi-sub { font-size: .7rem; color: var(--text-3); margin-top: .1rem; }
.dash-chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm); }

/* ctb-* legacy */
.ctb-search-wrap { position: relative; }
.ctb-search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.ctb-search-input { width: 100%; height: 40px; padding: 0 12px 0 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-family: var(--font); font-size: .875rem; color: var(--text); }
.ctb-search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ghost); }
.ctb-emp-list { display: flex; flex-direction: column; gap: 10px; }
.ctb-table-empty { text-align: center; padding: 2.5rem; color: var(--text-3); font-size: .875rem; }
.ctb-emp-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.ctb-emp-row:hover { border-color: var(--primary); box-shadow: 0 6px 22px -10px var(--primary); transform: translateY(-1px); }
.ctb-emp-avatar {
  width: 44px; height: 44px; flex: none;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--primary), var(--primary-strong));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px;
  box-shadow: 0 6px 14px -6px var(--primary);
}
.ctb-emp-info { flex: 1; min-width: 0; }
.ctb-emp-nome { font-weight: 700; font-size: 14.5px; color: var(--text); margin-bottom: 4px; }
.ctb-emp-meta {
  font-size: 12.5px; color: var(--text-3);
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.ctb-emp-meta svg { color: var(--text-3); }
.ctb-meta-dot { color: var(--text-3); opacity: .55; margin: 0 2px; }
.ctb-regime-chip {
  display: inline-flex; align-items: center;
  background: var(--primary-soft); color: var(--primary-deep);
  font-weight: 700; font-size: 11px;
  padding: 2px 9px; border-radius: 999px;
  letter-spacing: .01em;
}
.ctb-emp-actions { display: flex; gap: 6px; flex: none; }
.btn-icon-act {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 10px;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font); font-weight: 600; font-size: 12.5px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-icon-act:hover { background: var(--surface-3); color: var(--text); border-color: var(--text-3); }
.btn-icon-act.danger { color: var(--red); }
.btn-icon-act.danger:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.btn-icon-act svg { flex: none; }

/* Contábil — Tabela de documentos */
.ctb-doc-table-wrap { width: 100%; overflow-x: auto; }
.ctb-doc-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.ctb-doc-table thead th {
  text-align: left; padding: 10px 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.ctb-doc-table thead th:first-child { border-top-left-radius: 10px; }
.ctb-doc-table thead th:last-child  { border-top-right-radius: 10px; text-align: right; }
.ctb-doc-table tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.ctb-doc-table tbody td:last-child { text-align: right; }
.ctb-doc-table tbody tr:hover td { background: var(--surface-2); }
.ctb-doc-table tbody tr:last-child td { border-bottom: none; }
.ctb-table-empty { text-align: center !important; padding: 2.5rem !important; color: var(--text-3); font-size: 13.5px; }

/* Status badges */
.ctb-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 999px;
  letter-spacing: .01em;
}
.ctb-status.recebido       { background: var(--blue-bg);    color: var(--blue); }
.ctb-status.ocr_pendente   { background: var(--amber-bg);   color: var(--amber); }
.ctb-status.ocr_erro       { background: var(--red-bg);     color: var(--red); }
.ctb-status.revisao_manual { background: var(--violet-bg);  color: var(--violet); }
.ctb-status.aprovado       { background: var(--primary-soft); color: var(--primary-deep); }
.ctb-status.processado     { background: var(--primary-soft); color: var(--primary-deep); }

/* Feed (Atividade Recente) */
.ctb-feed-panel { padding: 18px; max-height: calc(100vh - 180px); display: flex; flex-direction: column; }
.ctb-feed-list { flex: 1; overflow-y: auto; padding-right: 4px; }
.ctb-feed-empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 1.5rem; }
.ctb-timeline { display: flex; flex-direction: column; gap: 10px; }
.ctb-tl-item { display: flex; align-items: flex-start; gap: 10px; }
.ctb-tl-dot {
  width: 9px; height: 9px; border-radius: 50%;
  flex: none; margin-top: 13px;
  background: var(--text-3);
}
.ctb-tl-dot.recebido       { background: var(--blue); }
.ctb-tl-dot.ocr_pendente   { background: var(--amber); }
.ctb-tl-dot.ocr_erro,
.ctb-tl-dot.erro_ocr       { background: var(--red); }
.ctb-tl-dot.revisao_manual,
.ctb-tl-dot.manual         { background: var(--violet); }
.ctb-tl-dot.aprovado,
.ctb-tl-dot.ocr_ok         { background: var(--primary); }
.ctb-tl-card {
  flex: 1; min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  border-left: 3px solid var(--text-3);
}
.ctb-tl-card.recebido       { border-left-color: var(--blue); }
.ctb-tl-card.ocr_pendente   { border-left-color: var(--amber); }
.ctb-tl-card.ocr_erro,
.ctb-tl-card.erro_ocr       { border-left-color: var(--red); background: color-mix(in srgb, var(--red-bg) 50%, var(--surface)); }
.ctb-tl-card.revisao_manual,
.ctb-tl-card.manual         { border-left-color: var(--violet); }
.ctb-tl-card.aprovado,
.ctb-tl-card.ocr_ok         { border-left-color: var(--primary); }
.ctb-tl-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.ctb-tl-icon { font-size: 13px; line-height: 1; }
.ctb-tl-label { font-size: 11.5px; font-weight: 700; color: var(--text-2); flex: 1; }
.ctb-tl-time { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ctb-tl-text { font-size: 12.5px; color: var(--text); line-height: 1.4; word-break: break-word; }
.ctb-tl-text strong { color: var(--text); font-weight: 700; }

/* Grid de empresas (ctb-arquivos) */
.ctb-arq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.ctb-arq-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  display: flex; align-items: flex-start; gap: 12px;
}
.ctb-arq-card:hover { border-color: var(--primary); box-shadow: 0 6px 22px -10px var(--primary); transform: translateY(-1px); }
.ctb-arq-card.active { border-color: var(--primary); background: var(--primary-soft); }
.ctb-arq-card-avatar {
  width: 42px; height: 42px; flex: none;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--primary), var(--primary-strong));
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
  box-shadow: 0 6px 14px -6px var(--primary);
}
.ctb-arq-card-body { flex: 1; min-width: 0; }
.ctb-arq-card-line1 { margin-bottom: 6px; }
.ctb-arq-card-name {
  font-weight: 700; font-size: 14px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ctb-arq-card-cnpj {
  font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin-top: 2px;
}
.ctb-arq-card-stats { display: flex; flex-wrap: wrap; gap: 4px; }
.ctb-arq-stat-pill {
  display: inline-flex; align-items: center;
  font-size: 10.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px;
  letter-spacing: .01em; line-height: 1.4;
}
.ctb-arq-stat-pill.total   { background: var(--surface-3); color: var(--text-2); }
.ctb-arq-stat-pill.pending { background: var(--amber-bg);  color: var(--amber); }
.ctb-arq-stat-pill.ok      { background: var(--primary-soft); color: var(--primary-deep); }
.ctb-arq-stat-pill.err     { background: var(--red-bg);    color: var(--red); }

/* sys-panel-* inside pages (token.html) */
.sys-panel-header { padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--border); }

/* Log table */
.log-level-info  { color: var(--blue); background: var(--blue-bg); }
.log-level-warn  { color: var(--amber); background: var(--amber-bg); }
.log-level-error { color: var(--red); background: var(--red-bg); }

/* Misc alert-* in JS modules */
.alert-success { background: var(--primary-soft); color: var(--primary-deep); border: 1px solid color-mix(in srgb,var(--primary) 25%,transparent); padding: .65rem 1rem; border-radius: 9px; font-size: .84rem; }
.alert-error   { background: var(--red-bg); color: var(--red); border: 1px solid color-mix(in srgb,var(--red) 25%,transparent); padding: .65rem 1rem; border-radius: 9px; font-size: .84rem; }

/* Missing .page-title-bar (app.js references it) */
.page-title-bar { display: none; }
.page-title-bar h1 { font-size: 1.4rem; font-weight: 800; }

/* Esl/esv for erp status */
.esl { font-size: .72rem; color: var(--text-3); }
.esv { font-size: .84rem; font-weight: 600; color: var(--text); }
.ib-icon { display: flex; flex-shrink: 0; margin-top: 1px; }

/* ── Home page dynamic classes (home.js) ──────────────────────── */

/* Modal backdrop — hidden by default, shown via .open */
.modal-backdrop { display: none; }
.modal-backdrop.open { display: grid; }
/* Agenda WA overlay (same pattern) */
.agwa-overlay { display: none !important; }
.agwa-overlay.open { display: flex !important; }

/* Calendar days */
.home-cal-day {
  height: 44px; display: grid; place-items: center; border-radius: 9px;
  font-size: 17px; font-weight: 700; color: var(--text-2);
  cursor: pointer; transition: background .12s; position: relative;
}
.home-cal-day:hover { background: var(--surface-2); }
.home-cal-day.other-month { color: var(--text-3); opacity: .45; }
.home-cal-day.today { background: var(--primary); color: #fff; font-weight: 800; }
.home-cal-day.has-event::after {
  content: ''; position: absolute; bottom: 3px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--blue);
}
.home-cal-day.today.has-event::after { background: rgba(255,255,255,.8); }

/* Weather forecast (hd-wf-*) */
.hd-wf-day { flex: 1; text-align: center; padding: 14px 6px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); min-width: 70px; }
.hd-wf-label { font-size: 10px; font-weight: 700; letter-spacing: .06em; color: var(--text-3); text-transform: uppercase; }
.hd-wf-icon { font-size: 60px; margin: 10px 0 6px; line-height: 1; filter: drop-shadow(0 5px 10px rgba(15,27,34,.14)); }
.hd-wf-max { font-weight: 800; font-size: 20px; }
.hd-wf-min { color: var(--text-3); font-size: 12px; }
.home-clima-icon { font-size: 72px !important; line-height: 1; filter: drop-shadow(0 6px 12px rgba(15,27,34,.15)); }

/* Next events */
.hd-next-event { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border-2); cursor: pointer; transition: background .1s; border-radius: 6px; }
.hd-next-event:last-child { border-bottom: none; }
.hd-next-event:hover { background: var(--surface-2); padding-left: 4px; }
.hd-nev-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
.hd-nev-body { flex: 1; min-width: 0; }
.hd-nev-titulo { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd-nev-hora { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.hd-next-empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 12px 0; }

/* Post-its */
.home-postit { padding: 10px 12px; border-radius: 11px; cursor: pointer; transition: transform .15s, box-shadow .15s; min-height: 80px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.home-postit:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.12); }
.home-postit-titulo { font-size: 13px; font-weight: 700; color: rgba(0,0,0,.75); }
.home-postit-conteudo { font-size: 12px; color: rgba(0,0,0,.55); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.home-postit-novo { display: grid !important; place-items: center; background: var(--surface-2) !important; border: 2px dashed var(--border); font-size: 24px; color: var(--text-3); min-height: 80px; box-shadow: none; }
.home-postit-novo:hover { border-color: var(--primary); color: var(--primary); }

/* Agenda items in modal */
.home-agenda-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 6px; cursor: pointer; transition: .12s; }
.home-agenda-item:hover { background: var(--surface-3); }
.home-agenda-cor { width: 5px; height: 40px; border-radius: 3px; flex-shrink: 0; }
.home-agenda-item-body { flex: 1; min-width: 0; }
.home-agenda-item-titulo { font-size: 14px; font-weight: 600; color: var(--text); }
.home-agenda-item-hora { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.home-agenda-item-del { width: 28px; height: 28px; border-radius: 7px; border: none; background: transparent; color: var(--text-3); cursor: pointer; display: grid; place-items: center; flex-shrink: 0; transition: .12s; font-size: 14px; }
.home-agenda-item-del:hover { background: var(--red-bg); color: var(--red); }

/* Recados */
.hd-recado-item { border-left: 3px solid var(--primary); padding: 8px 0 8px 12px; margin-bottom: 8px; }
.hd-recado-item:last-child { margin-bottom: 0; }
.hd-recado-titulo { font-size: 14px; font-weight: 700; color: var(--text); }
.hd-recado-conteudo { font-size: 13px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }
.hd-recado-data { font-size: 11.5px; color: var(--text-3); margin-top: 5px; display: flex; align-items: center; gap: 4px; }

/* ── Agenda modal extras (prototype-exact) ──────────────────────── */
.modal-head.agenda {
  background: linear-gradient(90deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 65%, var(--blue) 35%) 55%, var(--blue) 100%);
  color: #fff;
  padding: 18px 22px;
  border-radius: 20px 20px 0 0;
}
.modal-head.agenda span { color: #fff; font-size: 18px; font-weight: 800; }
.modal-x {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.22); border: none; color: #fff;
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.modal-x:hover { background: rgba(255,255,255,.35); }
.avatar-sm {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px; color: #fff;
  flex: none;
  background: linear-gradient(150deg, var(--primary), var(--primary-strong));
  text-transform: uppercase;
}

/* sys-tab also matches .sys-menu-item.active state (legacy JS hook) */
.sys-tab.active {
  background: var(--primary-ghost);
  color: var(--primary-deep);
  border-color: color-mix(in srgb, var(--primary) 22%, transparent);
  font-weight: 700;
}

/* Modal de visualização de envio */
.arq-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: arqFade .15s ease-out;
}
@keyframes arqFade { from { opacity: 0 } to { opacity: 1 } }
.arq-modal-box {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: min(900px, 100%);
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.arq-modal-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.arq-modal-meta {
  display: flex; flex-wrap: wrap; gap: 14px 24px;
  padding: 12px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.arq-modal-meta .k { color: var(--text-3); font-weight: 600; margin-right: 4px }
.arq-modal-meta .v { color: var(--text); font-weight: 500 }
.arq-modal-body {
  padding: 18px;
  overflow: auto;
  flex: 1 1 auto;
}
.arq-msg {
  background: var(--surface-2);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.arq-fallback {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-2);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}

/* file-card (Gestão de Arquivos — prototype) */
.file-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px;
  background: var(--surface); transition: box-shadow .15s, transform .15s, border-color .15s;
}
.file-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); }
.file-card .file-ic {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  flex: none; background: var(--red-bg); color: var(--red);
}
.file-card .file-info { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; }
.file-card .file-name { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .file-tel { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); }
.file-card .file-dest { display: inline-flex; align-items: center; gap: 7px; flex: none; color: var(--text-2); font-size: 13.5px; font-weight: 600; }
.file-card .file-dest .avatar-sm { width: 28px; height: 28px; border-radius: 9px; font-size: 11px; background: var(--primary); }
.file-card .file-date { font-family: var(--mono); font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; flex: none; }

/* ── Subtabs (Contatos / Grupos style) ────────────────────────── */
.subtabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 2px;
  margin-bottom: var(--gap);
  box-shadow: var(--shadow-sm);
}
.subtabs button {
  display: inline-flex; align-items: center; gap: 7px;
  border: none; background: transparent; color: var(--text-2);
  font-family: var(--font); font-weight: 600; font-size: 14px;
  padding: 8px 16px; border-radius: 9px;
  transition: .14s; cursor: pointer;
}
.subtabs button:hover { color: var(--text); background: var(--surface-2); }
.subtabs button.on {
  background: var(--primary-soft);
  color: var(--primary-deep);
  font-weight: 700;
}
.subtab-count {
  display: inline-block;
  background: var(--surface-3);
  color: var(--text-2);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.subtabs button.on .subtab-count {
  background: var(--primary);
  color: #fff;
}

/* ── Confirm Overlay (legacy modal) ────────────────────────── */
.confirm-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 1100;
  background: transparent;
  align-items: center; justify-content: center;
  padding: 24px;
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 30px 80px -20px rgba(15,27,34,.35), 0 8px 24px -8px rgba(15,27,34,.2), 0 0 0 1px var(--border);
  max-width: 480px; width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.confirm-header {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 20px 22px 12px;
}
.confirm-icon-wrap {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center; flex: none;
  background: var(--primary-soft);
  color: var(--primary-deep);
}
.confirm-icon-wrap.info  { background: var(--blue-bg); color: var(--blue); }
.confirm-icon-wrap.warn,
.confirm-icon-wrap.warning { background: var(--amber-bg); color: var(--amber); }
.confirm-icon-wrap.danger { background: var(--red-bg); color: var(--red); }
.confirm-icon-wrap span { font-size: 20px; line-height: 1; }
.confirm-text { flex: 1; min-width: 0; }
.confirm-text h3 { font-size: 17px; font-weight: 800; color: var(--text); margin: 0 0 6px; }
.confirm-text p  { font-size: 13.5px; color: var(--text-2); margin: 0; line-height: 1.5; }
.confirm-footer,
.confirm-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 22px 18px;
}
.confirm-btn-ok.danger  { background: var(--red);   color: #fff; }
.confirm-btn-ok.warning { background: var(--amber); color: #fff; }
.confirm-btn-ok.info    { background: var(--primary); color: #fff; }
