/* ==========================================================================
   App do MEI — sistema de design
   Um arquivo para site, app e admin. Tokens em :root, tema escuro por
   preferência do sistema ou data-theme. Mobile-first; nada depende de JS.
   ========================================================================== */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #F6F7F5;
  --surface: #FFFFFF;
  --surface-2: #F0F2EF;
  --border: #E3E6E1;
  --border-strong: #C9CEC6;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #8A94A6;
  --primary: #0F6E56;
  --primary-hover: #0B5744;
  --primary-soft: #E3F3EE;
  --primary-ink: #0A4A3A;
  --accent: #D97706;
  --accent-soft: #FEF3E2;
  --danger: #C62828;
  --danger-soft: #FDECEC;
  --success: #1B7F4D;
  --success-soft: #E4F5EB;
  --info: #1D4ED8;
  --info-soft: #E8EEFC;
  --warning: #B45309;
  --warning-soft: #FEF3E2;
  --focus: #0F6E56;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --shadow-md: 0 4px 16px rgba(16,24,40,.08);
  --shadow-lg: 0 16px 40px rgba(16,24,40,.14);

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
  --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px; --sp-20: 80px;

  --fs-xs: .75rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem; --fs-3xl: 2.25rem; --fs-4xl: 3rem;

  --nav-h: 56px;
  --bottom-nav-h: 64px;
  --sidebar-w: 248px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1512; --surface: #151D19; --surface-2: #1C2622; --border: #24312B; --border-strong: #3A4A42;
    --ink: #EEF2EF; --ink-2: #B3BEB7; --ink-3: #7F8B85;
    --primary: #3CC49C; --primary-hover: #5AD3AF; --primary-soft: #16302A; --primary-ink: #B9EBD9;
    --accent: #F5A524; --accent-soft: #33240E; --danger: #F07171; --danger-soft: #3A1B1B;
    --success: #4ECB83; --success-soft: #153324; --info: #7FA4FF; --info-soft: #1B2440;
    --warning: #F0B35C; --warning-soft: #33240E; --focus: #3CC49C;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 4px 16px rgba(0,0,0,.45); --shadow-lg: 0 16px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1512; --surface: #151D19; --surface-2: #1C2622; --border: #24312B; --border-strong: #3A4A42;
  --ink: #EEF2EF; --ink-2: #B3BEB7; --ink-3: #7F8B85;
  --primary: #3CC49C; --primary-hover: #5AD3AF; --primary-soft: #16302A; --primary-ink: #B9EBD9;
  --accent: #F5A524; --accent-soft: #33240E; --danger: #F07171; --danger-soft: #3A1B1B;
  --success: #4ECB83; --success-soft: #153324; --info: #7FA4FF; --info-soft: #1B2440;
  --warning: #F0B35C; --warning-soft: #33240E; --focus: #3CC49C;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow-md: 0 4px 16px rgba(0,0,0,.45); --shadow-lg: 0 16px 40px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Reset e base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs-md); line-height: 1.5; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
img, svg, video { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 var(--sp-3); line-height: 1.2; letter-spacing: -.01em; font-weight: 700; color: var(--ink); }
h1 { font-size: var(--fs-2xl); } h2 { font-size: var(--fs-xl); } h3 { font-size: var(--fs-lg); } h4 { font-size: var(--fs-md); }
p { margin: 0 0 var(--sp-4); }
small, .text-sm { font-size: var(--fs-sm); } .text-xs { font-size: var(--fs-xs); }
.muted { color: var(--ink-2); } .muted-3 { color: var(--ink-3); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: var(--r-sm); z-index: 100; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.container { width: 100%; max-width: 1120px; margin-inline: auto; padding-inline: var(--sp-4); }
.container--narrow { max-width: 720px; }
.container--wide { max-width: 1320px; }
.stack > * + * { margin-top: var(--sp-4); }
.stack--sm > * + * { margin-top: var(--sp-2); }
.stack--lg > * + * { margin-top: var(--sp-8); }
.row { display: flex; gap: var(--sp-3); align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.row--nowrap { flex-wrap: nowrap; }
.grid { display: grid; gap: var(--sp-4); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.flex-1 { flex: 1 1 auto; } .ml-auto { margin-left: auto; }
.mt-2 { margin-top: var(--sp-2); } .mt-4 { margin-top: var(--sp-4); } .mt-6 { margin-top: var(--sp-6); } .mt-8 { margin-top: var(--sp-8); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-4 { margin-bottom: var(--sp-4); } .mb-6 { margin-bottom: var(--sp-6); } .mb-0 { margin-bottom: 0; }
.text-center { text-align: center; } .text-right { text-align: right; }
.hide-mobile { display: none !important; }
@media (min-width: 900px) { .hide-mobile { display: initial !important; } .hide-desktop { display: none !important; } }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --------------------------------------------------------------------------
   Botões
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 44px; padding: 0 var(--sp-5); border-radius: var(--r-md); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: var(--fs-sm); cursor: pointer; text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); }
.btn--secondary { background: var(--primary-soft); color: var(--primary-ink); }
.btn--secondary:hover { background: var(--border); }
.btn--outline { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn--outline:hover { background: var(--surface-2); }
.btn--ghost { background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn--sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn--lg { min-height: 52px; padding: 0 var(--sp-6); font-size: var(--fs-md); }
.btn--block { width: 100%; }
.btn--icon { width: 44px; padding: 0; border-radius: 50%; }
.btn--icon.btn--sm { width: 36px; }
.btn--whatsapp { background: #25D366; color: #073B1E; }
.btn--whatsapp:hover { background: #1EBE5A; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn--loading { position: relative; color: transparent !important; pointer-events: none; }
.btn--loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fab { position: fixed; right: var(--sp-4); bottom: calc(var(--bottom-nav-h) + var(--safe-b) + var(--sp-4)); width: 56px; height: 56px; border-radius: 50%; box-shadow: var(--shadow-lg); z-index: 30; }
.fab svg { width: 24px; height: 24px; }
@media (min-width: 900px) { .fab { display: none; } }

/* --------------------------------------------------------------------------
   Formulários
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); }
.field__label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink); }
.field__label .req { color: var(--danger); margin-left: 2px; }
.field__hint { font-size: var(--fs-xs); color: var(--ink-3); }
.field__error { font-size: var(--fs-xs); color: var(--danger); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px var(--sp-4); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.input--sm { min-height: 40px; padding: 6px var(--sp-3); font-size: var(--fs-sm); }
.textarea { min-height: 112px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238A94A6' stroke-width='2'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--r-md) 0 0 var(--r-md); }
.input-group .btn { border-radius: 0 var(--r-md) var(--r-md) 0; }
.input-prefix { display: flex; align-items: center; padding: 0 var(--sp-3); border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--r-md) 0 0 var(--r-md); background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-sm); }
.input-prefix + .input { border-radius: 0 var(--r-md) var(--r-md) 0; }
.check { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.switch { position: relative; display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; font-size: var(--fs-sm); }
.switch input { position: absolute; opacity: 0; }
.switch__track { width: 44px; height: 26px; border-radius: 13px; background: var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: var(--shadow-sm); }
.switch input:checked + .switch__track { background: var(--primary); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.form-actions { display: flex; gap: var(--sp-3); justify-content: flex-end; flex-wrap: wrap; margin-top: var(--sp-6); }
.form-grid { display: grid; gap: 0 var(--sp-4); grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid--2 { grid-template-columns: 1fr 1fr; } .form-grid--3 { grid-template-columns: 1fr 1fr 1fr; } .span-2 { grid-column: span 2; } }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.segmented label { padding: 8px 14px; border-radius: 10px; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented input:checked + span, .segmented label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.segmented label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* --------------------------------------------------------------------------
   Cards, listas, tabelas
   -------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--shadow-sm); }
.card--flat { box-shadow: none; }
.card--pad-0 { padding: 0; overflow: hidden; }
.card__header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.card__header h2, .card__header h3 { margin: 0; }
.card--pad-0 .card__header { padding: var(--sp-4) var(--sp-5) 0; }
.card--pad-0 .card__footer { margin: 0; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card__footer { border-top: 1px solid var(--border); margin: var(--sp-5) calc(-1 * var(--sp-5)) calc(-1 * var(--sp-5)); padding: var(--sp-3) var(--sp-5); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); font-size: var(--fs-sm); }
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); color: inherit; text-decoration: none !important; min-height: 64px; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover, .list-row--link:hover { background: var(--surface-2); }
.list-row__body { flex: 1; min-width: 0; }
.list-row__title { font-weight: 600; display: block; }
.list-row__meta { font-size: var(--fs-sm); color: var(--ink-2); display: block; }
.list-row__end { text-align: right; flex: none; }
.list-row__amount { font-weight: 700; font-variant-numeric: tabular-nums; display: block; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: var(--fs-sm); flex: none; overflow: hidden; }
.avatar--lg { width: 56px; height: 56px; font-size: var(--fs-lg); }
.avatar--sm { width: 32px; height: 32px; font-size: var(--fs-xs); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: var(--sp-3) var(--sp-4); text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: var(--surface-2); }
.table--compact th, .table--compact td { padding: var(--sp-2) var(--sp-3); }
.empty { text-align: center; padding: var(--sp-10) var(--sp-4); color: var(--ink-2); }
.empty svg { width: 48px; height: 48px; margin: 0 auto var(--sp-4); color: var(--ink-3); }
.empty h3 { color: var(--ink); }
.empty p { max-width: 36ch; margin-inline: auto; }

/* --------------------------------------------------------------------------
   Badges, alertas, toasts
   -------------------------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; line-height: 1.6; }
.badge--primary { background: var(--primary-soft); color: var(--primary-ink); }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.alert { display: flex; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); font-size: var(--fs-sm); border: 1px solid transparent; margin-bottom: var(--sp-4); }
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.alert--info { background: var(--info-soft); color: var(--info); }
.alert--success { background: var(--success-soft); color: var(--success); }
.alert--warning { background: var(--warning-soft); color: var(--warning); }
.alert--danger { background: var(--danger-soft); color: var(--danger); }
.alert a { color: inherit; text-decoration: underline; font-weight: 600; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bottom-nav-h) + var(--safe-b) + var(--sp-4)); display: flex; flex-direction: column; gap: var(--sp-2); z-index: 90; width: min(92vw, 420px); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: var(--sp-6); left: auto; right: var(--sp-6); transform: none; } }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); box-shadow: var(--shadow-lg); font-size: var(--fs-sm); display: flex; gap: var(--sp-3); align-items: center; animation: toast-in .25s ease; }
.toast--ok { border-left: 4px solid var(--success); } .toast--erro { border-left: 4px solid var(--danger); } .toast--aviso { border-left: 4px solid var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------------------
   Diálogo, dropdown, abas, stepper
   -------------------------------------------------------------------------- */
dialog.dialog { border: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 0; width: 100%; max-width: 100%; margin: auto 0 0; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); max-height: 92dvh; }
dialog.dialog::backdrop { background: rgba(16,24,40,.5); backdrop-filter: blur(2px); }
@media (min-width: 640px) { dialog.dialog { border-radius: var(--r-xl); max-width: 520px; margin: auto; } dialog.dialog--wide { max-width: 760px; } }
.dialog__header { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.dialog__header h2 { margin: 0; font-size: var(--fs-lg); }
.dialog__body { padding: var(--sp-5); overflow-y: auto; max-height: calc(92dvh - 140px); }
.dialog__footer { display: flex; gap: var(--sp-3); justify-content: flex-end; padding: var(--sp-4) var(--sp-5) calc(var(--sp-4) + var(--safe-b)); border-top: 1px solid var(--border); }
.dropdown { position: relative; display: inline-block; }
.dropdown__menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-md); padding: 6px; z-index: 40; display: none; }
.dropdown[open] .dropdown__menu, .dropdown.is-open .dropdown__menu { display: block; }
.dropdown__item { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: var(--r-sm); font: inherit; font-size: var(--fs-sm); color: var(--ink); text-align: left; cursor: pointer; text-decoration: none !important; }
.dropdown__item:hover { background: var(--surface-2); }
.dropdown__item--danger { color: var(--danger); }
.dropdown__item svg { width: 18px; height: 18px; color: var(--ink-2); }
.dropdown summary { list-style: none; cursor: pointer; } .dropdown summary::-webkit-details-marker { display: none; }
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--sp-5); }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: var(--sp-3) var(--sp-4); font-size: var(--fs-sm); font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none !important; background: none; border-top: 0; border-left: 0; border-right: 0; font-family: inherit; cursor: pointer; }
.tab.is-active, .tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-size: var(--fs-sm); color: var(--ink-2); text-decoration: none !important; cursor: pointer; font-family: inherit; }
.chip.is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper { display: flex; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-6); }
.stepper__step { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.stepper__step.is-done { background: var(--primary); }
.progress { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.progress__bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }
.progress__bar--warning { background: var(--accent); } .progress__bar--danger { background: var(--danger); }

/* --------------------------------------------------------------------------
   Estatísticas e funil
   -------------------------------------------------------------------------- */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4) var(--sp-5); min-width: 0; }
.stat__label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; display: block; margin-bottom: 4px; }
.stat__value { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat__delta { font-size: var(--fs-xs); color: var(--ink-2); margin-top: 4px; display: block; }
.stat--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.stat--primary .stat__label, .stat--primary .stat__delta { color: rgba(255,255,255,.75); }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(280px, 1fr); gap: var(--sp-4); overflow-x: auto; padding-bottom: var(--sp-4); scroll-snap-type: x mandatory; }
.kanban__col { background: var(--surface-2); border-radius: var(--r-lg); padding: var(--sp-3); scroll-snap-align: start; min-height: 200px; }
.kanban__head { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-1) var(--sp-2) var(--sp-3); font-weight: 700; font-size: var(--fs-sm); }
.kanban__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-3); margin-bottom: var(--sp-2); display: block; color: inherit; text-decoration: none !important; }
.kanban__card:hover { box-shadow: var(--shadow-md); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.timeline__item { position: relative; padding: 0 0 var(--sp-5) var(--sp-8); font-size: var(--fs-sm); }
.timeline__item::before { content: ""; position: absolute; left: 6px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline__time { color: var(--ink-3); font-size: var(--fs-xs); display: block; }

/* --------------------------------------------------------------------------
   Casca do app: topbar, sidebar, bottom nav
   -------------------------------------------------------------------------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 50; height: calc(var(--nav-h) + var(--safe-t)); padding-top: var(--safe-t); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.topbar__inner { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding-inline: var(--sp-4); }
.topbar__title { font-weight: 700; font-size: var(--fs-lg); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__back { margin-left: calc(-1 * var(--sp-2)); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); text-decoration: none !important; font-size: var(--fs-lg); }
.brand__mark { width: 32px; height: 32px; border-radius: 9px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; }
.brand span b { color: var(--primary); }
.app__body { display: flex; flex: 1; }
.sidebar { display: none; }
.app__main { flex: 1; min-width: 0; padding: var(--sp-4) var(--sp-4) calc(var(--bottom-nav-h) + var(--safe-b) + var(--sp-8)); }
@media (min-width: 900px) {
  .sidebar { display: flex; flex-direction: column; width: var(--sidebar-w); flex: none; background: var(--surface); border-right: 1px solid var(--border); position: sticky; top: calc(var(--nav-h) + var(--safe-t)); height: calc(100dvh - var(--nav-h) - var(--safe-t)); padding: var(--sp-4) var(--sp-3); overflow-y: auto; }
  .app__main { padding: var(--sp-8) var(--sp-8) var(--sp-16); max-width: 1200px; }
  .bottom-nav { display: none !important; }
}
.nav-link { display: flex; align-items: center; gap: var(--sp-3); padding: 10px 12px; border-radius: var(--r-md); color: var(--ink-2); font-weight: 600; font-size: var(--fs-sm); text-decoration: none !important; }
.nav-link svg { width: 20px; height: 20px; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.is-active { background: var(--primary-soft); color: var(--primary-ink); }
.nav-section { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 700; padding: var(--sp-4) 12px var(--sp-2); }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--bottom-nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--surface); border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(5, 1fr); z-index: 50; }
.bottom-nav__item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--ink-3); text-decoration: none !important; }
.bottom-nav__item svg { width: 24px; height: 24px; }
.bottom-nav__item.is-active { color: var(--primary); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-6); flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head__sub { color: var(--ink-2); margin: 4px 0 0; }
.page-head__actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: calc(var(--bottom-nav-h) + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--border); margin: var(--sp-6) calc(-1 * var(--sp-4)) calc(-1 * var(--sp-8)); padding: var(--sp-3) var(--sp-4); display: flex; gap: var(--sp-3); z-index: 20; }
@media (min-width: 900px) { .sticky-actions { position: static; margin: var(--sp-6) 0 0; border: 0; padding: 0; background: none; justify-content: flex-end; } }
.search-bar { position: relative; }
.search-bar svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search-bar .input { padding-left: 42px; }

/* --------------------------------------------------------------------------
   Autenticação e páginas públicas (cliente final)
   -------------------------------------------------------------------------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: var(--sp-6) var(--sp-4); }
.auth__card { width: 100%; max-width: 440px; }
.auth__brand { display: flex; justify-content: center; margin-bottom: var(--sp-6); }
.auth__title { text-align: center; margin-bottom: var(--sp-2); }
.auth__sub { text-align: center; color: var(--ink-2); margin-bottom: var(--sp-6); }
.auth__footer { text-align: center; margin-top: var(--sp-6); font-size: var(--fs-sm); color: var(--ink-2); }
.divider { display: flex; align-items: center; gap: var(--sp-3); color: var(--ink-3); font-size: var(--fs-xs); margin: var(--sp-5) 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.public { min-height: 100dvh; background: var(--bg); }
.public__bar { height: 6px; background: var(--brand-color, var(--primary)); }
.public__header { padding: var(--sp-6) var(--sp-4); display: flex; align-items: center; gap: var(--sp-4); max-width: 760px; margin-inline: auto; }
.public__logo { width: 56px; height: 56px; border-radius: var(--r-md); object-fit: contain; background: var(--surface); border: 1px solid var(--border); }
.public__main { max-width: 760px; margin-inline: auto; padding: 0 var(--sp-4) var(--sp-16); }
.public__footer { text-align: center; color: var(--ink-3); font-size: var(--fs-xs); padding: var(--sp-8) var(--sp-4) calc(var(--sp-8) + var(--safe-b)); }
.public__actions { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: var(--sp-3) var(--sp-4) calc(var(--sp-3) + var(--safe-b)); display: flex; gap: var(--sp-3); margin: var(--sp-6) calc(-1 * var(--sp-4)) 0; }
.total-box { display: flex; justify-content: space-between; align-items: baseline; padding: var(--sp-4) var(--sp-5); background: var(--primary-soft); border-radius: var(--r-lg); color: var(--primary-ink); }
.total-box strong { font-size: var(--fs-2xl); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Site institucional
   -------------------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); height: 64px; }
.site-nav { display: none; gap: var(--sp-1); }
.site-nav a { padding: 8px 12px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 600; font-size: var(--fs-sm); text-decoration: none !important; }
.site-nav a:hover, .site-nav a.is-active { color: var(--ink); background: var(--surface-2); }
@media (min-width: 900px) { .site-nav { display: flex; } }
.site-footer { border-top: 1px solid var(--border); padding: var(--sp-12) 0 calc(var(--sp-8) + var(--safe-b)); color: var(--ink-2); font-size: var(--fs-sm); margin-top: var(--sp-20); }
.site-footer a { color: var(--ink-2); } .site-footer a:hover { color: var(--ink); }
.hero { padding: var(--sp-12) 0 var(--sp-8); }
.hero h1 { font-size: clamp(2rem, 6vw, 3.5rem); letter-spacing: -.03em; line-height: 1.05; margin-bottom: var(--sp-4); }
.hero p.lead { font-size: var(--fs-lg); color: var(--ink-2); max-width: 54ch; }
.eyebrow { display: inline-block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); margin-bottom: var(--sp-3); }
.section { padding: var(--sp-16) 0; }
.section--alt { background: var(--surface); border-block: 1px solid var(--border); }
.section__title { font-size: clamp(1.6rem, 4vw, 2.4rem); letter-spacing: -.02em; max-width: 24ch; }
.feature { padding: var(--sp-6); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.feature__icon { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-ink); display: inline-flex; align-items: center; justify-content: center; margin-bottom: var(--sp-4); }
.feature__icon svg { width: 22px; height: 22px; }
.pricing { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); align-items: start; }
.pricing__card { position: relative; }
.pricing__card--featured { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.pricing__price { font-size: var(--fs-3xl); font-weight: 800; letter-spacing: -.03em; }
.pricing__price small { font-size: var(--fs-sm); color: var(--ink-2); font-weight: 500; }
.pricing__list { list-style: none; padding: 0; margin: var(--sp-5) 0; font-size: var(--fs-sm); }
.pricing__list li { display: flex; gap: var(--sp-2); padding: 6px 0; border-bottom: 1px dashed var(--border); }
.pricing__list svg { width: 18px; height: 18px; color: var(--success); flex: none; }
.prose { max-width: 72ch; }
.prose h2 { margin-top: var(--sp-10); } .prose h3 { margin-top: var(--sp-8); }
.prose p, .prose li { color: var(--ink-2); font-size: var(--fs-md); line-height: 1.7; }
.prose ul { padding-left: 1.2em; }

/* --------------------------------------------------------------------------
   Utilidades finais
   -------------------------------------------------------------------------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r-sm); min-height: 1em; }
@keyframes shimmer { to { background-position: -200% 0; } }
.offline-banner { display: none; background: var(--accent); color: #2A1A05; text-align: center; font-size: var(--fs-sm); font-weight: 600; padding: 6px; }
body.is-offline .offline-banner { display: block; }
.copyable { cursor: pointer; border-bottom: 1px dashed var(--border-strong); }
.amount-pos { color: var(--success); } .amount-neg { color: var(--danger); }
.error-page { text-align: center; padding: var(--sp-20) 0; }
.error-page__code { font-size: var(--fs-4xl); font-weight: 800; color: var(--primary); margin: 0; letter-spacing: -.04em; }
.error-page__title { font-size: var(--fs-2xl); }
.error-page__text { color: var(--ink-2); max-width: 48ch; margin-inline: auto; }
@media print { .topbar, .sidebar, .bottom-nav, .fab, .public__actions, .sticky-actions, .toasts, .site-header, .site-footer { display: none !important; } body { background: #fff; } .card { box-shadow: none; } }

/* --------------------------------------------------------------------------
   Site: páginas de produto, ferramentas, blog, ajuda e legal
   -------------------------------------------------------------------------- */
.site-pipeline { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.site-pipeline a { display: inline-flex; align-items: center; gap: var(--sp-2); padding: 8px 14px 8px 8px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-weight: 600; font-size: var(--fs-sm); text-decoration: none !important; }
.site-pipeline a:hover { border-color: var(--primary); }
.site-pipeline__num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-sm); font-weight: 700; flex: none; }
.site-stage { display: grid; gap: var(--sp-8); align-items: start; }
@media (min-width: 900px) { .site-stage { grid-template-columns: 1fr 1fr; } }
.site-stage .pricing__list li { align-items: flex-start; }
.site-cta { display: grid; gap: var(--sp-6); align-items: center; padding: var(--sp-8); border-radius: var(--r-xl); background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent); }
.site-cta .section__title { margin-bottom: var(--sp-2); }
.site-cta .lead { color: var(--primary-ink); margin: 0; }
@media (min-width: 900px) { .site-cta { grid-template-columns: 1fr auto; } }
.site-faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); }
.site-faq summary::-webkit-details-marker { display: none; }
.site-faq summary::after { content: "+"; font-size: var(--fs-xl); color: var(--primary); line-height: 1; flex: none; }
.site-faq[open] summary::after { content: "–"; }
.site-card-link { display: block; color: inherit; text-decoration: none !important; transition: border-color .15s, box-shadow .15s; }
.site-card-link:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
.site-card-link h3 a { color: inherit; text-decoration: none; }
.site-step { display: flex; gap: var(--sp-4); align-items: flex-start; padding: var(--sp-5); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); }
.site-step h3 { margin: 2px 0 var(--sp-1); font-size: var(--fs-lg); }
.site-dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-5); margin: 0; font-size: var(--fs-sm); }
.site-dl dt { color: var(--ink-3); } .site-dl dd { margin: 0; color: var(--ink); font-weight: 600; }
.site-help { display: grid; gap: var(--sp-8); align-items: start; }
@media (min-width: 900px) { .site-help { grid-template-columns: 240px 1fr; } .site-help aside { position: sticky; top: 80px; } }
.site-help aside .list a { color: var(--ink-2); }
.site-help aside .list a.is-active { color: var(--ink); font-weight: 700; }
.site-x { display: inline-block; width: 18px; text-align: center; color: var(--ink-3); flex: none; }
.site-billing-toggle { display: inline-flex; }
.site-billing-toggle .badge { margin-left: 6px; }
.text-right { text-align: right; }
.site-hero-proof { display: flex; flex-wrap: wrap; gap: var(--sp-4) var(--sp-8); margin-top: var(--sp-8); color: var(--ink-2); font-size: var(--fs-sm); }
.site-hero-proof strong { display: block; color: var(--ink); font-size: var(--fs-xl); letter-spacing: -.02em; }
.site-phone { border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-lg); padding: var(--sp-5); max-width: 380px; margin-inline: auto; }
.site-phone .list-row { padding-inline: 0; }
.hero--split { display: grid; gap: var(--sp-10); align-items: center; }
@media (min-width: 900px) { .hero--split { grid-template-columns: 1.1fr .9fr; } }
.badge-count { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.admin-stats { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.admin-kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-5); font-size: var(--fs-sm); margin: 0; }
.admin-kv dt { color: var(--ink-3); } .admin-kv dd { margin: 0; }
.admin-filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: end; }
.admin-filters .field { margin: 0; min-width: 160px; }
.admin-editor { display: grid; gap: var(--sp-4); }
@media (min-width: 1100px) { .admin-editor { grid-template-columns: 1fr 1fr; } }
.admin-editor .textarea { min-height: 420px; font-family: var(--mono); font-size: var(--fs-sm); }
.admin-preview { border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-4); background: var(--surface); min-height: 420px; overflow: auto; }
