* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Paleta vibrante. Os tons de acento têm croma alto de propósito — é um painel de dinheiro
   que a pessoa abre todo dia, e cor forte ajuda a distinguir as fontes de receita de relance.
   O texto e os números continuam quase pretos: a cor mora no fundo, nos ícones e nas barras,
   nunca em cima do valor em si, que precisa de contraste máximo pra ser lido rápido. */
:root {
  --bg: oklch(0.972 0.014 90);
  --card-bg: oklch(1 0 0);
  --card-border: oklch(0.92 0.012 90);
  --shadow: 0 1px 2px oklch(0.3 0.03 280 / 0.05), 0 14px 30px oklch(0.35 0.05 280 / 0.07);
  --shadow-soft: 1px 0 0 oklch(0.9 0.012 90), 4px 0 24px oklch(0.35 0.05 280 / 0.05);
  --text: oklch(0.22 0.035 285);
  --text-secondary: oklch(0.46 0.045 285);
  --row-hover: oklch(0.97 0.018 90);
  --row-border: oklch(0.93 0.012 90);
  --head-bg: oklch(0.94 0.022 90);

  --teal: oklch(0.58 0.16 168);
  --teal-dark: oklch(0.47 0.15 170);
  --teal-bg: oklch(0.93 0.075 168);
  --amber: oklch(0.66 0.17 72);
  --amber-bg: oklch(0.945 0.09 78);
  --purple: oklch(0.55 0.2 300);
  --purple-bg: oklch(0.93 0.08 300);
  --blue: oklch(0.57 0.18 252);
  --blue-bg: oklch(0.93 0.08 252);
  --red: oklch(0.6 0.21 25);
  --red-bg: oklch(0.94 0.085 25);

  /* Cores extras: cada fonte de receita e cada categoria de despesa ganha identidade
     própria, em vez de todas dividirem os mesmos quatro tons. */
  --pink: oklch(0.62 0.21 350);
  --pink-bg: oklch(0.94 0.08 350);
  --lime: oklch(0.64 0.19 135);
  --lime-bg: oklch(0.94 0.09 135);
  --cyan: oklch(0.62 0.14 212);
  --cyan-bg: oklch(0.93 0.075 212);
  --orange: oklch(0.65 0.19 45);
  --orange-bg: oklch(0.94 0.09 45);
  --indigo: oklch(0.5 0.19 275);
  --indigo-bg: oklch(0.93 0.075 275);

  /* Cores tiradas dos logos: azul do Vip Poke (99,196,255) e rosa do Vip Sushi (235,90,155). */
  --poke-azul: oklch(0.75 0.14 240);
  --poke-azul-bg: oklch(0.93 0.07 240);
  --sushi-rosa: oklch(0.66 0.19 355);
  --sushi-rosa-bg: oklch(0.93 0.07 355);
  --grad-poke: linear-gradient(135deg, oklch(0.82 0.12 235), oklch(0.7 0.16 248));
  --grad-sushi: linear-gradient(135deg, oklch(0.34 0.02 300), oklch(0.16 0.01 300));

  --grad-teal: linear-gradient(135deg, oklch(0.66 0.17 165), oklch(0.5 0.16 190));
  --grad-red: linear-gradient(135deg, oklch(0.68 0.2 35), oklch(0.55 0.22 15));
  --grad-purple: linear-gradient(135deg, oklch(0.63 0.2 305), oklch(0.48 0.21 288));
  --grad-blue: linear-gradient(135deg, oklch(0.66 0.16 240), oklch(0.5 0.19 262));
  --grad-amber: linear-gradient(135deg, oklch(0.76 0.16 85), oklch(0.62 0.19 55));
  --grad-neutro: linear-gradient(135deg, oklch(0.8 0.02 90), oklch(0.7 0.02 90));

  /* Liquid Glass: o material é a soma de três coisas — um preenchimento translúcido, o
     desfoque saturado do que está atrás, e um brilho especular na aresta de cima que dá a
     espessura. Sozinho, o blur parece só um borrão; é o brilho que faz virar vidro. */
  --glass-fill: oklch(1 0 0 / 0.76);
  --glass-fill-forte: oklch(1 0 0 / 0.95);
  --glass-borda: oklch(1 0 0 / 0.7);
  --glass-blur: saturate(200%) blur(30px);
  --glass-brilho: inset 0 1px 0 oklch(1 0 0 / 0.9), inset 0 -1px 0 oklch(0.5 0.05 285 / 0.07);
  --glass-sombra: 0 2px 6px oklch(0.3 0.06 285 / 0.08), 0 16px 40px oklch(0.3 0.08 285 / 0.16);
}

/* Malha de cor por trás de tudo. Precisa ser SATURADA de verdade: vidro sobre fundo quase
   branco não vira vidro, vira leite — no iOS o material só lê como material porque existe
   cor viva por baixo dele. O conteúdo fica em cartões brancos sólidos por cima, então a
   força da cor aqui não custa legibilidade nenhuma. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(46vw 44vw at 4% -4%, oklch(0.82 0.19 168), transparent 58%),
    radial-gradient(40vw 38vw at 99% 4%, oklch(0.8 0.2 305), transparent 60%),
    radial-gradient(50vw 42vw at 84% 99%, oklch(0.84 0.19 55), transparent 60%),
    radial-gradient(42vw 42vw at 12% 96%, oklch(0.8 0.18 250), transparent 60%),
    radial-gradient(38vw 34vw at 52% 42%, oklch(0.85 0.16 340 / 0.7), transparent 62%);
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: oklch(0.94 0.03 90);
  color: var(--text);
  font-family: 'Manrope', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'IBM Plex Mono', monospace; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: oklch(0.55 0.04 285 / 0.28); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

button { font-family: inherit; }

/* ---------- Login ---------- */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border: none;
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 40px 34px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-logo {
  width: 52px;
  height: 52px;
  border-radius: 17px;
  background: var(--grad-teal);
  box-shadow: 0 8px 20px oklch(0.58 0.16 168 / 0.4);
  margin-bottom: 6px;
}
.login-title { font-weight: 800; font-size: 22px; letter-spacing: -.02em; }
.login-sub { font-weight: 600; font-size: 12.5px; color: var(--text-secondary); margin-top: -14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.field input {
  border: 1.5px solid var(--card-border);
  border-radius: 13px;
  padding: 12px 14px;
  /* 16px é o mínimo — abaixo disso o Safari do iOS dá zoom automático ao focar o campo. */
  font-size: 16px;
  font-family: inherit;
  background: white;
  color: var(--text);
}
.field input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-bg); }
.field select {
  border: 1.5px solid var(--card-border); border-radius: 13px; padding: 12px 14px;
  font-size: 16px; font-family: inherit; background: white; color: var(--text);
}
.field select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-bg); }
.checkbox-field {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--text-secondary); line-height: 1.4;
}
.checkbox-field input[type='checkbox'] { width: 17px; height: 17px; flex-shrink: 0; accent-color: var(--teal); margin: 0; }
.btn-primary {
  background: var(--grad-teal);
  color: white;
  border: none;
  border-radius: 13px;
  padding: 12px 18px;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: 0 4px 12px oklch(0.58 0.16 168 / 0.3);
  transition: transform .12s ease, box-shadow .2s ease;
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 6px 18px oklch(0.58 0.16 168 / 0.38); }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.login-error { color: var(--red); font-size: 12.5px; font-weight: 700; min-height: 16px; }

/* ---------- App shell ---------- */
#app-screen { display: none; height: 100vh; width: 100%; overflow: hidden; }
#app-screen.visible { display: flex; }

/* Painel flutuante em vez de coluna coberta até a borda: no iOS 26 a navegação paira sobre
   o conteúdo, com o fundo passando por baixo. */
.sidebar {
  width: 244px;
  flex-shrink: 0;
  background: var(--glass-fill);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-borda);
  border-radius: 26px;
  box-shadow: var(--glass-brilho), var(--glass-sombra);
  display: flex;
  flex-direction: column;
  padding: 20px 12px calc(18px + env(safe-area-inset-bottom, 0px)) 12px;
  margin: calc(14px + env(safe-area-inset-top, 0px)) 0 14px calc(14px + env(safe-area-inset-left, 0px));
  gap: 3px;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 26px 10px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 13px; flex-shrink: 0;
  background: var(--grad-teal);
  box-shadow: 0 6px 16px oklch(0.58 0.16 168 / 0.36);
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 800; font-size: 16.5px; line-height: 1.2; letter-spacing: -.01em; }
.brand-sub { font-weight: 600; font-size: 11.5px; color: var(--text-secondary); letter-spacing: .02em; }

.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 14px;
  cursor: pointer; font-size: 13.5px; font-weight: 700; color: var(--text-secondary); border: none;
  background: transparent; width: 100%; text-align: left;
  transition: background .18s ease, color .18s ease;
}
.nav-item:hover { background: oklch(1 0 0 / 0.55); color: var(--text); }
/* Item ativo é uma lâmina de vidro sobre o painel, não um retângulo pintado. */
.nav-item.active {
  background: var(--glass-fill-forte); color: var(--text);
  box-shadow: var(--glass-brilho), 0 2px 8px oklch(0.35 0.06 285 / 0.1);
}
/* Ladrilho colorido em toda linha, como a lista de Ajustes do iOS: o ícone é o que dá
   identidade à tela, então ele é colorido sempre — o estado ativo se marca pelo vidro atrás,
   não por acender o ícone. */
.nav-icon {
  width: 29px; height: 29px; border-radius: 9px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; color: white; background: var(--nav-grad, var(--grad-neutro));
  box-shadow: 0 2px 5px oklch(0.35 0.06 285 / 0.18), inset 0 1px 0 oklch(1 0 0 / 0.35);
  transition: transform .18s ease;
}
.nav-item.active .nav-icon { transform: scale(1.06); }

/* Lojas Gerais e Vip Poke levam a marca real no lugar de um ícone genérico. É o MESMO arquivo
   de silhueta nos dois, pintado por `background` — daí as duas saírem com exatamente o mesmo
   recorte, proporção e centralização, sem depender de acertar dois desenhos separados.
   `contain` + altura de 74% dá a folga lateral que o dragão (alto e estreito) precisa pra
   não encostar na borda do ladrilho. */
.marca {
  display: block; width: 100%; height: 100%;
  -webkit-mask: url('/marca-dragao.png') center / auto 84% no-repeat;
  mask: url('/marca-dragao.png') center / auto 84% no-repeat;
}
.marca-sushi { background: oklch(0.68 0.2 355); }
.marca-poke { background: oklch(0.18 0.02 260); }
/* No cartão do Dashboard o ladrilho é maior, então a marca pode respirar um pouco mais. */
.marca-kpi { -webkit-mask-size: auto 80%; mask-size: auto 80%; }
.logout-btn {
  margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 12px;
  cursor: pointer; font-size: 13px; font-weight: 700; color: oklch(0.45 0.04 285); border: none;
  background: transparent; width: 100%; text-align: left;
}
.logout-btn:hover { background: var(--red-bg); color: var(--red); }
.sidebar-footer {
  padding: 12px 14px 0 14px; font-size: 11px;
  color: oklch(0.45 0.04 285); font-weight: 600; letter-spacing: .02em;
}
.sidebar-backdrop { display: none; }

#boot-loading {
  position: fixed; inset: 0; z-index: 200; background: none;
  display: flex; align-items: center; justify-content: center;
}
.boot-logo {
  width: 52px; height: 52px; border-radius: 17px;
  background: var(--grad-teal);
  box-shadow: 0 8px 22px oklch(0.58 0.16 168 / 0.4);
  animation: boot-pulse 1.1s ease-in-out infinite;
}
@keyframes boot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.92); }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

/* Vidro fosco: o conteúdo passa por baixo ao rolar em vez de bater numa barra opaca.
   O fundo semi-sólido é o fallback onde backdrop-filter não existe. */
.header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(22px + env(safe-area-inset-top, 0px)) 36px 22px 36px;
  background: var(--glass-fill); backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-borda); border-radius: 24px;
  box-shadow: var(--glass-brilho), var(--glass-sombra);
  margin: 14px 14px 0 14px; padding-left: 26px; padding-right: 14px;
  flex-wrap: wrap; z-index: 10; position: relative;
}
.header-title { font-size: 23px; font-weight: 800; letter-spacing: -.025em; display: flex; align-items: center; gap: 12px; }
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: 10px; }
.period-pill {
  display: flex; align-items: center; gap: 6px; padding: 5px; border-radius: 16px;
  background: oklch(0.55 0.03 285 / 0.07); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.period-btn {
  /* 36px em vez de 30px — mais perto do alvo de toque mínimo recomendado (44pt) sem
     desproporcionar a pílula de período. */
  width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-weight: 800; color: oklch(0.5 0.02 90); background: var(--card-bg);
  box-shadow: 0 1px 2px oklch(0.3 0.02 90 / 0.06); border: none; font-size: 16px;
}
.period-label { font-size: 13.5px; font-weight: 700; min-width: 130px; text-align: center; }

.alerts-bar { display: flex; gap: 10px; padding: 16px 28px 4px 28px; flex-wrap: wrap; background: none; }
.alert-chip {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 9px; font-size: 12.5px;
  font-weight: 700; cursor: pointer; border: 1px solid; background: none; font-family: inherit;
}
.alert-chip.alta { background: oklch(0.94 0.085 25 / 0.72); color: var(--red); border-color: oklch(1 0 0 / 0.5); }
.alert-chip.media { background: oklch(0.945 0.09 78 / 0.72); color: oklch(0.5 0.14 70); border-color: oklch(1 0 0 / 0.5); }
.alert-chip {
  padding: 0; gap: 0; border-radius: 14px;
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  box-shadow: var(--glass-brilho);
}
.alert-chip-main {
  display: flex; align-items: center; gap: 8px; padding: 8px 4px 8px 14px; background: none;
  border: none; font: inherit; color: inherit; cursor: pointer; font-weight: 700;
}
.alert-chip-go { opacity: .7; font-weight: 800; white-space: nowrap; }
.alert-chip-snooze {
  background: none; border: none; color: inherit; opacity: .5; cursor: pointer; font-family: inherit;
  font-size: 16px; line-height: 1; padding: 8px 12px 8px 6px;
}
.alert-chip-snooze:hover { opacity: 1; }

.content {
  flex: 1; overflow: auto; -webkit-overflow-scrolling: touch;
  padding: 10px 28px calc(40px + env(safe-area-inset-bottom, 0px)) 28px;
  background: none;
}

/* ---------- Movimento (transições de tela, contagem, feedback de salvar) ---------- */
#top-progress {
  position: absolute; top: 0; left: 0; height: 2px; width: 30%; background: var(--teal);
  z-index: 15; opacity: 0; pointer-events: none;
}
#top-progress.loading { opacity: 1; animation: progress-slide 1s ease-in-out infinite; }
@keyframes progress-slide {
  0% { width: 0%; margin-left: 0%; }
  50% { width: 55%; margin-left: 25%; }
  100% { width: 0%; margin-left: 100%; }
}

@keyframes content-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.content-enter { animation: content-fade-in .28s ease; }

@keyframes save-flash-pulse {
  0% { box-shadow: 0 0 0 0 oklch(0.55 0.1 165 / 0.45); }
  100% { box-shadow: 0 0 0 7px oklch(0.55 0.1 165 / 0); }
}
.save-flash { animation: save-flash-pulse .6s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .content-enter, .save-flash, #top-progress.loading, .chart-bar, .source-row-fill {
    animation: none !important; transition: none !important;
  }
}

/* Cartão de conteúdo é OPACO de propósito. Vidro é material de navegação; número de dinheiro
   pede fundo sólido e contraste máximo. Translúcido aqui foi o que deixou tudo lavado. */
.card {
  background: oklch(1 0 0); border: none; border-radius: 22px;
  box-shadow: 0 1px 2px oklch(0.3 0.06 285 / 0.08), 0 10px 30px oklch(0.3 0.08 285 / 0.12);
  overflow: hidden;
}

/* ---------- Estado vazio / repetir mês anterior ---------- */
.empty-month {
  display: flex; align-items: center; gap: 16px; padding: 18px 22px; margin-bottom: 18px;
  background: var(--amber-bg); border: 1px solid oklch(0.87 0.05 85); border-radius: 16px;
}
.empty-month-icon { color: var(--amber); flex-shrink: 0; display: flex; }
.empty-month-text { flex: 1; min-width: 0; }
.empty-month-title { font-weight: 800; font-size: 14.5px; color: oklch(0.42 0.09 75); }
.empty-month-sub { font-size: 12.5px; font-weight: 600; color: oklch(0.5 0.05 80); line-height: 1.5; margin-top: 3px; }
.empty-month-btn { flex-shrink: 0; }

.empty-state { padding: 34px 24px; text-align: center; }
.empty-state-title { font-weight: 800; font-size: 15px; }
.empty-state-sub { font-size: 13px; color: var(--text-secondary); font-weight: 600; margin-top: 6px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 16px); background: var(--text); color: white; font-size: 13px;
  font-weight: 700; padding: 12px 18px; border-radius: 12px; z-index: 200; opacity: 0;
  transition: opacity .25s ease, transform .25s ease; max-width: min(460px, calc(100vw - 32px));
  text-align: center; line-height: 1.45; box-shadow: 0 8px 24px oklch(0.2 0.02 90 / 0.28);
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Busca em lista ---------- */
.search-box {
  display: flex; align-items: center; gap: 9px; margin: 0 4px 12px 4px; padding: 0 15px;
  background: oklch(1 0 0 / 0.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-borda); border-radius: 15px;
  box-shadow: var(--glass-brilho); color: var(--text-secondary); max-width: 340px;
}
.search-box input {
  flex: 1; border: none; background: none; padding: 11px 0; font-family: inherit;
  /* 16px é o mínimo — abaixo disso o Safari do iOS dá zoom automático ao focar o campo. */
  font-size: 16px; color: var(--text); outline: none; min-width: 0;
}
.search-hidden { display: none !important; }

/* ---------- Dashboard ---------- */
/* O saldo é a resposta pra "como foi o mês" — sai da fileira de KPIs e vira o card
   principal. Antes tudo tinha o mesmo peso visual e o olho não sabia onde pousar. */
/* O número que responde "como foi o mês". Tudo aqui existe pra ele ser lido de longe: peso
   máximo, tracking fechado, e um banho de cor de baixa intensidade no card inteiro em vez de
   uma tarja lateral — a cor informa o sinal sem competir com o valor. */
.hero-card {
  padding: 34px 36px 32px 36px; margin-bottom: 16px; position: relative; overflow: hidden;
}
.hero-card::after {
  content: ''; position: absolute; inset: 0; opacity: .5; pointer-events: none;
}
.hero-positivo::after { background: radial-gradient(120% 140% at 100% 0%, var(--teal-bg), transparent 62%); }
.hero-negativo::after { background: radial-gradient(120% 140% at 100% 0%, var(--red-bg), transparent 62%); }
.hero-neutro::after { background: radial-gradient(120% 140% at 100% 0%, oklch(0.96 0.012 90), transparent 62%); }
.hero-card > * { position: relative; z-index: 1; }
.hero-label { font-size: 11.5px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .08em; }
.hero-value {
  font-size: 58px; font-weight: 800; letter-spacing: -.045em; line-height: 1.02; margin-top: 10px;
  font-variant-numeric: tabular-nums;
}
.hero-positivo .hero-value { color: var(--teal-dark); }
.hero-negativo .hero-value { color: var(--red); }
.hero-neutro .hero-value { color: oklch(0.75 0.015 90); }
.hero-sub { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-top: 8px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 30px; }
.kpi-card { padding: 24px 26px; display: flex; flex-direction: column; gap: 16px; }
/* Ícone em gradiente com sombra da própria cor: o acento vive num objeto pequeno e sólido,
   não espalhado pelo card. */
.kpi-icon {
  width: 40px; height: 40px; border-radius: 13px; display: flex; align-items: center;
  justify-content: center; color: white !important;
}
.kpi-label { font-size: 11px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .07em; }
.kpi-value { font-size: 27px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }

.section-title {
  font-size: 12px; font-weight: 800; color: oklch(0.34 0.05 285); margin: 0 4px 12px 4px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  text-transform: uppercase; letter-spacing: .07em;
}
.legend { display: flex; align-items: center; gap: 14px; font-size: 12px; font-weight: 700; color: var(--text-secondary); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; }

.chart-card { padding: 24px 24px 16px 24px; margin-bottom: 24px; }
.chart-bars { display: flex; align-items: flex-end; gap: 18px; height: 190px; position: relative; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; min-width: 0; }
.chart-saldo { font-size: 11.5px; font-weight: 800; white-space: nowrap; }
/* Rótulo só no mês aberto no seletor: os 6 ao mesmo tempo viravam ruído em cima das barras.
   Nos outros o valor sai no toque (tooltip), então o dado continua acessível. */
.chart-saldo-oculto { visibility: hidden; }
.chart-pair { display: flex; align-items: flex-end; gap: 6px; height: 140px; width: 100%; justify-content: center; position: relative; }
.chart-bar { width: 26px; border-radius: 8px 8px 3px 3px; min-height: 3%; transition: height .6s cubic-bezier(.2, .8, .2, 1); cursor: pointer; }
.chart-bar-entrada { background: var(--grad-teal) !important; }
.chart-bar-saida { background: var(--grad-red) !important; }
.chart-col-atual .chart-bar { box-shadow: 0 0 0 2px oklch(1 0 0), 0 0 0 3.5px currentColor; }
.chart-month { font-size: 12px; font-weight: 700; color: oklch(0.5 0.02 90); text-transform: capitalize; }
.chart-col-atual .chart-month { color: var(--text); font-weight: 800; }

/* A linha de saldo é o que o usuário realmente quer ler (sobrou ou faltou), e as barras
   sozinhas obrigavam a comparar duas alturas de cabeça. Fica por cima, sem capturar clique
   pra não roubar o toque das barras. */
.chart-line { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.chart-saldo-line { fill: none; stroke: oklch(0.38 0.05 285); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-saldo-dot { fill: white; stroke: oklch(0.38 0.05 285); stroke-width: 2.5; }
.chart-zero-line { stroke: oklch(0.88 0.015 90); stroke-width: 1; stroke-dasharray: 2 5; stroke-linecap: round; }
.legend-dot-line { width: 14px; height: 2.5px; border-radius: 2px; background: oklch(0.38 0.05 285); }
.chart-tooltip {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 8px;
  background: var(--text); color: white; font-size: 11px; font-weight: 700; padding: 5px 9px;
  border-radius: 7px; white-space: nowrap; pointer-events: none; z-index: 5;
}

/* ---------- Dívidas em Aberto ---------- */
.debt-total-inline { font-size: 14px; font-weight: 800; color: var(--red); }
.debt-card { padding: 8px 22px; }
.debt-row { padding: 14px 0; border-top: 1px solid oklch(0.94 0.008 85); }
.debt-row:first-child { border-top: none; }
.debt-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.debt-name { font-weight: 700; font-size: 13.5px; }
.debt-quitado {
  color: var(--teal-dark); font-weight: 800; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .04em; background: var(--teal-bg); padding: 2px 7px; border-radius: 5px; margin-left: 6px;
}
.debt-saldo { font-size: 14px; font-weight: 700; }
.debt-progress-track { height: 6px; border-radius: 4px; background: oklch(0.93 0.01 85); overflow: hidden; }
.debt-progress-fill { height: 100%; background: var(--grad-amber); border-radius: 4px; transition: width .5s ease; }
.debt-progress-done { background: var(--grad-teal); }
.debt-meta { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); margin-top: 6px; }

/* Financiamento pago sai da lista principal e vem pra cá recolhido: continua consultável,
   mas para de empurrar pra baixo o que ainda se deve. */
.debt-quitados { margin-bottom: 24px; }
.debt-quitados > summary {
  cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--text-secondary);
  padding: 8px 4px; list-style: none; display: flex; align-items: center; gap: 7px;
}
.debt-quitados > summary::-webkit-details-marker { display: none; }
.debt-quitados > summary::before { content: '▸'; font-size: 10px; transition: transform .18s ease; }
.debt-quitados[open] > summary::before { transform: rotate(90deg); }
.debt-quitados > summary:hover { color: var(--text); }

/* ---------- Projeção de fluxo de caixa ---------- */
.projection-note {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-secondary); background: oklch(0.94 0.012 90); padding: 3px 8px; border-radius: 6px;
}
.projection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.projection-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.projection-month { font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: capitalize; }
.projection-saldo { font-size: 19px; font-weight: 700; margin: 2px 0 4px; }
.projection-detail { font-size: 11px; font-weight: 600; color: var(--text-secondary); }

.source-list { overflow: hidden; }
.source-row {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px; padding: 13px 22px; border-top: 1px solid oklch(0.94 0.008 85);
  cursor: pointer; background: none; border-left: none; border-right: none; border-bottom: none; width: 100%;
  text-align: left; font-family: inherit; color: inherit;
}
.source-row:first-child { border-top: none; }
.source-row:hover { background: var(--row-hover); }
.source-row-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%; z-index: 0;
  transition: width .7s cubic-bezier(.2, .8, .2, 1);
}
.source-dot, .source-label, .source-value { position: relative; z-index: 1; }
.source-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.source-label { flex: 1; font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.source-value { font-size: 14.5px; font-weight: 600; }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th { text-align: right; padding: 10px 14px; font-weight: 700; color: var(--text-secondary); background: var(--head-bg); white-space: nowrap; }
thead th:first-child, thead th.col-name { text-align: left; }
thead tr:first-child th:first-child { border-top-left-radius: 17px; }
thead tr:first-child th:last-child { border-top-right-radius: 17px; }
tbody td { padding: 9px 14px; text-align: right; }
tbody td:first-child, tbody td.col-name { text-align: left; font-weight: 700; white-space: nowrap; }
tbody tr { border-top: 1px solid var(--row-border); }
tfoot td { padding: 12px 14px; text-align: right; font-weight: 800; border-top: 2px solid oklch(0.88 0.01 85); background: var(--head-bg); }
tfoot td:first-child { text-align: left; }
tfoot tr:last-child td:first-child { border-bottom-left-radius: 17px; }
tfoot tr:last-child td:last-child { border-bottom-right-radius: 17px; }
.row-propria { background: oklch(0.965 0.035 155); }
.row-franquia { background: oklch(0.995 0.004 85); }
.sticky-col { position: sticky; left: 0; background: inherit; }

.cell-value { font-family: 'IBM Plex Mono', monospace; font-weight: 600; }
.editable { cursor: pointer; }
.editable:hover { background: oklch(0.96 0.012 90); }
.edit-input {
  /* 16px fixo (não "inherit" do 12.5px da tabela) — abaixo disso o Safari do iOS dá zoom
     automático ao focar o campo, o que atrapalha muito editar valor numa tabela densa. */
  font-family: 'IBM Plex Mono', monospace; font-size: 16px; font-weight: 600; text-align: right;
  width: 100%; border: 1px solid var(--teal); border-radius: 6px; padding: 2px 4px; background: white; color: var(--text);
}

/* ---------- Fechamento ---------- */
.fechamento-header { font-size: 13px; font-weight: 700; color: var(--text-secondary); margin: 4px 4px 10px 4px; }
.col-previsto { background: oklch(0.97 0.025 165); }
th.col-previsto { background: var(--teal-bg); color: oklch(0.4 0.1 165); font-weight: 800; }
tfoot td.col-previsto { background: var(--teal-bg); }

.fechamento-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.fechamento-toolbar .fechamento-header { margin: 0 0 0 4px; }

/* 4 colunas com a diferença — cabe confortável até ~760px, e esticar além disso só
   afastaria Previsão de Realizado, que é justamente a comparação que a tela existe pra fazer. */
.card-fechamento { max-width: 760px; }

/* A diferença é o que justifica a tela existir: sem ela, comparar Previsão x Realizado
   linha a linha é conta de cabeça. */
.col-diferenca { text-align: right; white-space: nowrap; }
th.col-diferenca { color: var(--text-secondary); }
.dif { font-weight: 700; font-size: 13px; }
.dif-positiva { color: var(--teal-dark); }
.dif-negativa { color: var(--red); }
.dif-pct { font-weight: 600; opacity: .7; font-size: 11.5px; }
.dif-vazia { color: oklch(0.78 0.01 85); }
.realizado-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.realizado-suggestion {
  font-size: 10.5px; font-weight: 700; color: var(--teal); background: var(--teal-bg);
  border: none; border-radius: 5px; padding: 2px 6px; cursor: pointer; white-space: nowrap;
}
.realizado-suggestion:hover, .realizado-suggestion:active { background: var(--teal); color: white; }

/* ---------- Poke ---------- */
.poke-year-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.poke-summary-chip {
  background: var(--card-bg); border: 1px solid var(--card-border); box-shadow: var(--shadow);
  border-radius: 14px; padding: 14px 16px; font-family: inherit; text-align: left; color: inherit;
}
/* "Sem destino" é o maior número em aberto do sistema; era só um texto vermelho parado.
   Vira botão que filtra a grade pras linhas que realmente têm repasse pendente. */
button.poke-summary-chip { cursor: pointer; }
button.poke-summary-chip:disabled { cursor: default; opacity: .75; }
.poke-summary-cta { font-size: 11px; font-weight: 800; color: var(--amber); margin-top: 6px; }
.poke-summary-ativo { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber-bg); }
.poke-summary-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-secondary); margin-bottom: 6px; }
.poke-summary-value { font-size: 18px; font-weight: 700; }
.poke-summary-pessoal .poke-summary-value { color: var(--purple); }
.poke-summary-loja .poke-summary-value { color: var(--teal); }
.poke-summary-pendente .poke-summary-value { color: var(--amber); }
.poke-hint { font-size: 12px; font-weight: 600; color: var(--text-secondary); margin: 0 4px 10px 4px; }
.poke-cell-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.poke-cell {
  display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 6px 10px;
  border-radius: 8px; font-family: 'IBM Plex Mono', monospace; font-weight: 600; cursor: pointer; border: none;
  background: transparent; color: inherit; font-size: inherit;
}
.poke-edit-btn {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 28px; height: 28px; border-radius: 7px; border: none; background: transparent;
  color: oklch(0.68 0.02 90); cursor: pointer;
}
.poke-edit-btn:hover { background: oklch(0.94 0.012 90); color: var(--text); }
.poke-cell.pessoal { background: var(--purple-bg); color: var(--purple); }
.poke-cell.loja { background: var(--teal-bg); color: var(--teal-dark); }
.poke-add-week { display: flex; align-items: center; gap: 8px; margin: 0 4px 12px 4px; }
.poke-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.poke-toolbar .search-box { margin: 0 0 0 4px; }

/* ---------- Imóveis ---------- */
.imoveis-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin: 0 4px 14px 4px;
}
.imoveis-hint { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
/* auto-fit (não auto-fill) com minmax: com 4 imóveis a grade acomoda os 4 na mesma linha em
   tela larga em vez de deixar o quarto sozinho embaixo, que ficava com cara de inacabado. */
.imoveis-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.imovel-card { padding: 22px 24px; display: flex; flex-direction: column; gap: 13px; }
.imovel-icon { width: 40px; height: 40px; border-radius: 13px; display: flex; align-items: center; justify-content: center; color: white !important; }
.imovel-label { font-size: 12.5px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .03em; }
.imovel-value { font-family: 'IBM Plex Mono', monospace; font-size: 23px; font-weight: 600; letter-spacing: -.02em; }
.imovel-sub { font-size: 12px; font-weight: 600; color: oklch(0.6 0.02 90); }

/* ---------- Histórico ---------- */
.historico-hint { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin: 0 4px 12px 4px; }
.historico-list { padding: 0; }
.historico-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%;
  padding: 13px 22px; border: none; border-top: 1px solid oklch(0.94 0.008 85);
  background: none; font-family: inherit; color: inherit; text-align: left; cursor: pointer;
}
.historico-row:first-child { border-top: none; }
.historico-row:hover { background: var(--row-hover); }
.historico-main { min-width: 0; }
.historico-label { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.historico-meta { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); margin-top: 3px; }
.historico-valores { display: flex; align-items: center; gap: 8px; flex-shrink: 0; font-size: 12.5px; }
.historico-antes { color: var(--text-secondary); text-decoration: line-through; }
.historico-seta { color: oklch(0.75 0.01 85); }
.historico-depois { font-weight: 700; }
.historico-acao {
  flex-shrink: 0; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-secondary); background: oklch(0.95 0.012 90); padding: 3px 8px; border-radius: 6px;
}

/* ---------- Lojas Gerais: card por loja (celular) ---------- */
/* A tabela de 7 colunas em 375px obrigava a rolar pro lado a cada campo, o que inviabilizava
   lançar dados pelo telefone. Card empilhado resolve; no computador a tabela continua melhor
   (dá pra comparar as lojas entre si de relance), então as duas formas coexistem. */
.lojas-cards { display: none; }
.loja-card { padding: 16px 18px; margin-bottom: 12px; }
.loja-card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.loja-card-rank {
  font-size: 11px; font-weight: 800; color: var(--text-secondary); background: oklch(0.95 0.012 90);
  border-radius: 6px; padding: 2px 7px; flex-shrink: 0;
}
.loja-card-name { flex: 1; font-weight: 800; font-size: 14px; min-width: 0; }
.loja-card-tipo {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 6px; flex-shrink: 0;
}
.row-propria .loja-card-tipo { background: var(--teal-bg); color: var(--teal-dark); }
.row-franquia .loja-card-tipo { background: oklch(0.95 0.012 90); color: var(--text-secondary); }
.loja-card-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.loja-card-field { min-width: 0; }
.loja-card-label { font-size: 10.5px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .03em; }
.loja-card-value {
  font-family: 'IBM Plex Mono', monospace; font-size: 15px; font-weight: 600; margin-top: 2px;
  padding: 4px 6px; margin-left: -6px; border-radius: 7px; cursor: pointer;
}
.loja-card-value:hover { background: var(--row-hover); }

/* ---------- Despesas ---------- */
.lojas-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 4px 10px 4px; flex-wrap: wrap; }
.lojas-toolbar-actions { display: flex; gap: 8px; }
.despesas-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 4px 10px 4px; flex-wrap: wrap; }
.despesas-hint { color: oklch(0.65 0.02 90); font-weight: 600; }
.legend-despesas { flex-wrap: wrap; gap: 8px 16px; }
.legend-despesas strong { color: var(--text); font-weight: 800; }
.legend-despesas .legend-dot { width: 11px; height: 11px; }
.store-name-btn {
  background: none; border: none; padding: 0; margin: 0; cursor: pointer; text-align: left;
  font: inherit; color: inherit;
}
.store-name-btn:hover { color: var(--teal-dark); text-decoration: underline; }

.category-summary { display: flex; gap: 9px; flex-wrap: wrap; margin: 0 4px 16px 4px; }
/* Cada categoria com sua cor: o resumo deixa de ser seis retângulos iguais e vira algo que
   dá pra ler de relance ("o vermelho é cartão"). */
.category-chip {
  display: flex; align-items: center; gap: 9px; padding: 9px 15px; border-radius: 14px;
  background: var(--card-bg); border: none; box-shadow: var(--shadow);
}
.category-chip-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--cat-color, var(--text-secondary)); }
.category-chip-label { font-size: 11px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; }
.category-chip-value { font-size: 13.5px; font-weight: 700; letter-spacing: -.02em; color: var(--cat-color, var(--text)); }
.cat-cartao { --cat-color: var(--red); }
.cat-emprestimo { --cat-color: var(--amber); }
.cat-casa { --cat-color: var(--blue); }
.cat-pessoal { --cat-color: var(--purple); }
.cat-escola { --cat-color: var(--cyan); }
.cat-saude { --cat-color: var(--pink); }
.cat-outro { --cat-color: var(--text-secondary); }

.col-current-month { background: oklch(0.96 0.03 165); }
thead th.col-current-month { background: oklch(0.9 0.05 165); color: oklch(0.4 0.1 165); }
tfoot td.col-current-month { background: oklch(0.9 0.05 165); }

.expense-loan-btn {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; border: none; background: transparent;
  color: oklch(0.68 0.02 90); font-size: 11px; font-weight: 800; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.expense-loan-btn:hover { background: var(--amber-bg); color: var(--amber); }
.loan-badge { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.loan-badge-track { width: 44px; height: 4px; border-radius: 3px; background: oklch(0.93 0.01 85); overflow: hidden; }
.loan-badge-fill { height: 100%; background: var(--grad-amber); border-radius: 3px; }
.loan-badge-text { font-size: 10px; font-weight: 700; color: var(--text-secondary); font-family: 'IBM Plex Mono', monospace; }

/* Zebra bem sutil — só aparece nas frestas/células vazias, já que os valores lançados têm
   fundo próprio (cor do status). Ajuda a acompanhar uma linha específica na grade densa. */
.despesas-table tbody tr:nth-child(even) { background: oklch(0.985 0.006 85); }
.btn-add {
  display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; font-size: 12.5px;
  font-weight: 700; cursor: pointer; background: var(--teal); color: white; border: none;
}
.btn-add:hover { background: var(--teal-dark); }
.expense-name-cell { display: flex; align-items: center; gap: 2px; }
.expense-remove {
  cursor: pointer; color: oklch(0.7 0.02 90); font-size: 14px; line-height: 1; background: none; border: none;
  /* padding + margem negativa: aumenta a área de toque sem empurrar o layout ao redor. */
  padding: 8px; margin: -8px;
}
.expense-remove:hover { color: var(--red); }
.expense-cell {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 7px; font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px; font-weight: 600; cursor: pointer; white-space: nowrap; border: none;
}
.expense-cell.previsto { background: var(--amber-bg); color: var(--amber); }
.expense-cell.pago { background: var(--teal-bg); color: var(--teal-dark); }
.expense-cell.lojaPaga { background: var(--blue-bg); color: var(--blue); }
/* Célula sem lançamento: sem cor de status, pra não parecer uma "previsão" que existe. */
.expense-cell.vazia { background: none; color: oklch(0.78 0.01 85); }

/* Escolha direta do status, no lugar da bolinha de 6px que ciclava. Cada opção é um alvo
   grande, mostra o que significa e leva ao estado desejado num toque só. */
.status-opcoes { display: flex; flex-direction: column; gap: 7px; }
.status-opcao {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; width: 100%;
  padding: 10px 13px; border-radius: 10px; border: 1.5px solid var(--card-border);
  background: var(--card-bg); font-family: inherit; cursor: pointer; text-align: left;
}
.status-opcao-label { font-size: 13.5px; font-weight: 800; }
.status-opcao-hint { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); }
.status-opcao:hover { border-color: oklch(0.82 0.02 85); }
.status-previsto.status-ativo { background: var(--amber-bg); border-color: var(--amber); }
.status-previsto.status-ativo .status-opcao-label { color: var(--amber); }
.status-pago.status-ativo { background: var(--teal-bg); border-color: var(--teal); }
.status-pago.status-ativo .status-opcao-label { color: var(--teal-dark); }
.status-lojaPaga.status-ativo { background: var(--blue-bg); border-color: var(--blue); }
.status-lojaPaga.status-ativo .status-opcao-label { color: var(--blue); }
/* O botão em si é maior (14x14) que o pontinho visível (6x6, via ::after) — só o visual
   fica pequeno, a área de toque real é maior, sem deixar a grade densa mais "inchada". */
.status-dot {
  width: 14px; height: 14px; flex-shrink: 0; border: none; padding: 0; background: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.status-dot::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; }
th.sticky-col, td.sticky-col { position: sticky; left: 0; z-index: 1; }
thead th.sticky-col { background: var(--head-bg); }
tbody td.sticky-col { background: oklch(0.995 0.004 85); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: oklch(0.25 0.03 285 / 0.28); display: flex; align-items: center;
  justify-content: center; z-index: 100; padding: 20px;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.modal-card {
  background: oklch(1 0 0 / 0.9); backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  border: 1px solid var(--glass-borda); border-radius: 26px;
  box-shadow: var(--glass-brilho), 0 24px 60px oklch(0.25 0.05 285 / 0.24);
  padding: 26px 26px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 15px;
}
.modal-card-wide { max-width: 520px; }
.modal-title { font-weight: 800; font-size: 15px; }
.modal-hint { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.modal-hint code { background: oklch(0.95 0.012 90); padding: 2px 5px; border-radius: 5px; font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; }
.import-textarea {
  width: 100%; font-family: 'IBM Plex Mono', monospace; font-size: 12px; padding: 10px 12px;
  border: 1px solid var(--card-border); border-radius: 10px; resize: vertical; color: var(--text);
}
.import-result { font-size: 12.5px; font-weight: 600; min-height: 16px; }
.import-result-error { color: var(--red); }
.import-result-warning { color: var(--amber); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-secondary {
  background: none; border: 1px solid var(--card-border); border-radius: 10px; padding: 9px 14px;
  font-weight: 700; font-size: 13px; cursor: pointer; color: var(--text);
}
.btn-danger { background: var(--red); color: white; border: none; border-radius: 10px; padding: 9px 14px; font-weight: 700; font-size: 13px; cursor: pointer; }

/* ---------- Touch feedback (:hover não é confiável em touchscreen — :active dá o retorno tátil) ---------- */
.nav-item:active { background: oklch(0.94 0.014 90); }
.logout-btn:active { background: var(--red-bg); color: var(--red); }
.source-row:active { background: var(--row-hover); }
.alert-chip:active { filter: brightness(0.96); }
.period-btn:active { background: oklch(0.9 0.01 85); }
.btn-primary:active { background: var(--teal-dark); }
.btn-add:active { background: var(--teal-dark); }
.btn-secondary:active { background: oklch(0.94 0.012 90); }
.editable:active { background: oklch(0.94 0.012 90); }
.poke-cell:active { filter: brightness(0.95); }
.poke-edit-btn:active { background: oklch(0.9 0.012 90); }
.expense-cell:active { filter: brightness(0.95); }
.expense-remove:active { color: var(--red); }
.expense-loan-btn:active { background: var(--amber-bg); color: var(--amber); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  /* A gaveta agora tem margem (painel flutuante), então translateX(-100%) deixaria a
     margem aparecendo como uma lasca branca na borda — daí o deslocamento extra. */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    margin: 10px; transform: translateX(calc(-100% - 20px));
    transition: transform .28s cubic-bezier(.32, .72, 0, 1);
    box-shadow: var(--glass-brilho), 0 20px 50px oklch(0.3 0.08 285 / 0.28);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open {
    display: block; position: fixed; inset: 0; background: oklch(0.2 0.02 90 / 0.35); z-index: 19;
  }
  .hamburger { display: flex; align-items: center; justify-content: center; }
  .header {
    padding: calc(14px + env(safe-area-inset-top, 0px)) 14px 14px 18px;
    margin: 10px 10px 0 10px; border-radius: 22px;
  }
  .content { padding: 8px 10px calc(32px + env(safe-area-inset-bottom, 0px)) 10px; }
  .alerts-bar { padding: 12px 10px 2px 10px; }
  .kpi-value { font-size: 22px; }
  .period-label { min-width: 96px; font-size: 12px; }

  /* No celular a tabela de lojas vira card por loja — ver comentário em .lojas-cards. */
  .lojas-tabela { display: none; }
  .lojas-cards { display: block; }

  .hero-value { font-size: 40px; }
  .hero-card { padding: 24px 22px; }

  /* Alerta que quebra em duas linhas fica centralizado por herança do flex — no celular,
     onde ele quase sempre quebra, isso deixa o texto desalinhado da margem do cartão. */
  .alert-chip-main { text-align: left; align-items: flex-start; }
  .alert-chip-main svg { margin-top: 2px; flex-shrink: 0; }

  /* Ícone ao lado do texto em vez de acima: um card por linha empilhado verticalmente
     desperdiçava meia tela em espaço vazio. */
  .kpi-card { flex-direction: row; align-items: center; gap: 16px; padding: 18px 20px; }
  .kpi-icon { width: 44px; height: 44px; }
  .kpi-value { font-size: 24px; }
  .empty-month { flex-direction: column; align-items: flex-start; gap: 12px; padding: 16px 18px; }
  .empty-month-btn { width: 100%; }
  .search-box { max-width: none; }
  .fechamento-toolbar, .imoveis-toolbar { flex-direction: column; align-items: stretch; }
  .card-fechamento { max-width: none; }
  .chart-bar { width: 18px; }
  .historico-row { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .toast, .debt-quitados > summary::before { transition: none !important; }
}
