/* =====================================================================
   BLACK CRM — design system
   Display: Bricolage Grotesque · Texto: Inter · Números: IBM Plex Mono
   ===================================================================== */

:root {
  --ink:        #0C1322;
  --ink-2:      #16203A;
  --ink-3:      #22304F;
  --paper:      #F2F5FB;
  --surface:    #FFFFFF;
  --line:       #E2E7F2;
  --line-soft:  #EEF1F8;

  --text:       #141C2E;
  --text-2:     #4A5568;
  --muted:      #7B849B;

  --brand:      #2E5BFF;
  --brand-700:  #1F42CC;
  --brand-50:   #EDF1FF;

  --mint:       #00A88F;
  --mint-50:    #E4F7F3;
  --amber:      #E08700;
  --amber-50:   #FFF4E0;
  --danger:     #DC2F35;
  --danger-50:  #FDECEC;
  --won:        #12A150;
  --won-50:     #E6F6EC;
  --violet:     #7248D6;
  --violet-50:  #F1ECFD;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;

  --sh-1: 0 1px 2px rgba(16, 24, 40, .05);
  --sh-2: 0 4px 14px rgba(16, 24, 40, .07);
  --sh-3: 0 18px 44px rgba(12, 19, 34, .16);

  --sidebar-w: 248px;
  --topbar-h: 62px;

  --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; letter-spacing: -.02em; font-weight: 600; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.ico { flex: none; vertical-align: -.18em; }

/* Números sempre em mono — a assinatura tipográfica do sistema */
.num, .money, td.num, .kpi__value, .stat {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

/* =====================================================================
   Estrutura
   ===================================================================== */

.shell { display: flex; min-height: 100vh; }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--ink);
  color: #AEB8CE;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 16px;
  color: #fff;
}
.brand__mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--brand), #00C2A8);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px; color: #fff;
  box-shadow: 0 4px 14px rgba(46, 91, 255, .45);
}
.brand__name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -.03em; }
.brand__name span { color: #6FE3D0; }

.nav { padding: 6px 12px 20px; overflow-y: auto; flex: 1; }
.nav__group { margin-top: 18px; }
.nav__label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .13em;
  color: #5C6883; padding: 0 10px 8px; font-weight: 600;
}
.nav__item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 9px;
  color: #B4BED3; font-weight: 500; font-size: 13.5px;
  margin-bottom: 2px; position: relative;
}
.nav__item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav__item.is-active { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(46,91,255,.32); }
.nav__count {
  margin-left: auto; font-family: var(--font-mono); font-size: 11px;
  background: rgba(255,255,255,.1); padding: 1px 7px; border-radius: 20px;
}
.nav__item.is-active .nav__count { background: rgba(255,255,255,.22); }

.sidebar__foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar__user { display: flex; align-items: center; gap: 10px; }
.sidebar__user b { color: #fff; font-size: 13px; display: block; font-weight: 600; }
.sidebar__user small { color: #6E7A94; font-size: 11.5px; }
.sidebar__out { color: #7C879E; margin-left: auto; display: grid; place-items: center; padding: 6px; border-radius: 8px; }
.sidebar__out:hover { background: rgba(255,255,255,.08); color: #fff; }

/* --- Main --- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.topbar__search { position: relative; flex: 1; max-width: 420px; }
.topbar__search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar__search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--paper); font: inherit; color: var(--text);
}
.topbar__search input:focus { background: #fff; border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-50); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.content { padding: 24px; flex: 1; }
.content--wide { padding: 20px 24px; }

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; line-height: 1.15; }
.page-head p { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; }
.page-head__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.eyebrow {
  font-size: 11px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); font-weight: 600; font-family: var(--font-mono);
}

/* =====================================================================
   Botões
   ===================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px;
  border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--text);
  font: 600 13.5px/1 var(--font-body);
  cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .06s;
}
.btn:hover { background: var(--line-soft); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(46,91,255,.25); }
.btn--primary:hover { background: var(--brand-700); border-color: var(--brand-700); }
.btn--dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--dark:hover { background: var(--ink-2); }
.btn--won { background: var(--won); border-color: var(--won); color: #fff; }
.btn--won:hover { background: #0E8944; }
.btn--danger { background: #fff; border-color: #F2C7C7; color: var(--danger); }
.btn--danger:hover { background: var(--danger-50); }
.btn--sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn--icon { width: 38px; padding: 0; }
.btn--icon.btn--sm { width: 32px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* =====================================================================
   Cartões
   ===================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.card__head {
  padding: 15px 18px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 12px;
}
.card__head h2, .card__head h3 { font-size: 15px; font-weight: 600; }
.card__head .btn { margin-left: auto; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--line-soft); background: #FBFCFE; border-radius: 0 0 var(--r-lg) var(--r-lg); }

.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--2-1 { grid-template-columns: 2fr 1fr; }
.grid--1-2 { grid-template-columns: 1fr 2fr; }

/* KPI */
.kpi { padding: 17px 18px; position: relative; overflow: hidden; }
.kpi__label { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi__value { font-size: 27px; font-weight: 600; margin-top: 9px; line-height: 1.05; }
.kpi__foot { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi__delta { font-family: var(--font-mono); font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.kpi__delta.up { color: var(--won); }
.kpi__delta.down { color: var(--danger); }
.kpi__spark { position: absolute; right: 14px; top: 14px; opacity: .5; color: var(--brand); }

/* =====================================================================
   Tabelas
   ===================================================================== */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600; padding: 11px 14px;
  border-bottom: 1px solid var(--line); background: #FAFBFE; white-space: nowrap;
}
table.data th a { color: inherit; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tbody tr:hover { background: #FAFBFF; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .t-right { text-align: right; }
table.data .t-center { text-align: center; }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; gap: 5px; justify-content: flex-end; opacity: .35; transition: opacity .15s; }
tr:hover .row-actions { opacity: 1; }

/* =====================================================================
   Badges e chips
   ===================================================================== */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; line-height: 1.5;
  white-space: nowrap;
}
.badge--neutral { background: var(--line-soft); color: var(--text-2); }
.badge--brand   { background: var(--brand-50); color: var(--brand-700); }
.badge--won     { background: var(--won-50); color: #0B7A3C; }
.badge--danger  { background: var(--danger-50); color: #B71C1C; }
.badge--amber   { background: var(--amber-50); color: #9A5B00; }
.badge--mint    { background: var(--mint-50); color: #007A68; }
.badge--violet  { background: var(--violet-50); color: #5B32B8; }

.avatar {
  display: inline-grid; place-items: center;
  border-radius: 50%; background: var(--av, var(--brand));
  color: #fff; font-weight: 600; flex: none;
  font-family: var(--font-body); letter-spacing: -.01em;
}
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid #fff; }
.avatar-stack .avatar:first-child { margin-left: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 20px; border: 1px solid var(--line);
  background: #fff; font-size: 12.5px; font-weight: 500; color: var(--text-2);
}
.chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }
.chip.is-on:hover { color: #fff; }

/* =====================================================================
   Formulários
   ===================================================================== */

.form-grid { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field > label .req { color: var(--danger); }
.field .hint { font-size: 11.5px; color: var(--muted); }

.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font: inherit; color: var(--text);
}
.textarea { height: auto; padding: 10px 12px; min-height: 96px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237B849B' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50);
}
.input:disabled, .select:disabled { background: var(--line-soft); color: var(--muted); }
.input-money { font-family: var(--font-mono); }

.check { display: flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }

.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.form-actions .spacer { margin-left: auto; }

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 13px 16px; background: #fff;
  border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 16px;
}
.filters .input, .filters .select { height: 36px; width: auto; min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }

/* =====================================================================
   Alertas
   ===================================================================== */

.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 15px; border-radius: var(--r);
  font-size: 13.5px; margin-bottom: 16px; border: 1px solid;
}
.alert--success { background: var(--won-50); border-color: #BFE6CE; color: #0B6B37; }
.alert--error   { background: var(--danger-50); border-color: #F3C9C9; color: #A31B1B; }
.alert--info    { background: var(--brand-50); border-color: #CBD7FF; color: var(--brand-700); }
.alert--warn    { background: var(--amber-50); border-color: #F3DCAE; color: #8A5200; }

/* Toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r);
  box-shadow: var(--sh-3); font-size: 13.5px; display: flex; gap: 9px; align-items: center;
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* =====================================================================
   Kanban do funil
   ===================================================================== */

.board {
  display: flex; gap: 14px; align-items: flex-start;
  overflow-x: auto; padding-bottom: 14px; min-height: 60vh;
}
.column {
  width: 288px; flex: none;
  background: #EAEEF7;
  border-radius: 14px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 210px);
}
.column__head {
  padding: 12px 13px 10px;
  border-top: 3px solid var(--stage, var(--brand));
  border-radius: 14px 14px 0 0;
  background: #F6F8FC;
}
.column__title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.column__idx {
  font-family: var(--font-mono); font-size: 10.5px; color: #fff;
  background: var(--stage, var(--brand)); border-radius: 5px; padding: 1px 5px;
}
.column__count { margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.column__sum { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; margin-top: 4px; color: var(--text-2); }
.column__body { padding: 10px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; flex: 1; }
.column.is-over { background: #DDE6FB; outline: 2px dashed var(--brand); outline-offset: -3px; }

.deal-card {
  background: #fff; border: 1px solid var(--line); border-radius: 11px;
  padding: 11px 12px; cursor: grab; box-shadow: var(--sh-1);
  transition: box-shadow .15s, transform .1s;
  display: block; color: inherit;
}
.deal-card:hover { box-shadow: var(--sh-2); text-decoration: none; transform: translateY(-1px); }
.deal-card.is-dragging { opacity: .45; }
.deal-card__title { font-weight: 600; font-size: 13px; line-height: 1.35; }
.deal-card__co { color: var(--muted); font-size: 11.5px; margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.deal-card__row { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.deal-card__value { font-family: var(--font-mono); font-weight: 600; font-size: 13px; }
.deal-card__row .avatar { margin-left: auto; }

/* Barra de "temperatura": quanto o negócio está parado na etapa */
.rot { height: 3px; border-radius: 3px; background: var(--line-soft); margin-top: 9px; overflow: hidden; }
.rot span { display: block; height: 100%; border-radius: 3px; background: var(--mint); }
.rot.warm span { background: var(--amber); }
.rot.cold span { background: var(--danger); }
.deal-card__meta { display: flex; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--muted); align-items: center; }

/* =====================================================================
   Perfil / detalhe
   ===================================================================== */

.detail-head {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; margin-bottom: 16px;
}
.detail-head__top { display: flex; gap: 16px; align-items: flex-start; }
.detail-head h1 { font-size: 22px; }
.detail-head__sub { color: var(--muted); margin-top: 4px; font-size: 13px; display: flex; gap: 14px; flex-wrap: wrap; }
.detail-head__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.factbar { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.fact__k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.fact__v { font-size: 15px; font-weight: 600; margin-top: 3px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a {
  padding: 10px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.is-active { color: var(--brand); border-bottom-color: var(--brand); }

/* Etapas do funil como trilho */
.stage-rail { display: flex; gap: 3px; margin-top: 16px; }
.stage-rail__item {
  flex: 1; height: 30px; display: grid; place-items: center;
  background: var(--line-soft); color: var(--muted);
  font-size: 11.5px; font-weight: 600; position: relative;
}
.stage-rail__item:first-child { border-radius: 8px 0 0 8px; }
.stage-rail__item:last-child { border-radius: 0 8px 8px 0; }
.stage-rail__item.done { background: #D5E0FF; color: var(--brand-700); }
.stage-rail__item.now { background: var(--brand); color: #fff; }
.stage-rail__item.won { background: var(--won); color: #fff; }
.stage-rail__item.lost { background: var(--danger); color: #fff; }
.stage-rail__item:hover { text-decoration: none; filter: brightness(.96); }

/* Timeline */
.timeline { position: relative; padding-left: 30px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item__dot {
  position: absolute; left: -30px; top: 1px;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 2px solid var(--line);
  display: grid; place-items: center; color: var(--muted);
}
.tl-item__dot.brand { border-color: var(--brand); color: var(--brand); }
.tl-item__dot.won { border-color: var(--won); color: var(--won); }
.tl-item__dot.danger { border-color: var(--danger); color: var(--danger); }
.tl-item__head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl-item__head b { font-size: 13.5px; }
.tl-item__time { font-size: 11.5px; color: var(--muted); font-family: var(--font-mono); }
.tl-item__body { font-size: 13px; color: var(--text-2); margin-top: 4px; white-space: pre-wrap; }

/* Lista de atividades */
.act { display: flex; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.act:last-child { border-bottom: 0; }
.act__type { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--brand-50); color: var(--brand); }
.act__type.tarefa { background: var(--line-soft); color: var(--text-2); }
.act__type.ligacao { background: var(--mint-50); color: var(--mint); }
.act__type.reuniao { background: var(--violet-50); color: var(--violet); }
.act__type.email { background: var(--brand-50); color: var(--brand); }
.act__type.whatsapp { background: var(--won-50); color: var(--won); }
.act__type.visita { background: var(--amber-50); color: var(--amber); }
.act__main { flex: 1; min-width: 0; }
.act__title { font-weight: 600; font-size: 13.5px; }
.act__title.done { text-decoration: line-through; color: var(--muted); }
.act__meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.act.late .act__meta .due { color: var(--danger); font-weight: 600; }

/* =====================================================================
   Gráficos em SVG puro
   ===================================================================== */

.bars { display: flex; align-items: flex-end; gap: 10px; height: 168px; padding-top: 10px; }
.bars__col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; height: 100%; }
.bars__bar { width: 100%; max-width: 42px; background: linear-gradient(180deg, var(--brand), #5C82FF); border-radius: 6px 6px 3px 3px; min-height: 3px; position: relative; transition: filter .15s; }
.bars__col:hover .bars__bar { filter: brightness(1.12); }
.bars__bar.alt { background: linear-gradient(180deg, var(--mint), #37C9B2); }
.bars__val { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); font-weight: 600; }
.bars__lbl { font-size: 11px; color: var(--muted); }

.funnel { display: flex; flex-direction: column; gap: 7px; }
.funnel__row { display: flex; align-items: center; gap: 12px; }
.funnel__name { width: 130px; font-size: 12.5px; color: var(--text-2); flex: none; }
.funnel__track { flex: 1; height: 26px; background: var(--line-soft); border-radius: 6px; overflow: hidden; }
.funnel__fill { height: 100%; border-radius: 6px; background: var(--brand); display: flex; align-items: center; padding: 0 9px; color: #fff; font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; min-width: 4px; }
.funnel__side { width: 92px; text-align: right; font-family: var(--font-mono); font-size: 12px; color: var(--muted); flex: none; }

.progress { height: 8px; background: var(--line-soft); border-radius: 8px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--brand); border-radius: 8px; }
.progress.ok span { background: var(--won); }
.progress.warn span { background: var(--amber); }

.rank { display: flex; flex-direction: column; }
.rank__row { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.rank__row:last-child { border-bottom: 0; }
.rank__pos { font-family: var(--font-mono); font-size: 12px; color: var(--muted); width: 20px; }
.rank__name { font-weight: 600; font-size: 13.5px; }
.rank__bar { flex: 1; height: 6px; background: var(--line-soft); border-radius: 6px; overflow: hidden; }
.rank__bar span { display: block; height: 100%; background: var(--brand); }
.rank__val { font-family: var(--font-mono); font-size: 13px; font-weight: 600; width: 105px; text-align: right; }

/* =====================================================================
   Estado vazio, paginação, modal
   ===================================================================== */

.empty { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty__mark { width: 46px; height: 46px; border-radius: 14px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; margin: 0 auto 14px; }
.empty h3 { font-size: 16px; color: var(--text); margin-bottom: 5px; }
.empty p { margin: 0 0 16px; font-size: 13.5px; }

.pager { display: flex; align-items: center; gap: 6px; justify-content: center; padding: 14px; }
.pager a, .pager span {
  min-width: 33px; height: 33px; padding: 0 9px; border-radius: 8px;
  display: inline-grid; place-items: center; font-size: 13px; font-family: var(--font-mono);
  border: 1px solid var(--line); color: var(--text-2); background: #fff;
}
.pager a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.pager .is-current { background: var(--ink); border-color: var(--ink); color: #fff; }
.pager .muted { border: 0; background: none; color: var(--muted); font-family: var(--font-body); }

.modal-bg {
  position: fixed; inset: 0; background: rgba(12,19,34,.55);
  display: none; align-items: flex-start; justify-content: center;
  z-index: 100; padding: 40px 16px; overflow-y: auto;
}
.modal-bg.is-open { display: flex; }
.modal {
  background: #fff; border-radius: var(--r-lg); width: 100%; max-width: 540px;
  box-shadow: var(--sh-3); animation: modal-in .2s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(-12px); } }
.modal__head { padding: 17px 20px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; }
.modal__head h3 { font-size: 16px; }
.modal__head button { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--muted); padding: 4px; }
.modal__body { padding: 20px; }
.modal__foot { padding: 14px 20px; border-top: 1px solid var(--line-soft); display: flex; gap: 9px; justify-content: flex-end; }

/* Barras comparativas (ganho x perdido) */
.bars__stack { display: flex; align-items: flex-end; gap: 4px; width: 100%; height: 100%;
  justify-content: center; }
.bars__stack .bars__bar { max-width: 22px; }
.bars__bar--won { background: linear-gradient(180deg, var(--won), #2FC46B); }
.bars__bar--lost { background: linear-gradient(180deg, var(--danger), #F0666B); opacity: .85; }
.bars__label { display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 11px; color: var(--muted); text-align: center; }
.bars__label b { font-size: 11.5px; color: var(--text-2); }
.bars__label .num { font-size: 11px; }
.legend { display: flex; gap: 18px; justify-content: center; margin-top: 16px;
  font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 6px; vertical-align: -1px; }

/* =====================================================================
   Proposta comercial (documento)
   ===================================================================== */

.kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.kpis .kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.kpi--brand { border-left: 3px solid var(--brand); }
.kpi--won { border-left: 3px solid var(--won); }

.quote-sum {
  border-top: 1px solid var(--line);
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 10px;
  align-items: flex-end;
}
.quote-sum__row {
  display: flex; align-items: center; justify-content: flex-end; gap: 18px;
  min-width: 320px; font-size: 13px; color: var(--muted);
}
.quote-sum__row b { color: var(--text); font-size: 15px; }
.quote-sum__row--total {
  border-top: 1px dashed var(--line); padding-top: 12px;
  font-size: 15px; color: var(--text); font-weight: 600;
}
.quote-sum__row--total b { font-size: 24px; color: var(--brand); }

.doc { max-width: 940px; }
.doc .card__body { padding: 36px 40px 30px; }
.doc__head { display: flex; justify-content: space-between; gap: 30px; align-items: flex-start;
  padding-bottom: 20px; border-bottom: 2px solid var(--ink); }
.doc__brand { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
.doc__brand-sub { font-size: 12px; color: var(--muted); line-height: 1.7; margin-top: 5px; }
.doc__meta { text-align: right; }
.doc__code { font-size: 17px; font-weight: 700; letter-spacing: .04em; }
.doc__title { font-family: var(--font-display); font-size: 23px; margin: 24px 0 20px; letter-spacing: -.02em; }
.doc__parties { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-bottom: 26px; }
.doc__party { font-size: 12.5px; line-height: 1.8; margin-top: 6px; }
.doc__items { margin-bottom: 0; }
.doc__items thead th { background: var(--paper); }
.doc__totals { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin: 22px 0 8px; }
.doc__total-row { display: flex; justify-content: space-between; gap: 26px; min-width: 300px;
  font-size: 13px; color: var(--muted); }
.doc__total-row b { color: var(--text); }
.doc__total-row--big { border-top: 2px solid var(--ink); padding-top: 10px; font-size: 15px;
  color: var(--text); font-weight: 600; }
.doc__total-row--big b { font-size: 25px; color: var(--brand); }
.doc__terms { display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px;
  border-top: 1px solid var(--line-soft); padding-top: 20px; margin-top: 20px; }
.doc__terms p { font-size: 12.5px; line-height: 1.75; margin: 6px 0 0; color: var(--text); }
.doc__sign { display: grid; grid-template-columns: repeat(2, 1fr); gap: 60px; margin: 54px 0 10px; }
.doc__sign-line { border-top: 1px solid var(--ink); padding-top: 8px; text-align: center;
  font-size: 12px; color: var(--muted); }
.doc__foot { font-size: 11px; color: var(--muted); text-align: center; margin: 26px 0 0; }

@media (max-width: 860px) {
  .doc .card__body { padding: 22px; }
  .doc__head, .doc__parties, .doc__terms, .doc__sign { grid-template-columns: 1fr; flex-direction: column; }
  .doc__meta { text-align: left; }
}

/* Utilidades */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.t-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-won { color: var(--won); }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.nowrap { white-space: nowrap; }
.t-right { text-align: right; }
.hide { display: none; }

/* =====================================================================
   Impressão (proposta comercial)
   ===================================================================== */

@media print {
  .sidebar, .topbar, .page-head__actions, .no-print, .tabs { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  @page { margin: 16mm; }
}

/* =====================================================================
   Responsivo
   ===================================================================== */

@media (max-width: 1180px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--2-1, .grid--1-2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--sh-3);
  }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(12,19,34,.5); z-index: 39; }
  .nav-toggle { display: inline-flex !important; }
  .content { padding: 16px; }
  .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .page-head h1 { font-size: 21px; }
}

@media (max-width: 620px) {
  .grid--4 { grid-template-columns: 1fr; }
  .funnel__name { width: 90px; font-size: 11.5px; }
  .funnel__side { width: 70px; }
  .detail-head__actions { width: 100%; margin-left: 0; }
}

.nav-toggle { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
