/* ---------- Tokens ---------- */
:root {
  --bg: #eee9e1;
  --bg-glow-1: #f6dcc3;
  --bg-glow-2: #e3e6d6;
  --surface: #faf8f4;
  --surface-2: #f2eee7;
  --surface-3: #e8e2d8;
  --ink: #1b1a18;
  --ink-2: #4a4640;
  --muted: #847d72;
  --line: #e2dbd0;
  --focus: #c9532c;
  --shadow: 0 1px 2px rgba(40, 30, 15, .04), 0 8px 24px rgba(40, 30, 15, .06);
  --shadow-lg: 0 24px 60px rgba(30, 22, 10, .18);

  --st-qualificacao: #f1c644;
  --st-qualificacao-ink: #2a2209;
  --st-proposta: #2e5b4e;
  --st-proposta-ink: #f4f1ea;
  --st-negociacao: #c9532c;
  --st-negociacao-ink: #fbf3ee;
  --st-fechamento: #1b1a18;
  --st-fechamento-ink: #f4f1ea;
  --st-ganho: #3d8b5a;
  --st-perdido: #9a948b;

  --good: #3d8b5a;
  --warn: #d49a1c;
  --bad: #c9532c;

  --radius: 22px;
  --radius-sm: 14px;
  --font: 'Outfit', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311; --bg-glow-1: #2a1d14; --bg-glow-2: #18201c;
    --surface: #1e1c19; --surface-2: #26231f; --surface-3: #312d28;
    --ink: #f1ede6; --ink-2: #cfc8bd; --muted: #958d81; --line: #34302a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    --st-fechamento: #3a3631; --st-proposta: #2f6655;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141311; --bg-glow-1: #2a1d14; --bg-glow-2: #18201c;
  --surface: #1e1c19; --surface-2: #26231f; --surface-3: #312d28;
  --ink: #f1ede6; --ink-2: #cfc8bd; --muted: #958d81; --line: #34302a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  --st-fechamento: #3a3631; --st-proposta: #2f6655;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.bg-orbs {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 400px at 8% -5%, var(--bg-glow-1), transparent 70%),
    radial-gradient(700px 500px at 95% 105%, var(--bg-glow-2), transparent 70%);
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 18px clamp(16px, 4vw, 70px) 0 clamp(16px, 4vw, 70px);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 19px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; background: var(--ink); color: var(--st-qualificacao);
  display: grid; place-items: center; font-weight: 700; font-size: 17px;
}
.brand-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; gap: 4px; order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs a {
  padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--ink-2);
  white-space: nowrap; transition: background .15s;
}
.tabs a:hover { background: var(--surface-2); }
.tabs a.active { background: var(--ink); color: var(--surface); }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.icon-btn, .avatar-btn {
  position: relative; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center;
  box-shadow: var(--shadow);
}
.icon-btn:hover { background: var(--surface-2); }
.avatar-btn { background: var(--ink); color: var(--surface); font-weight: 600; font-size: 13px; border: 0; }
.dot-badge {
  position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--bad); box-shadow: 0 0 0 2px var(--surface);
}
@media (min-width: 900px) {
  .tabs { order: 0; width: auto; }
}

/* ---------- Rail ---------- */
.rail {
  position: fixed; left: 12px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 4px; padding: 10px 6px;
  background: var(--st-fechamento); border-radius: 999px; z-index: 20; box-shadow: var(--shadow-lg);
}
.rail button {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: #e9e4db;
  display: grid; place-items: center;
}
.rail button:hover { background: rgba(255,255,255,.12); }
.rail-sep { height: 1px; background: rgba(255,255,255,.15); margin: 6px 6px; }
@media (max-width: 1099px) { .rail { display: none; } }

/* ---------- Layout ---------- */
main {
  padding: 22px clamp(16px, 4vw, 70px) 60px clamp(16px, 4vw, 70px);
  max-width: 1600px; margin: 0 auto; outline: none;
}
.loading { padding: 80px 0; text-align: center; color: var(--muted); }

.page-head { display: flex; align-items: center; gap: 18px 28px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title { font-size: clamp(28px, 3.4vw, 38px); line-height: 1.02; font-weight: 500; letter-spacing: -.02em; margin: 0; }
.page-title span { display: block; }
.kpis { display: flex; gap: 14px 26px; flex-wrap: wrap; }
.kpi { display: flex; align-items: center; gap: 12px; }
.kpi-icon {
  width: 44px; height: 44px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line);
  display: grid; place-items: center; flex: none;
}
.kpi-value { font-size: 21px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.kpi-label { font-size: 13px; color: var(--muted); }
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--st-qualificacao); color: var(--st-qualificacao-ink);
}
.pill.green { background: var(--st-proposta); color: var(--st-proposta-ink); }
.pill.red { background: var(--st-negociacao); color: var(--st-negociacao-ink); }
.pill.soft { background: var(--surface-3); color: var(--ink-2); font-weight: 500; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .spacer { flex: 1; }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 16px; height: 44px; min-width: 0; flex: 0 1 300px; box-shadow: var(--shadow);
}
.search input { border: 0; background: transparent; outline: none; width: 100%; min-width: 0; }
.search input::placeholder { color: var(--muted); }

.seg {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px;
}
.seg button {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink-2);
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px;
  font-size: 13px; font-weight: 500;
}
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 500; font-size: 14px;
  white-space: nowrap; box-shadow: var(--shadow);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--bad); }
.btn.small { height: 34px; padding: 0 14px; font-size: 13px; box-shadow: none; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.round-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; flex: none;
}
.round-btn:hover { background: var(--surface-2); }

.card {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; gap: 4px 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.card-head .sub { color: var(--muted); font-size: 13px; }
.card-head .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.empty { text-align: center; color: var(--muted); padding: 34px 16px; font-size: 14px; }
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; font-size: 15px; }

i[data-icon] { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; font-style: normal; }
i[data-icon] svg { width: 100%; height: 100%; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600;
  flex: none; border: 2px solid var(--surface);
}
.avatar.lg { width: 52px; height: 52px; font-size: 17px; border: 0; }

/* ---------- Overview ---------- */
.ov-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .ov-grid { grid-template-columns: 1.7fr 1fr; } }
.ov-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 18px;
  border-radius: var(--radius-sm); background: var(--st-qualificacao); color: var(--st-qualificacao-ink); font-size: 14px;
}
.ov-banner .btn { margin-left: auto; height: 36px; box-shadow: none; background: rgba(255,255,255,.55); border-color: transparent; color: inherit; }
.chart-big { font-size: 32px; font-weight: 600; letter-spacing: -.02em; }
.chart-legend { display: flex; gap: 18px; font-size: 13px; color: var(--muted); margin: 6px 0 10px; flex-wrap: wrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--st-negociacao); }
.lg-dash { width: 16px; border-top: 2px dashed var(--ink); }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid { stroke: var(--line); }
.chart .bar { fill: var(--st-negociacao); transition: opacity .15s; }
.chart .bar.current { fill: var(--ink); }
.chart .bar:hover { opacity: .8; }
.chart .target { stroke: var(--ink); stroke-dasharray: 5 5; stroke-width: 1.5; fill: none; }
.chart .val { fill: var(--ink-2); font-size: 11px; font-family: var(--font); font-weight: 500; }

.hot-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-top: 1px solid var(--line);
  background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; width: 100%;
}
.list-item:first-child { border-top: 0; }
button.list-item:hover { background: var(--surface-2); border-radius: 12px; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .s { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-box {
  width: 46px; flex: none; text-align: center; border-radius: 12px; background: var(--surface-2); padding: 5px 0; line-height: 1.1;
}
.date-box b { display: block; font-size: 17px; }
.date-box small { font-size: 11px; color: var(--muted); text-transform: uppercase; }

/* ---------- Pipeline ---------- */
.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 16px;
  overflow-x: auto; padding-bottom: 14px; align-items: start; scroll-snap-type: x proximity;
}
.board.with-closed { grid-template-columns: repeat(4, minmax(270px, 1fr)) minmax(180px, .6fr); }
.col {
  background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; min-height: 300px; scroll-snap-align: start;
  display: flex; flex-direction: column; transition: background .15s, border-color .15s;
}
.col.drag-over { background: var(--surface-2); border-color: var(--ink-2); border-style: dashed; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 0; }
.col-head .dot { width: 12px; height: 12px; border-radius: 50%; }
.col-head h3 { font-size: 15px; font-weight: 600; margin: 0; }
.col-head .count { font-size: 12px; background: var(--surface-3); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.col-head .round-btn { margin-left: auto; }
.col-total { color: var(--muted); font-size: 13px; padding: 2px 4px 12px; }
.col-cards { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.drop-hint {
  border: 1.5px dashed var(--line); border-radius: 18px; padding: 18px; text-align: center; color: var(--muted); font-size: 13px;
}

.deal-card {
  position: relative; border-radius: 20px; padding: 16px 16px 14px; cursor: grab; user-select: none;
  background: var(--deal-bg); color: var(--deal-ink); box-shadow: 0 2px 6px rgba(0,0,0,.06);
  transition: transform .15s, box-shadow .15s; text-align: left; border: 0; width: 100%; display: block;
}
.deal-card:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.12); }
.deal-card.dragging { opacity: .45; }
.deal-card .when { font-size: 12px; opacity: .8; display: flex; align-items: center; gap: 6px; }
.deal-card .late { background: rgba(0,0,0,.18); padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.deal-card h4 { margin: 10px 0 2px; font-size: 17px; font-weight: 600; line-height: 1.2; padding-right: 26px; }
.deal-card .co { font-size: 13px; opacity: .82; }
.deal-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.deal-card .amount { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.deal-card .prob { font-size: 12px; opacity: .75; }
.deal-card .menu-btn {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid currentColor; opacity: .55; background: transparent; color: inherit; display: grid; place-items: center;
}
.deal-card .menu-btn:hover { opacity: 1; }
.deal-card .avatar { border-color: var(--deal-bg); }

.st-qualificacao { --deal-bg: var(--st-qualificacao); --deal-ink: var(--st-qualificacao-ink); }
.st-proposta { --deal-bg: var(--st-proposta); --deal-ink: var(--st-proposta-ink); }
.st-negociacao { --deal-bg: var(--st-negociacao); --deal-ink: var(--st-negociacao-ink); }
.st-fechamento { --deal-bg: var(--st-fechamento); --deal-ink: var(--st-fechamento-ink); }
.st-ganho { --deal-bg: var(--st-ganho); --deal-ink: #f2f7f3; }
.st-perdido { --deal-bg: var(--st-perdido); --deal-ink: #faf8f4; }

.closed-stack { display: flex; flex-direction: column; gap: 16px; }
.closed-zone {
  border-radius: var(--radius); padding: 18px; min-height: 140px; display: flex; flex-direction: column; gap: 6px;
  border: 1.5px dashed var(--line); background: color-mix(in srgb, var(--surface) 60%, transparent); transition: all .15s;
}
.closed-zone h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.closed-zone .big { font-size: 22px; font-weight: 600; }
.closed-zone small { color: var(--muted); }
.closed-zone.drag-over.win { background: var(--st-ganho); color: #fff; border-color: var(--st-ganho); }
.closed-zone.drag-over.lose { background: var(--st-perdido); color: #fff; border-color: var(--st-perdido); }
.closed-zone .btn { margin-top: auto; align-self: flex-start; }

/* Menu suspenso */
.menu {
  position: fixed; z-index: 60; min-width: 200px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 6px;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 9px 12px;
  border-radius: 10px; text-align: left; font-size: 14px;
}
.menu button:hover { background: var(--surface-2); }
.menu .sep { height: 1px; background: var(--line); margin: 5px 6px; }
.menu .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 6px 12px 2px; }
.menu .danger { color: var(--bad); }
.menu .dot { width: 10px; height: 10px; border-radius: 50%; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stage-tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.stage-tag .dot { width: 9px; height: 9px; border-radius: 50%; }

/* ---------- Clientes ---------- */
.cust-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.cust-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform .15s; }
.cust-card:hover { transform: translateY(-2px); }
.cust-top { display: flex; align-items: flex-start; justify-content: space-between; }
.star { border: 1px solid var(--line); background: var(--surface); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.star.on { background: var(--st-qualificacao); border-color: var(--st-qualificacao); color: var(--st-qualificacao-ink); }
.cust-name { font-size: 17px; font-weight: 600; line-height: 1.2; }
.cust-role { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.cust-stats small { display: block; font-size: 11px; color: var(--muted); }
.cust-stats b { font-size: 15px; font-weight: 600; }
.health { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.health-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.health-bar span { display: block; height: 100%; border-radius: 99px; }
.cust-foot { display: flex; align-items: center; gap: 6px; }
.cust-foot .pill { margin-right: auto; }

/* ---------- Agenda ---------- */
.ag-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .ag-grid { grid-template-columns: 1.6fr 1fr; } }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.cal-head h2 { margin: 0 auto 0 0; font-size: 20px; font-weight: 600; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .wd { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; text-align: center; padding-bottom: 4px; }
.cal .day {
  min-height: 92px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid transparent;
  padding: 6px; display: flex; flex-direction: column; gap: 3px; text-align: left; overflow: hidden;
}
.cal .day:hover { border-color: var(--line); }
.cal .day.out { opacity: .4; }
.cal .day.sel { border-color: var(--ink); background: var(--surface); }
.cal .day .n { font-size: 13px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal .day.today .n { background: var(--st-negociacao); color: #fff; }
.ev-chip {
  font-size: 11px; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--chip-bg); color: var(--chip-ink);
}
.ev-chip.done { opacity: .5; text-decoration: line-through; }
.ev-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
@media (max-width: 640px) {
  .cal .day { min-height: 54px; }
  .ev-chip { font-size: 0; height: 6px; padding: 0; }
}
.tp-reuniao { --chip-bg: var(--st-proposta); --chip-ink: var(--st-proposta-ink); }
.tp-ligacao { --chip-bg: var(--st-qualificacao); --chip-ink: var(--st-qualificacao-ink); }
.tp-tarefa { --chip-bg: var(--st-fechamento); --chip-ink: var(--st-fechamento-ink); }
.tp-followup { --chip-bg: var(--st-negociacao); --chip-ink: var(--st-negociacao-ink); }

.ev-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-top: 1px solid var(--line); }
.ev-row:first-child { border-top: 0; }
.ev-row .check {
  width: 24px; height: 24px; border-radius: 8px; border: 1.5px solid var(--muted); background: transparent; flex: none;
  display: grid; place-items: center; margin-top: 2px; color: transparent;
}
.ev-row .check.on { background: var(--good); border-color: var(--good); color: #fff; }
.ev-row .grow { flex: 1; min-width: 0; }
.ev-row .t { font-weight: 500; }
.ev-row.done .t { text-decoration: line-through; color: var(--muted); }
.ev-row .s { color: var(--muted); font-size: 13px; }
.ev-type { width: 8px; align-self: stretch; border-radius: 4px; background: var(--chip-bg); flex: none; }

/* ---------- Modal ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(20, 16, 10, .38); z-index: 50; display: flex;
  align-items: center; justify-content: center; padding: 16px; animation: fade .15s ease;
}
.overlay.side { justify-content: flex-end; padding: 0; }
.modal {
  background: var(--surface); border-radius: 26px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  max-height: calc(100vh - 32px); overflow: auto; animation: pop .18s ease;
}
.overlay.side .modal { max-width: 520px; height: 100vh; max-height: 100vh; border-radius: 26px 0 0 26px; animation: slide .2s ease; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 6px; }
.modal-head h2 { margin: 0; font-size: 21px; font-weight: 600; flex: 1; letter-spacing: -.01em; }
.modal-body { padding: 14px 24px 8px; }
.modal-foot { display: flex; gap: 10px; padding: 14px 24px 22px; justify-content: flex-end; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.form { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; grid-column: span 2; }
.field.half { grid-column: span 1; }
@media (max-width: 520px) { .field.half { grid-column: span 2; } }
.field label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); background: var(--surface-2); border-radius: 12px; padding: 11px 13px; outline: none; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink-2); background: var(--surface); }
.field textarea { resize: vertical; min-height: 84px; }
.field .hint { font-size: 12px; color: var(--muted); }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; grid-column: span 2; }
.check-line input { width: 18px; height: 18px; accent-color: var(--good); }

.detail-hero { display: flex; gap: 14px; align-items: center; padding: 6px 24px 16px; }
.detail-hero .cust-name { font-size: 20px; }
.contact-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 24px 16px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 18px 0 6px; display: flex; align-items: center; }
.section-title .btn { margin-left: auto; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info-grid div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.info-grid small { display: block; font-size: 11px; color: var(--muted); }
.info-grid span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search-results { max-height: 50vh; overflow: auto; padding: 0 12px 12px; }
.search-big { border: 0; outline: none; background: transparent; font-size: 20px; width: 100%; padding: 22px 24px 14px; }
.search-group { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 12px 12px 4px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 999px; font-size: 14px;
  box-shadow: var(--shadow-lg); animation: pop .2s ease; display: flex; gap: 12px; align-items: center;
}
.toast button { background: none; border: 0; color: var(--st-qualificacao); font-weight: 600; padding: 0; }
.toast.err { background: var(--bad); color: #fff; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .page-head { gap: 14px; }
  .kpi-icon { width: 38px; height: 38px; }
  .kpi-value { font-size: 18px; }
  .search { flex: 1 1 100%; }
  .board, .board.with-closed { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 82%; }
  .overlay.side .modal { border-radius: 0; }
}

/* ---------- Recebimentos ---------- */
.rec-item { gap: 10px; }
.rec-main { background: none; border: 0; padding: 0; text-align: left; min-width: 0; }
.rec-item > b { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data .pill { white-space: nowrap; }
