:root {
  --bg: #f5f7fb; --surface: #ffffff; --panel: #fafbfd; --surface-2: #eef1f7; --border: #e2e7f0;
  --text: #0f172a; --muted: #64748b; --primary: #4f46e5; --primary-2: #6366f1;
  --green: #047857; --red: #be123c; --amber: #b45309; --violet: #6d28d9; --cyan: #0e7490; --radius: 14px;
  /* tintas de papel (mesmo significado da landing): verde = entrada, rosa = saída/perigo,
     âmbar = atenção/vencendo, violeta = análise, ciano = sincronização/info */
  --green-bg: #e6f7ef; --red-bg: #ffe9ee; --amber-bg: #fff4de; --violet-bg: #f2ecff; --cyan-bg: #e2f6fa; --primary-bg: #eef0ff;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04);
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 2px 8px rgba(15,23,42,.05);
  --shadow-lg: 0 4px 12px rgba(15,23,42,.08), 0 12px 28px rgba(15,23,42,.06);
  /* escala tipográfica: razão ~1.18, base 15px */
  --fs-xs: .8125rem; --fs-sm: .875rem; --fs-base: .9375rem; --fs-md: 1.0625rem;
  --fs-lg: 1.25rem; --fs-xl: 1.5rem; --fs-2xl: 1.75rem;
  /* identidade de movimento — arquétipo Corporate (ver DESIGN.md > Motion) */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur-quick: .15s; --dur-standard: .28s; --dur-slow: .42s;
  --font-display: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  color-scheme: light;
}
/* Escuro: automático (segue o sistema, quando o usuário não fixou um modo) ou fixado via
   data-theme="dark"/"light" em <html>, controlado pelo seletor de aparência no topbar. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --surface: #121a2e; --panel: #0e1526; --surface-2: #1a2440; --border: #243152;
    --text: #e6eaf5; --muted: #8b97b5; --primary: #818cf8; --primary-2: #6366f1;
    --green: #4ade80; --red: #fb7185; --amber: #fbbf24; --violet: #a78bfa; --cyan: #22d3ee;
    --green-bg: #0f2a22; --red-bg: #2e1420; --amber-bg: #2b2210; --violet-bg: #211a3d; --cyan-bg: #0d2630; --primary-bg: #1c1f45;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.25);
    --shadow: 0 1px 2px rgba(0,0,0,.25), 0 2px 10px rgba(0,0,0,.22);
    --shadow-lg: 0 6px 16px rgba(0,0,0,.3), 0 16px 32px rgba(0,0,0,.24);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --surface: #121a2e; --panel: #0e1526; --surface-2: #1a2440; --border: #243152;
  --text: #e6eaf5; --muted: #8b97b5; --primary: #818cf8; --primary-2: #6366f1;
  --green: #4ade80; --red: #fb7185; --amber: #fbbf24; --violet: #a78bfa; --cyan: #22d3ee;
  --green-bg: #0f2a22; --red-bg: #2e1420; --amber-bg: #2b2210; --violet-bg: #211a3d; --cyan-bg: #0d2630; --primary-bg: #1c1f45;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.25);
  --shadow: 0 1px 2px rgba(0,0,0,.25), 0 2px 10px rgba(0,0,0,.22);
  --shadow-lg: 0 6px 16px rgba(0,0,0,.3), 0 16px 32px rgba(0,0,0,.24);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: var(--fs-base); line-height: 1.5; -webkit-font-smoothing: antialiased; }
::selection { background: color-mix(in srgb, var(--primary) 35%, transparent); color: var(--text); }
input, textarea { caret-color: var(--primary); }
* { scrollbar-color: color-mix(in srgb, var(--muted) 55%, transparent) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 99px; border: 3px solid var(--bg); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--muted) 65%, transparent); background-clip: padding-box; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.pos { color: var(--green); } .neg { color: var(--red); }
/* títulos e números de destaque na mesma face display da landing (Plus Jakarta Sans) */
h1, h2, .brand, .stat .value, .te-preco { font-family: var(--font-display); }
h1 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -.02em; margin: 0; }
h2 { font-size: var(--fs-md); font-weight: 700; letter-spacing: -.01em; margin: 0 0 12px; }
h3 { font-size: var(--fs-xs); margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* marca */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand.big { font-size: 26px; justify-content: center; }
.brand-txt { display: grid; line-height: 1.05; }
.brand-txt small { font-family: Inter, system-ui, sans-serif; font-weight: 600; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 3px; white-space: nowrap; }
.logo { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #4f46e5, #0e7490); font-weight: 700; }

/* fim do teste grátis */
#trialExpired { position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.te-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 20px; padding: 28px; box-shadow: var(--shadow-lg); text-align: center; }
.te-card h2 { margin-top: 18px; font-size: var(--fs-xl); }
.te-planos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.te-plano { border: 1px solid var(--border); border-radius: 12px; padding: 14px 10px; }
.te-preco { font-size: 20px; font-weight: 700; }
.te-preco span { font-size: 12px; font-weight: 500; color: var(--muted); }

/* auth */
.auth { position: relative; min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--bg); overflow: hidden; }
#authCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-card { position: relative; z-index: 1; width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px; padding: 28px; box-shadow: var(--shadow-lg); text-align: center; }
.auth-card form { text-align: left; }
.divider { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
#googleBtn { display: flex; justify-content: center; }

/* MFA (setup + verificação) */
.mfa-qr { display: block; width: 176px; height: 176px; margin: 18px auto; padding: 10px; background: #fff; border-radius: 14px; box-shadow: var(--shadow-sm); box-sizing: border-box; object-fit: contain; }
.mfa-secret { display: inline-block; margin-top: 4px; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); font-size: 12px; letter-spacing: .04em; word-break: break-all; }
#mfaSetupCode, #mfaVerifyCode { text-align: center; letter-spacing: .3em; font-size: 20px; font-variant-numeric: tabular-nums; }
#mfaSetupForm, #mfaVerifyForm { margin-top: 6px; }

/* layout */
.nav-icon { width: 1em; height: 1em; vertical-align: -0.15em; flex-shrink: 0; transition: transform var(--dur-quick) var(--ease); }
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100%; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px 14px; border-right: 1px solid var(--border); background: var(--panel); display: flex; flex-direction: column; gap: 20px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 13.5px; transition: background-color var(--dur-quick) var(--ease), color var(--dur-quick) var(--ease); }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.nav-item.active .nav-icon { transform: scale(1.08); }
.nav-item .nav-icon { width: 17px; height: 17px; flex-shrink: 0; }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item.primary { font-weight: 700; font-size: 14.5px; color: var(--text); padding: 9px 12px; }
.nav-item.primary .nav-icon { width: 20px; height: 20px; }
.nav-item.primary.active { color: var(--primary); }
.nav-divider { height: 1px; background: var(--border); margin: 8px 6px; flex-shrink: 0; }
.nav-item.admin { color: color-mix(in srgb, var(--primary) 70%, var(--text)); }
.nav-item.admin:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); }
.nav-item.admin.active { color: var(--primary); }
.side-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
main { min-width: 0; padding: 0 28px 40px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 0; flex-wrap: wrap; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.bottom-nav { display: none; }
.workspace-banner { display: flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--primary) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--border)); color: var(--text); border-radius: 10px; padding: 10px 14px; font-size: var(--fs-sm); margin-bottom: 16px; }
.workspace-banner .nav-icon { width: 16px; height: 16px; color: var(--primary); flex: none; }

/* componentes */
.grid { display: grid; gap: 16px; }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hero { background: linear-gradient(135deg, #4f46e5, #0891b2); color: #fff; border: none; }
.hero h3, .hero .sub { color: rgba(255,255,255,.8); }

/* botões */
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer;
  white-space: nowrap; position: relative; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease,
              transform var(--dur-quick) var(--ease), filter var(--dur-quick) var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 4px 10px rgba(0,0,0,.12);
}
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 2px 4px rgba(0,0,0,.14), 0 8px 18px rgba(0,0,0,.16); transform: translateY(-1px); }
.btn.primary:active { filter: brightness(.97); box-shadow: 0 1px 2px rgba(0,0,0,.14); transform: translateY(1px) scale(.98); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--border)); background: color-mix(in srgb, var(--red) 6%, var(--surface)); }
.btn.danger:hover { background: color-mix(in srgb, var(--red) 14%, var(--surface)); border-color: color-mix(in srgb, var(--red) 55%, var(--border)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.full { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .6; cursor: wait; transform: none; filter: none; }
.btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible, .bottom-nav a:focus-visible,
.li.clickable:focus-visible, tr.clickable:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 15px; height: 15px;
  border-radius: 50%; border: 2px solid var(--muted); border-top-color: transparent;
  animation: spin .65s linear infinite;
}
.btn.primary.loading::after { border-color: rgba(255,255,255,.55); border-top-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  position: relative; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  width: 40px; height: 40px; cursor: pointer; color: var(--text);
  transition: background-color var(--dur-quick) var(--ease), border-color var(--dur-quick) var(--ease), transform var(--dur-quick) var(--ease);
}
.icon-btn .nav-icon { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.icon-btn:active { transform: scale(.94); }
.badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 6px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 0; font-weight: 500; }
label.check { display: flex; gap: 8px; align-items: flex-start; }
input, select, textarea { width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; transition: border-color .15s ease, box-shadow .15s ease; }
input[type=checkbox] { width: auto; margin-top: 2px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 40%, transparent); border-color: var(--primary); }
input:invalid:not(:placeholder-shown), input.invalid, select.invalid { border-color: var(--red); }
input:invalid:not(:placeholder-shown):focus, input.invalid:focus { outline-color: color-mix(in srgb, var(--red) 40%, transparent); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.top-actions input[type=month] { width: auto; margin: 0; padding: 8px 10px; }
.fipe-box { margin-top: 18px; padding: 12px; border-radius: 12px; background: var(--surface-2); }
.fipe-box label { margin-top: 8px; }
.fipe-box label:first-of-type { margin-top: 0; }
#fipeResult a, #fipeResult button { vertical-align: middle; }
.tabs { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; margin: 18px 0 6px; }
.tabs button { flex: 1; white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; background: transparent; padding: 8px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.error { color: var(--red); font-size: 13px; min-height: 18px; }
.row { display: flex; gap: 10px; align-items: center; } .row > * { flex: 1; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.toolbar > * { width: auto; margin: 0; }

/* listas e tabelas */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.li:last-child { border-bottom: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--surface-2); }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; width: 100%; height: 100%; border-radius: 99px; background: var(--primary-2); transform-origin: left; transition: transform var(--dur-slow) var(--ease); }
.bar.warn > i { background: var(--amber); } .bar.over > i { background: var(--red); }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.chart-box { position: relative; height: 260px; }
.alert-item { border-left: 1px solid color-mix(in srgb, var(--primary-2) 45%, var(--border)); background: color-mix(in srgb, var(--primary-2) 8%, var(--surface-2)); padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; }
.alert-item.warning { border-color: color-mix(in srgb, var(--amber) 55%, var(--border)); background: color-mix(in srgb, var(--amber) 10%, var(--surface-2)); }
.alert-item.danger { border-color: color-mix(in srgb, var(--red) 55%, var(--border)); background: color-mix(in srgb, var(--red) 10%, var(--surface-2)); }
.md { line-height: 1.6; } .md h2 { margin-top: 18px; } .md a { color: var(--primary); } .md blockquote { margin: 0; padding: 8px 12px; border-left: 1px solid var(--border); color: var(--muted); }

/* animações de abertura — orquestradas via GSAP em app.js (view, cards, auth, onboarding) */
@keyframes dialogIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
/* feedback de erro: recusa firme, sem overshoot (arquétipo Corporate) */
@keyframes shake {
  10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); }
}
.shake { animation: shake .4s var(--ease); }
.toast.success { background: color-mix(in srgb, var(--green) 30%, #111827); }
.toast.error { background: color-mix(in srgb, var(--red) 32%, #111827); }

/* modal e toast */
dialog { border: none; border-radius: 18px; padding: 0; background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 32px)); max-height: 90vh; box-shadow: var(--shadow-lg); }
dialog[open] { animation: dialogIn var(--dur-standard) var(--ease) both; }
dialog::backdrop { background: rgba(8,12,24,.55); backdrop-filter: blur(2px); animation: backdropIn .25s ease both; }
dialog form { padding: 22px; overflow: auto; max-height: 90vh; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; background: #111827; color: #fff; padding: 10px 16px;
  border-radius: 10px; z-index: 50; box-shadow: var(--shadow-lg); max-width: calc(100vw - 32px);
  transform: translateX(-50%) translateY(0); opacity: 1;
  transition: opacity var(--dur-standard) var(--ease), transform var(--dur-standard) var(--ease);
}
.toast.hidden { display: flex !important; opacity: 0; transform: translateX(-50%) translateY(10px); pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  dialog[open], dialog::backdrop, .shake { animation-duration: .01ms !important; animation-delay: 0s !important; }
  .btn, .btn:active, .btn.primary:hover, .icon-btn:active, #assistantBtn:hover, #assistantBtn:active { transform: none !important; }
  .toast, .bar > i { transition-duration: .01ms !important; }
}

/* assistente de uso (robô) */
#assistantBtn {
  position: fixed; right: 20px; bottom: 24px; z-index: 25; width: 56px; height: 56px;
  border-radius: 50%; border: none; background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-size: 26px; cursor: pointer; box-shadow: var(--shadow-lg); display: grid; place-items: center;
  transition: transform var(--dur-quick) var(--ease), box-shadow var(--dur-quick) var(--ease);
}
#assistantBtn:hover { transform: translateY(-2px); }
#assistantBtn:active { transform: scale(.94); }
#assistantPanel {
  position: fixed; right: 20px; bottom: 92px; z-index: 26; width: min(380px, calc(100vw - 40px));
  height: min(560px, calc(100vh - 140px)); background: var(--surface); border-radius: 18px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
}
#assistantPanel .ap-head {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
  background: color-mix(in srgb, var(--primary-2) 85%, black); color: #fff; flex: none;
}
#assistantPanel .ap-head strong { font-size: var(--fs-sm); }
#assistantPanel .ap-close { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; opacity: .85; }
#assistantPanel .ap-close:hover { opacity: 1; }
#ap-msgs { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.ap-msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: var(--fs-sm); line-height: 1.45; }
.ap-msg.bot { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.ap-msg.user { align-self: flex-end; background: color-mix(in srgb, var(--primary-2) 85%, black); color: #fff; border-bottom-right-radius: 4px; }
.ap-msg.bot :is(strong, b) { color: var(--primary); }
.ap-action { align-self: flex-start; max-width: 88%; }
.ap-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; flex: none; }
.ap-chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 5px 11px; font-size: var(--fs-xs); cursor: pointer; }
.ap-chip:hover { background: var(--surface-2); }
#assistantPanel form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); flex: none; }
#assistantPanel form input { margin: 0; }
@media (max-width: 760px) {
  /* empilha acima do botão "+ Lançamento", que também mora à direita no celular */
  #assistantBtn { right: 16px; bottom: calc(140px + env(safe-area-inset-bottom)); width: 50px; height: 50px; font-size: 22px; }
  #assistantPanel { bottom: calc(200px + env(safe-area-inset-bottom)); right: 12px; width: calc(100vw - 24px); }
}

/* assistente de primeiro acesso */
.onboarding {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 96%, transparent);
}
.ob-card { width: 100%; max-width: 460px; background: var(--surface); border-radius: 20px; padding: 28px; box-shadow: var(--shadow-lg); }
.ob-steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.ob-steps i { width: 22px; height: 4px; border-radius: 99px; background: var(--surface-2); display: block; }
.ob-steps i.done { background: var(--primary-2); }
.ob-steps i.active { background: var(--primary); }
.ob-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin: 0 auto 14px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; }
.ob-icon .nav-icon { width: 24px; height: 24px; }
.ob-card h2 { text-align: center; font-size: var(--fs-lg); }
.ob-card p.muted { text-align: center; margin-top: -6px; }
.ob-actions { display: flex; gap: 10px; margin-top: 22px; }
.ob-actions .btn { flex: 1; }
.ob-skip { text-align: center; margin-top: 12px; }
.ob-skip button { background: none; border: none; color: var(--muted); font: inherit; font-size: var(--fs-xs); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ob-skip button:hover { color: var(--text); }

/* responsivo */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  main { padding: 0 16px calc(90px + env(safe-area-inset-bottom)); }
  .g4, .g3, .g2 { grid-template-columns: 1fr; }
  .g4.keep2 { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 14px 0 10px; }
  h1 { font-size: 19px; }
  #quickAdd { position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); border-radius: 99px; padding: 14px 18px; z-index: 20; box-shadow: 0 8px 20px rgba(0,0,0,.22), 0 2px 6px rgba(0,0,0,.16); }
  .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 15; justify-content: space-around; }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; font-size: 11px; color: var(--muted); text-decoration: none; padding: 4px 0; }
  .bottom-nav a .nav-icon { width: 20px; height: 20px; }
  .bottom-nav a.active { color: var(--primary); }
  .stat .value { font-size: 20px; }
  .keep2 .stat .value { font-size: 17px; }
  .keep2 .card { padding: 14px; }
  .hide-sm { display: none; }
}

/* saudação do painel: "Olá, X — contas a pagar hoje" + totais de vencimento */
.greet { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.greet-txt strong { display: block; font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 800; letter-spacing: -.02em; }
.greet-txt span { color: var(--muted); font-size: var(--fs-sm); }
.greet-due { display: flex; gap: 10px; }
.gd { min-width: 150px; padding: 8px 14px; border-radius: 10px; background: var(--surface-2); border-top: 3px solid var(--c); }
.gd span { display: block; font-size: var(--fs-xs); color: var(--muted); }
.gd b { font-family: var(--font-display); font-variant-numeric: tabular-nums; color: var(--red); }
.gd-today { --c: var(--amber); } .gd-next { --c: #0891b2; }
@media (max-width: 600px) { .greet-due { width: 100%; } .gd { flex: 1; min-width: 0; } }

/* ---- sistema de cores com papel (paridade com a landing) ---- */
.stat.tint-green { background: var(--green-bg); border-color: transparent; }
.stat.tint-red { background: var(--red-bg); border-color: transparent; }
.stat.tint-violet { background: var(--violet-bg); border-color: transparent; }
.stat.tint-green h3 { color: var(--green); } .stat.tint-red h3 { color: var(--red); } .stat.tint-violet h3 { color: var(--violet); }
.gd-today { background: var(--amber-bg); } .gd-next { background: var(--cyan-bg); }
.gd { border-top: 0; }
.gd span { font-weight: 600; } .gd-today span { color: var(--amber); } .gd-next span { color: var(--cyan); }
.chip.c-green { background: var(--green-bg); color: var(--green); }
.chip.c-red { background: var(--red-bg); color: var(--red); }
.chip.c-amber { background: var(--amber-bg); color: var(--amber); }
.chip.c-violet { background: var(--violet-bg); color: var(--violet); }
.chip.c-cyan { background: var(--cyan-bg); color: var(--cyan); }
.alert-item { border: 0; background: var(--cyan-bg); }
.alert-item strong { color: var(--cyan); }
.alert-item.warning { background: var(--amber-bg); } .alert-item.warning strong { color: var(--amber); }
.alert-item.danger { background: var(--red-bg); } .alert-item.danger strong { color: var(--red); }
.nav-item.active { background: var(--primary-bg); }

/* confirmação */
.confirm-dlg { width: min(440px, calc(100vw - 32px)); }
.cf-form { padding: 24px; }
.cf-head { display: flex; align-items: center; gap: 12px; }
.cf-head h2 { margin: 0; font-size: var(--fs-lg); }
.cf-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--primary-bg); color: var(--primary); }
.cf-ic.danger { background: var(--red-bg); color: var(--red); }
.cf-ic .nav-icon { width: 20px; height: 20px; }
.cf-msg { margin: 12px 0 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; }
.btn.danger-solid { background: var(--red); border-color: transparent; color: #fff; }
.btn.danger-solid:hover { filter: brightness(1.08); background: var(--red); }
.btn.danger-solid:disabled { opacity: .45; cursor: not-allowed; }

/* ações em lote nos lançamentos */
.bulk-bar { position: sticky; top: 76px; z-index: 4; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; padding: 10px 12px; border-radius: 12px; background: var(--primary-bg); box-shadow: var(--shadow-sm); }
.bulk-bar strong { color: var(--primary); margin-right: 4px; font-variant-numeric: tabular-nums; }
.bulk-bar select { width: auto; margin: 0; padding: 7px 10px; }
.bulk-bar .btn .nav-icon { width: 15px; height: 15px; }
th.sel, td.sel { width: 36px; padding-right: 0; }
td.sel input, th.sel input { margin: 0; width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
tr.selected td { background: var(--primary-bg); }
tr.clickable.selected:hover td { background: color-mix(in srgb, var(--primary) 16%, var(--surface)); }
@media (max-width: 760px) {
  .bulk-bar { position: fixed; top: auto; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 40; margin: 0; box-shadow: var(--shadow-lg); background: var(--surface); outline: 2px solid var(--primary-bg); }
  .bulk-bar strong { width: 100%; }
  .bulk-bar select { flex: 1 1 100%; min-width: 0; }
}

/* Nora: a assistente (mesma personagem da landing) */
#assistantBtn .nora-ic { width: 34px; height: 36px; }
#assistantBtn { background: var(--surface) !important; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.ap-nome { display: flex; align-items: center; gap: 10px; }
.ap-nome .nora-ic { width: 30px; height: 32px; flex: none; }
.ap-nome span { display: grid; line-height: 1.15; font-family: var(--font-display); }
.ap-nome small { font-family: Inter, system-ui, sans-serif; font-weight: 500; font-size: 11px; color: rgba(255,255,255,.82); }
