/* CRM Grupo Manancial — identidade: amarelo Pantone 610 C (#E8D54D), preto/grafite, Glacial Indifference + Montserrat */
@font-face { font-family: 'Glacial'; src: url('/assets/fonts/glacial-regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Glacial'; src: url('/assets/fonts/glacial-bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/assets/fonts/Montserrat-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/assets/fonts/Montserrat-Medium.ttf') format('truetype'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/assets/fonts/Montserrat-SemiBold.ttf') format('truetype'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/assets/fonts/Montserrat-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Montserrat'; src: url('/assets/fonts/Montserrat-ExtraBold.ttf') format('truetype'); font-weight: 800; font-display: swap; }

:root {
  --brand: #E8D54D;
  --brand-strong: #d9c332;
  --brand-soft: #faf5d2;
  --ink: #2b2a2c;
  --ink-2: #4a494c;
  --muted: #6f6d72;
  --faint: #9a989d;
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --line: #e7e5df;
  --line-2: #d8d6cf;
  --side: #232224;
  --side-ink: #e9e8e4;
  --side-muted: #9d9ba0;
  --ok: #1f9d55;
  --ok-soft: #e3f5ea;
  --warn: #b7791f;
  --warn-soft: #fdf1dc;
  --bad: #d64545;
  --bad-soft: #fbe6e6;
  --info: #2f6fca;
  --info-soft: #e5eefb;
  --hot: #e0582b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 19, 21, .06), 0 4px 14px rgba(20, 19, 21, .05);
  --shadow-lg: 0 10px 40px rgba(20, 19, 21, .18);
  --font: 'Montserrat', Verdana, system-ui, sans-serif;
  --display: 'Glacial', 'Montserrat', Verdana, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --brand: #E8D54D;
  --brand-strong: #f0df62;
  --brand-soft: #3a361c;
  --ink: #f1f0ec;
  --ink-2: #d6d4cf;
  --muted: #a9a7ad;
  --faint: #7d7b81;
  --bg: #161517;
  --surface: #201f22;
  --surface-2: #262528;
  --line: #333236;
  --line-2: #413f44;
  --side: #111012;
  --ok-soft: #173a26;
  --warn-soft: #3d2f15;
  --bad-soft: #401c1c;
  --info-soft: #1a2c47;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 700; margin: 0; letter-spacing: .01em; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
p { margin: 0 0 .6em; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.center { text-align: center; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.sm { gap: 6px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }

/* ---------------- Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 248px; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40; transition: transform .2s ease; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar .brand img { width: 38px; height: 38px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; }
.sidebar .brand b { font-family: var(--display); font-size: 17px; letter-spacing: .12em; display: block; }
.sidebar .brand span { font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--brand); }
.company-switch { margin: 12px 12px 4px; padding: 9px 11px; border-radius: 10px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; color: var(--side-ink); width: calc(100% - 24px); text-align: left; }
.company-switch:hover { background: rgba(255,255,255,.09); }
.nav { padding: 8px 10px 16px; overflow-y: auto; flex: 1; }
.nav .group { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--side-muted); margin: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--side-ink); font-size: 13.5px; font-weight: 500; opacity: .86; }
.nav a:hover { background: rgba(255,255,255,.06); opacity: 1; }
.nav a.active { background: var(--brand); color: #1b1a1c; opacity: 1; font-weight: 600; }
.nav a .count { margin-left: auto; font-size: 11px; background: rgba(255,255,255,.12); padding: 0 7px; border-radius: 99px; }
.nav a.active .count { background: rgba(0,0,0,.12); }
.sidebar .foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11px; color: var(--side-muted); }
.main { flex: 1; margin-left: 248px; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 24px; min-height: 60px; }
.topbar .menu-btn { display: none; }
.searchbox { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; color: var(--muted); cursor: text; }
.searchbox kbd { margin-left: auto; font-size: 11px; border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; color: var(--faint); font-family: var(--font); }
.content { padding: 22px 24px 60px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.backdrop { position: fixed; inset: 0; background: rgba(12, 11, 13, .45); z-index: 35; }

/* ---------------- Botões */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; min-height: 36px; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #1b1a1c; }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.sm { padding: 4px 10px; min-height: 30px; font-size: 12px; }
.btn.icon { padding: 7px; min-width: 36px; }
.btn.sm.icon { padding: 4px; min-width: 30px; }
.btn.wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn.ai { background: linear-gradient(135deg, #2b2a2c, #4b4518); border-color: #2b2a2c; color: var(--brand); }
.btn.ai:hover { filter: brightness(1.15); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-h h3 { display: flex; align-items: center; gap: 8px; }
.card-b { padding: 16px; }
.card-b.flush { padding: 0; }
.kpi { padding: 16px; position: relative; overflow: hidden; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-family: var(--display); font-size: 27px; font-weight: 700; margin-top: 6px; letter-spacing: .01em; }
.kpi .foot { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kpi .icon-bubble { position: absolute; right: 14px; top: 14px; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-soft); color: var(--ink); display: grid; place-items: center; }
.kpi.accent { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.kpi.accent .label, .kpi.accent .foot { color: color-mix(in srgb, var(--surface) 70%, transparent); }
.kpi.accent .icon-bubble { background: var(--brand); color: #1b1a1c; }
.delta { font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }

/* ---------------- Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge.brand { background: var(--brand); color: #1b1a1c; border-color: transparent; }
.badge.dark { background: var(--ink); color: var(--surface); border-color: transparent; }
.temp { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; }
.temp .bar { width: 44px; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.temp .bar i { display: block; height: 100%; border-radius: 99px; }
.temp.hot { color: var(--hot); } .temp.hot .bar i { background: var(--hot); }
.temp.warm { color: var(--warn); } .temp.warm .bar i { background: #e6a23c; }
.temp.cold { color: var(--info); } .temp.cold .bar i { background: #7aa6e6; }

/* ---------------- Tabelas */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--ink); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .title-cell b { display: block; font-weight: 600; }
.table .title-cell span { font-size: 12px; color: var(--muted); }
.table tfoot td { font-weight: 700; background: var(--surface-2); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

/* ---------------- Formulários */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.field > label .req { color: var(--bad); }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field .err { font-size: 11.5px; color: var(--bad); }
.input, .select, .textarea { width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: 9px; padding: 8px 11px; min-height: 38px; outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); }
.textarea { min-height: 90px; resize: vertical; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 38px; }
.input-group .addon { position: absolute; right: 8px; color: var(--muted); display: grid; place-items: center; }
.input.filled { background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: #b9a52a; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px 14px; }
.span-12 { grid-column: span 12; } .span-9 { grid-column: span 9; } .span-8 { grid-column: span 8; } .span-6 { grid-column: span 6; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; } .span-2 { grid-column: span 2; }
.form-section { grid-column: span 12; font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 4px; }
.form-section:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.filters .input, .filters .select { min-height: 34px; padding: 5px 10px; width: auto; }
.filters .input.search { min-width: 240px; flex: 1; max-width: 360px; }
.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.segmented button { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------------- Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 600; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand-strong); }
.tabs button .count { font-size: 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; }

/* ---------------- Modal */
.modal-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(12, 11, 13, .5); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 720px; display: flex; flex-direction: column; max-height: 90vh; }
.modal.lg { max-width: 1040px; }
.modal.sm { max-width: 460px; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-b { padding: 20px; overflow-y: auto; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px; flex-wrap: wrap; }

/* ---------------- Toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--surface); padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; font-size: 13px; animation: pop .2s ease; border-left: 4px solid var(--brand); }
.toast.error { border-left-color: var(--bad); }
.toast.info { border-left-color: var(--info); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---------------- Dropdowns / popovers */
.pop { position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 220px; }
.menu { padding: 6px; display: flex; flex-direction: column; }
.menu button, .menu a { display: flex; gap: 9px; align-items: center; padding: 8px 10px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; text-align: left; font-size: 13px; width: 100%; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.notif-panel { width: min(400px, calc(100vw - 24px)); right: 0; top: 46px; max-height: 70vh; overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.notif:hover { background: var(--surface-2); }
.notif.unread { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #1b1a1c; font-weight: 700; font-size: 12px; display: grid; place-items: center; flex-shrink: 0; }
.avatar.dark { background: var(--ink); color: var(--brand); }
.icon-dot { position: relative; }
.icon-dot .n { position: absolute; top: -3px; right: -3px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 99px; display: grid; place-items: center; padding: 0 4px; }

/* ---------------- Paleta de comandos (busca) */
.palette { max-width: 640px; }
.palette .input { border: 0; box-shadow: none; font-size: 16px; min-height: 52px; padding: 0 18px; }
.palette .results { border-top: 1px solid var(--line); max-height: 60vh; overflow-y: auto; padding: 6px; }
.palette .res { display: flex; gap: 12px; align-items: center; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.palette .res.on, .palette .res:hover { background: var(--brand-soft); }
.palette .res .ic { width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; flex-shrink: 0; }

/* ---------------- Kanban */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.col-h { padding: 11px 12px; border-bottom: 1px solid var(--line); }
.col-h .t { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.col-h .t i { width: 9px; height: 9px; border-radius: 50%; }
.col-h .v { font-size: 12px; color: var(--muted); margin-top: 2px; }
.col-b { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 80px; }
.col.drop { outline: 2px dashed var(--brand-strong); outline-offset: -4px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; cursor: grab; box-shadow: var(--shadow); }
.kcard:hover { border-color: var(--line-2); }
.kcard .t { font-weight: 600; font-size: 13px; line-height: 1.3; }
.kcard .o { font-size: 12px; color: var(--muted); }
.kcard .f { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; }

/* ---------------- Timeline */
.timeline { display: flex; flex-direction: column; }
.tl { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tl:last-child { border-bottom: 0; }
.tl .ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-2); border: 1px solid var(--line); }
.tl .ic.whatsapp { background: #e4f8ec; color: #128c4a; border-color: transparent; }
.tl .ic.email { background: var(--info-soft); color: var(--info); border-color: transparent; }
.tl .ic.sistema { background: transparent; color: var(--faint); }
.tl .ic.reuniao, .tl .ic.visita { background: var(--brand-soft); border-color: transparent; }
.tl .meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tl .body { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; margin-top: 3px; }
.tl.sys .body { color: var(--muted); font-size: 12.5px; }
.bubble-in { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; padding: 8px 11px; display: inline-block; max-width: 100%; }
.bubble-out { background: color-mix(in srgb, #25d366 14%, var(--surface)); border-radius: 12px 4px 12px 12px; padding: 8px 11px; display: inline-block; max-width: 100%; }
.composer { padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }

/* ---------------- Detalhe */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.detail.left { grid-template-columns: 320px minmax(0, 1fr); }
.info-list { display: grid; grid-template-columns: 130px 1fr; gap: 7px 12px; font-size: 13px; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; word-break: break-word; }
.hero { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.logo-box { width: 56px; height: 56px; border-radius: 14px; background: #2b2a2c; color: var(--brand); border: 1px solid rgba(255,255,255,.08); display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 20px; flex-shrink: 0; }
.ai-box { border: 1px solid color-mix(in srgb, var(--brand) 60%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 10%, var(--surface)), var(--surface)); }
.step { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.step:last-child { border-bottom: 0; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand-strong); border-radius: 99px; }
.empty { text-align: center; padding: 38px 16px; color: var(--muted); }
.empty .ic { width: 52px; height: 52px; border-radius: 14px; background: var(--brand-soft); color: var(--ink); display: grid; place-items: center; margin: 0 auto 10px; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.funnel-row { display: grid; grid-template-columns: 120px 1fr 90px; gap: 10px; align-items: center; font-size: 12.5px; padding: 5px 0; }
.funnel-row .barw { background: var(--surface-2); border-radius: 6px; height: 24px; overflow: hidden; }
.funnel-row .barw i { display: flex; align-items: center; height: 100%; border-radius: 6px; padding-left: 8px; font-size: 11.5px; font-weight: 700; color: #1b1a1c; min-width: 26px; }
.list-item { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item.click { cursor: pointer; }
.list-item.click:hover { background: var(--surface-2); }
.dropzone { border: 2px dashed var(--line-2); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone.on, .dropzone:hover { border-color: var(--brand-strong); background: var(--brand-soft); }
.risk-matrix { display: grid; grid-template-columns: 26px repeat(5, 1fr); gap: 3px; font-size: 11px; }
.risk-matrix .cell { aspect-ratio: 1.6; border-radius: 5px; display: grid; place-items: center; font-weight: 700; color: #1b1a1c; }
.slider-row { display: grid; grid-template-columns: 1fr 120px 24px; gap: 8px; align-items: center; font-size: 12.5px; }
.editor-toolbar { display: flex; gap: 4px; flex-wrap: wrap; padding: 6px; border: 1px solid var(--line-2); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--surface-2); position: sticky; top: 60px; z-index: 5; }
.editor { border: 1px solid var(--line-2); border-radius: 0 0 10px 10px; min-height: 520px; padding: 28px 34px; background: #fff; color: #222; outline: none; }
.doc h1 { font-size: 22px; text-align: center; margin: 8px 0 12px; }
.doc h2 { font-size: 16px; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 2px solid var(--brand); text-transform: uppercase; letter-spacing: .03em; }
.doc h3 { font-size: 14px; margin: 14px 0 6px; }
.doc p, .doc li { font-size: 13px; line-height: 1.6; text-align: justify; }
.doc table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 12px; }
.doc th { background: #2b2a2c; color: #fff; padding: 6px 8px; text-align: left; }
.doc td { border-bottom: 1px solid #ddd; padding: 6px 8px; }
.doc tfoot td { background: #faf5d2; }
.doc .cover { border: 1px solid #e7e5df; border-left: 6px solid var(--brand); padding: 14px 18px; margin-bottom: 18px; border-radius: 6px; }

/* ---------------- Login / seleção de empresa */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); }
.auth-art { background: radial-gradient(circle at 20% 15%, #3a3830 0, #1b1a1c 55%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 60px solid var(--brand); right: -220px; bottom: -220px; opacity: .9; }
.auth-art .logo { background: #fff; border-radius: 14px; padding: 14px 18px; display: inline-block; max-width: 360px; }
.auth-art .logo img { width: 100%; display: block; }
.auth-art h1 { font-size: 38px; max-width: 460px; line-height: 1.12; }
.auth-art h1 em { color: var(--brand); font-style: normal; }
.auth-art ul { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; max-width: 440px; position: relative; z-index: 1; }
.auth-art li { display: flex; gap: 10px; align-items: center; color: #d8d6cf; font-size: 14px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-form .box { width: 100%; max-width: 400px; }
.company-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.company-card { background: var(--surface); border: 2px solid var(--line); border-radius: 18px; padding: 24px; cursor: pointer; text-align: left; transition: transform .15s, border-color .15s, box-shadow .15s; display: flex; flex-direction: column; gap: 14px; }
.company-card:hover { transform: translateY(-3px); border-color: var(--brand-strong); box-shadow: var(--shadow-lg); }
.company-card .logo { height: 92px; display: flex; align-items: center; background: #fff; border-radius: 12px; padding: 10px 14px; border: 1px solid #ecebe6; }
.logo-plate { background: #fff; border-radius: 14px; padding: 12px 18px; display: inline-block; }
.company-card .logo img { max-height: 70px; max-width: 100%; object-fit: contain; }
.selector-page { min-height: 100vh; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; }

/* ---------------- Guia */
.guide h3 { margin: 18px 0 6px; }
.guide ol, .guide ul { padding-left: 20px; }
.guide li { margin-bottom: 4px; }
.callout { border-left: 4px solid var(--brand); background: var(--brand-soft); padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: 13px; }

/* ---------------- Responsivo (mobile-first ajustes) */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail, .detail.left { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; }
  .topbar { padding: 8px 12px; }
  .topbar .menu-btn { display: inline-flex; }
  .searchbox kbd { display: none; }
  .content { padding: 16px 16px 90px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 28px 20px; min-height: auto; }
  .auth-art h1 { font-size: 26px; margin-top: 18px; }
  .auth-art ul { display: none; }
  .auth-art::after { width: 260px; height: 260px; border-width: 34px; right: -120px; bottom: -150px; }
  .form-grid > [class*="span-"] { grid-column: span 12; }
  .info-list { grid-template-columns: 110px 1fr; }
  .editor { padding: 18px; }
  .hide-sm { display: none !important; }
  /* Tabelas viram cartões */
  table.table.responsive thead { display: none; }
  table.table.responsive tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  table.table.responsive td { border: 0; padding: 0; font-size: 13px; }
  table.table.responsive td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
  table.table.responsive td.primary { grid-column: span 2; }
  table.table.responsive td.num { text-align: left; }
  table.table.responsive tfoot { display: none; }
  .bottom-nav { display: flex !important; }
  .toasts { bottom: 76px; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi .value { font-size: 21px; }
  .kpi .icon-bubble { display: none; }
  h1 { font-size: 21px; }
  .funnel-row { grid-template-columns: 90px 1fr 70px; }
}
.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; background: var(--side); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--side-muted); padding: 4px 8px; border-radius: 8px; min-width: 58px; }
.bottom-nav a.active { color: var(--brand); }

/* ---------------- Impressão (propostas e relatórios) */
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  body { background: #fff; }
  .no-print, .sidebar, .topbar, .bottom-nav, .toasts, .editor-toolbar { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .print-page { box-shadow: none !important; border: 0 !important; padding: 0 !important; }
  .doc h2 { break-after: avoid; }
  .doc table, .doc tr { break-inside: avoid; }
}
