/* ==========================================================================
   APEXX CRM — folha de estilos (CSS puro)
   Tokens idênticos aos do projeto original (oklch). Sem Tailwind, sem build.
   Ordem: 1 tokens · 2 base · 3 componentes · 4 layout/telas · 5 utilitários
   ========================================================================== */

/* ---------- 1. TOKENS ---------- */
:root {
  color-scheme: dark;
  --radius: 0.5rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;

  --background: oklch(0.115 0.012 286);
  --foreground: oklch(0.965 0.006 286);
  --card: oklch(0.155 0.014 286);
  --card-foreground: oklch(0.965 0.006 286);
  --popover: oklch(0.17 0.014 286);
  --popover-foreground: oklch(0.965 0.006 286);
  --primary: oklch(0.705 0.205 344);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.215 0.016 286);
  --secondary-foreground: oklch(0.94 0.006 286);
  --muted: oklch(0.205 0.014 286);
  --muted-foreground: oklch(0.69 0.018 286);
  --accent: oklch(0.225 0.018 286);
  --accent-foreground: oklch(0.97 0.005 286);
  --destructive: oklch(0.64 0.215 24);
  --destructive-foreground: oklch(0.985 0 0);
  --border: oklch(0.27 0.018 286);
  --input: oklch(0.29 0.018 286);
  --ring: oklch(0.705 0.205 344);
  --success: oklch(0.72 0.17 158);
  --warning: oklch(0.86 0.17 92);
  --brand-orange: oklch(0.75 0.18 64);
  --brand-pink: oklch(0.67 0.2 349);
  --brand-blue: oklch(0.62 0.21 257);
  --brand-gradient: linear-gradient(90deg, var(--brand-orange) 0%, var(--brand-pink) 52%, var(--brand-blue) 100%);
  --shadow-brand: 0 12px 36px -12px color-mix(in oklab, var(--brand-pink) 55%, transparent);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* ---------- 2. BASE ---------- */
*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
html { background: var(--background); -webkit-text-size-adjust: 100%; }
body { margin: 0; background-color: var(--background); color: var(--foreground); font-family: var(--font-sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
h1, h2, h3, h4, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: 0; margin: 0; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; }
::selection { background: color-mix(in oklab, var(--brand-pink) 38%, transparent); color: var(--foreground); }
[hidden] { display: none !important; }
.icon { width: 16px; height: 16px; flex-shrink: 0; pointer-events: none; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.brand-text { background-image: var(--brand-gradient); background-clip: text; -webkit-background-clip: text; color: transparent; }
.bg-gradient { background-image: var(--brand-gradient); }
.shadow-brand { box-shadow: var(--shadow-brand); }

.brand-atmosphere { position: relative; }
.brand-atmosphere::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 48% at 8% 8%, color-mix(in oklab, var(--brand-blue) 15%, transparent), transparent),
    radial-gradient(ellipse 58% 42% at 88% 54%, color-mix(in oklab, var(--brand-pink) 14%, transparent), transparent),
    radial-gradient(ellipse 55% 40% at 28% 100%, color-mix(in oklab, var(--brand-orange) 10%, transparent), transparent);
}
@media (prefers-reduced-motion: no-preference) { .brand-atmosphere::before { animation: atmosphere 12s ease-in-out infinite alternate; } }
@keyframes atmosphere { from { opacity: 0.7; } to { opacity: 1; } }

/* ---------- 3. COMPONENTES ---------- */
/* botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; height: 36px; padding: 8px 16px;
  border-radius: var(--radius-md); font-size: 14px; font-weight: 500; line-height: 20px; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--ring); }
.btn:disabled { pointer-events: none; opacity: .5; cursor: not-allowed; }
.btn-default { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow); }
.btn-default:hover { background: color-mix(in oklab, var(--primary) 90%, transparent); }
.btn-brand { background-image: var(--brand-gradient); color: var(--primary-foreground); box-shadow: var(--shadow-brand); }
.btn-brand:hover { background-image: var(--brand-gradient); filter: brightness(1.06); }
.btn-outline { border: 1px solid var(--input); background: var(--background); box-shadow: var(--shadow-sm); }
.btn-outline:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: color-mix(in oklab, var(--secondary) 80%, transparent); }
.btn-ghost:hover { background: var(--accent); color: var(--accent-foreground); }
.btn-link { color: var(--primary); text-underline-offset: 4px; }
.btn-link:hover { text-decoration: underline; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon-sm { width: 32px; height: 32px; }
.btn-del:hover, .btn-del-icon:hover { color: var(--destructive); }
.btn-del, .btn-del-icon { color: var(--muted-foreground); }
.inline-link { height: auto; padding: 0 4px; }

/* campos */
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-size: 14px; font-weight: 500; line-height: 1; }
.label.caps { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted-foreground); }
.input, .textarea, .select {
  display: flex; width: 100%; border-radius: var(--radius-md); border: 1px solid var(--input); background: transparent; font-size: 16px; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s; color: var(--foreground);
}
.input { height: 36px; padding: 4px 12px; }
.textarea { min-height: 60px; padding: 8px 12px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--muted-foreground); }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--ring); }
.input:disabled, .textarea:disabled, .select:disabled { cursor: not-allowed; opacity: .5; }
@media (min-width: 768px) { .input, .textarea, .select { font-size: 14px; } }
input[type="date"], input[type="month"], input[type="time"] { color-scheme: dark; }
.select-wrap { position: relative; display: block; width: 100%; }
.select { appearance: none; -webkit-appearance: none; height: 36px; padding: 8px 32px 8px 12px; cursor: pointer; white-space: nowrap; text-overflow: ellipsis; }
.select.has-icon { padding-left: 36px; }
.select option { background: var(--popover); color: var(--popover-foreground); }
.select-icon { position: absolute; left: 12px; top: 10px; color: var(--muted-foreground); }
.select-chev { position: absolute; right: 12px; top: 10px; opacity: .5; }
.check { width: 16px; height: 16px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track { display: inline-flex; align-items: center; width: 36px; height: 20px; border-radius: 999px; border: 2px solid transparent; background: var(--input); box-shadow: var(--shadow-sm); transition: background-color .15s; }
.switch-thumb { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--background); box-shadow: var(--shadow-lg); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.search-box { position: relative; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); display: flex; }
.alert-err { border: 1px solid color-mix(in oklab, var(--destructive) 30%, transparent); background: color-mix(in oklab, var(--destructive) 10%, transparent); border-radius: var(--radius-md); padding: 8px 12px; font-size: 14px; color: var(--destructive); }

/* cartões e tabelas */
.card { border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--card); color: var(--card-foreground); box-shadow: var(--shadow); }
.card-head { border-bottom: 1px solid var(--border); padding: 16px 20px; }
.table-wrap { overflow-x: auto; }
.bordered-y { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.tbl { width: 100%; font-size: 14px; }
.tbl thead { text-align: left; font-size: 12px; color: var(--muted-foreground); }
.tbl th { font-weight: 500; text-align: inherit; }
.tbl th.right, .tbl td.right { text-align: right; }
.tbl tr.bb { border-bottom: 1px solid var(--border); }
.bordered-y .tbl thead, .tbl thead.thead-caps { background: color-mix(in oklab, var(--muted) 40%, transparent); border-bottom: 1px solid var(--border); }
.thead-caps th { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.row-click { cursor: pointer; border-bottom: 1px solid var(--border); }
.row-click:hover, .row-click:focus-visible { background: color-mix(in oklab, var(--accent) 60%, transparent); outline: none; }
.row-click:last-child { border-bottom: 0; }
.row-click.on { background: color-mix(in oklab, var(--accent) 70%, transparent); }
.bb { border-bottom: 1px solid var(--border); }

/* diálogos */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgb(0 0 0 / .8); animation: fade-in .2s ease-out; }
.dialog { position: relative; display: grid; gap: 16px; align-content: start; width: 100%; max-height: 90vh; overflow-y: auto; border: 1px solid var(--border); background: var(--background); padding: 24px; box-shadow: var(--shadow-lg); animation: dlg-in .2s ease-out; }
@media (min-width: 640px) { .dialog { border-radius: var(--radius-lg); } }
@media (max-width: 639px) { .dialog { max-height: 100vh; height: 100%; } }
.dialog-md { max-width: 28rem; } .dialog-lg { max-width: 32rem; } .dialog-2xl { max-width: 42rem; } .dialog-6xl { max-width: 72rem; }
.dialog-head { display: flex; flex-direction: column; gap: 6px; }
.dialog-title { font-size: 18px; font-weight: 600; line-height: 1; letter-spacing: -0.025em; padding-right: 24px; }
.dialog-desc { font-size: 14px; color: var(--muted-foreground); }
.dialog-close { position: absolute; right: 16px; top: 16px; border-radius: 2px; opacity: .7; display: flex; transition: opacity .15s; }
.dialog-close:hover { opacity: 1; }
.dialog-close:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes dlg-in { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: none; } }

/* avisos (toast) */
.toaster { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { min-width: 240px; max-width: 356px; border: 1px solid var(--border); border-left-width: 3px; background: var(--background); color: var(--foreground); border-radius: 8px; padding: 14px 16px; font-size: 13px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
.toast.in { opacity: 1; transform: none; }
.toast-success { border-left-color: var(--success); } .toast-error { border-left-color: var(--destructive); } .toast-info { border-left-color: var(--brand-blue); }
@media (max-width: 767px) { .toaster { bottom: 88px; left: 16px; } .toast { max-width: none; } }

/* marca */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { position: relative; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--radius-md); }
.brand-mark span { font-size: 18px; color: var(--primary-foreground); font-weight: 700; }
.brand-name { font-size: 17px; font-weight: 700; line-height: 1; letter-spacing: normal; }
.brand-sub { margin-top: 4px; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .24em; color: var(--muted-foreground); }

/* selos e etiquetas */
.entry-badge { display: inline-flex; flex-shrink: 0; align-items: center; gap: 4px; border: 1px solid color-mix(in oklab, var(--brand-orange) 40%, transparent); background: color-mix(in oklab, var(--brand-orange) 10%, transparent); border-radius: 4px; padding: 2px 6px; font-size: 11px; font-weight: 500; line-height: 16px; color: var(--brand-orange); }
.stage-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.stage-dot.sm { margin: 0; }
.await-tag { margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--brand-orange); }
.pill-count { margin-left: auto; background: var(--muted); padding: 0 6px; border-radius: 4px; font-size: 10px; }
.count-chip { background: var(--muted); padding: 2px 6px; border-radius: 4px; font-size: 10px; color: var(--muted-foreground); }
.chip-status { display: inline-flex; border-radius: 4px; padding: 2px 6px; font-size: 11px; font-weight: 600; }
.bg-blue { background-color: var(--brand-blue); } .bg-orange { background-color: var(--brand-orange); } .bg-pink { background-color: var(--brand-pink); }
.bg-success { background-color: var(--success); } .bg-destructive { background-color: var(--destructive); } .bg-muted { background-color: var(--muted-foreground); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }

/* ---------- 4. LAYOUT E TELAS ---------- */
/* autenticação */
.auth { position: relative; display: grid; min-height: 100vh; overflow: hidden; background: var(--background); }
.auth-aside { display: none; min-height: 100vh; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--border); padding: 48px; }
.auth-aside > * { position: relative; z-index: 1; }
.auth-hero { max-width: 36rem; position: relative; z-index: 10; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 20px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .18em; color: var(--muted-foreground); }
.auth-hero h1 { font-size: 48px; line-height: 1.05; font-weight: 600; letter-spacing: normal; }
.auth-hero p { margin-top: 24px; max-width: 32rem; font-size: 18px; line-height: 1.625; color: var(--muted-foreground); }
.auth-main { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 24px; }
.auth-box { width: 100%; max-width: 28rem; }
.auth-brand-mobile { margin-bottom: 40px; }
.auth-title { font-size: 30px; line-height: 36px; margin-top: 8px; letter-spacing: normal; }
.divider-or { display: flex; align-items: center; gap: 12px; margin: 24px 0; }
.divider-or span { height: 1px; flex: 1; background: var(--border); }
.divider-or em { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted-foreground); }
.auth-denied { width: 100%; max-width: 28rem; padding: 32px; text-align: center; }
.denied-icon { margin: 0 auto 20px; display: flex; width: 48px; height: 48px; align-items: center; justify-content: center; border-radius: 50%; background: color-mix(in oklab, var(--destructive) 15%, transparent); color: var(--destructive); }
@media (min-width: 640px) { .auth-main { padding: 40px; } }
@media (min-width: 1024px) {
  .auth { grid-template-columns: 1.1fr 0.9fr; } .auth-aside { display: flex; } .auth-brand-mobile { display: none; }
}
@media (min-width: 1280px) { .auth-hero h1 { font-size: 60px; } }

/* estrutura */
.shell { min-height: 100vh; background: var(--background); }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; display: none; width: 240px; flex-direction: column; border-right: 1px solid var(--border); background: color-mix(in oklab, var(--card) 50%, transparent); }
.sidebar-head { border-bottom: 1px solid var(--border); padding: 20px; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; }
.sidebar-foot { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding: 16px; }
.team-btn { height: 36px; width: 100%; justify-content: flex-start; gap: 12px; padding: 0 12px; font-size: 14px; color: var(--muted-foreground); }
.team-btn:hover { color: var(--foreground); }
.nav-btn-d { height: 40px; width: 100%; justify-content: flex-start; gap: 12px; border-radius: var(--radius-md); padding: 0 12px; font-size: 14px; color: var(--muted-foreground); }
.nav-btn-d:hover { color: var(--foreground); }
.nav-btn-d.active { background: var(--accent); color: var(--foreground); box-shadow: inset 3px 0 0 0 var(--brand-pink); }
.nav-btn-m { height: auto; min-width: 80px; flex: 1; flex-direction: column; gap: 4px; border-radius: var(--radius-md); padding: 8px 0; font-size: 9px; color: var(--muted-foreground); }
.nav-btn-m .icon { width: 20px; height: 20px; }
.nav-btn-m.active { color: var(--primary); }
.content { }
.topbar { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--border); background: color-mix(in oklab, var(--background) 90%, transparent); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.topbar-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 12px 16px; }
.main { margin: 0 auto; max-width: 1500px; padding: 24px 16px 96px; }
.mobile-nav { position: fixed; inset: auto 0 0 0; z-index: 40; display: flex; overflow-x: auto; border-top: 1px solid var(--border); background: color-mix(in oklab, var(--card) 95%, transparent); padding: 4px; backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.only-mobile { display: inline-flex; }
.hide-mobile { display: none; }
@media (min-width: 640px) { .topbar-in { padding: 12px 24px; } .main { padding-left: 24px; padding-right: 24px; } .hide-mobile { display: inline; } p.hide-mobile { display: block; } }
@media (min-width: 768px) {
  .sidebar { display: flex; } .content { padding-left: 240px; } .mobile-nav { display: none; } .only-mobile { display: none; } .main { padding-bottom: 32px; }
}

/* filtros / banners / lembretes */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.reminder { display: flex; align-items: center; gap: 8px; border: 1px solid; border-radius: var(--radius-md); padding: 8px 12px; margin-bottom: 20px; }
.reminder-late { border-color: color-mix(in oklab, var(--destructive) 40%, transparent); background: color-mix(in oklab, var(--destructive) 10%, transparent); }
.reminder-soon { border-color: color-mix(in oklab, var(--brand-orange) 40%, transparent); background: color-mix(in oklab, var(--brand-orange) 10%, transparent); }
.reminder-text { height: auto; width: 100%; justify-content: flex-start; white-space: normal; padding: 4px 8px; text-align: left; font-size: 14px; }
.btn-xs-link { height: auto; padding: 4px 8px; font-size: 12px; }
.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; border: 1px solid color-mix(in oklab, var(--brand-blue) 25%, transparent); background: color-mix(in oklab, var(--brand-blue) 10%, transparent); border-radius: var(--radius-md); padding: 12px 16px; }

/* missões */
.today { margin-bottom: 24px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 16px 0; }
.mrow { display: flex; align-items: flex-start; gap: 8px; min-width: 0; border-bottom: 1px solid var(--border); padding: 12px 0; }
.mrow:last-child { border-bottom: 0; }
.mrow-main { height: auto; min-width: 0; flex: 1; flex-direction: column; align-items: flex-start; gap: 4px; white-space: normal; padding: 4px 8px; text-align: left; }
.count-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; border-bottom: 1px solid var(--border); padding-bottom: 20px; }
.cal-title { min-width: 144px; text-transform: capitalize; }
.cal-layout { display: grid; gap: 24px; min-width: 0; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-head div { padding: 12px 0; text-align: center; font-size: 10px; font-weight: 500; color: var(--muted-foreground); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--border); border-top: 1px solid var(--border); }
.day { height: 80px; min-width: 0; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 4px; white-space: normal; border-radius: 0; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 8px; color: var(--foreground); }
.day.sel { background: var(--accent); box-shadow: inset 0 0 0 1px var(--primary); }
.day.out { color: color-mix(in oklab, var(--muted-foreground) 50%, transparent); }
.day-num { display: flex; width: 24px; height: 24px; flex-shrink: 0; align-items: center; justify-content: center; font-size: 12px; }
.day-num.today { border-radius: 50%; background: var(--primary); color: var(--primary-foreground); }
.day-count { display: flex; max-width: 100%; align-items: center; gap: 4px; font-size: 10px; }
.dot-sm { width: 4px; height: 4px; flex-shrink: 0; border-radius: 50%; background: currentColor; }
.side-head { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.linked { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 12px; }
.pick-list { max-height: 160px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
.pick-item { height: auto; width: 100%; flex-direction: column; align-items: flex-start; gap: 4px; white-space: normal; padding: 8px 12px; text-align: left; }
.link-left { height: auto; white-space: normal; padding: 8px 0; text-align: left; }
@media (min-width: 640px) { .count-row { grid-template-columns: repeat(4, 1fr); } .day { height: 96px; } }
@media (min-width: 1280px) { .cal-layout { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); } }

/* leads e pipeline */
.w-search { width: 100%; }
@media (min-width: 640px) { .w-search { width: 18rem; } .w-search-lg { width: 20rem; } }
.max-md { max-width: 28rem; }
.search-pop { position: absolute; z-index: 20; margin-top: 4px; width: 100%; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--popover); box-shadow: var(--shadow-lg); }
.search-item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; text-align: left; font-size: 14px; }
.search-item:hover { background: var(--accent); }
.relx { position: relative; overflow-x: auto; }
.timeline { position: relative; display: grid; min-width: 640px; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.timeline-line { position: absolute; left: 10%; right: 10%; top: 18px; height: 2px; opacity: .6; }
.step { display: flex; width: 100%; flex-direction: column; align-items: center; border-radius: var(--radius-md); padding: 4px 8px 12px; text-align: center; transition: background-color .15s; }
.step:hover { background: color-mix(in oklab, var(--accent) 50%, transparent); }
.step.on { background: color-mix(in oklab, var(--accent) 70%, transparent); }
.step-badge { position: relative; z-index: 10; display: flex; width: 32px; height: 32px; align-items: center; justify-content: center; border-radius: 50%; border: 4px solid var(--card); }
.step-badge.ring { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--primary); }
.step-bar { margin-top: 8px; width: 32px; height: 4px; border-radius: 999px; background: transparent; transition: all .15s; }
.step:not(.on):hover .step-bar { background: var(--border); }
.stage-panel { border: 1px solid var(--border); border-radius: var(--radius-lg); background: color-mix(in oklab, var(--card) 45%, transparent); animation: slide-in .2s ease-out; }
.stage-panel-head { border-bottom: 1px solid var(--border); padding: 12px 16px; }
.lead-grid { display: grid; gap: 8px; padding: 12px; grid-template-columns: 1fr; }
.lead-card { display: flex; height: auto; width: 100%; align-items: stretch; justify-content: flex-start; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--card); padding: 12px; text-align: left; transition: background-color .15s, border-color .15s; }
.lead-card:hover { border-color: color-mix(in oklab, var(--primary) 40%, transparent); background: var(--accent); }
.lead-card-foot { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 8px; }
@keyframes slide-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (min-width: 640px) { .lead-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .lead-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .lead-grid { grid-template-columns: repeat(4, 1fr); } }

/* janela de lead */
.value-grid { display: grid; gap: 12px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 16px 0; }
.section { border-top: 1px solid var(--border); padding-top: 16px; }
.section-top { border-top: 1px solid var(--border); padding-top: 20px; }
.hist { border-left: 2px solid var(--brand-blue); padding-left: 12px; }
.member { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 8px 12px; font-size: 14px; }
.grid-2 { display: grid; gap: 16px; }
.grid-name { display: grid; gap: 16px; }
.grid-2s { display: grid; gap: 12px; }
.grid-2-tight { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; gap: 12px; }
.grid-3-tight { display: grid; gap: 12px; }
.grid-3i { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 640px) {
  .value-grid { grid-template-columns: repeat(3, 1fr); } .grid-2 { grid-template-columns: 1fr 1fr; } .grid-name { grid-template-columns: 1fr 170px; }
  .grid-2s { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-3-tight { grid-template-columns: repeat(3, 1fr); }
}

/* metas */
.goals-top { display: grid; gap: 16px; }
.goals-cta { display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.goal-grid { display: grid; gap: 16px; }
.goal-card { display: flex; flex-direction: column; padding: 16px; }
.goal-actions { margin-top: 16px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; }
.act-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; font-size: 12px; }
.act { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; border-radius: var(--radius-md); background: color-mix(in oklab, var(--muted) 40%, transparent); padding: 8px 10px; }
.act-del { flex-shrink: 0; color: var(--muted-foreground); display: flex; }
.act-del:hover { color: var(--destructive); }
.donut { position: relative; flex-shrink: 0; }
.donut-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
@media (min-width: 640px) { .goals-cta { flex-direction: row; align-items: center; } }
@media (min-width: 768px) { .goal-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .goals-top { grid-template-columns: auto 1fr; } }
@media (min-width: 1280px) { .goal-grid { grid-template-columns: repeat(3, 1fr); } }

/* dashboard e gráficos */
.kpi-grid { display: grid; gap: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.charts-2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.drill { height: auto; min-height: 112px; flex-direction: column; align-items: flex-start; gap: 12px; white-space: normal; padding: 16px; text-align: left; }
.drill-row { height: auto; width: 100%; justify-content: space-between; white-space: normal; text-align: left; }
.chart { width: 100%; min-width: 0; position: relative; overflow: hidden; }
.chart svg { display: block; }
.h-72 { height: 288px; } .h-60 { height: 240px; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-axis { fill: var(--muted-foreground); font-size: 11px; font-family: var(--font-sans); }
.ch-axis-sm { font-size: 10px; }
.ch-leg { font-size: 11px; font-family: var(--font-sans); }
.ch-hit { fill: transparent; }
.ch-hit:hover { fill: var(--accent); fill-opacity: .5; }
.chart-tip { position: fixed; z-index: 300; display: none; pointer-events: none; border: 1px solid var(--border); border-radius: 6px; background: var(--popover); color: var(--popover-foreground); padding: 8px 12px; font-size: 12px; box-shadow: var(--shadow-lg); }
.tip-title { font-weight: 500; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-dot { width: 8px; height: 8px; border-radius: 50%; }
@media (min-width: 640px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } .metric-grid { grid-template-columns: repeat(4, 1fr); } .charts-2 { grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.55fr); } }

/* produtos e orçamentos */
.tabs-bar { border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.card-grid { display: grid; gap: 12px; }
.p-card { display: flex; flex-direction: column; padding: 16px; }
.prod-meta { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 4px 16px; border-top: 1px solid var(--border); padding-top: 12px; font-size: 12px; color: var(--muted-foreground); }
.dim { opacity: .6; }
.clamp-2, .clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { -webkit-line-clamp: 2; line-clamp: 2; } .clamp-3 { -webkit-line-clamp: 3; line-clamp: 3; }
.comp-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.col-span-2 { grid-column: span 2; }
.col-span-full { grid-column: 1 / -1; }
.disc-row { display: grid; grid-template-columns: 100px 1fr auto; gap: 8px; }
.quote-cols { display: grid; gap: 24px; }
.menu-grid { display: grid; gap: 12px; max-height: 550px; overflow-y: auto; align-content: start; }
.prod-pick { display: flex; flex-direction: column; }
.q-item { display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 16px; }
.totals { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 12px 0; font-size: 14px; }
.q-line { border-bottom: 1px solid var(--border); padding: 12px 0; }
.quote-line { height: auto; width: 100%; justify-content: space-between; white-space: normal; border-radius: 0; border-bottom: 1px solid var(--border); padding: 12px 0; text-align: left; }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, 1fr); } .menu-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .quote-cols { grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr); } }
@media (min-width: 1280px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- 5. UTILITÁRIOS ---------- */
.row { display: flex; align-items: center; }
.stack { display: flex; flex-direction: column; }
.center-box { display: flex; align-items: center; justify-content: center; background: var(--background); }
.pad-6 { padding: 24px; min-height: 100vh; }
.wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .end { justify-content: flex-end; }
.items-start { align-items: flex-start; } .items-end { align-items: flex-end; }
.grow { flex: 1 1 0%; } .shrink-0 { flex-shrink: 0; } .min-w-0 { min-width: 0; }
.gap-1 { gap: 4px; } .gap-15 { gap: 6px; } .gap-2 { gap: 8px; } .gap-25 { gap: 10px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; } .gap-8 { gap: 32px; }
.block { display: block; } .rel { position: relative; } .rel-z { position: relative; z-index: 10; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-words { overflow-wrap: anywhere; } .wrap-text { white-space: normal; } .pre-wrap { white-space: pre-wrap; } .line-through { text-decoration: line-through; }
.center { text-align: center; } .right { text-align: right; } .mx-auto { margin-left: auto; margin-right: auto; }
.text-xs { font-size: 12px; line-height: 16px; } .text-sm { font-size: 14px; line-height: 20px; } .text-base { font-size: 16px; line-height: 24px; }
.text-lg { font-size: 18px; line-height: 28px; } .text-xl { font-size: 20px; line-height: 28px; } .text-2xl { font-size: 24px; line-height: 32px; }
.tiny { font-size: 10px; line-height: 14px; } .tiny-11 { font-size: 11px; line-height: 16px; } .tiny-12 { font-size: 12px; line-height: 16px; }
.font-display { font-family: var(--font-display); }
.semibold { font-weight: 600; } .medium { font-weight: 500; } .bold { font-weight: 700; } .normal { font-weight: 400; }
.caps-wide { text-transform: uppercase; letter-spacing: .14em; }
.lh-tight { line-height: 1.25; }
.c-primary { color: var(--primary); } .c-muted { color: var(--muted-foreground); } .c-fg { color: var(--foreground); } .c-success { color: var(--success); }
.c-destructive { color: var(--destructive); } .c-orange { color: var(--brand-orange); } .c-blue { color: var(--brand-blue); } .c-pink { color: var(--brand-pink); } .c-onprimary { color: var(--primary-foreground); }
.w-full { width: 100%; } .w-40 { width: 10rem; } .w-44 { width: 11rem; } .w-56 { width: 14rem; }
.h-7 { height: 28px; } .h-8 { height: 32px; } .h-9 { height: 36px; } .h-10 { height: 40px; } .h-11 { height: 44px; }
.mt-05 { margin-top: 2px; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-7 { margin-top: 28px; } .mt-6 { margin-top: 24px; } .mt-auto { margin-top: auto; }
.mb-3 { margin-bottom: 12px; } .mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }
.ml-2 { margin-left: 8px; } .ml-15 { margin-left: 6px; } .mr-2 { margin-right: 8px; }
.pt-2 { padding-top: 8px; } .pt-4 { padding-top: 16px; } .pl-9 { padding-left: 36px; }
.p-0 { padding: 0; } .p-3 { padding: 12px; } .p-4 { padding: 16px; } .p-5 { padding: 20px; } .p-12 { padding: 48px; }
.px-3 { padding-left: 12px; padding-right: 12px; } .px-4 { padding-left: 16px; padding-right: 16px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; } .py-8 { padding-top: 32px; padding-bottom: 32px; } .py-10 { padding-top: 40px; padding-bottom: 40px; } .py-16 { padding-top: 64px; padding-bottom: 64px; }
.overflow-hidden { overflow: hidden; }
.i-3 { width: 12px; height: 12px; } .i-35 { width: 14px; height: 14px; } .i-5 { width: 20px; height: 20px; } .i-6 { width: 24px; height: 24px; }
.i-7 { width: 28px; height: 28px; } .i-8 { width: 32px; height: 32px; }
.stack.gap-25 > *, .stack.gap-15 > * { min-width: 0; }
@media (max-width: 639px) { .hide-sm-down { display: none !important; } }
@media (max-width: 1023px) { .hide-md-down { display: none !important; } }

/* ---- Produtos / Orçamentos (portfólio e carrinho interno) ---- */
.btn-lg { height: 48px; padding: 0 28px; font-size: 15px; }
.cta-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px; text-align: center; }
.cta-icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 16px; background: var(--accent); color: var(--primary); }
.lead-pick-list { max-height: 360px; overflow-y: auto; }
.lead-pick { display: flex; width: 100%; height: auto; justify-content: space-between; gap: 12px; padding: 10px 12px; text-align: left; border: 1px solid var(--border); border-radius: var(--radius-md); }
.lead-pick:hover { border-color: var(--brand-pink); }
.cart-panel { align-self: start; }
.cart-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 12px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius-md); }
.prod-pick.picked { border-color: var(--brand-pink); box-shadow: 0 0 0 1px var(--brand-pink) inset; }
.menu-grid-tall { max-height: 720px; }
.quote-text { min-height: 260px; line-height: 1.5; font-size: 13px; }
.pay-sum { padding: 8px 12px; border-radius: var(--radius-md); background: var(--accent); }
@media (min-width: 1024px) { .cart-panel { position: sticky; top: 80px; max-height: calc(100vh - 96px); overflow-y: auto; } }

/* indicador de sincronização com o banco */
.sync-pill { position: fixed; left: 16px; bottom: 16px; z-index: 90; padding: 6px 12px; border-radius: 999px; font-size: 12px; background: var(--card); color: var(--muted-foreground); border: 1px solid var(--border); box-shadow: 0 4px 16px rgb(0 0 0 / .35); opacity: 0; pointer-events: none; transition: opacity .2s; }
.sync-pill.show { opacity: 1; }
.sync-pill.error { background: var(--destructive); color: var(--destructive-foreground); border-color: transparent; }
@media (max-width: 1023px) { .sync-pill { bottom: 76px; } }
