/* Contas em Dia — visual (docs/07-design-system.md). Mobile primeiro; ≥900px vira layout de desktop. */

/* Fontes guardadas no próprio app (tools/vendor-fonts.mjs): funcionam offline e sem chamadas ao Google.
   Inter (texto e números) e Fraunces (títulos), variáveis, alfabeto latino; licença SIL OFL 1.1 em assets/fonts/. */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url('../assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fraunces'; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url('../assets/fonts/fraunces-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Paleta "leve": fundo quase branco com toque de menta, acentos em pastel, sombras difusas. */
  --bg: #F5F8F7;
  --bg-elev: #EDF4F1;
  --surface: #FFFFFF;
  --surface-2: #F4F8F7;
  --line: #E3EBE8;
  --line-2: #D0DCD7;
  --ink: #1F2A27;
  --ink-2: #53635E;
  --ink-3: #8B9A95;
  --brand: #1A8268;
  --brand-2: #146B56;
  --brand-ink: #FFFFFF;
  --brand-soft: #E3F5EF;
  --accent: #F08A6C;
  --gold: #D99A1E;
  --gold-soft: #FDF4DF;
  --ok: #1C7C52;
  --ok-soft: #E4F5EC;
  --warn: #A15C0B;
  --warn-soft: #FDF1DE;
  --bad: #C23B2B;
  --bad-soft: #FDE9E6;
  --info: #2F6F9F;
  --info-soft: #E6F0F8;
  --muted-soft: #EEF3F1;
  --income: #1C7C52;
  /* Preenchimentos (barras e pontos): versões claras das cores de status — o texto usa as versões fortes. */
  --ok-fill: #4CC08F;
  --warn-fill: #F2B544;
  --bad-fill: #EE7D6E;
  --info-fill: #7DB3E0;
  --hero-from: #DDF5EC;
  --hero-to: #E6F0FC;
  --hero-shine: rgba(255, 255, 255, .8);
  --hero-glow: rgba(255, 209, 102, .32);
  --toast-bg: #24302D;
  --toast-ink: #F4F8F6;
  --toast-action: #8FE3C8;
  --shadow-1: 0 1px 2px rgba(31, 42, 39, .04);
  --shadow-2: 0 1px 2px rgba(31, 42, 39, .03), 0 10px 30px -14px rgba(31, 42, 39, .14);
  --shadow-3: 0 24px 64px -24px rgba(31, 42, 39, .28);
  --r-xl: 24px;
  --r-lg: 18px;
  --r-md: 14px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --tabbar-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

/* Tema escuro: só quando escolhido em Ajustes (ou "Automático" com o sistema escuro). O padrão é o claro. */
:root[data-theme="dark"] {
  --bg: #111615; --bg-elev: #151B19; --surface: #19201E; --surface-2: #1E2624; --line: #29322F; --line-2: #36403C;
  --ink: #ECF1EF; --ink-2: #AFBAB6; --ink-3: #7F8B87;
  --brand: #5CC7A6; --brand-2: #7AD3B8; --brand-ink: #0E1513; --brand-soft: #18302A;
  --accent: #F29C82; --gold: #E6B54F; --gold-soft: #2B2617;
  --ok: #5CC08F; --ok-soft: #15291F; --warn: #E7A853; --warn-soft: #2D2316; --bad: #F07A6A; --bad-soft: #301C19;
  --info: #7FB2DA; --info-soft: #172530; --muted-soft: #222A28; --income: #5CC08F;
  --hero-from: #1B2D28; --hero-to: #1A2532; --hero-shine: rgba(255, 255, 255, .04); --hero-glow: rgba(255, 209, 102, .10);
  --ok-fill: #3FA97A; --warn-fill: #D99A3A; --bad-fill: #D9675A; --info-fill: #5B8FBF;
  --toast-bg: #ECF1EF; --toast-ink: #111615; --toast-action: #1A8268;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .7);
  --shadow-3: 0 24px 64px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { overflow-wrap: anywhere; }
.ico { flex: none; display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.skip { position: absolute; left: -999px; top: 8px; }
.skip:focus { left: 12px; z-index: 200; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

/* ---------------------------------------------------------------- estrutura */
/* Celular (< 640px): barra superior compacta + barra inferior com o +. Tablet (640–899px): menu lateral
   recolhido, só com os ícones. Computador (≥ 900px): menu lateral que recolhe (aberto a partir de 1200px). */
.app { min-height: 100dvh; }
.main { min-width: 0; }
.sidebar { display: none; }
.view {
  display: block; outline: none; margin: 0 auto; max-width: 760px;
  padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 32px);
  transition: opacity .2s;
  /* As telas se adaptam à largura disponível (container queries), não só ao tamanho da janela. */
  container: view / inline-size;
}
body.booting .view { opacity: 0; }

/* Cor de cada seção: o ícone ganha um quadrado suave da cor (ativo: cor cheia). */
.t-mint { --t: #1A8268; --t-soft: #E3F5EF; }
.t-sky { --t: #2F6FB0; --t-soft: #E5EFFA; }
.t-amber { --t: #B26A00; --t-soft: #FDF1DC; }
.t-violet { --t: #6A4FC9; --t-soft: #EFEBFC; }
.t-slate { --t: #4F5F6B; --t-soft: #EBF0F2; }
.t-red { --t: #C23B2B; --t-soft: #FDE9E6; }
:root[data-theme="dark"] .t-mint { --t: #5CC7A6; --t-soft: #183029; }
:root[data-theme="dark"] .t-sky { --t: #7FB0E8; --t-soft: #172434; }
:root[data-theme="dark"] .t-amber { --t: #E6A64A; --t-soft: #2F2513; }
:root[data-theme="dark"] .t-violet { --t: #A894F2; --t-soft: #221D38; }
:root[data-theme="dark"] .t-slate { --t: #A9B6BE; --t-soft: #20272B; }
:root[data-theme="dark"] .t-red { --t: #F07A6A; --t-soft: #35201D; }

/* barra inferior (celular) */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding: 0 6px var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(18px); backdrop-filter: saturate(1.4) blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
  font-size: 10.5px; font-weight: 600; color: var(--ink-3); letter-spacing: .01em;
}
.tab-ico { display: grid; place-items: center; width: 54px; height: 30px; border-radius: 99px; transition: background .2s, color .2s; }
.tabbar a.on { color: var(--ink); }
.tabbar a.on .tab-ico { background: var(--t-soft); color: var(--t); }
.fab {
  justify-self: center; width: 56px; height: 56px; border-radius: 19px; transform: translateY(-14px);
  display: grid; place-items: center; color: #FFFFFF;
  background: linear-gradient(135deg, #2BC398, var(--brand) 70%);
  box-shadow: 0 10px 22px -10px color-mix(in srgb, var(--brand) 75%, transparent), 0 0 0 5px var(--bg);
  transition: transform .15s;
}
.fab:active { transform: translateY(-14px) scale(.95); }

/* barra superior: compacta no celular (logo, mês, pessoa); no computador traz o resumo do mês */
.topbar {
  position: sticky; top: 0; z-index: 28;
  display: flex; align-items: center; gap: 8px; min-height: 56px;
  padding: calc(8px + var(--safe-t)) 12px 8px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid var(--line);
  container: topbar / inline-size;
}
.tb-brand { flex: none; display: grid; border-radius: 10px; }
.tb-brand img { border-radius: 9px; }
.tb-month { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; }
.tb-month .month-switch { flex: 0 1 auto; min-width: 0; padding: 2px; border-radius: 12px; box-shadow: none; }
.tb-month .month-label { min-width: 0; padding: 6px 6px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-month .icon-btn { width: 34px; height: 34px; }
.tb-when { display: none; flex: none; padding: 4px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 650; color: var(--brand); background: var(--brand-soft); }
.tb-kpis { display: none; margin: 0; }
.tb-actions { position: relative; flex: none; display: flex; align-items: center; gap: 4px; }
.tb-icon { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--ink-2); }
.tb-icon:hover { background: var(--surface); color: var(--ink); }
.tb-badge {
  position: absolute; top: 4px; right: 3px; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 99px; background: var(--bad); color: #FFFFFF; font-size: 10.5px; font-weight: 700; box-shadow: 0 0 0 2px var(--bg);
}
.tb-user { display: flex; align-items: center; gap: 9px; padding: 3px; border-radius: 99px; text-align: left; }
.tb-user:hover { background: var(--surface); }
.tb-house { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.tb-who, .tb-caret { display: none; }
.tb-who strong { display: block; max-width: 160px; font-size: 13.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-who small { display: block; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.tb-caret { color: var(--ink-3); }
.tb-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3);
}
.tb-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; font-weight: 550; color: var(--ink-2); text-align: left; }
.tb-menu button:hover, .tb-menu button:focus-visible { background: var(--surface-2); color: var(--ink); }
.tb-kpi dt { font-size: 11px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.tb-kpi dd { margin: 1px 0 0; font-size: 14px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tb-kpi dd.pos { color: var(--ok); }
.tb-kpi dd.neg { color: var(--bad); }
.tb-bar { display: inline-block; width: 54px; height: 6px; margin-left: 8px; border-radius: 99px; overflow: hidden; vertical-align: middle; background: var(--muted-soft); }
.tb-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #52CFA9, var(--brand)); }
@container topbar (max-width: 360px) { .tb-icon { display: none; } }

@media (min-width: 640px) {
  .app { display: grid; grid-template-columns: 264px minmax(0, 1fr); transition: grid-template-columns .25s ease; }
  .app.side-collapsed { grid-template-columns: 80px minmax(0, 1fr); }
  body.booting .app { transition: none; }
  .sidebar {
    position: sticky; top: 0; z-index: 30; height: 100dvh;
    display: flex; flex-direction: column; gap: 18px; padding: calc(20px + var(--safe-t)) 14px 16px;
    background: var(--surface); border-right: 1px solid var(--line);
  }
  .tabbar { display: none; }
  .topbar { gap: 18px; min-height: 66px; padding: calc(10px + var(--safe-t)) 28px 10px; }
  .tb-brand { display: none; }
  .tb-month { flex: none; justify-content: flex-start; }
  .tb-when { display: inline-flex; }
  .tb-kpis { display: flex; flex: 1; align-items: center; justify-content: flex-end; gap: 22px; min-width: 0; }
  .tb-who, .tb-caret { display: block; }
  .tb-user { padding: 4px 10px 4px 4px; }
  .view { padding: 26px 32px 64px; max-width: 1180px; width: 100%; }
  .view.wide { max-width: 1480px; }
}
@container topbar (max-width: 1080px) { .k-in, .k-out { display: none; } }
@container topbar (max-width: 900px) { .k-paid { display: none; } }
@container topbar (max-width: 780px) { .k-due, .tb-who { display: none; } }
@container topbar (max-width: 640px) { .tb-kpis, .tb-when { display: none; } }

/* logotipo (anel "C" com o check dourado) + nome */
.brand { display: flex; align-items: center; min-height: 44px; padding: 0 4px; border-radius: 12px; }
.brand-lockup { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark { flex: none; width: var(--mark); height: var(--mark); border-radius: calc(var(--mark) * .23); box-shadow: 0 8px 18px -10px rgba(13, 94, 75, .7); }
.brand-text { display: grid; gap: 3px; min-width: 0; white-space: nowrap; text-align: left; }
.brand-text strong { font-size: 18px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; color: var(--ink); }
.brand-text strong span { color: var(--brand); }
.brand-text small { font-size: 9.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }

/* menu lateral */
.new-btn {
  position: relative; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 14px;
  background: linear-gradient(135deg, #2BC398, var(--brand) 70%); color: #FFFFFF; font-weight: 650; white-space: nowrap;
  box-shadow: 0 10px 22px -12px color-mix(in srgb, var(--brand) 80%, transparent);
}
.new-btn .ico { flex: none; }
.new-btn:hover { filter: brightness(1.05); }
.side-nav { display: grid; gap: 4px; }
.side-nav a {
  position: relative; display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 8px; border-radius: 14px;
  color: var(--ink-2); font-weight: 600; white-space: nowrap;
}
.nav-ico {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: var(--t-soft); color: var(--t); transition: background .2s, color .2s, box-shadow .2s;
}
.side-nav a:hover { background: var(--surface-2); color: var(--ink); }
.side-nav a.on { background: var(--t-soft); color: var(--ink); }
.side-nav a.on .nav-ico { background: var(--t); color: #FFFFFF; box-shadow: 0 6px 14px -8px var(--t); }
.side-label { overflow: hidden; text-overflow: ellipsis; }
.side-foot {
  position: relative; display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 10px; border-radius: 12px;
  background: var(--surface-2); color: var(--ink-3); font-size: 12px; white-space: nowrap;
}
.side-foot .ico { flex: none; color: var(--brand); }
.side-toggle { display: none; }
@media (min-width: 900px) {
  .side-toggle {
    position: absolute; top: 31px; right: -14px; z-index: 2; display: grid; place-items: center;
    width: 28px; height: 28px; border-radius: 50%; background: var(--surface); color: var(--ink-2);
    border: 1px solid var(--line); box-shadow: var(--shadow-2); transition: transform .25s, color .15s;
  }
  .side-toggle:hover { color: var(--brand); }
  .side-collapsed .side-toggle { transform: rotate(180deg); }
}
/* recolhido: só os ícones; o nome continua para leitores de tela e aparece numa dica ao passar o mouse */
.side-collapsed .sidebar .brand { justify-content: center; padding: 0; }
.side-collapsed .sidebar .brand-text, .side-collapsed .side-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.side-collapsed .new-btn, .side-collapsed .side-nav a { justify-content: center; padding: 0; }
.side-collapsed .side-foot { justify-content: center; padding: 10px 0; }
.side-collapsed .sidebar [data-label]:hover::after, .side-collapsed .sidebar [data-label]:focus-visible::after {
  content: attr(data-label); position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%); z-index: 50;
  padding: 6px 10px; border-radius: 8px; background: var(--toast-bg); color: var(--toast-ink);
  font-size: 12.5px; font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow-2);
}

/* papel Leitor: some o que altera dados (as ações também são recusadas em main.js) */
body.read-only [data-perm="edit"], body.read-only .check { display: none !important; }
body.read-only .tabbar { grid-template-columns: repeat(4, 1fr); }

/* ---------------------------------------------------------------- cabeçalho de página */
.page-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.page-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.page-title {
  margin: 0; font-family: var(--display); font-weight: 500; font-size: 27px; line-height: 1.08;
  letter-spacing: -.015em; font-variation-settings: 'opsz' 96;
}
.page-sub { margin: 5px 0 0; color: var(--ink-3); font-size: 13.5px; }
@container view (min-width: 640px) {
  .page-head { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .page-title { font-size: 36px; }
}
.month-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-1);
}
.month-label { flex: 1; min-width: 150px; text-align: center; font-weight: 650; font-size: 14.5px; padding: 7px 10px; border-radius: 10px; }
.month-label:hover:not(.static) { background: var(--surface-2); }
.month-label.static { cursor: default; font-family: var(--display); font-size: 18px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--ink-2); flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.soft { background: var(--brand-soft); color: var(--brand); }
.icon-btn.danger { color: var(--bad); }

/* ---------------------------------------------------------------- cartões e seções */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 16px; box-shadow: var(--shadow-1);
}
.card + .card { margin-top: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.005em; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; color: var(--brand); font-weight: 650; font-size: 13px; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.home-grid { display: grid; gap: 14px; }
.home-col > * + * { margin-top: 14px; }
@container view (min-width: 760px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; align-items: start; }
}

/* ---------------------------------------------------------------- saldo (hero) */
.hero {
  position: relative; overflow: hidden; isolation: isolate; border-radius: var(--r-xl); padding: 20px 20px 18px; color: var(--ink);
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
  border: 1px solid color-mix(in srgb, var(--brand) 12%, transparent);
  box-shadow: var(--shadow-2);
}
.hero::before {
  content: ''; position: absolute; z-index: -1; left: -70px; top: -100px; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, var(--hero-shine), transparent 65%);
}
.hero::after {
  content: ''; position: absolute; z-index: -1; right: -70px; bottom: -100px; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, var(--hero-glow), transparent 68%);
}
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hero-label { font-size: 13px; color: var(--ink-2); }
.hero-chip { font-size: 11px; font-weight: 650; padding: 3px 9px; border-radius: 99px; color: var(--brand); background: color-mix(in srgb, var(--surface) 78%, transparent); }
.hero-chip.neg { color: var(--bad); background: var(--bad-soft); }
.hero-value {
  font-family: var(--display); font-size: 42px; font-weight: 500; letter-spacing: -.02em; line-height: 1.1;
  margin: 6px 0 16px; font-variant-numeric: lining-nums tabular-nums; font-variation-settings: 'opsz' 120;
}
.hero-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px 0;
  border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
}
.hero-grid span { display: block; font-size: 11.5px; color: var(--ink-3); }
.hero-grid strong { display: block; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-progress { margin-top: 14px; }
.hero-progress-text { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 7px; font-variant-numeric: tabular-nums; }
.hero-bar {
  height: 8px; border-radius: 99px; overflow: hidden;
  background: color-mix(in srgb, var(--surface) 82%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 6%, transparent);
}
.hero-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #52CFA9, var(--brand)); transition: width .4s; }
.hero-progress small { display: block; margin-top: 8px; font-size: 12px; color: var(--ink-3); }

/* situação do mês (Início): 4 indicadores gerenciais, 2×2 no celular e em linha a partir de 600px */
.status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@container view (min-width: 600px) { .status-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container view (min-width: 760px) { .home-col .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat {
  display: grid; grid-template-columns: 36px minmax(0, 1fr); column-gap: 10px; align-items: center;
  padding: 12px; border-radius: 16px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); transition: border-color .15s, transform .15s;
}
.stat:hover { border-color: color-mix(in srgb, var(--t) 45%, var(--line)); transform: translateY(-1px); }
.stat-ico { grid-row: 1 / 4; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--t-soft); color: var(--t); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.stat-value { font-size: 16px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.t-red .stat-value { color: var(--t); }
.stat-sub { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- alertas e dicas */
.alerts { display: grid; gap: 10px; }
.alert {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left;
  border-radius: var(--r-md); border: 1px solid transparent;
}
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, currentColor 14%, transparent); }
.alert-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.alert-text strong { font-size: 14px; }
.alert-text small { color: var(--ink-2); font-size: 12.5px; }
.cta {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px; text-align: left; border-radius: var(--r-md);
  background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 28%, transparent);
}
.cta-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, transparent); }
.cta-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cta-text strong { font-size: 14px; }
.cta-text small { color: var(--ink-2); font-size: 12.5px; }
.tip {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
}
.tip > div { flex: 1; min-width: 0; }
.tip strong { font-size: 14px; }
.tip p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-2); }
.tip-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.sheet-body .tip { margin-bottom: 14px; }
.sample-banner {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 12px; margin-bottom: 14px;
  border-radius: 12px; background: var(--gold-soft); color: var(--ink-2); font-size: 13px;
}
.sample-banner .ico { color: var(--gold); }
.sample-banner .link-btn { margin-left: auto; }
.welcome-card { background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--r-lg); margin-bottom: 14px; }

/* ---------------------------------------------------------------- listas de lançamentos */
.list { display: flex; flex-direction: column; }
.row {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  padding: 10px 6px; border-radius: 12px; cursor: pointer; transition: background .12s;
}
.row + .row { box-shadow: inset 0 1px 0 var(--line); }
.row:hover { background: var(--surface-2); }
.row.paid .row-title, .row.paid .amt, .row.skipped .row-title, .row.skipped .amt { opacity: .55; }
.row.skipped .row-title { text-decoration: line-through; }
.row-main { min-width: 0; }
.row-title { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.row-meta .sep { opacity: .55; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.row-sub { display: flex; align-items: center; gap: 6px; }
.amt { font-weight: 650; font-size: 14.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt.income { color: var(--income); }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; margin-left: 4px;
  border-radius: 99px; background: var(--muted-soft); color: var(--ink-2); font-size: 11px; font-weight: 600; vertical-align: 1px;
}
.est { font-size: 11px; color: var(--ink-3); border: 1px dashed var(--line-2); padding: 0 6px; border-radius: 99px; }
@media (max-width: 520px) { .card { padding: 14px 12px; } }
/* Linhas se ajustam à largura da própria lista (cartão estreito no desktop = mesmo ajuste do celular). */
.list { container-type: inline-size; }
@container (max-width: 460px) {
  .row { gap: 10px; padding: 10px 2px; }
  .row-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
  .row-sub .pill.info { display: none; }
}
@container (max-width: 340px) { .row-sub .avatar { display: none; } }

.date-badge {
  width: 44px; height: 46px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--line); line-height: 1; flex: none;
}
.date-badge .d { font-family: var(--display); font-size: 19px; font-weight: 550; font-variant-numeric: lining-nums; }
.date-badge .w { margin-top: 3px; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.date-badge.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.date-badge.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.date-badge.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.date-badge.bad .w, .date-badge.warn .w, .date-badge.ok .w { color: inherit; opacity: .8; }
.date-badge.muted { color: var(--ink-3); }
.lead-icon {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
}
.lead-icon.big { width: 54px; height: 54px; border-radius: 17px; }

.check {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1.5px solid var(--line-2); color: transparent; transition: background .15s, border-color .15s, color .15s;
}
.check:hover { border-color: var(--ok); color: var(--ok); }
.check.on { background: var(--ok); border-color: var(--ok); color: #fff; }

.pill {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 99px;
  font-size: 11px; font-weight: 650; white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.muted { background: var(--muted-soft); color: var(--ink-3); }
.cat-dot { display: inline-block; flex: none; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--c); }
.avatar {
  width: var(--s); height: var(--s); border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c) 24%, var(--surface)); color: color-mix(in srgb, var(--c) 78%, var(--ink));
  font-size: calc(var(--s) * .4); font-weight: 700; letter-spacing: .02em;
}
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }

/* ---------------------------------------------------------------- barras por categoria */
.cat-bars { display: grid; gap: 13px; }
.cat-bar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; font-size: 13.5px; }
.cat-name { display: inline-flex; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-val { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cat-val small { font-weight: 500; color: var(--ink-3); }
.bar { display: block; height: 8px; border-radius: 99px; background: var(--muted-soft); overflow: hidden; }
.bar.thin { height: 6px; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--bar, var(--brand)); transition: width .4s; }
.bar > span.ok { background: var(--ok-fill); }
.bar > span.warn { background: var(--warn-fill); }
.bar > span.bad { background: var(--bad-fill); }

/* ---------------------------------------------------------------- botões e campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 650; font-size: 14px; white-space: nowrap; transition: background .15s, transform .06s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-ghost { background: transparent; border-color: transparent; color: var(--bad); }
.btn.small { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.big { width: 100%; height: 52px; font-size: 15px; border-radius: 14px; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }

.form { display: grid; gap: 15px; }
.form div[data-for]:not(.field) { display: grid; gap: 15px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.field-hint { font-size: 12px; color: var(--ink-3); }
.field-hint:empty { display: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font-size: 16px; outline: none; appearance: none; -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 70px; padding: 10px 14px; resize: vertical; line-height: 1.4; }
select.input {
  padding-right: 38px; background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23868C85' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
input[type="date"].input, input[type="time"].input { min-height: 46px; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.input.invalid { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.money-wrap { position: relative; display: block; }
.money-wrap .cur { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 650; pointer-events: none; }
.money-wrap .input { padding-left: 44px; font-variant-numeric: tabular-nums; }
.money-wrap.big .input { height: 66px; padding-left: 58px; font-family: var(--display); font-size: 34px; font-weight: 500; letter-spacing: -.01em; }
.money-wrap.big .cur { left: 18px; font-size: 18px; }

.seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--muted-soft); }
.seg button {
  flex: 1; height: 36px; padding: 0 10px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13.5px; font-weight: 650; color: var(--ink-2); white-space: nowrap;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface);
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.chip.on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 45%, transparent); color: var(--brand); }
.chip:has(.swatch) { padding: 0 7px; }
.swatch { display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--c); }
.chip.on .swatch { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }

.switch-row { display: flex; align-items: center; gap: 12px; padding: 4px 0; cursor: pointer; font-weight: 600; position: relative; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row small { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-3); }
.switch { position: relative; flex: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line-2); transition: background .2s; }
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s;
}
.switch-row input:checked + .switch { background: var(--brand); }
.switch-row input:checked + .switch::after { transform: translateX(18px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--brand); outline-offset: 2px; }

details.more { border-top: 1px solid var(--line); padding-top: 12px; }
details.more summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; font-weight: 650; font-size: 13.5px; color: var(--brand); }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary .ico { transform: rotate(180deg); }
details.more > * + * { margin-top: 14px; }

/* ---------------------------------------------------------------- folhas (bottom sheets) */
body.has-sheet { overflow: hidden; }
.sheet-layer { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(12, 15, 14, .45); opacity: 0; transition: opacity .2s; }
.sheet {
  position: relative; display: flex; flex-direction: column; width: 100%; max-width: 560px;
  max-height: calc(100dvh - 20px - var(--safe-t)); padding-bottom: var(--safe-b);
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-3); outline: none;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
}
.sheet-layer.open .sheet-backdrop { opacity: 1; }
.sheet-layer.open .sheet { transform: none; }
.sheet-layer.closing .sheet { transform: translateY(100%); transition-duration: .18s; }
.sheet-layer.closing .sheet-backdrop { opacity: 0; }
.sheet-grip { flex: none; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 99px; background: var(--line-2); }
.sheet-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 20px 6px; }
.sheet-heading { min-width: 0; }
.sheet-title { margin: 0; font-family: var(--display); font-size: 23px; font-weight: 550; line-height: 1.2; }
.sheet-sub { margin: 4px 0 0; color: var(--ink-3); font-size: 13px; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 10px 20px 20px; }
.sheet-foot {
  flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 12px 20px 16px; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 24px 24px;
}
.sheet-foot .btn.primary { flex: 1; }
@media (min-width: 640px) {
  .sheet-layer { align-items: center; padding: 24px; }
  .sheet {
    border-radius: 24px; max-height: calc(100dvh - 48px); opacity: 0; transform: translateY(14px) scale(.985);
    transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .2s;
  }
  .sheet-layer.open .sheet { opacity: 1; transform: none; }
  .sheet-layer.closing .sheet { opacity: 0; transform: translateY(8px) scale(.985); }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 20px; }
  .sheet-foot .btn.primary { flex: none; min-width: 150px; }
}
.sheet-dialog { max-width: 440px; }
.dialog-text { margin: 0 0 6px; color: var(--ink-2); }
.choice-list { display: grid; gap: 8px; margin-top: 8px; }
.choice {
  display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; text-align: left;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2);
}
.choice:hover { border-color: var(--line-2); }
.choice span { font-size: 12.5px; color: var(--ink-3); }
.choice.danger strong { color: var(--bad); }
.choice.on { border-color: var(--brand); background: var(--brand-soft); }

/* detalhe */
.detail-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0 16px; text-align: center; }
.detail-hero p { margin: 0; }
.detail-amount { font-family: var(--display); font-size: 38px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; }
.detail-amount.income { color: var(--income); }
.detail-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.info { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.info-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 11px 14px; font-size: 14px; }
.info-row + .info-row { border-top: 1px solid var(--line); }
.info-row > span { color: var(--ink-3); flex: none; }
.info-row > strong { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-align: right; min-width: 0; }
.sub-block { margin-top: 16px; }
.sub-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 14px; }
.mini-row {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 10px;
  border-radius: 10px; font-size: 14px; text-align: left;
}
button.mini-row:hover { background: var(--surface-2); }
.mini-row + .mini-row { box-shadow: inset 0 1px 0 var(--line); }
.mini-row.child { padding-left: 30px; }
.mini-row.on { background: var(--brand-soft); }
.mini-row > span { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.mini-row strong { font-variant-numeric: tabular-nums; }
.mini-row .who { display: grid; gap: 1px; min-width: 0; text-align: left; }
.mini-row .who strong { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .who small { font-size: 12px; color: var(--ink-3); }

/* controle de acesso: linha do PIN e tabela de permissões por papel */
.pin-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; }
.pin-line > span { display: inline-flex; align-items: center; gap: 6px; }
.pin-line .ico { color: var(--brand); }
.perm-table th.c, .perm-table td.c { text-align: center; }
.perm-table td.yes { color: var(--ok); }
.perm-table td.no { color: var(--ink-3); }
.perm-table td:first-child { min-width: 180px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.stack { display: flex; flex-direction: column; min-width: 0; }
.stack strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack small { color: var(--ink-3); font-size: 12px; }
.warn-text { display: flex; align-items: center; gap: 6px; color: var(--warn); font-size: 13px; }
.due-list { display: grid; gap: 8px; }
.due-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.due-name { flex: 1; min-width: 0; display: flex; align-items: center; }
.due-name > span { display: flex; flex-direction: column; min-width: 0; }
.due-name strong { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-name small { font-size: 12px; color: var(--ink-3); }
.input.day { width: 78px; flex: none; text-align: center; }
.year-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.year-nav strong { font-family: var(--display); font-size: 21px; font-weight: 550; }
.month-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.month-grid button { height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 650; text-transform: capitalize; }
.month-grid button.now { border-color: var(--brand); color: var(--brand); }
.month-grid button.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.import-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.import-stats div { padding: 10px 4px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.import-stats strong { display: block; font-family: var(--display); font-size: 20px; font-weight: 550; }
.import-stats span { font-size: 11.5px; color: var(--ink-3); }
.activity-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.activity-row small { color: var(--ink-3); white-space: nowrap; }

/* ---------------------------------------------------------------- calendário */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.toolbar .seg { flex: none; }
.cal-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.cal-summary > div:first-child { grid-column: 1 / -1; flex-direction: row; align-items: baseline; flex-wrap: wrap; column-gap: 8px; }
.cal-summary > div:first-child strong { font-size: 17px; }
@container view (min-width: 600px) {
  .cal-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cal-summary > div:first-child { grid-column: auto; flex-direction: column; }
}
.cal-summary > div {
  display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.cal-summary span, .cal-summary small { font-size: 11.5px; color: var(--ink-3); }
.cal-summary strong { font-size: 14.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
strong.ok, .mini-totals strong.ok { color: var(--ok); }
strong.bad, .mini-totals strong.bad { color: var(--bad); }
.cal-layout { display: grid; gap: 14px; }
.cal-card { padding: 12px 10px; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); padding-bottom: 6px; text-align: center; font-size: 11px; font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-day {
  position: relative; min-width: 0; aspect-ratio: 1 / 1.1; padding: 6px 1px 4px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink); transition: background .12s;
}
.cal-day.out { visibility: hidden; }
.cal-day .n { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font-size: 14px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.cal-day.we .n { color: var(--ink-3); }
.cal-day.has { background: var(--surface-2); }
.cal-day:hover:not(.out) { background: var(--brand-soft); }
.cal-day.today .n { background: var(--brand); color: var(--brand-ink); }
.cal-day.sel { background: var(--brand-soft); box-shadow: inset 0 0 0 1.5px var(--brand); }
.cal-day .dots { display: flex; gap: 3px; height: 6px; }
.cal-day .dots i, .cal-legend i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.cal-day .amt { font-size: 10px; font-weight: 600; color: var(--ink-3); line-height: 1; letter-spacing: -.01em; }
.cal-day.done .amt { opacity: .6; }
i.bad { background: var(--bad-fill); }
i.warn { background: var(--warn-fill); }
i.info { background: var(--info-fill); }
i.ok { background: var(--ok-fill); }
i.income { background: transparent; box-shadow: inset 0 0 0 1.5px var(--income); }
.cal-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; padding-top: 12px; font-size: 11.5px; color: var(--ink-3); }
.cal-legend i { width: 7px; height: 7px; margin-right: 5px; vertical-align: 1px; }
.day-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 6px; }
.day-panel-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.day-panel-head p { margin: 2px 0 0; }
@container view (min-width: 760px) {
  .cal-layout { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
  .cal-layout .card + .card { margin-top: 0; }
  .day-panel { position: sticky; top: 24px; }
  .cal-day { aspect-ratio: 1 / .92; }
  .cal-day .amt { font-size: 11px; }
}
details.nodate { margin-top: 14px; }
details.nodate summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 650; font-size: 14px; color: var(--ink-2); }
details.nodate summary::-webkit-details-marker { display: none; }
details.nodate summary > span { display: inline-flex; align-items: center; gap: 8px; }
details.nodate[open] summary { margin-bottom: 8px; }
details.nodate[open] summary > .ico { transform: rotate(180deg); }
details.nodate .btn { margin-top: 10px; }
.agenda-day { margin-bottom: 14px; }
.agenda-date {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; padding: 8px 4px;
  background: var(--bg); font-size: 13px; color: var(--ink-2); text-transform: capitalize; font-variant-numeric: tabular-nums;
}
.agenda-day.is-today .agenda-date strong { color: var(--brand); }
.agenda-day .list { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px 10px; }

/* ---------------------------------------------------------------- lançamentos */
.entries-top { display: grid; gap: 12px; margin-bottom: 16px; }
.search {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-3);
}
.search:focus-within { border-color: var(--brand); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--ink); }
.mini-totals { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-3); }
.mini-totals strong { margin-left: 4px; color: var(--ink); font-variant-numeric: tabular-nums; }
.entries-top .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.entries-top .chips::-webkit-scrollbar { display: none; }
@container view (min-width: 640px) { .entries-top .chips { margin: 0; padding: 0; flex-wrap: wrap; } }
@container view (min-width: 1000px) {
  #entries-list { columns: 2; column-gap: 14px; }
  .cat-section { break-inside: avoid; }
}
.cat-section { margin-bottom: 12px; padding: 4px 12px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.cat-section-head { display: flex; align-items: center; gap: 8px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.cat-section-head h3 { flex: 1; margin: 0; font-size: 14.5px; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-section-head strong { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.cat-section .row:first-of-type { box-shadow: none; }

/* ---------------------------------------------------------------- dashboard */
/* Cores dos gráficos validadas para daltonismo (validate_palette.js, skill de dataviz), claro e escuro:
   s1 água · s2 laranja · s3 azul · s4 amarelo, sempre nessa ordem. q1–q5: rampa azul de intensidade.
   st-*: estados reservados (bom, atenção, crítico), sempre acompanhados de ícone e texto. */
:root {
  --s1: #1BAF7A; --s2: #EB6834; --s3: #2A78D6; --s4: #EDA100;
  --q1: #86B6EF; --q2: #5598E7; --q3: #2A78D6; --q4: #1C5CAB; --q5: #104281;
  --st-good: #0CA30C; --st-warn: #FAB219; --st-crit: #D03B3B;
  --delta-good: #006300; --delta-bad: #C23B2B;
}
:root[data-theme="dark"] {
  --s1: #199E70; --s2: #D95926; --s3: #3987E5; --s4: #C98500;
  --q1: #184F95; --q2: #1C5CAB; --q3: #2A78D6; --q4: #5598E7; --q5: #9EC5F4;
  --delta-good: #0CA30C; --delta-bad: #F07A6A;
}
.dash { display: grid; gap: 14px; }
.dash-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dash-filters .seg { flex: none; }
.dash-filters .month-switch { flex: 1 1 240px; }
.dash-top { display: grid; gap: 14px; }
@container view (min-width: 1000px) { .dash-top { grid-template-columns: minmax(300px, 1fr) minmax(0, 2fr); } }
.dash-hero {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px 20px; border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); border: 1px solid color-mix(in srgb, var(--brand) 12%, transparent);
}
.hero-figure { font-family: var(--font); font-size: clamp(36px, 11cqi, 52px); font-weight: 650; letter-spacing: -.025em; line-height: 1.05; }
.hero-figure.neg { color: var(--bad); }
.hero-facts {
  align-self: stretch; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0 0; padding-top: 12px;
  border-top: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
}
.hero-facts dt { font-size: 11.5px; color: var(--ink-3); }
.hero-facts dd { margin: 2px 0 0; font-size: 14px; font-weight: 650; }
.hero-facts dd.bad { color: var(--bad); }
.kpi-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@container view (min-width: 600px) { .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-1);
}
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.kpi-value { font-size: 22px; font-weight: 650; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-hint { font-size: 11.5px; color: var(--ink-3); }
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; margin-top: auto; padding-top: 6px; min-height: 34px; }
.spark { flex: none; max-width: 45%; height: auto; }
.spark path { fill: none; stroke: var(--ink-3); stroke-opacity: .5; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--s1); stroke: var(--surface); stroke-width: 2; }
.delta { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 3px; font-size: 12px; font-weight: 650; }
.delta b { font-size: 9px; }
.delta small { font-weight: 500; color: var(--ink-3); }
.delta.good { color: var(--delta-good); }
.delta.bad { color: var(--delta-bad); }
.delta.flat { color: var(--ink-3); }
@container view (max-width: 420px) { .kpi-value { font-size: 19px; } }

.dash-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@container view (min-width: 700px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid .span-2 { grid-column: span 2; }
}
@container view (min-width: 1240px) { .dash-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dash-grid .span-all { grid-column: 1 / -1; }
.card.dash-card { margin: 0; min-width: 0; container: card / inline-size; }
.dash-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.dash-card-head > div:not(.seg) { flex: 1 1 180px; min-width: 0; }
.dash-card-head h2 { margin: 0; font-size: 15.5px; font-weight: 650; }
.dash-card-head p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-3); }
.tv-toggle {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border-radius: 9px; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.tv-toggle[aria-pressed="true"] { background: var(--brand-soft); border-color: transparent; color: var(--brand); }

/* legendas e marcas */
.legend { display: flex; flex-wrap: wrap; margin: -8px 0 4px -8px; font-size: 12px; color: var(--ink-2); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px; border-radius: 8px; }
.legend .lg:hover { background: var(--surface-2); }
.legend .lg[aria-pressed="false"] { color: var(--ink-3); text-decoration: line-through; }
.legend .lg[aria-pressed="false"] i { opacity: .3; }
.sq { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; }
.ln { display: inline-block; flex: none; width: 14px; height: 2px; border-radius: 2px; }
.sq.s1, .ln.s1 { background: var(--s1); }
.sq.s2, .ln.s2 { background: var(--s2); }
.sq.s3, .ln.s3 { background: var(--s3); }
.sq.s4, .ln.s4 { background: var(--s4); }
.ln.ink { background: var(--ink); }
.sq.q1 { background: var(--q1); }
.sq.q2 { background: var(--q2); }
.sq.q3 { background: var(--q3); }
.sq.q4 { background: var(--q4); }
.sq.q5 { background: var(--q5); }
.sq.none { background: transparent; }

/* gráficos do Chart.js: o contêiner tem altura fixa e o canvas acompanha a largura do cartão */
.chart { position: relative; width: 100%; }
.chart canvas { display: block; border-radius: 8px; }
.chart-off { display: grid; place-items: center; height: 100%; margin: 0; padding: 0 16px; text-align: center; }
.donut-wrap { display: grid; gap: 12px 20px; align-items: center; }
@container card (min-width: 400px) { .donut-wrap { grid-template-columns: 184px minmax(0, 1fr); } }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; gap: 1px; text-align: center; pointer-events: none; }
.donut-center strong { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.donut-center small { font-size: 11.5px; color: var(--ink-3); }
.viz-tip {
  position: fixed; z-index: 95; min-width: 150px; max-width: 260px; padding: 9px 11px; pointer-events: none;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-3); font-size: 12.5px;
}
.viz-tip-t { margin-bottom: 4px; font-weight: 650; color: var(--ink-2); }
.viz-tip-r { display: grid; grid-template-columns: 14px auto minmax(0, 1fr); align-items: center; gap: 2px 8px; }
.viz-tip-r strong { font-variant-numeric: tabular-nums; }
.viz-tip-r span { color: var(--ink-3); }

/* barras horizontais, barra 100%, faixa de calor e medidores */
.hbars { display: grid; gap: 2px; }
.hbar { display: grid; gap: 6px; width: 100%; padding: 8px 6px; border-radius: 10px; text-align: left; }
.hbar:hover, .hbar:focus-visible { background: var(--surface-2); }
.hbar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; }
.hbar-label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-label .cat-dot { margin-right: 0; }
.hbar-value { font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hbar-value small { margin-left: 6px; font-weight: 500; color: var(--ink-3); }
.hbar-track { display: block; height: 10px; }
.hbar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--s1); }
.hbar .delta { font-size: 11.5px; }
.stack-legend { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.stack-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 40px; align-items: center; gap: 8px; font-size: 13.5px; }
.stack-legend strong { font-variant-numeric: tabular-nums; text-align: right; }
.stack-legend small { color: var(--ink-3); text-align: right; }
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.hc {
  aspect-ratio: 1; display: grid; place-items: center; border-radius: 7px; outline: none;
  font-size: 11.5px; font-weight: 650; color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line);
}
.hc[data-act] { cursor: pointer; }
.hc:focus-visible { box-shadow: 0 0 0 2px var(--brand); }
.hc.q1, .hc.q2, .hc.q3, .hc.q4, .hc.q5 { border-color: transparent; }
.hc.q1 { background: var(--q1); color: #0B0B0B; }
.hc.q2 { background: var(--q2); color: #0B0B0B; }
.hc.q3 { background: var(--q3); color: #FFFFFF; }
.hc.q4 { background: var(--q4); color: #FFFFFF; }
.hc.q5 { background: var(--q5); color: #FFFFFF; }
:root[data-theme="dark"] .hc.q1, :root[data-theme="dark"] .hc.q2, :root[data-theme="dark"] .hc.q3 { color: #FFFFFF; }
:root[data-theme="dark"] .hc.q4, :root[data-theme="dark"] .hc.q5 { color: #0B0B0B; }
.heat-scale { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 10px; font-size: 11.5px; color: var(--ink-3); }
.heat-scale .hc { width: 14px; height: 14px; aspect-ratio: auto; border-radius: 3px; }
.meters { display: grid; gap: 6px; }
.meter { padding: 6px 2px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 7px; font-size: 13.5px; }
.meter-label { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; }
.meter-label .cat-dot { margin-right: 0; }
.meter-state { font-size: 12.5px; color: var(--ink-2); text-align: right; }
.meter-state b { margin-right: 4px; font-weight: 800; }
.meter-track { height: 8px; border-radius: 99px; overflow: hidden; background: var(--track); }
.meter-track span { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--fill); }
.m-good { --fill: var(--st-good); --track: color-mix(in srgb, var(--st-good) 16%, var(--surface)); }
.m-warn { --fill: var(--st-warn); --track: color-mix(in srgb, var(--st-warn) 22%, var(--surface)); }
.m-crit { --fill: var(--st-crit); --track: color-mix(in srgb, var(--st-crit) 16%, var(--surface)); }
.m-none { --fill: var(--line-2); --track: var(--muted-soft); }
.m-good .meter-state b { color: var(--delta-good); }
.m-warn .meter-state b { color: var(--warn); }
.m-crit .meter-state, .m-crit .meter-state b { color: var(--bad); }
.meter-btn { display: block; width: 100%; padding: 4px 8px; border-radius: 10px; text-align: left; }
.meter-btn:hover { background: var(--surface-2); }

/* destaques, maiores despesas e tabela equivalente */
.insight-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
@container view (min-width: 900px) { .insight-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.insight { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; line-height: 1.4; }
.insight-icon { width: 28px; height: 28px; display: grid; place-items: center; flex: none; border-radius: 9px; }
.insight.bad .insight-icon { background: var(--bad-soft); color: var(--bad); }
.insight.warn .insight-icon { background: var(--warn-soft); color: var(--warn); }
.insight.ok .insight-icon { background: var(--ok-soft); color: var(--ok); }
.insight.info .insight-icon { background: var(--info-soft); color: var(--info); }
.top-list { display: grid; gap: 2px; }
.top-item { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 9px 6px; border-radius: 10px; text-align: left; }
.top-item:hover { background: var(--surface-2); }
.top-rank { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; background: var(--muted-soft); font-size: 12px; font-weight: 700; color: var(--ink-2); }
.top-main { display: flex; flex-direction: column; min-width: 0; }
.top-main strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-main small { display: inline-flex; align-items: center; font-size: 12px; color: var(--ink-3); }
.top-val { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tv-scroll { overflow-x: auto; }
table.tv { width: 100%; border-collapse: collapse; font-size: 13px; }
.tv th, .tv td { padding: 7px 8px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tv th { font-size: 11.5px; font-weight: 650; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.tv .n { text-align: right; font-variant-numeric: tabular-nums; }
.grid-scroll { overflow-x: auto; margin: 4px -16px 8px; padding: 0 16px; -webkit-overflow-scrolling: touch; }
table.grid { min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.grid th, .grid td { padding: 7px 10px; white-space: nowrap; text-align: right; border-bottom: 1px solid var(--line); }
.grid thead th { position: sticky; top: 0; background: var(--surface); color: var(--ink-3); font-weight: 650; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.grid tbody th, .grid thead th:first-child, .grid tfoot th {
  position: sticky; left: 0; z-index: 1; max-width: 190px; overflow: hidden; text-overflow: ellipsis; text-align: left; background: var(--surface);
}
.grid .grid-cat th, .grid .grid-cat td { background: var(--surface-2); font-weight: 700; }
.grid .grid-item th { padding-left: 24px; font-weight: 450; color: var(--ink-2); }
.grid td.z { color: var(--line-2); }
.grid td button { padding: 2px 5px; margin: -2px -5px; border-radius: 6px; font: inherit; }
.grid td button:hover { background: var(--brand-soft); color: var(--brand); }
.grid tfoot th, .grid tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--line-2); }
.grid td:last-child { font-weight: 650; }

/* ---------------------------------------------------------------- ajustes */
.settings { display: grid; gap: 20px; }
@container view (min-width: 700px) { .settings { grid-template-columns: 1fr 1fr; align-items: start; gap: 22px; } }
.set-group h2 { margin: 0 0 8px 4px; font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; }
.set-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.set-item { width: 100%; min-height: 60px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; }
.set-item + .set-item { border-top: 1px solid var(--line); }
button.set-item:hover { background: var(--surface-2); }
.set-item.static { flex-wrap: wrap; cursor: default; }
.set-item.static .seg { flex: 1 1 260px; }
.set-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.set-item.danger .set-icon { background: var(--bad-soft); color: var(--bad); }
.set-item.danger strong { color: var(--bad); }
.set-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-text strong { font-size: 14.5px; font-weight: 650; }
.set-text small { font-size: 12.5px; color: var(--ink-3); }
.set-right { display: flex; align-items: center; color: var(--ink-3); }
.toggle { position: relative; width: 44px; height: 26px; border-radius: 99px; background: var(--line-2); transition: background .2s; }
.toggle i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .2s; }
.toggle.on { background: var(--brand); }
.toggle.on i { transform: translateX(18px); }
.ok-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; }

/* ---------------------------------------------------------------- vazio, avisos, bloqueio */
.empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 12px; text-align: center; color: var(--ink-3); }
.empty-icon { width: 54px; height: 54px; margin-bottom: 6px; border-radius: 17px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-3); }
.empty-title { margin: 0; font-weight: 650; color: var(--ink-2); }
.empty-text { max-width: 340px; margin: 0 0 6px; font-size: 13px; }

.toasts {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index: 80;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none;
}
body.has-sheet .toasts { bottom: calc(var(--safe-b) + 90px); }
@media (min-width: 640px) { .toasts, body.has-sheet .toasts { bottom: 24px; } }
.toast {
  pointer-events: auto; max-width: 520px; display: flex; align-items: center; gap: 14px; padding: 11px 12px 11px 16px;
  border-radius: 14px; background: var(--toast-bg); color: var(--toast-ink); font-size: 14px; box-shadow: var(--shadow-3);
  opacity: 0; transform: translateY(10px); transition: opacity .22s, transform .22s;
}
.toast.show { opacity: 1; transform: none; }
.toast.bad { background: var(--bad); color: #fff; }
.toast-btn { padding: 4px 8px; border-radius: 8px; color: var(--toast-action); font-weight: 750; }
.toast.bad .toast-btn { color: #fff; text-decoration: underline; }

body.locked .app, body.locked #overlays, body.locked .toasts { visibility: hidden; }
.lock { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: var(--bg); transition: opacity .2s; }
.lock.out { opacity: 0; }
.lock-box { width: 100%; max-width: 380px; text-align: center; }
.lock-logo { display: block; margin: 0 auto 16px; border-radius: 15px; box-shadow: 0 12px 28px -14px rgba(13, 94, 75, .75); }
.lock h2 { margin: 0; font-family: var(--display); font-size: 25px; font-weight: 500; }
/* perfis (controle de acesso): quem está usando? */
.lock-people { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.lock-person {
  display: grid; justify-items: center; gap: 4px; width: 104px; padding: 14px 6px 12px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); transition: border-color .15s, transform .15s;
}
.lock-person:hover { border-color: var(--brand); transform: translateY(-2px); }
.lock-person .avatar { margin-bottom: 4px; font-size: 20px; }
.lock-person strong { max-width: 100%; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lock-person small { font-size: 11.5px; color: var(--ink-3); }
.lock-back { margin: 20px auto 0; }
.lock-msg { min-height: 20px; margin: 6px 0 20px; color: var(--ink-3); }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin-bottom: 28px; }
.pin-dots i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--ink-3); transition: background .12s, border-color .12s; }
.pin-dots i.on { background: var(--brand); border-color: var(--brand); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); justify-content: center; gap: 14px 24px; }
.keypad button {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); font-family: var(--display); font-size: 27px; font-weight: 500;
}
.keypad button:active { background: var(--brand-soft); }

/* ---------------------------------------------------------------- boas-vindas */
body.onboarding {
  background:
    radial-gradient(70% 45% at 50% -8%, var(--hero-from), transparent 72%),
    radial-gradient(55% 40% at 100% 30%, var(--hero-to), transparent 72%),
    var(--bg);
  background-attachment: fixed;
}
body.onboarding .tabbar, body.onboarding .sidebar, body.onboarding .topbar { display: none !important; }
body.onboarding .app { display: block; }
body.onboarding .view { max-width: 480px; padding-bottom: 40px; margin-left: auto; margin-right: auto; }
.onboard { min-height: calc(100dvh - 60px); display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 20px 2px; }
.onboard-brand { display: flex; justify-content: center; margin: 0 0 14px; }
.onboard-brand .brand-text strong { font-size: 34px; letter-spacing: -.03em; }
.onboard-brand .brand-text small { font-size: 11.5px; letter-spacing: .2em; }
.onboard-brand .brand-lockup { gap: 16px; }
.onboard-tag { margin: 2px 0 22px; font-size: 16px; color: var(--ink-2); }
.onboard-points { display: grid; gap: 9px; margin: 0 0 24px; padding: 0; list-style: none; text-align: left; }
.onboard-points li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; font-size: 14.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.onboard-points .ico { color: var(--brand); }
.onboard-actions { display: grid; gap: 10px; margin-bottom: 14px; }
.fatal { max-width: 440px; margin: 18vh auto; padding: 24px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
