/* =========================================================================
   CRM MEI — design system
   Tokens → base → layout → componentes → telas
   ========================================================================= */

:root {
  color-scheme: light dark;

  /* Neutros */
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f2f4f7;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;

  /* Marca (verde contábil) */
  --brand: #0f7a56;
  --brand-hover: #0b6647;
  --brand-ink: #ffffff;
  --brand-soft: #e7f5ef;
  --brand-line: #b7e3cf;
  --chart: #0f7a56;           /* validado: L e contraste ≥3:1 sobre a superfície clara */
  --chart-track: #eef0f3;

  /* Status */
  --ok: #067647;      --ok-soft: #ecfdf3;
  --warn: #b54708;    --warn-soft: #fffaeb;
  --danger: #b42318;  --danger-soft: #fef3f2;
  --info: #175cd3;    --info-soft: #eff8ff;

  /* Barra lateral */
  --side-bg: #0c1d17;
  --side-ink: #c7d3ce;
  --side-muted: #7f938b;
  --side-hover: #15302a;
  --side-active: #1b3d33;

  /* Tipografia */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 20px; --fs-2xl: 24px; --fs-3xl: 30px;

  /* Espaço, raio, sombra */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px;
  --shadow-xs: 0 1px 2px rgb(16 24 40 / .05);
  --shadow-sm: 0 1px 3px rgb(16 24 40 / .08), 0 1px 2px rgb(16 24 40 / .04);
  --shadow-lg: 0 20px 40px -8px rgb(16 24 40 / .18), 0 6px 12px -6px rgb(16 24 40 / .08);
  --ring: 0 0 0 4px rgb(15 122 86 / .14);

  accent-color: var(--brand);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1412;
    --surface: #151c1a;
    --surface-2: #121816;
    --surface-3: #1b2421;
    --line: #26302d;
    --line-strong: #34403c;
    --ink: #eef2f0;
    --ink-2: #cdd6d2;
    --muted: #93a19b;
    --faint: #6b7a74;
    --brand: #2fa678;
    --brand-hover: #39b484;
    --brand-ink: #04170f;
    --brand-soft: #143128;
    --brand-line: #1f5643;
    --chart: #2fa678;         /* validado para a superfície escura */
    --chart-track: #1f2926;
    --ok: #47cd89;     --ok-soft: #0f2a1d;
    --warn: #fdb022;   --warn-soft: #2e2210;
    --danger: #f97066; --danger-soft: #331716;
    --info: #84caff;   --info-soft: #102236;
    --side-bg: #0a110f;
    --side-ink: #c7d3ce;
    --side-muted: #6f817a;
    --side-hover: #131f1b;
    --side-active: #183129;
    --shadow-xs: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-sm: 0 1px 3px rgb(0 0 0 / .45);
    --shadow-lg: 0 24px 48px -12px rgb(0 0 0 / .6);
    --ring: 0 0 0 4px rgb(47 166 120 / .22);
  }
}

/* ------------------------------------------------------------------ base */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); font-size: var(--fs-md); line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); font-weight: 650; letter-spacing: -.02em; }
h2 { font-size: var(--fs-lg); font-weight: 600; }
h3 { font-size: var(--fs-md); font-weight: 600; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.xs { font-size: var(--fs-xs); }
.sm { font-size: var(--fs-sm); }
.row { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: var(--s3); }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

/* ------------------------------------------------------------------ layout */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--side-bg); color: var(--side-ink); padding: var(--s5) var(--s3);
  display: flex; flex-direction: column; gap: var(--s1); position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2) var(--s5); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(140deg, #1aa074, #0b5e42); color: #fff; font-weight: 750; font-size: 15px; box-shadow: inset 0 1px 0 rgb(255 255 255 / .2); }
.brand-name { white-space: nowrap; font-weight: 650; color: #fff; font-size: 15px; line-height: 1.2; }
.brand-sub { color: var(--side-muted); font-size: var(--fs-xs); }
.nav-group { margin-top: var(--s4); }
.nav-label { color: var(--side-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding: 0 var(--s3) var(--s2); }
.nav a { display: flex; align-items: center; gap: var(--s3); padding: 8px var(--s3); border-radius: var(--r-md); color: var(--side-ink); font-weight: 500; font-size: var(--fs-md); }
.nav a:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 2px 0 0 #3fcf98; }
.nav a .count { margin-left: auto; font-size: 11px; font-weight: 600; background: rgb(255 255 255 / .1); color: #fff; border-radius: 999px; padding: 1px 7px; }
.nav a .count.alert { background: #b42318; }
.side-foot { margin-top: auto; padding: var(--s3); border-top: 1px solid rgb(255 255 255 / .08); display: flex; gap: var(--s3); align-items: center; }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who strong { display: block; color: #fff; font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { color: var(--side-muted); font-size: var(--fs-xs); }
.side-foot .icon-btn { color: var(--side-muted); }
.side-foot .icon-btn:hover { background: var(--side-hover); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s8); background: color-mix(in srgb, var(--surface) 88%, transparent); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: saturate(1.4) blur(8px); }
.search { position: relative; width: min(420px, 100%); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 36px; background: var(--surface-2); }
.page { padding: var(--s6) var(--s8) 64px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s6); }
.page-head .titles { min-width: 0; }
.page-head .eyebrow { color: var(--muted); font-size: var(--fs-sm); margin-bottom: 2px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: var(--s2); flex-wrap: wrap; }
.crumb { font-size: var(--fs-sm); color: var(--muted); display: inline-flex; align-items: center; gap: 4px; margin-bottom: 6px; }

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: var(--s2) var(--s3); overflow-x: auto; gap: var(--s2); }
  .brand { padding: 0; }
  .brand-sub, .nav-label, .side-foot .who { display: none; }
  .nav-group { margin: 0; }
  .nav { display: flex; gap: 2px; }
  .nav a { white-space: nowrap; padding: 7px 10px; }
  .nav a span.lbl { display: none; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .topbar { position: static; padding: var(--s3) var(--s4); flex-wrap: wrap; }
  .topbar .search { order: 3; width: 100%; }
  .topbar .spacer { display: none; }
  .topbar .btn { flex: 1; }
  .page { padding: var(--s5) var(--s4) 48px; }
}

/* ------------------------------------------------------------------ controles */
input, select, textarea {
  font: inherit; color: inherit; width: 100%; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-md); padding: 8px 12px; box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
label.field { display: grid; gap: 6px; font-weight: 500; font-size: var(--fs-sm); color: var(--ink-2); }
label.field .hint { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }
label.check { display: flex; gap: 10px; align-items: center; font-size: var(--fs-md); color: var(--ink-2); }
label.check input { width: 16px; height: 16px; box-shadow: none; }
.form-grid { display: grid; gap: var(--s4); grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }

.btn {
  font: inherit; font-size: var(--fs-sm); font-weight: 600; line-height: 20px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-xs);
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger-soft); }
.btn.wa { color: #067647; }
.btn.sm { padding: 5px 10px; font-size: var(--fs-xs); gap: 6px; }
.btn:disabled { opacity: .55; cursor: progress; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); border-radius: var(--r-md); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }

.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r-md); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: var(--fs-sm); font-weight: 500; border: 0; background: transparent; color: var(--muted); padding: 5px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.seg button .c { color: var(--faint); font-weight: 500; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ superfícies */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: var(--fs-md); font-weight: 600; }
.card-head p { color: var(--muted); font-size: var(--fs-xs); }
.card-head .actions { margin-left: auto; display: flex; gap: var(--s2); align-items: center; }
.card-body { padding: var(--s5); }
.card-body.tight { padding: var(--s2) var(--s5); }
.grid { display: grid; gap: var(--s5); }
.g-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-detail { grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); align-items: start; }
@media (max-width: 1200px) { .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) { .g-2-1, .g-3, .g-2, .g-detail { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .g-kpi { grid-template-columns: 1fr; } }

/* KPI */
.kpi { padding: var(--s5); display: grid; gap: var(--s2); position: relative; overflow: hidden; }
.kpi-top { display: flex; align-items: center; gap: var(--s2); color: var(--muted); font-size: var(--fs-sm); font-weight: 500; }
.kpi-icon { width: 30px; height: 30px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.kpi-value { font-size: var(--fs-3xl); font-weight: 650; letter-spacing: -.025em; line-height: 1.1; }
.kpi-foot { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-xs); color: var(--muted); flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; border-radius: 999px; padding: 1px 7px; font-size: 11.5px; }
.delta.up { color: var(--ok); background: var(--ok-soft); }
.delta.down { color: var(--danger); background: var(--danger-soft); }
.delta.flat { color: var(--muted); background: var(--surface-3); }
.kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s3); }
.kpi .spark { width: 96px; height: 36px; flex: none; margin-bottom: 2px; }
a.kpi { color: inherit; }
a.kpi:hover { text-decoration: none; border-color: var(--line-strong); }

/* Badges / pílulas */
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge.mei, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: var(--surface-3); color: var(--muted); }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); font-size: var(--fs-sm); border: 1px solid transparent; }
.alert svg { margin-top: 1px; }
.alert.alto { background: var(--danger-soft); color: var(--danger); }
.alert.medio { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--info-soft); color: var(--info); }

.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 650; background: var(--brand-soft); color: var(--brand); flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10.5px; }

/* Progresso */
.progress { display: flex; height: 8px; border-radius: 999px; background: var(--chart-track); overflow: hidden; gap: 2px; }
.progress span { display: block; height: 100%; }
.progress .p-done { background: var(--chart); }
.progress .p-sent { background: color-mix(in srgb, var(--chart) 45%, var(--chart-track)); }
.legend { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }

/* Tabelas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
th, td { text-align: left; padding: 12px var(--s4); border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; }
th:first-child { border-top-left-radius: var(--r-lg); } th:last-child { border-top-right-radius: var(--r-lg); }
tbody tr { transition: background .1s; }
tbody tr.click:hover { background: var(--surface-2); cursor: pointer; }
tbody tr:last-child td { border-bottom: 0; }
td .t1 { font-weight: 600; color: var(--ink); }
td .t2 { color: var(--muted); font-size: var(--fs-xs); }
td.r, th.r { text-align: right; }
td.chk, th.chk { width: 36px; padding-right: 0; }
td.chk input, th.chk input { width: 16px; height: 16px; box-shadow: none; }

.empty { padding: 40px var(--s5); text-align: center; color: var(--muted); display: grid; gap: var(--s2); justify-items: center; }
.empty .e-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--faint); }
.empty strong { color: var(--ink); }

/* Listas */
.list-item { display: flex; gap: var(--s3); align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: var(--fs-sm); }
.list-item .li-sub { color: var(--muted); font-size: var(--fs-xs); }
a.list-item { color: inherit; }
a.list-item:hover { text-decoration: none; }
a.list-item:hover .li-title { color: var(--brand); }

/* ------------------------------------------------------------------ gráficos */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .bar { fill: var(--chart); transition: opacity .12s; }
.chart .bar.dim { opacity: .45; }
.chart .hit { fill: transparent; cursor: default; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; padding: 6px 10px; border-radius: var(--r-md); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); box-shadow: var(--shadow-lg); z-index: 3; }
.tip strong { font-weight: 650; }
.tip[hidden] { display: none; }
.hbars { display: grid; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: var(--s3); align-items: center; font-size: var(--fs-sm); }
.hbar .lbl { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .track { display: block; height: 10px; position: relative; }
.hbar .fill { display: block; height: 100%; background: var(--chart); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .val { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }

/* Agenda MEI */
.ag { display: grid; gap: var(--s3); padding: var(--s4) 0; border-bottom: 1px solid var(--line); }
.ag:first-child { padding-top: 0; }
.ag:last-child { border-bottom: 0; padding-bottom: 0; }
.ag-head { display: flex; align-items: center; gap: var(--s3); }
.ag-date { width: 46px; flex: none; text-align: center; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.ag-date .m { display: block; background: var(--brand); color: var(--brand-ink); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 0; }
.ag-date .d { display: block; font-size: 18px; font-weight: 700; padding: 2px 0 3px; }
.ag-title { font-weight: 600; }
.ag-sub { color: var(--muted); font-size: var(--fs-xs); }

/* ------------------------------------------------------------------ kanban */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(272px, 1fr); gap: var(--s4); overflow-x: auto; padding-bottom: var(--s3); align-items: start; }
.col { background: var(--surface-3); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.col-head { padding: 12px 14px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: var(--fs-sm); }
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.col[data-stage=qualificacao] .dot { background: #6172f3; }
.col[data-stage=proposta] .dot { background: #f79009; }
.col[data-stage=negociacao] .dot { background: #ee46bc; }
.col[data-stage=ganho] .dot { background: var(--ok); }
.col[data-stage=perdido] .dot { background: var(--danger); }
.col-head .n { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.col-head .v { margin-left: auto; color: var(--muted); font-weight: 500; font-size: var(--fs-xs); }
.col-body { padding: 0 10px 10px; display: grid; gap: 8px; overflow-y: auto; min-height: 80px; align-content: start; border-radius: 0 0 var(--r-lg) var(--r-lg); transition: background .12s; }
.col.drop .col-body { background: var(--brand-soft); outline: 2px dashed var(--brand-line); outline-offset: -4px; }
.deal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; cursor: grab; display: grid; gap: 8px; box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s; }
.deal:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.deal.dragging { opacity: .4; }
.deal .t { font-weight: 600; font-size: var(--fs-sm); overflow-wrap: anywhere; }
.deal .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: var(--fs-xs); }
.deal .foot { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--fs-xs); border-top: 1px solid var(--line); padding-top: 8px; }
.deal .stale { color: var(--warn); font-weight: 600; }
.deal .val { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------ linha do tempo */
.timeline { display: grid; }
.ev { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 10px 0; position: relative; }
.ev::before { content: ""; position: absolute; left: 13.5px; top: 38px; bottom: -6px; width: 1px; background: var(--line); }
.ev:last-child::before { display: none; }
.ev .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.ev .dot svg { width: 14px; height: 14px; }
.ev.note .dot { background: var(--info-soft); color: var(--info); }
.ev.message .dot { background: var(--ok-soft); color: var(--ok); }
.ev.stage .dot { background: var(--warn-soft); color: var(--warn); }
.ev.transcript .dot { background: var(--ok-soft); color: var(--ok); }
.transcript summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 500; list-style: none; }
.transcript summary::-webkit-details-marker { display: none; }
.transcript summary::after { content: " · ver conversa"; color: var(--brand); font-weight: 600; }
.transcript[open] summary::after { content: " · ocultar"; }
.transcript .body { margin-top: 8px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); font-size: var(--fs-xs); line-height: 1.6; max-height: 360px; overflow-y: auto; }
.ev.alert .dot { background: var(--danger-soft); color: var(--danger); }
.ev .body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-sm); }
.ev .when { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }

dl.facts { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; font-size: var(--fs-sm); }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); }
@media (max-width: 600px) { dl.facts { grid-template-columns: 1fr; gap: 2px 0; } dl.facts dd { margin-bottom: 8px; } }

.task { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task input { width: 16px; height: 16px; margin-top: 2px; box-shadow: none; flex: none; }
.task .tt { font-size: var(--fs-sm); font-weight: 500; }
.task.done .tt { text-decoration: line-through; color: var(--muted); }
.task .due.late { color: var(--danger); font-weight: 600; }

.copy { display: flex; gap: 6px; }
.copy input { font-family: var(--mono); font-size: 12px; background: var(--surface-2); }

.bulkbar { position: sticky; bottom: 16px; display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r-lg); box-shadow: var(--shadow-lg); margin-top: var(--s4); z-index: 4; }
.bulkbar .btn { background: transparent; color: var(--bg); border-color: rgb(255 255 255 / .25); box-shadow: none; }
.bulkbar .btn:hover { background: rgb(255 255 255 / .1); }

select.status { width: auto; padding: 4px 28px 4px 10px; font-size: var(--fs-xs); font-weight: 600; border-radius: 999px; box-shadow: none; }
select.status.s-pendente { background-color: var(--surface-3); color: var(--ink-2); border-color: transparent; }
select.status.s-enviado { background-color: var(--info-soft); color: var(--info); border-color: transparent; }
select.status.s-concluido { background-color: var(--ok-soft); color: var(--ok); border-color: transparent; }
select.status.s-nao_se_aplica { background-color: transparent; color: var(--muted); border-color: var(--line); }

/* ------------------------------------------------------------------ diálogo */
dialog { border: 1px solid var(--line); border-radius: var(--r-xl); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog.wide { width: min(880px, calc(100vw - 24px)); }
dialog::backdrop { background: rgb(12 17 16 / .5); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: var(--s5) var(--s6); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { flex: 1; font-size: var(--fs-lg); }
#modal-body { padding: var(--s6); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s6); flex-wrap: wrap; }

/* ------------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { background: var(--side-bg); color: #dfe7e3; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; inset: auto -20% -40% auto; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(closest-side, rgb(26 160 116 / .35), transparent); }
.login-art h2 { font-size: 30px; font-weight: 650; color: #fff; letter-spacing: -.02em; max-width: 420px; line-height: 1.2; }
.login-art ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; color: #b9c8c2; position: relative; z-index: 1; }
.login-art li { display: flex; gap: 10px; align-items: center; }
.login-art li svg { color: #3fcf98; }
.login-form { display: grid; place-items: center; padding: 24px; }
.login-form form { width: min(380px, 100%); display: grid; gap: var(--s4); }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(8px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r-md); font-weight: 500; font-size: var(--fs-sm); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 50; max-width: calc(100vw - 32px); box-shadow: var(--shadow-lg); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); color: #fff; }
