/* ============================================================
   Corpus CRM — design system
   Camada: INTERFACE (tokens, layout, componentes)
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  color-scheme: light;

  --surface-0: #f7f7f5;   /* plano da página */
  --surface-1: #ffffff;   /* cards */
  --surface-2: #fbfbfa;   /* sidebar / cabeçalhos de tabela */
  --surface-3: #f1f1ee;   /* hover / trilhos */
  --surface-inv: #0b0b0b;

  --ink-1: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --ink-inv: #ffffff;

  --line: #e6e5e0;
  --line-strong: #d5d4cd;
  --ring: rgba(11,11,11,.10);

  --brand: #12a86f;
  --brand-strong: #0e8f5f;
  --brand-soft: #e4f6ee;
  --brand-ink: #ffffff;

  --good: #0ca30c;   --good-soft: #e8f6e8;
  --warn: #fab219;   --warn-soft: #fdf3df;
  --serious: #ec835a; --serious-soft: #fdeee7;
  --crit: #d03b3b;   --crit-soft: #fbeaea;
  --vip: #8a6a12;    --vip-soft: #f7f0dc;

  /* categóricas validadas (dataviz) */
  --s1: #12a86f; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;

  --seq-250: #8fdcbb; --seq-350: #4cc998; --seq-450: #12a86f;
  --seq-550: #0e8f5f; --seq-650: #0a6b47;

  --grid: #ebeae4;
  --axis: #c3c2b7;

  --shadow-1: 0 1px 2px rgba(11,11,11,.05), 0 1px 3px rgba(11,11,11,.04);
  --shadow-2: 0 4px 14px rgba(11,11,11,.07), 0 1px 3px rgba(11,11,11,.05);
  --shadow-3: 0 18px 48px rgba(11,11,11,.16), 0 2px 8px rgba(11,11,11,.08);

  --r-sm: 7px; --r: 11px; --r-lg: 16px; --r-xl: 22px;
  --sb-w: 246px;
  --top-h: 60px;

  --ff: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, "Helvetica Neue", Arial, sans-serif;
  --ff-num: var(--ff);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --surface-0: #0c0c0c;
  --surface-1: #161615;
  --surface-2: #121211;
  --surface-3: #232322;
  --surface-inv: #ffffff;

  --ink-1: #ffffff;
  --ink-2: #c3c2b7;
  --ink-3: #8b8a84;
  --ink-inv: #0b0b0b;

  --line: #292927;
  --line-strong: #3a3a37;
  --ring: rgba(255,255,255,.10);

  --brand: #18b57a;
  --brand-strong: #2fcb8f;
  --brand-soft: rgba(24,181,122,.16);
  --brand-ink: #ffffff;

  --good: #0ca30c;   --good-soft: rgba(12,163,12,.14);
  --warn: #fab219;   --warn-soft: rgba(250,178,25,.13);
  --serious: #ec835a; --serious-soft: rgba(236,131,90,.14);
  --crit: #d03b3b;   --crit-soft: rgba(208,59,59,.16);
  --vip: #eda100;    --vip-soft: rgba(237,161,0,.14);

  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;

  --seq-250: #184f95; --seq-350: #256abf; --seq-450: #3987e5;
  --seq-550: #6da7ec; --seq-650: #9ec5f4;

  --grid: #232322;
  --axis: #383835;

  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 4px 16px rgba(0,0,0,.45);
  --shadow-3: 0 20px 56px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--ff);
  background: var(--surface-0);
  color: var(--ink-1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4,h5 { margin: 0; font-weight: 600; letter-spacing: -.015em; }
p { margin: 0; }
::selection { background: var(--brand); color: #fff; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.dim   { color: var(--ink-2); }
.nowrap{ white-space: nowrap; }
.right { text-align: right; }
.center{ text-align: center; }
.hide  { display: none !important; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ============ LAYOUT ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sb-w); z-index: 60;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transition: transform .26s cubic-bezier(.32,.72,0,1);
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; height: var(--top-h); flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
}
.brand-mark { color: var(--ink-1); display: flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 14px; letter-spacing: -.02em; }
.brand-text span { font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__close { display: none; margin-left: auto; }

.nav { flex: 1 1 auto; overflow-y: auto; padding: 10px 10px 16px; }
.nav__group { margin: 14px 0 6px; padding: 0 8px; font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.nav__group:first-child { margin-top: 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 13.5px; font-weight: 450;
  position: relative; transition: background .13s, color .13s;
}
.nav a svg { flex: 0 0 auto; opacity: .78; }
.nav a:hover { background: var(--surface-3); color: var(--ink-1); }
.nav a.is-active { background: var(--surface-3); color: var(--ink-1); font-weight: 550; }
:root[data-theme="dark"] .nav a.is-active { background: #262624; }
.nav a.is-active svg { opacity: 1; color: var(--brand); }
.nav .pill { margin-left: auto; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 20px; background: var(--brand); color: #fff; }
.nav .pill--muted { background: var(--surface-3); color: var(--ink-3); }
:root[data-theme="dark"] .nav .pill--muted { background: #2c2c2a; }

.sidebar__foot { flex: 0 0 auto; padding: 10px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; }
.user-chip:hover { background: var(--surface-3); }
.user-chip__txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-chip__txt strong { font-size: 12.5px; font-weight: 550; }
.user-chip__txt small { font-size: 11px; color: var(--ink-3); }

.scrim { position: fixed; inset: 0; background: rgba(11,11,11,.42); z-index: 55; backdrop-filter: blur(2px); }

.shell { flex: 1 1 auto; min-width: 0; margin-left: var(--sb-w); display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top-h);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: color-mix(in srgb, var(--surface-0) 86%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__burger { display: inline-flex; }
@media (min-width: 901px) {
  .app.menu-oculto .sidebar { display: none; }
  .app.menu-oculto .shell { margin-left: 0; }
}
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search { position: relative; display: flex; align-items: center; gap: 8px; width: min(420px, 42vw); padding: 0 10px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-1); color: var(--ink-3); transition: border-color .15s, box-shadow .15s; }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search input { flex: 1; border: 0; background: none; outline: none; font-size: 13.5px; color: var(--ink-1); min-width: 0; }
.search input::placeholder { color: var(--ink-3); }
.search kbd { font-family: var(--ff); font-size: 11px; color: var(--ink-3); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface-2); }
.search__results { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-3); max-height: 60vh; overflow-y: auto; padding: 6px; z-index: 50; }
/* busca embutida no cabeçalho de um card */
.search--inline { width: min(340px, 100%); height: 32px; }
.search__cat { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 8px 9px 4px; font-weight: 600; }
.search__item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: var(--r-sm); cursor: pointer; }
.search__item:hover, .search__item.is-sel { background: var(--surface-3); }
.search__item small { margin-left: auto; color: var(--ink-3); font-size: 11.5px; }

.view { padding: 18px 24px 26px; max-width: 1560px; width: 100%; outline: none; }
.view--flush { padding: 0; max-width: none; }

/* ============ ELEMENTOS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface-1); color: var(--ink-1);
  font-size: 13.2px; font-weight: 520; cursor: pointer; white-space: nowrap;
  transition: background .14s, border-color .14s, transform .06s, box-shadow .14s;
  box-shadow: var(--shadow-1);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(.5px); }
.btn--primary { background: var(--ink-1); border-color: var(--ink-1); color: var(--ink-inv); }
.btn--primary:hover { background: #29292a; border-color: #29292a; }
:root[data-theme="dark"] .btn--primary:hover { background: #e9e9e6; border-color: #e9e9e6; }
.btn--brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--brand:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--ink-1); }
.btn--danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, var(--line)); background: var(--surface-1); }
.btn--danger:hover { background: var(--crit-soft); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn--xs { height: 26px; padding: 0 8px; font-size: 11.8px; border-radius: 7px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid transparent;
  background: transparent; color: var(--ink-2); cursor: pointer; transition: background .14s, color .14s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink-1); }
.dot-badge { position: absolute; top: 6px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--crit); box-shadow: 0 0 0 2px var(--surface-0); }
.ico-moon { display: none; }
:root[data-theme="dark"] .ico-sun { display: none; }
:root[data-theme="dark"] .ico-moon { display: block; }

.seg { display: inline-flex; padding: 2px; background: var(--surface-3); border-radius: 9px; gap: 2px; }
.seg button { height: 28px; padding: 0 10px; border: 0; background: transparent; border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: background .14s, color .14s; }
.seg button:hover { color: var(--ink-1); }
.seg button.is-active { background: var(--surface-1); color: var(--ink-1); font-weight: 560; box-shadow: var(--shadow-1); }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 550; color: var(--ink-2); }
.field > .hint { font-size: 11.5px; color: var(--ink-3); }
.input, .select, .textarea {
  height: 36px; padding: 0 11px; border-radius: 9px; width: 100%;
  border: 1px solid var(--line-strong); background: var(--surface-1); color: var(--ink-1);
  font-size: 13.5px; outline: none; transition: border-color .14s, box-shadow .14s;
}
.textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 74px; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 8l3-3.5' fill='none' stroke='%23898781' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--brand); }

/* cards */
/* overflow: hidden contém as listas que usam margem negativa para sangrar até a borda */
.card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); overflow: hidden; }
.card__head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card__head h3 { font-size: 14px; letter-spacing: -.01em; }
.card__head .sub { font-size: 12px; color: var(--ink-3); }
.card__head .spacer { margin-left: auto; }
.card__body { padding: 14px 16px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 17px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }

/* page header */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { font-size: 21px; letter-spacing: -.025em; }
.page-head .sub { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.page-head .spacer { margin-left: auto; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* grid helpers */
.grid { display: grid; gap: 12px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* KPI */
.kpi { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 11px 14px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi__label { font-size: 11.6px; color: var(--ink-3); font-weight: 500; letter-spacing: .01em; display: flex; align-items: center; gap: 6px; }
.kpi__value { font-size: 22px; font-weight: 620; letter-spacing: -.03em; line-height: 1.1; }
.kpi__value small { font-size: 13px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.kpi__foot { display: flex; align-items: center; gap: 8px; font-size: 11.8px; color: var(--ink-3); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 11.6px; }
.delta--up { color: #006300; } :root[data-theme="dark"] .delta--up { color: #0ca30c; }
.delta--down { color: var(--crit); }
.delta--flat { color: var(--ink-3); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: 20px; font-size: 11.4px; font-weight: 560; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; border: 1px solid transparent; }
.badge svg { width: 11px; height: 11px; }
.badge--good { background: var(--good-soft); color: #0a7d0a; } :root[data-theme="dark"] .badge--good { color: #3fc23f; }
.badge--warn { background: var(--warn-soft); color: #8a6110; } :root[data-theme="dark"] .badge--warn { color: #fab219; }
.badge--serious { background: var(--serious-soft); color: #b4522a; } :root[data-theme="dark"] .badge--serious { color: #ec835a; }
.badge--crit { background: var(--crit-soft); color: #b02b2b; } :root[data-theme="dark"] .badge--crit { color: #e66767; }
.badge--brand { background: var(--brand-soft); color: var(--brand-strong); } :root[data-theme="dark"] .badge--brand { color: #5ed3a4; }
.badge--vip { background: var(--vip-soft); color: var(--vip); }
.badge--dark { background: var(--ink-1); color: var(--ink-inv); }
.badge--out { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 500; background: var(--surface-3); color: var(--ink-2); }

/* avatar */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--av, var(--brand)); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.avatar--sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 56px; height: 56px; font-size: 19px; }
.avatar--xl { width: 72px; height: 72px; font-size: 24px; }

/* tabelas */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.2px; }
table.tbl th { text-align: left; font-size: 11.4px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; white-space: nowrap; }
table.tbl th.sortable { cursor: pointer; user-select: none; }
table.tbl th.sortable:hover { color: var(--ink-1); }
table.tbl th .sort-ind { opacity: .5; margin-left: 3px; font-size: 9px; }
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tbody tr { transition: background .1s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr.is-clickable { cursor: pointer; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-user__txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.cell-user__txt strong { font-weight: 550; font-size: 13.2px; }
.cell-user__txt small { color: var(--ink-3); font-size: 11.5px; }

/* filtros / chips */
.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 20px; border: 1px solid var(--line-strong); background: var(--surface-1); font-size: 12.6px; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: all .14s; white-space: nowrap; }
.chip:hover { border-color: var(--ink-3); color: var(--ink-1); }
.chip.is-active { background: var(--ink-1); border-color: var(--ink-1); color: var(--ink-inv); font-weight: 550; }
.chip .n { font-size: 11px; opacity: .65; font-variant-numeric: tabular-nums; }
/* abas do atendimento (etapas do funil): uma linha por cima da tela inteira */
.subnav.inbox-abas { margin: 0; padding: 0 12px; background: var(--surface); height: 41px; align-items: stretch; overflow-y: hidden; }
.inbox-abas button { display: inline-flex; align-items: center; }
.inbox-abas .n { margin-left: 6px; font-size: 11.5px; font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.inbox-abas button.is-active .n { color: var(--ink-1); }
.inbox.inbox--abas { height: calc(100vh - var(--top-h) - 41px); height: calc(100dvh - var(--top-h) - 41px); }

/* barra de progresso */
.bar { display: block; height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--brand); transition: width .5s cubic-bezier(.32,.72,0,1); }
.bar--good > i { background: var(--good); }
.bar--warn > i { background: var(--warn); }
.bar--crit > i { background: var(--crit); }

/* score ring */
.score { position: relative; display: inline-block; line-height: 0; width: 44px; height: 44px; flex: 0 0 auto; }
.score svg { transform: rotate(-90deg); }
.score span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums; }

/* empty */
.empty { padding: 46px 20px; text-align: center; color: var(--ink-3); }
.empty h4 { font-size: 14px; color: var(--ink-2); margin-bottom: 5px; }
.empty p { font-size: 12.8px; max-width: 380px; margin: 0 auto; }

/* modal */
.modal-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(11,11,11,.44); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; animation: fadeIn .16s ease; }
.modal { width: 100%; max-width: 620px; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-3); animation: pop .2s cubic-bezier(.32,.72,0,1); overflow: hidden; }
.modal--lg { max-width: 900px; }
.modal--xl { max-width: 1120px; }
.modal__head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal__head h3 { font-size: 15.5px; }
.modal__head .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.modal__body { padding: 18px 20px; max-height: 72vh; overflow-y: auto; }
.modal__foot { padding: 13px 20px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; background: var(--surface-2); }
@keyframes fadeIn { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985) } }

/* toasts */
.toasts { position: fixed; z-index: 120; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 9px; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; min-width: 260px; max-width: 380px; padding: 11px 14px; border-radius: var(--r); background: var(--surface-inv); color: var(--ink-inv); box-shadow: var(--shadow-3); font-size: 13px; animation: slideIn .22s cubic-bezier(.32,.72,0,1); }
.toast strong { display: block; font-weight: 600; margin-bottom: 1px; }
.toast small { opacity: .72; font-size: 12px; }
.toast .ic { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(18px) } }

/* dropdown */
.menu { position: absolute; z-index: 100; min-width: 190px; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-3); padding: 5px; animation: pop .13s ease; }
.menu button { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 7px 9px; border: 0; background: none; border-radius: var(--r-sm); font-size: 13px; cursor: pointer; color: var(--ink-1); }
.menu button:hover { background: var(--surface-3); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.menu .lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); padding: 7px 9px 3px; font-weight: 600; }

/* ============ CHARTS ============ */
.chart { width: 100%; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart text { font-family: var(--ff); fill: var(--ink-3); font-size: 11px; }
.chart .tick { font-size: 10.5px; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .crosshair { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.chart .marker { opacity: 0; }
.chart-tip { position: absolute; pointer-events: none; z-index: 30; background: var(--surface-inv); color: var(--ink-inv); border-radius: 8px; padding: 7px 10px; font-size: 12px; box-shadow: var(--shadow-2); white-space: nowrap; opacity: 0; transform: translate(-50%, -120%); transition: opacity .1s; }
.chart-tip b { font-weight: 600; }
.chart-tip .r { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.chart-tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chart-wrap { position: relative; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* funil */
.funnel { display: flex; flex-direction: column; gap: 3px; }
.funnel__row { display: grid; grid-template-columns: 132px 1fr auto; align-items: center; gap: 12px; padding: 5px 0; }
.funnel__lbl { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.funnel__track { height: 30px; background: var(--surface-3); border-radius: 6px; overflow: hidden; position: relative; }
.funnel__fill { height: 100%; border-radius: 6px; display: flex; align-items: center; padding: 0 9px; color: #fff; font-size: 12px; font-weight: 600; transition: width .6s cubic-bezier(.32,.72,0,1); }
.funnel__meta { font-size: 12.2px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* insight cards */
.insight { display: flex; gap: 12px; padding: 14px 15px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface-1); box-shadow: var(--shadow-1); transition: border-color .15s, transform .15s, box-shadow .15s; cursor: pointer; }
.insight:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.insight__ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-3); }
.insight__ic svg { width: 17px; height: 17px; }
.insight h4 { font-size: 13.2px; font-weight: 600; margin-bottom: 3px; }
.insight p { font-size: 12.4px; color: var(--ink-2); line-height: 1.45; }
.insight .act { font-size: 12.2px; font-weight: 600; color: var(--brand); margin-top: 7px; display: inline-flex; align-items: center; gap: 4px; }

/* kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding: 4px 24px 24px; align-items: flex-start; min-height: 60vh; }
.kb-col { flex: 0 0 274px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100vh - 190px); }
.kb-col.is-over { border-color: var(--brand); background: var(--brand-soft); }
.kb-col__head { padding: 11px 13px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.kb-col__head h4 { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kb-col__head .n { font-size: 11px; color: var(--ink-3); background: var(--surface-3); border-radius: 20px; padding: 1px 7px; font-weight: 600; }
.kb-col__head .val { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.kb-col__body { padding: 9px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; flex: 1; }
.kb-card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r); padding: 11px; cursor: grab; box-shadow: var(--shadow-1); transition: box-shadow .14s, transform .14s, opacity .14s; }
.kb-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.kb-card.is-dragging { opacity: .4; }
.kb-card__top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.kb-card__top strong { font-size: 12.8px; font-weight: 560; }
.kb-card__prod { font-size: 12px; color: var(--ink-2); margin-bottom: 8px; line-height: 1.35; }
.kb-card__foot { display: flex; align-items: center; gap: 8px; font-size: 11.4px; color: var(--ink-3); }
.kb-card__val { font-weight: 650; font-size: 13px; color: var(--ink-1); font-variant-numeric: tabular-nums; }
.prob { display: inline-flex; align-items: center; gap: 4px; }
.prob i { display: block; width: 20px; height: 3px; border-radius: 2px; background: var(--surface-3); }
.prob i.on { background: var(--brand); }

/* inbox */
.inbox { display: grid; grid-template-columns: 306px minmax(0,1fr) 316px; height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); border-top: 0; }
/* as três colunas rolam por dentro; sem min-height:0 o conteúdo do chat estica a página */
.inbox > * { min-height: 0; }
.inbox__items, .chat__body, .side-panel { min-height: 0; }
.inbox__list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; background: var(--surface-2); }
.inbox__search { padding: 11px 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; }
.inbox__items { overflow-y: auto; flex: 1; }
.conv-item { display: flex; gap: 10px; padding: 11px 13px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; position: relative; }
.conv-item:hover { background: var(--surface-3); }
.conv-item.is-active { background: var(--surface-1); box-shadow: inset 2px 0 0 var(--brand); }
.conv-item__body { flex: 1; min-width: 0; }
.conv-item__top { display: flex; align-items: baseline; gap: 8px; }
.conv-item__top strong { font-size: 13px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item__top small { margin-left: auto; color: var(--ink-3); font-size: 11px; white-space: nowrap; }
.conv-item__msg { font-size: 12.2px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0 5px; }
.conv-item__tags { display: flex; gap: 5px; flex-wrap: wrap; }
.unread { width: 17px; height: 17px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }

.chat { display: flex; flex-direction: column; min-width: 0; background: var(--surface-0); }
.chat__head { display: flex; align-items: center; gap: 11px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-1); flex: 0 0 auto; }
/* conversa com a cara do WhatsApp: fundo bege desenhado, balão branco (cliente) e verde-claro (loja) */
.chat__body { flex: 1; overflow-y: auto; padding: 18px 6% 10px; display: flex; flex-direction: column; gap: 3px; background-color: #efeae2; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23d6cdbf' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round' opacity='.38'%3E%3Cpath d='M14 18h16a5 5 0 0 1 5 5v8a5 5 0 0 1-5 5h-9l-6 5v-5h-1a5 5 0 0 1-5-5v-8a5 5 0 0 1 5-5z'/%3E%3Ccircle cx='80' cy='22' r='6'/%3E%3Cpath d='M98 52l3 6 6 1-4.5 4 1 6-5.5-3-5.5 3 1-6L89 59l6-1z'/%3E%3Cpath d='M22 78c4-6 12-6 16 0'/%3E%3Ccircle cx='26' cy='72' r='1.4'/%3E%3Ccircle cx='34' cy='72' r='1.4'/%3E%3Cpath d='M64 88h14v12H64zM66 88v-3a5 5 0 0 1 10 0v3'/%3E%3Cpath d='M100 96l6 6M106 96l-6 6'/%3E%3Cpath d='M50 44c3 0 5 2 5 5s-5 7-5 7-5-4-5-7 2-5 5-5z'/%3E%3C/g%3E%3C/svg%3E"); background-size: 240px; }
:root[data-theme="dark"] .chat__body { background-color: #0b141a; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23233138' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' opacity='.7'%3E%3Cpath d='M14 18h16a5 5 0 0 1 5 5v8a5 5 0 0 1-5 5h-9l-6 5v-5h-1a5 5 0 0 1-5-5v-8a5 5 0 0 1 5-5z'/%3E%3Ccircle cx='80' cy='22' r='6'/%3E%3Cpath d='M98 52l3 6 6 1-4.5 4 1 6-5.5-3-5.5 3 1-6L89 59l6-1z'/%3E%3Cpath d='M22 78c4-6 12-6 16 0'/%3E%3Ccircle cx='26' cy='72' r='1.4'/%3E%3Ccircle cx='34' cy='72' r='1.4'/%3E%3Cpath d='M64 88h14v12H64zM66 88v-3a5 5 0 0 1 10 0v3'/%3E%3Cpath d='M100 96l6 6M106 96l-6 6'/%3E%3Cpath d='M50 44c3 0 5 2 5 5s-5 7-5 7-5-4-5-7 2-5 5-5z'/%3E%3C/g%3E%3C/svg%3E"); }
.chat__body.chat-drop { outline: 3px dashed #00a884; outline-offset: -10px; }
.chat__day { align-self: center; font-size: 12px; color: #54656f; background: #fff; padding: 5px 12px; border-radius: 8px; margin: 12px 0 8px; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); }
:root[data-theme="dark"] .chat__day { background: #182229; color: #8696a0; }
.msg { max-width: min(65%, 540px); padding: 6px 9px 7px; border-radius: 8px; font-size: 14px; line-height: 1.42; position: relative; box-shadow: 0 1px .5px rgba(11, 20, 26, .13); white-space: pre-wrap; word-break: break-word; color: #111b21; }
.msg--in { align-self: flex-start; background: #fff; border: 0; border-top-left-radius: 0; }
.msg--out, .msg--ai { align-self: flex-end; background: #d9fdd3; color: #111b21; border: 0; border-top-right-radius: 0; }
:root[data-theme="dark"] .msg--in { background: #202c33; color: #e9edef; }
:root[data-theme="dark"] .msg--out, :root[data-theme="dark"] .msg--ai { background: #005c4b; color: #e9edef; }
.msg--reagida { margin-bottom: 16px; }
.msg--apagada { font-style: italic; color: #667781; }
:root[data-theme="dark"] .msg--apagada { color: #8696a0; }
.msg--enviando { opacity: .7; font-style: italic; }
.msg__menu { position: absolute; top: 2px; right: 2px; width: 24px; height: 22px; padding: 0; border: 0; border-radius: 0 6px 0 12px; background: inherit; color: #8696a0; display: inline-flex; align-items: center; justify-content: center; opacity: 0; cursor: pointer; transition: opacity .12s; z-index: 1; }
.msg:hover .msg__menu, .msg__menu:focus { opacity: 1; }
.msg__enc { display: flex; align-items: center; gap: 4px; font-size: 12px; font-style: italic; color: #667781; margin-bottom: 2px; }
.msg__reacoes { position: absolute; bottom: -15px; right: 8px; display: flex; gap: 1px; padding: 1px 5px; font-size: 14px; line-height: 20px; background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(11, 20, 26, .2); }
.msg--in .msg__reacoes { right: auto; left: 8px; }
:root[data-theme="dark"] .msg__reacoes { background: #202c33; }
.tq { display: inline-flex; color: #8696a0; margin-left: 2px; }
.tq--lida { color: #53bdeb; }
.tq--erro { color: #e66767; }
.reac-pop { position: fixed; z-index: 90; display: flex; align-items: center; gap: 2px; padding: 4px 6px; background: var(--surface-1); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow-3); }
.reac-pop button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: none; font-size: 22px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.reac-pop button:hover, .reac-pop button.is-on { background: var(--surface-3); }
.cmp-btn { width: 40px; height: 40px; flex: 0 0 auto; padding: 0; border: 0; border-radius: 50%; background: none; color: #54656f; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.cmp-btn:hover { background: var(--surface-3); }
:root[data-theme="dark"] .cmp-btn { color: #aebac1; }
.cmp-btn--brand, :root[data-theme="dark"] .cmp-btn--brand { background: #00a884; color: #fff; }
.cmp-btn--brand:hover { background: #008f72; }
.cmp-btn[hidden] { display: none; }
.cmp-gravando { display: flex; align-items: center; gap: 10px; padding: 2px 0; font-size: 14px; }
.cmp-gravando[hidden] { display: none; }
.cmp-gravando__ponto { width: 10px; height: 10px; border-radius: 50%; background: #e66767; animation: gravPisca 1s ease-in-out infinite; }
@keyframes gravPisca { 50% { opacity: .25; } }
.chat__composer { position: relative; }
.emoji-pop { position: absolute; bottom: calc(100% + 6px); left: 10px; z-index: 30; width: 340px; max-width: calc(100% - 20px); max-height: 250px; overflow-y: auto; display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; padding: 8px; background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-3); }
.emoji-pop button { border: 0; background: none; font-size: 22px; line-height: 34px; border-radius: 8px; cursor: pointer; }
.emoji-pop button:hover { background: var(--surface-3); }
.anexo-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.anexo-item { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.anexo-item img, .anexo-item video { display: block; width: 100%; height: 120px; object-fit: cover; }
.anexo-doc { display: flex; align-items: center; justify-content: center; height: 120px; color: var(--ink-3); }
.anexo-nome { padding: 6px 8px; font-size: 12px; display: flex; flex-direction: column; gap: 1px; word-break: break-all; }
.msg--note { align-self: center; background: var(--warn-soft); color: #7a5510; font-size: 12.2px; border-radius: 9px; max-width: 80%; }
:root[data-theme="dark"] .msg--note { color: #fab219; }
.msg__meta { display: flex; align-items: center; gap: 5px; font-size: 10.5px; opacity: .62; margin-top: 3px; justify-content: flex-end; }
.msg--in .msg__meta { justify-content: flex-start; }
.msg__author { font-size: 12.5px; font-weight: 600; color: #008069; margin-bottom: 1px; }
:root[data-theme="dark"] .msg__author { color: #06cf9c; }
/* responder citando (igual ao WhatsApp) e arquivos da mensagem */
.msg__citada { border-left: 3px solid var(--brand); background: rgba(0, 0, 0, .06); border-radius: 6px; padding: 4px 8px; font-size: 11.8px; margin-bottom: 5px; opacity: .9; white-space: pre-wrap; max-height: 3.6em; overflow: hidden; }
.msg--out .msg__citada { border-left-color: #06cf9c; background: rgba(0, 0, 0, .05); }
.msg__resp { position: absolute; top: 4px; right: -30px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface-1); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; opacity: 0; cursor: pointer; transition: opacity .12s; }
.msg--out .msg__resp, .msg--ai .msg__resp { right: auto; left: -30px; }
.msg:hover .msg__resp, .msg__resp:focus { opacity: 1; }
@media (hover: none) { .msg__resp { opacity: .55; } }
.msg__midia img, .msg__midia video { max-width: 240px; max-height: 280px; border-radius: 9px; display: block; }
.msg__midia audio { width: 250px; max-width: 100%; display: block; }
.msg__midia { margin: 2px 0 5px; }
.msg__midia-aviso { font-size: 11.5px; opacity: .7; margin: 2px 0 4px; }
/* anúncio da Meta / status que o cliente respondeu */
.msg__ctx { display: flex; gap: 9px; margin: 1px 0 7px; padding: 6px; border-radius: 9px; background: rgba(0, 0, 0, .05); border-left: 3px solid #53bdeb; white-space: normal; max-width: 380px; }
.msg--out .msg__ctx { background: rgba(0, 0, 0, .05); border-left-color: #06cf9c; }
.msg__ctx img { width: 68px; height: 68px; object-fit: cover; border-radius: 6px; display: block; flex: 0 0 auto; }
.msg__ctx-txt { min-width: 0; font-size: 12px; line-height: 1.38; }
.msg__ctx-rot { font-size: 10.5px; font-weight: 650; opacity: .68; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 1px; }
.msg__ctx-desc { opacity: .82; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.msg__ctx-link { display: inline-block; margin-top: 2px; font-size: 11.2px; color: var(--brand); }
/* áudio no jeito do WhatsApp: foto com microfone, play, ondinha com a bolinha e a duração */
.wa-audio { --pct: 0%; display: flex; align-items: center; gap: 8px; width: 300px; max-width: 100%; padding: 3px 1px 0; white-space: normal; }
.wa-audio__quem { position: relative; flex: 0 0 auto; display: inline-flex; }
.wa-audio__quem .avatar { width: 48px; height: 48px; font-size: 15px; }
.wa-audio__mic { position: absolute; right: -5px; bottom: -3px; color: #53bdeb; display: inline-flex; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .35)); }
.wa-audio__vel { display: none; flex: 0 0 auto; width: 48px; height: 26px; border: 0; border-radius: 13px; background: rgba(0, 0, 0, .08); color: inherit; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; align-items: center; justify-content: center; }
.msg--out .wa-audio__vel { background: rgba(0, 0, 0, .08); }
.wa-audio.is-ativo .wa-audio__quem { display: none; }
.wa-audio.is-ativo .wa-audio__vel { display: inline-flex; }
.wa-audio__play { flex: 0 0 auto; width: 30px; height: 30px; padding: 0; border: 0; background: none; color: inherit; opacity: .78; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.wa-audio__play:hover { opacity: 1; }
.wa-audio__corpo { flex: 1 1 auto; min-width: 0; }
.wa-audio__onda { position: relative; height: 28px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.wa-audio__onda i { flex: 1 1 0; min-width: 2px; border-radius: 2px; background: currentColor; opacity: .3; }
.wa-audio__onda i.on { opacity: .85; }
.wa-audio__ponto { position: absolute; top: 50%; left: var(--pct); width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%; background: #53bdeb; pointer-events: none; }
.msg--out .wa-audio__ponto { background: #00a884; }
.wa-audio__tempo { font-size: 11px; opacity: .72; margin-top: 1px; font-variant-numeric: tabular-nums; }
.composer-citando { display: flex; align-items: center; gap: 6px; padding: 0 0 7px; }
.msg-card { align-self: flex-end; max-width: min(70%, 420px); background: var(--surface-1); border: 1px solid var(--line); border-radius: 14px; padding: 10px; box-shadow: var(--shadow-1); }
.msg-card__prod { display: flex; gap: 10px; align-items: center; }
.chat__composer { flex: 0 0 auto; border-top: 1px solid var(--line); background: var(--surface-1); padding: 10px 14px 12px; }
.composer-tools { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.composer-row { display: flex; gap: 9px; align-items: flex-end; }
.composer-row textarea { flex: 1; min-height: 38px; max-height: 130px; }
.ai-banner { display: flex; align-items: center; gap: 9px; padding: 7px 12px; background: var(--brand-soft); border-bottom: 1px solid var(--line); font-size: 12.2px; color: var(--brand-strong); }
:root[data-theme="dark"] .ai-banner { color: #86b6ef; }
.typing { display: inline-flex; gap: 3px; align-items: center; }
.typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s } .typing i:nth-child(3) { animation-delay: .4s }
@keyframes blink { 0%,60%,100% { opacity:.25 } 30% { opacity:1 } }

.side-panel { border-left: 1px solid var(--line); overflow-y: auto; background: var(--surface-2); }
.side-panel__sec { padding: 14px 15px; border-bottom: 1px solid var(--line); }
.side-panel__sec h5 { font-size: 10.8px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 650; margin-bottom: 9px; }
.dl { display: flex; flex-direction: column; gap: 7px; }
.dl div { display: flex; align-items: baseline; gap: 10px; font-size: 12.6px; }
.dl dt { color: var(--ink-3); flex: 0 0 auto; }
.dl dd { margin: 0 0 0 auto; text-align: right; font-weight: 520; }

/* timeline */
.tl { position: relative; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl__item { position: relative; padding: 0 0 20px; }
.tl__dot { position: absolute; left: -22px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: var(--surface-1); border: 1px solid var(--line-strong); display: grid; place-items: center; }
.tl__dot svg { width: 9px; height: 9px; }
.tl__date { font-size: 11.4px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tl__title { font-size: 13.2px; font-weight: 540; margin: 1px 0 2px; }
.tl__desc { font-size: 12.4px; color: var(--ink-2); line-height: 1.45; }

/* device chain */
.chain { display: flex; align-items: center; gap: 0; overflow-x: auto; padding: 4px 0 10px; }
.chain__node { flex: 0 0 auto; border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; background: var(--surface-1); min-width: 140px; text-align: center; }
.chain__node.is-current { border-color: var(--ink-1); box-shadow: var(--shadow-2); }
.chain__node.is-next { border-style: dashed; border-color: var(--brand); background: var(--brand-soft); }
.chain__node strong { display: block; font-size: 12.6px; font-weight: 580; }
.chain__node small { font-size: 11px; color: var(--ink-3); }
.chain__arrow { flex: 0 0 auto; width: 30px; height: 1px; background: var(--line-strong); position: relative; }
.chain__arrow::after { content: ""; position: absolute; right: 0; top: -3px; border-left: 6px solid var(--line-strong); border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent; }

/* device glyph */
.glyph { display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); flex: 0 0 auto; }
.glyph svg { display: block; }

/* produto card */
.prod-card { background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; display: flex; flex-direction: column; }
.prod-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.prod-card__img { aspect-ratio: 4/3; background: linear-gradient(160deg, var(--surface-2), var(--surface-3)); display: grid; place-items: center; position: relative; }
.prod-card__body { padding: 12px 13px 13px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.prod-card__cat { font-size: 10.6px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); font-weight: 600; }
.prod-card__name { font-size: 13.4px; font-weight: 560; line-height: 1.3; }
.prod-card__price { font-size: 15px; font-weight: 650; letter-spacing: -.02em; margin-top: auto; }
.prod-card__price s { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-right: 6px; }
.stock-pill { position: absolute; top: 9px; right: 9px; }

/* stepper / automations */
.flow { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 0; }
.flow__node { width: min(100%, 380px); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 13px; background: var(--surface-1); box-shadow: var(--shadow-1); display: flex; align-items: center; gap: 10px; }
.flow__node.is-trigger { border-color: var(--ink-1); }
.flow__node.is-cond { border-style: dashed; }
.flow__node .ic { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-3); display: grid; place-items: center; flex: 0 0 auto; }
.flow__node strong { font-size: 12.8px; font-weight: 560; display: block; }
.flow__node small { font-size: 11.5px; color: var(--ink-3); }
.flow__link { width: 1px; height: 18px; background: var(--line-strong); position: relative; }
.flow__link::after { content: ""; position: absolute; bottom: 0; left: -3.5px; border-top: 6px solid var(--line-strong); border-left: 3.5px solid transparent; border-right: 3.5px solid transparent; }

/* listas simples */
.list { display: flex; flex-direction: column; }
/* dentro de um card sem padding a lista não pode ter margem negativa (o card corta o que sai) */
.card__body--flush > .list { margin: 0 !important; }
/* listas que sangram até a borda dentro de card__body com padding */
.card__body:not(.card__body--flush) > .list { margin: -14px -16px !important; }
.list__row { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid var(--line); transition: background .1s; }
.list__row:last-child { border-bottom: 0; }
.list__row:hover { background: var(--surface-2); }
.list__row.is-clickable { cursor: pointer; }

/* rank */
.rank-n { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--ink-2); flex: 0 0 auto; }
.rank-n--1 { background: var(--vip-soft); color: var(--vip); }
.rank-n--2 { background: var(--surface-3); color: var(--ink-2); }
.rank-n--3 { background: var(--serious-soft); color: #b4522a; }

/* stars */
.stars { display: inline-flex; gap: 1px; color: var(--warn); }
.stars svg { width: 13px; height: 13px; }
.stars .off { color: var(--line-strong); }

/* checklist trade-in */
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 10px; }
.grade__item { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 11px; }
.grade__item label { font-size: 11.6px; color: var(--ink-3); display: block; margin-bottom: 6px; font-weight: 550; }

/* split de detalhe */
.detail { display: grid; grid-template-columns: minmax(0,1fr) 336px; gap: 16px; align-items: start; }
.subnav { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.subnav button { border: 0; background: none; padding: 9px 12px; font-size: 13px; font-weight: 500; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color .13s, border-color .13s; }
.subnav button:hover { color: var(--ink-1); }
.subnav button.is-active { color: var(--ink-1); border-bottom-color: var(--ink-1); font-weight: 580; }

/* hero cliente */
.hero { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.hero__stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; width: 100%; }
.hero__stat { background: var(--surface-1); padding: 11px 13px; }
.hero__stat span { font-size: 11.2px; color: var(--ink-3); display: block; }
.hero__stat strong { font-size: 16px; font-weight: 620; letter-spacing: -.02em; }

/* util anim */
.fade-in { animation: fadeUp .26s cubic-bezier(.32,.72,0,1); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px) } }

/* ============ LOGIN ============ */
.login { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: var(--surface-0); }
.login__card { width: 100%; max-width: 380px; background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 28px 26px 26px; display: flex; flex-direction: column; gap: 14px; }
.login__brand { display: flex; align-items: center; gap: 11px; color: var(--ink-1); margin-bottom: 4px; }
.login__brand div { display: flex; flex-direction: column; line-height: 1.15; }
.login__brand strong { font-size: 15px; letter-spacing: -.02em; }
.login__brand span { font-size: 12px; color: var(--ink-3); }
.login__card h1 { font-size: 20px; letter-spacing: -.025em; margin: 6px 0 2px; }
.login__erro { font-size: 12.6px; color: var(--crit); background: var(--crit-soft); padding: 9px 11px; border-radius: 9px; }
[hidden] { display: none !important; }

/* ============ RESPONSIVO ============ */
@media (max-width: 1360px) {
  .inbox { grid-template-columns: 280px minmax(0,1fr) 290px; }
}
@media (max-width: 1180px) {
  .g-5 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .detail { grid-template-columns: minmax(0,1fr); }
  .inbox { grid-template-columns: 264px minmax(0,1fr); }
  .side-panel { display: none; }
  .side-panel.is-open { display: block; position: fixed; right: 0; top: var(--top-h); bottom: 0; width: min(340px, 88vw); z-index: 50; box-shadow: var(--shadow-3); }
}
@media (max-width: 900px) {
  :root { --top-h: 56px; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-3); }
  .sidebar.is-open { transform: none; }
  .sidebar__close { display: inline-flex; }
  .shell { margin-left: 0; }
  .topbar__burger { display: inline-flex; }
  /* o topbar não pode empurrar a largura da página: é ele quem define o overflow */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar__actions { gap: 2px; }
  #quickAdd { width: 34px; padding: 0; }
  #quickAdd span { display: none; }
  .search { width: auto; flex: 1 1 auto; min-width: 0; }
  .search kbd { display: none; }
  .view { padding: 16px 14px 70px; }
  .view--flush { padding: 0; }   /* Atendimento ocupa a tela exata: sem scroll por fora */
  .card__head { flex-wrap: wrap; }
  .card__head .spacer { display: none; }
  .search--inline { width: 100%; }
  .page-head .page-actions .btn { flex: 1 1 auto; }
  .g-2, .g-3, .g-4, .g-5 { grid-template-columns: minmax(0,1fr); }
  .seg { display: none; }
  .kanban { padding: 4px 14px 24px; }
  .inbox { grid-template-columns: minmax(0,1fr); height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); }
  .inbox__list { display: none; border-right: 0; }
  .inbox.show-list .inbox__list { display: flex; }
  .inbox.show-list .chat { display: none; }
  .modal { max-width: none; }
  .modal-scrim { padding: 0; align-items: flex-end; }
  .modal { border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92vh; display: flex; flex-direction: column; }
  .modal__body { max-height: none; }
  .toasts { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }

  /* tabelas viram cards */
  table.tbl, table.tbl tbody, table.tbl tr, table.tbl td { display: block; width: 100%; }
  table.tbl thead { display: none; }
  table.tbl tbody tr { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; background: var(--surface-1); padding: 4px 0; box-shadow: var(--shadow-1); }
  table.tbl tbody tr:hover { background: var(--surface-1); }
  table.tbl td { border: 0; padding: 7px 13px; display: flex; align-items: center; gap: 12px; }
  table.tbl td::before { content: attr(data-label); font-size: 11.4px; color: var(--ink-3); font-weight: 550; flex: 0 0 40%; }
  table.tbl td[data-label=""]::before, table.tbl td.td-main::before { display: none; }
  table.tbl td.td-main { padding-top: 11px; }
  table.tbl td > * { margin-left: auto; }
  table.tbl td.td-main > * { margin-left: 0; }
  .table-wrap { overflow: visible; }
  .list__row { flex-wrap: wrap; row-gap: 7px; }
  .list__row > div { min-width: 58%; }
  .hero__stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .funnel__row { grid-template-columns: 96px 1fr; }
  .funnel__meta { grid-column: 2; text-align: right; }
}
@media (max-width: 560px) {
  .page-head h1 { font-size: 18px; }
  .kpi__value { font-size: 20px; }
  .chain { padding-bottom: 4px; }
}
@media print {
  .sidebar, .topbar, .page-actions { display: none !important; }
  .shell { margin-left: 0; }
  .card { break-inside: avoid; box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* logo da Corpus: fundo escuro no tema claro, para o brasão branco aparecer */
.brand-logo { display:block; border-radius:8px; background:#0b0b0b; padding:3px 6px; box-sizing:content-box; }
:root[data-theme="dark"] .brand-logo { background:transparent; padding:0; }
/* foto real: área branca (as fotos têm fundo branco) e a foto ocupa a altura do card */
.prod-card__img:has(img) { background: #fff; }
.prod-card__img img { width: auto !important; height: 90% !important; max-width: 92%; object-fit: contain; border-radius: 0 !important; }

/* seta de voltar: icon('chevron', n, 'flip') */
.ic.flip { transform: scaleX(-1); }

/* ---------- Caixa (venda no balcão) ---------- */
/* no computador a tela inteira é o caixa: os produtos rolam dentro do quadro e o painel da venda fica sempre à vista */
.cx { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; height: calc(100vh - var(--top-h) - 122px); min-height: 480px; }
.cx__prod { padding: 14px; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.cx__prod > :not(.cx__grade), .cx__venda > :not(.cx__itens) { flex: none; }   /* só a grade e a lista de itens encolhem */
.cx__busca { display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface-1); color: var(--ink-3); }
.cx__busca:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.cx__busca input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink-1); }
.cx__titulo { font-size: 12px; font-weight: 600; color: var(--ink-3); margin: 14px 2px 8px; min-height: 15px; }
.cx__grade { flex: 1 1 auto; min-height: 0; overflow-y: auto; align-content: start; margin: 0 -14px -14px; padding: 2px 14px 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cx__nada { grid-column: 1 / -1; padding: 30px 0; text-align: center; color: var(--ink-3); font-size: 13px; }
.cx-tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 9px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-1); text-align: left; cursor: pointer; font: inherit; color: var(--ink-1); transition: border-color .12s, box-shadow .12s, transform .08s; }
.cx-tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.cx-tile:active { transform: scale(.98); }
.cx-tile.is-on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.cx-tile__foto { display: flex; align-items: center; justify-content: center; height: 96px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.cx-tile__foto--img { background: #fff; }
.cx-tile__foto img { width: 100%; height: 100%; object-fit: contain; }
.cx-tile__nome { font-size: 12.4px; font-weight: 560; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 32px; }
.cx-tile__preco { font-size: 14.5px; font-weight: 680; }
.cx-tile__qtd { position: absolute; top: 6px; right: 6px; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; background: var(--brand); color: #fff; font-size: 12.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-1); }

.cx__venda { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; min-height: 0; overflow: visible; }
.cx__cab { display: flex; align-items: center; gap: 8px; }
.cx__cab h3 { font-size: 15px; }
.cx__cab .muted { font-size: 12.4px; }
.cx__itens { flex: 1 1 auto; min-height: 64px; overflow-y: auto; margin: 0 -16px; padding: 0 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cx__vazio { color: var(--ink-3); font-size: 12.8px; padding: 22px 0; text-align: center; }
.cx-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cx-item:last-child { border-bottom: 0; }
.cx-item__topo { display: flex; gap: 8px; align-items: flex-start; }
.cx-item__nome { flex: 1; min-width: 0; font-size: 12.8px; font-weight: 560; line-height: 1.3; padding-top: 3px; }
.cx-item__tirar { width: 26px; height: 26px; flex: none; }
.cx-item__linha { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.cx-qtd { display: inline-flex; align-items: center; height: 32px; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; flex: none; }
.cx-qtd button { width: 32px; height: 100%; border: 0; background: var(--surface-2); color: var(--ink-1); font: inherit; font-size: 16px; cursor: pointer; }
.cx-qtd button:hover:not(:disabled) { background: var(--surface-3); }
.cx-qtd button:disabled { color: var(--ink-3); opacity: .5; cursor: default; }
.cx-qtd span { min-width: 30px; text-align: center; font-weight: 650; font-size: 13px; }
.cx-item__preco { display: inline-flex; align-items: center; gap: 3px; height: 32px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 11.6px; color: var(--ink-3); background: var(--surface-1); }
.cx-item__preco:focus-within { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.cx-item__preco input { width: 62px; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13px; color: var(--ink-1); text-align: right; }
.cx-item__sub { margin-left: auto; font-size: 13.4px; white-space: nowrap; }
.cx__total { display: flex; align-items: baseline; justify-content: space-between; }
.cx__total span { font-size: 13px; font-weight: 560; color: var(--ink-2); }
.cx__total strong { font-size: 25px; font-weight: 720; letter-spacing: -.01em; white-space: nowrap; }
/* nome e CPF lado a lado; o cliente achado ocupa a linha de baixo; a lista de nomes abre na largura toda, logo abaixo do nome */
.cx__cliente { position: relative; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 10px; }
.cx__cliente > #cxLigado { grid-column: 1 / -1; grid-row: 2; }
.cx__cliente > #cxLigado:empty { display: none; }
.cx-sug { position: absolute; left: 0; right: 0; z-index: 30; background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: var(--shadow-3); overflow: hidden; }
.cx-sug__op { display: block; width: 100%; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; font: inherit; color: var(--ink-1); cursor: pointer; }
.cx-sug__op:last-child { border-bottom: 0; }
.cx-sug__op:hover { background: var(--surface-3); }
.cx-sug__op strong { display: block; font-size: 12.8px; font-weight: 600; }
.cx-sug__op span { display: block; font-size: 11.6px; color: var(--ink-3); margin-top: 1px; }
.cx-ligado { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r); background: var(--brand-soft); }
.cx-ligado > svg { color: var(--brand-strong); flex: none; }
.cx-ligado > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cx-ligado strong { font-size: 12.6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-ligado span { font-size: 11.4px; color: var(--ink-2); }
.cx-aviso { font-size: 11.8px; color: var(--crit); margin-top: 4px; }
.cx-aviso:empty { display: none; }
.cx-pag { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.cx-pag__op { height: 40px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface-1); font: inherit; font-size: 12.8px; font-weight: 560; color: var(--ink-1); cursor: pointer; }
.cx-pag__op:hover { background: var(--surface-3); }
.cx-pag__op.is-on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); box-shadow: 0 0 0 1px var(--brand); }
.cx__fim { width: 100%; height: 50px; font-size: 15px; font-weight: 650; justify-content: center; border-radius: var(--r); }
.cx__fim:disabled { opacity: .45; cursor: default; }
.cx__falta { font-size: 11.8px; color: var(--ink-3); text-align: center; margin-top: -4px; }
.cx__falta:empty { display: none; }
.cx-ok { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 28px 4px 12px; }
.cx-ok__icone { width: 58px; height: 58px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong); display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.cx-ok h3 { font-size: 17px; }
.cx-ok__valor { font-size: 30px; font-weight: 720; letter-spacing: -.01em; }
.cx-ok__quem { font-size: 12.8px; color: var(--ink-2); }
.cx-ok .cx__fim { margin-top: 16px; }
.cx-ok__ver { font-size: 12.6px; color: var(--brand-strong); margin-top: 4px; }
.cx__voltar, .cx__barra { display: none; }

@media (max-width: 1180px) { .cx { grid-template-columns: minmax(0, 1fr) 350px; } }
@media (max-width: 900px) {
  .cx { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .cx__prod { padding: 10px; margin-bottom: 76px; }
  .cx__grade { overflow: visible; margin: 0; padding: 0; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .cx-tile__foto { height: 84px; }
  .cx__venda { display: none; position: fixed; inset: 0; z-index: 80; max-height: none; border: 0; border-radius: 0; overflow-y: auto; padding: 14px 16px 18px; }
  .cx--aberta .cx__venda { display: flex; }
  .cx__cliente { grid-template-columns: minmax(0, 1fr); }
  .cx__itens { flex: none; overflow: visible; }
  .cx__voltar { display: inline-flex; }
  .cx__barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; height: 58px; padding: 0 18px; border: 0; border-radius: 14px; background: var(--brand); color: #fff; font: inherit; box-shadow: var(--shadow-3); cursor: pointer; }
  .cx__barra[hidden] { display: none; }
  .cx__barra > span:first-child { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
  .cx__barra small { font-size: 11.6px; opacity: .85; }
  .cx__barra strong { font-size: 17px; }
  .cx__barra-ir { font-size: 14px; font-weight: 650; }
}
