/* ════════════════════════════════════════════════════════════════════════════
   GranaSpace — Design System
   Paleta: Verde-água & Branco Neutro  ·  Interface clara e arejada + topo escuro
   ════════════════════════════════════════════════════════════════════════════ */

:root {
  --ink:         #0F2A2E;   /* topo, navbar, sidebar, texto forte */
  --ink-soft:    #163A37;
  --ink-2:       #1C4640;
  --primary:     #12B886;   /* CTA, acento, valores positivos */
  --primary-dark:#0E9E76;
  --mint:        #14B8A6;   /* links, destaques */
  --teal:        #0EA5A4;
  --gold:        #E0A53E;   /* premium / PRO */
  --gold-dark:   #C98A2A;
  --pos:         #0E9E76;   /* entradas */
  --neg:         #E5484D;   /* saídas */
  --warn:        #F59E0B;
  --info:        #3B82F6;
  --danger:      #EF4444;

  --text:        #13312E;   /* corpo */
  --text-2:      #2C4B46;
  --muted:       #6A8079;   /* secundário */
  --bg:          #F4FAF8;   /* fundo claro, arejado */
  --surface:     #FFFFFF;
  --surface-2:   #EFF6F3;
  --border:      #E2EEE9;
  --border-2:    #D5E5DF;

  --radius:      14px;
  --radius-sm:   10px;
  --radius-lg:   20px;
  --shadow-sm:   0 1px 3px rgba(15,42,46,0.06);
  --shadow:      0 4px 20px rgba(15,42,46,0.08), 0 1px 4px rgba(15,42,46,0.04);
  --shadow-lg:   0 12px 48px rgba(15,42,46,0.14);

  --font-brand: 'Plus Jakarta Sans', Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-ui:    'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--bg);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, .font-brand { font-family: var(--font-brand); letter-spacing: -0.02em; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.text-primary-gs { color: var(--primary) !important; }
.text-gold  { color: var(--gold)  !important; }
.text-ink   { color: var(--ink)   !important; }
.text-muted-gs { color: var(--muted) !important; }
.amount-pos { color: var(--pos) !important; font-variant-numeric: tabular-nums; }
.amount-neg { color: var(--neg) !important; font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }

/* ── Brand wordmark ──────────────────────────────────────────────────────── */
.brand-grana { color: #fff;          font-family: var(--font-brand); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.03em; }
.brand-space  { color: var(--primary);font-family: var(--font-brand); font-weight: 800; font-size: 1.3rem; letter-spacing: -0.03em; }
.gs-footer .brand-grana { color: #fff; }

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.gs-navbar {
  background: var(--ink) !important;
  padding: 0.7rem 0;
  position: sticky; top: 0; z-index: 1000;
  box-shadow: 0 2px 18px rgba(0,0,0,0.18);
}
.gs-navbar .nav-link { color: rgba(255,255,255,0.72) !important; font-weight: 500; font-size: 0.92rem; }
.gs-navbar .nav-link:hover { color: #fff !important; }
.gs-logo-dot {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--teal));
  display: grid; place-items: center; color: #fff; font-size: 0.85rem;
  box-shadow: 0 3px 10px rgba(18,184,134,0.4);
}

/* Seletor de espaço */
.gs-ws-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.12);
  color: #fff; border-radius: 10px; padding: 5px 12px; font-size: 0.85rem; font-weight: 600;
}
.gs-ws-btn:hover { background: rgba(255,255,255,0.12); }
.gs-ws-emoji { font-size: 1rem; }
.gs-ws-menu { border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); padding: 6px; min-width: 240px; }
.gs-ws-menu .ws-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 0.88rem; }
.gs-ws-menu .ws-item:hover { background: var(--surface-2); }
.gs-ws-menu .ws-item.active { background: rgba(18,184,134,0.1); color: var(--primary-dark); font-weight: 600; }
.gs-ws-menu .ws-role { margin-left: auto; font-size: 0.68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* Sino de notificações */
.gs-bell { position: relative; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.06); }
.gs-bell:hover { color: #fff; background: rgba(255,255,255,0.12); }
.gs-bell-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); border: 1.5px solid var(--ink); }

/* Avatar / menu do usuário */
/* inline-flex é necessário aqui: .gs-avatar usa `display:grid` (bloco), o que
   sem isso empurra a seta do dropdown (::after) pra uma linha abaixo do
   círculo em vez de ficar ao lado — ficava "embolado" no mobile. */
.gs-avatar-btn { display: inline-flex; align-items: center; background: transparent; border: none; padding: 0; }
.gs-avatar-btn::after { color: rgba(255,255,255,0.5); margin-left: 4px; flex-shrink: 0; }
.gs-avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 0.95rem; }
.gs-user-menu { border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); padding: 6px; min-width: 210px; }
.gs-user-menu .dropdown-item { border-radius: 8px; font-size: 0.9rem; padding: 0.5rem 0.75rem; }
.gs-user-menu .dropdown-item:hover { background: var(--surface-2); }

.gs-trial-pill { background: rgba(224,165,62,0.16); color: #FAD79A; border: 1px solid rgba(224,165,62,0.45); font-weight: 600; }
.gs-trial-pill:hover { color: #fff; }

/* ── Banners ─────────────────────────────────────────────────────────────── */
.gs-banner { text-align: center; padding: 0.5rem 1rem; font-size: 0.85rem; font-weight: 500; }
.gs-banner a, .gs-banner-link { color: inherit; text-decoration: underline; font-weight: 600; background: none; border: none; }
.gs-banner-trial { background: linear-gradient(90deg, var(--gold-dark), var(--gold)); color: #2a1c00; }
.gs-banner-info  { background: rgba(59,130,246,0.1); color: #1D4ED8; border-bottom: 1px solid rgba(59,130,246,0.2); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-gs-primary {
  background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm);
  font-weight: 700; padding: 0.6rem 1.3rem; transition: all .18s; box-shadow: 0 4px 14px rgba(18,184,134,0.32);
}
.btn-gs-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(18,184,134,0.42); }
.btn-gs-primary:disabled { opacity: .55; box-shadow: none; transform: none; }

.btn-gs-ghost { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,0.35); border-radius: var(--radius-sm); font-weight: 600; padding: 0.6rem 1.2rem; transition: all .18s; }
.btn-gs-ghost:hover { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.6); }

.btn-gs-outline { background: var(--surface); color: var(--primary-dark); border: 1.5px solid var(--border-2); border-radius: var(--radius-sm); font-weight: 600; padding: 0.55rem 1.1rem; transition: all .18s; align-items: center;}
.btn-gs-outline:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--surface-2); }

.btn-gs-gold { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: #fff; border: none; border-radius: var(--radius-sm); font-weight: 700; padding: 0.6rem 1.3rem; transition: all .2s; box-shadow: 0 4px 16px rgba(224,165,62,0.4); }
.btn-gs-gold:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 7px 22px rgba(224,165,62,0.5); }

.btn-gs-soft { background: rgba(18,184,134,0.1); color: var(--primary-dark); border: 1.5px solid rgba(18,184,134,0.25); border-radius: var(--radius-sm); font-weight: 600; padding: 0.45rem 0.95rem; font-size: 0.85rem; transition: all .15s; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn-gs-soft:hover { background: rgba(18,184,134,0.18); color: var(--primary-dark); border-color: var(--primary); }

.btn-gs-danger-soft { background: rgba(229,72,77,0.08); color: var(--neg); border: 1.5px solid rgba(229,72,77,0.22); border-radius: var(--radius-sm); font-weight: 600; padding: 0.45rem 0.95rem; font-size: 0.85rem; }
.btn-gs-danger-soft:hover { background: rgba(229,72,77,0.16); color: var(--neg); }

.btn:active { transform: translateY(1px); }

/* ── Badges / chips ──────────────────────────────────────────────────────── */
.badge-pro  { background: var(--gold); color: #fff; font-weight: 700; font-size: 0.62rem; padding: 3px 8px; border-radius: 6px; letter-spacing: .05em; text-transform: uppercase; }
.badge-role { font-size: 0.62rem; padding: 2px 8px; border-radius: 20px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge-role.owner  { background: rgba(224,165,62,0.16); color: var(--gold-dark); }
.badge-role.editor { background: rgba(18,184,134,0.14); color: var(--primary-dark); }
.badge-role.viewer { background: rgba(106,128,121,0.14); color: var(--muted); }
.gs-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 4px 11px; font-size: 0.78rem; font-weight: 600; color: var(--text-2); }
.gs-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.gs-pill-btn { background: transparent; border: 1px solid var(--border-2); color: var(--muted); border-radius: 20px; font-size: 0.76rem; font-weight: 600; padding: 4px 13px; margin-bottom: 5px; transition: all .15s; }
.gs-pill-btn:hover { background: var(--surface-2); color: var(--text); }
.gs-pill-btn.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.gs-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.dash-card { border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 1.4rem; margin-bottom: 1.25rem; }
.dash-card h5 { font-weight: 700; color: var(--text); margin-bottom: 1rem; font-size: 1rem; }
/* Grid (não position:absolute) — o ícone vira uma coluna de verdade, do
   tamanho dele mesmo, então o texto nunca pode invadir esse espaço, não
   importa o tamanho do valor/rótulo nem a largura do card. Funciona
   independente da ordem do ícone no DOM (alguns call sites colocam
   .stat-ic antes de .lbl/.val/.sub, outros depois — grid-column/row
   ignora a ordem de origem). */
.stat-card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); padding: 1.3rem; height: 100%; position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; column-gap: .6rem; align-items: start;
}
.stat-card .lbl { grid-column: 1; grid-row: 1; font-size: 0.74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: 0.35rem; }
/* .val/.sub ocupam a largura toda (grid-column 1/-1): ficam sempre na linha
   abaixo do ícone, então usar o espaço da coluna dele não arrisca sobrepor —
   e é o que o botão dentro de .sub (ex.: toggle saldo total/mês) espera pra
   encostar de verdade na borda direita do card com ms-auto. */
/* clamp (não breakpoints fixos) — escala suave com a largura da viewport em
   vez de saltos entre tamanhos fixos; substitui os overrides inline que
   cada tela vinha aplicando por conta própria (painel.html, contas.js). */
.stat-card .val { grid-column: 1 / -1; grid-row: 2; font-size: clamp(1.15rem, 5.2vw, 1.9rem); font-weight: 800; color: var(--text); line-height: 1; font-family: var(--font-brand); font-variant-numeric: tabular-nums; }
.stat-card .sub { grid-column: 1 / -1; grid-row: 3; font-size: 0.78rem; color: var(--muted); margin-top: 0.35rem; }
/* A aparência do selo do ícone vale em QUALQUER lugar: o /perfil usa .stat-ic
   solto dentro de .dash-card (seções "Indique e ganhe", "Conhecendo o app" e
   a zona de perigo), e ali o ícone ficava descolado do canto porque o
   display:grid morava no seletor descendente. Do .stat-card fica só o que é
   específico dele: a posição na grade do cartão. */
.stat-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 1.05rem; flex-shrink: 0; }
.stat-card .stat-ic { grid-column: 2; grid-row: 1; }
.stat-ic.green { background: rgba(18,184,134,0.12); color: var(--primary); }
.stat-ic.red   { background: rgba(229,72,77,0.1);  color: var(--neg); }
.stat-ic.gold  { background: rgba(224,165,62,0.14); color: var(--gold-dark); }
.stat-ic.blue  { background: rgba(59,130,246,0.1);  color: var(--info); }
.stat-ic.ink   { background: rgba(15,42,46,0.08);   color: var(--ink); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.gs-label { color: var(--text-2); font-size: 0.82rem; font-weight: 600; margin-bottom: 0.35rem; display: block; }
.gs-input, .form-control.gs-input, .form-select.gs-input {
  background: var(--surface); border: 1.5px solid var(--border-2); color: var(--text);
  border-radius: var(--radius-sm); padding: 0.6rem 0.85rem; font-size: 0.92rem; transition: all .15s; width: 100%;
}
.gs-input::placeholder { color: #9DB0AA; }
.gs-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(18,184,134,0.14); background: #fff; }
.gs-input:disabled { background: var(--surface-2); opacity: .7; cursor: not-allowed; }
.gs-input-sm { padding: 0.35rem 0.6rem; font-size: 0.82rem; }
.gs-help { font-size: 0.76rem; color: var(--muted); margin-top: 0.3rem; }

/* Botão discreto (lápis) pra editar um valor exibido inline — ex.: vencimento
   de uma fatura em renderBillBlock. */
.btn-link-edit { background: none; border: none; padding: 0 0 0 5px; color: var(--muted); font-size: 0.72rem; cursor: pointer; }
.btn-link-edit:hover { color: var(--primary); }

/* ── Calculadora no campo de valor (PRO) ─────────────────────────────────── */
.amt-field { position: relative; }
.amt-field .gs-input { padding-right: 2.35rem; }
.amt-calc-btn {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  width: 28px; height: 28px; border: none; background: transparent; border-radius: 8px;
  color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: all .15s;
}
.amt-calc-btn:hover { background: var(--surface-2); color: var(--primary); }

/* ── Calculadora (overlay, recurso PRO) ──────────────────────────────────── */
.calc-backdrop {
  position: fixed; inset: 0; background: rgba(15,42,46,0.55); backdrop-filter: blur(2px);
  z-index: 1300; display: none; align-items: center; justify-content: center; padding: 1rem;
}
.calc-backdrop.show { display: flex; animation: fadeIn .2s ease; }
.calc-modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 340px; padding: 1.4rem; }
.calc-display { background: var(--surface-2); border-radius: var(--radius-sm); padding: .9rem 1rem; margin-bottom: 1rem; text-align: right; }
.calc-display-op { font-size: .82rem; color: var(--muted); min-height: 1.1em; }
.calc-display-main { font-size: 2rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.2; word-break: break-all; }
.calc-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.calc-btn {
  height: 52px; border: 1px solid var(--border-2); background: var(--surface); border-radius: var(--radius-sm);
  font-size: 1.1rem; font-weight: 600; color: var(--text); cursor: pointer; transition: all .1s;
}
.calc-btn:active { transform: scale(0.95); }
.calc-btn:hover { background: var(--surface-2); }
.calc-btn.calc-fn { background: var(--surface-2); color: var(--text-2); font-size: .95rem; }
.calc-btn.calc-op { background: var(--primary); color: #fff; border-color: var(--primary); }
.calc-btn.calc-op:hover { background: var(--primary-dark); }
.calc-btn.calc-eq { background: var(--ink); color: #fff; border-color: var(--ink); }
.calc-btn.calc-zero { grid-column: span 2; }

/* ── Flatpickr (seletor de mês) — acentos do design system ──────────────── */
.gs-month-input { cursor: pointer; text-align: center; }
.flatpickr-calendar { font-family: 'Inter', sans-serif; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.flatpickr-current-month .cur-year { font-weight: 600; }
.flatpickr-monthSelect-month.selected,
.flatpickr-monthSelect-month.startRange,
.flatpickr-monthSelect-month.endRange { background-color: var(--primary); border-color: var(--primary); }
.flatpickr-monthSelect-month.today { border-color: var(--primary); }
.flatpickr-monthSelect-month:hover,
.flatpickr-monthSelect-month:focus { background: var(--surface-2); border-color: var(--surface-2); outline: 0; }
.flatpickr-monthSelect-month.flatpickr-disabled { color: var(--border-2); }

/* Seletor de tipo entrada/saída (segmented) */
.gs-segment { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 3px; }
.gs-segment button { border: none; background: transparent; border-radius: 8px; padding: 0.4rem 0.9rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .15s; }
.gs-segment button.active.income  { background: var(--pos); color: #fff; }
.gs-segment button.active.expense { background: var(--neg); color: #fff; }
.gs-segment button.active.transfer{ background: var(--info); color: #fff; }

/* ── Tables / list rows ──────────────────────────────────────────────────── */
.gs-table { width: 100%; border-collapse: collapse; }
.gs-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; }
.gs-table td { padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.gs-table tr:last-child td { border-bottom: none; }
.gs-table tbody tr:hover { background: var(--surface-2); }

/* Cada linha é seu próprio "card" (borda + fundo + padding) em vez de só uma
   divisória entre itens — separa visualmente um lançamento do outro. */
.tx-row { display: flex; align-items: center; gap: 12px; padding: 0.75rem 0.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; }
.tx-row:last-child { margin-bottom: 0; }
/* Consolidado: já foi resolvido, perde ênfase pra não competir com o que
   ainda precisa de atenção. Vencido: ganha destaque (o oposto). */
.tx-row-paid .tx-desc { font-weight: 500; color: var(--text-2); }
.tx-row-overdue { background: rgba(229,72,77,.05); border-color: rgba(229,72,77,.35); }
.tx-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 1rem; flex-shrink: 0; }
.tx-main { min-width: 0; flex: 1; }
.tx-desc { font-weight: 600; color: var(--text); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-row-stack .tx-desc,
.tx-row-stack .tx-desc .text-truncate {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
.tx-meta { font-size: 0.76rem; color: var(--muted); }
/* Data por extenso de "Próximas contas", em linha própria — texto corrido,
   sem o visual de pílula do .gs-chip (que é compartilhado com filtros/tags
   em outras telas e não deve mudar globalmente). */
.tx-date-full { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
.tx-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Valor à esquerda (junto do resto do conteúdo), tick sempre à direita —
   lado a lado (não empilhado), com respiro entre os dois. Em telas
   estreitas (.tx-row-stack/.tx-row-pay em display:block), esta caixa vira
   um bloco de largura cheia e o space-between empurra o tick até a borda
   direita de verdade; no desktop (ainda flex), os dois ficam simplesmente
   colados no fim da linha (a caixa encolhe ao conteúdo, sem espaço extra
   pra distribuir). */
.tx-amount-col { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
/* Botão de consolidar dentro da linha do lançamento (contas.js "A pagar/
   receber" e painel.js "Próximas contas") — só o tick, sem texto, padronizado
   entre as duas telas. Menor que um .gs-pill-btn comum (que o media de toque
   logo abaixo infla pra 36px) pra não competir com o valor acima dele. */
.tx-pay-btn { width: 26px; height: 26px; padding: 0; display: grid; place-items: center; font-size: .72rem; border-radius: 50%; flex-shrink: 0; }
/* Tick verde (só indicativo, sem interação) no lugar do .tx-pay-btn quando o
   lançamento já está consolidado — mesmo tamanho/formato, sem virar botão. */
.tx-paid-tick { width: 26px; height: 26px; display: grid; place-items: center; font-size: .72rem; border-radius: 50%; flex-shrink: 0; background: rgba(14,158,118,.14); color: var(--pos); }
@media (hover: none) and (pointer: coarse) {
  /* seletor composto (.gs-pill-btn.tx-pay-btn) — precisa vencer em
     especificidade a regra global .gs-pill-btn{min-height:36px} que vem
     depois no arquivo (mesma pegadinha do toggle "Saldo total" já corrigida). */
  .gs-pill-btn.tx-pay-btn { min-height: 0; }
}
/* Listas com mais conteúdo por linha que um .tx-row comum (painel.js
   "Próximas contas"/"Lançamentos recentes", lancamentos.js #txList) espremiam
   ícone + texto + valor (+ botão de consolidar, quando existe) numa linha só
   em telas estreitas. Empilha nessas (mesma solução já usada em contas.js
   pra "A pagar/receber": o gap do .tx-row continua funcionando em
   display:block, então o espaçamento se mantém). */
@media (max-width: 680px) {
  .tx-row-stack { display: block; }
}

.cat-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ── Progress / barras ───────────────────────────────────────────────────── */
.gs-progress { height: 8px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.gs-progress > span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary-dark), var(--primary)); transition: width .5s ease; }
.gs-progress.warn  > span { background: linear-gradient(90deg, #d98a12, var(--warn)); }
.gs-progress.danger> span { background: linear-gradient(90deg, #c0392b, var(--neg)); }

/* ── App layout (sidebar + conteúdo) ─────────────────────────────────────── */
.app-layout { display: flex; min-height: calc(100vh - var(--navbar-h, 58px)); }
.app-sidebar {
  width: 240px; flex-shrink: 0; background: var(--ink); padding: 1.1rem 0 1rem;
  position: sticky; top: var(--navbar-h, 58px); height: calc(100vh - var(--navbar-h, 58px)); overflow-y: auto;
  display: flex; flex-direction: column;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.05);
}
.sidebar-section { padding: 0.4rem 1.25rem 0.4rem; font-size: 0.64rem; color: rgba(255,255,255,0.32); text-transform: uppercase; letter-spacing: .09em; font-weight: 700; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 11px; padding: 0.6rem 1rem; margin: 1px 10px;
  color: rgba(255,255,255,0.6); font-size: 0.88rem; font-weight: 500; border-radius: 10px; transition: all .16s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar-nav a.active { background: rgba(18,184,134,0.16); color: var(--primary); font-weight: 600; }
.sidebar-nav a i { width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-foot { margin-top: auto; padding: 0.5rem 10px 0; }
.sidebar-logout { display: flex; align-items: center; gap: 11px; padding: 0.6rem 1rem; color: rgba(255,255,255,0.45); font-size: 0.88rem; border-radius: 10px; }
.sidebar-logout:hover { background: rgba(229,72,77,0.14); color: #FCA5A5; }

.app-main { flex: 1; min-width: 0; background: var(--bg); }
.app-topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0.85rem 1.5rem; display: flex; align-items: center; gap: 1rem; position: sticky; top: var(--navbar-h, 58px); z-index: 20; box-shadow: var(--shadow-sm); }
.app-topbar h1 { font-size: 1.1rem; font-weight: 800; color: var(--text); margin: 0; font-family: var(--font-brand); }
/* overflow-x mora aqui (não em .app-main) de propósito: .app-main é ANCESTRAL
   da .app-topbar (position:sticky) — overflow != visible num ancestral quebra
   o cálculo de sticky em alguns engines, fazendo a topbar ficar "grudada" e
   cobrir o conteúdo logo abaixo dela (ex.: as abas de #contasTabs) mesmo sem
   rolar a página. .app-content é irmã da topbar, não ancestral — protege
   contra overflow horizontal do conteúdo sem quebrar o sticky. */
.app-content { padding: 1.5rem; overflow-x: hidden; }

/* Tabs mobile */
.app-tabs-mobile-wrap { display: none; position: sticky; top: var(--navbar-h, 58px); z-index: 19; background: var(--surface); border-bottom: 1px solid var(--border); }
.app-tabs-mobile { display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; white-space: nowrap; padding: 0 4px; }
.app-tabs-mobile::-webkit-scrollbar { display: none; }
.app-tabs-mobile .tab-mobile { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; flex: 0 0 auto; padding: 8px 11px 6px; min-width: 58px; font-size: 0.66rem; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; }
.app-tabs-mobile .tab-mobile i { font-size: 1rem; }
.app-tabs-mobile .tab-mobile.active { color: var(--primary-dark); border-bottom-color: var(--primary); }

/* Bottom nav */
.app-bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--ink); border-top: 1px solid rgba(255,255,255,0.08); z-index: 1100; }
.app-bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px; color: rgba(255,255,255,0.45); font-size: 0.62rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.app-bottom-nav a i { font-size: 1.05rem; }
.app-bottom-nav a.active { color: var(--primary); }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.gs-empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.gs-empty i { font-size: 2.2rem; color: var(--border-2); margin-bottom: 0.75rem; display: block; }
.gs-empty h6 { color: var(--text-2); font-weight: 700; margin-bottom: 0.25rem; }

/* ── Upgrade prompt (PRO) ────────────────────────────────────────────────── */
.upgrade-prompt { background: linear-gradient(160deg, rgba(224,165,62,0.08), rgba(255,255,255,0)); border: 1px solid rgba(224,165,62,0.25); border-top: 3px solid var(--gold); border-radius: var(--radius); padding: 1.75rem; text-align: center; max-width: 460px; margin: 0 auto; }
.upgrade-prompt .up-ic { width: 50px; height: 50px; border-radius: 50%; background: rgba(224,165,62,0.14); display: grid; place-items: center; margin: 0 auto 0.75rem; color: var(--gold-dark); font-size: 1.3rem; }
.upgrade-prompt h4 { font-weight: 800; font-size: 1.05rem; margin-bottom: 0.4rem; }
.upgrade-prompt p { color: var(--muted); font-size: 0.88rem; margin-bottom: 1.25rem; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast-msg { position: fixed; bottom: 24px; right: 24px; padding: 0.85rem 1.4rem; border-radius: 12px; font-weight: 600; font-size: 0.9rem; z-index: 9999; opacity: 0; transform: translateY(10px); transition: all .3s; max-width: 340px; box-shadow: var(--shadow-lg); color: #fff; }
.toast-msg.show { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--primary); }
.toast-error   { background: var(--neg); }
.toast-info    { background: var(--ink); }

/* ── Loaders ─────────────────────────────────────────────────────────────── */
.spinner-gs { width: 38px; height: 38px; border: 3px solid rgba(18,184,134,0.2); border-top-color: var(--primary); border-radius: 50%; animation: spin .75s linear infinite; margin: 2rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.9rem; padding: 2rem; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.fx-in { animation: fadeIn .28s ease both; }
.fx-stagger > * { animation: fadeIn .3s ease both; }
.fx-stagger > *:nth-child(2){ animation-delay: .04s; }
.fx-stagger > *:nth-child(3){ animation-delay: .08s; }
.fx-stagger > *:nth-child(4){ animation-delay: .12s; }
.fx-stagger > *:nth-child(n+5){ animation-delay: .16s; }

/* ── Modal helper (overlay simples controlado por JS) ────────────────────── */
.gs-modal-backdrop { position: fixed; inset: 0; background: rgba(15,42,46,0.5); backdrop-filter: blur(2px); z-index: 1200; display: none; align-items: center; justify-content: center; padding: 1rem; }
.gs-modal-backdrop.show { display: flex; animation: fadeIn .2s ease; }
.gs-modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto; }
.gs-modal-head { padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.gs-modal-head h5 { margin: 0; font-weight: 800; font-size: 1.05rem; }
.gs-modal-head .gs-close { margin-left: auto; background: none; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.gs-modal-body { padding: 1.4rem; }
/* flex-wrap: alguns modais têm até 4 botões no rodapé (Excluir/Consolidar/
   Cancelar/Salvar) — sem quebra de linha, eles estouravam a largura do
   modal em telas estreitas (≤640px) em vez de simplesmente ir pra 2 linhas. */
.gs-modal-foot { padding: 1rem 1.4rem; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: flex-end; }

/* SweetAlert2 (confirmações/alertas) precisa ficar ACIMA de qualquer overlay
   próprio (.gs-modal-backdrop / .gs-sheet-backdrop, z-index 1200) — o z-index
   padrão do swal2 (1060) fica atrás deles quando o alerta é aberto de dentro
   de um modal/sheet (ex.: confirmar exclusão de um item). */
.swal2-container { z-index: 99999 !important; }

/* ══ Cursor utilitário ════ */
[role="button"], [data-action], [onclick], .clickable, label[for] { cursor: pointer; }
button:disabled, [disabled] { cursor: not-allowed; }

/* ════════════════════════════════════════════════════════════════════════════
   Landing page
   ════════════════════════════════════════════════════════════════════════════ */
.hero-section { background: var(--ink); position: relative; overflow: hidden; padding: 4.5rem 0 5rem; }
.hero-section::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 720px 480px at 78% 35%, rgba(18,184,134,0.14), transparent 70%), radial-gradient(ellipse 500px 400px at 12% 85%, rgba(14,165,164,0.08), transparent 65%); pointer-events: none; }
.hero-tag { display: inline-flex; align-items: center; gap: 7px; background: rgba(18,184,134,0.14); border: 1px solid rgba(18,184,134,0.32); color: var(--primary); font-size: 0.78rem; font-weight: 600; padding: 6px 14px; border-radius: 100px; margin-bottom: 1.3rem; letter-spacing: .03em; }
.hero-title { font-size: clamp(2.1rem, 5vw, 3.6rem); font-weight: 800; color: #fff; line-height: 1.1; letter-spacing: -0.03em; margin-bottom: 1.2rem; }
.hero-title .accent { color: var(--primary); }
.hero-lead { font-size: 1.12rem; color: rgba(255,255,255,0.66); max-width: 520px; line-height: 1.65; margin-bottom: 2rem; }
.hero-stats { display: flex; gap: 2rem; flex-wrap: wrap; margin-top: 2.25rem; }
.hero-stat .num { font-size: 1.5rem; font-weight: 800; color: var(--primary); font-family: var(--font-brand); }
.hero-stat .lbl { font-size: 0.74rem; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: .05em; }

.hero-mock { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-lg); padding: 1.25rem; backdrop-filter: blur(6px); box-shadow: var(--shadow-lg); }

.section { padding: 4.5rem 0; }
.section-light { background: var(--surface); }
.section-gray  { background: var(--bg); }
.section-ink   { background: var(--ink); color: #fff; }
.section-title { font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.75rem; }
.section-sub   { font-size: 1.05rem; color: var(--muted); max-width: 620px; margin: 0 auto 2.5rem; }
.section-ink .section-sub { color: rgba(255,255,255,0.6); }
.eyebrow { font-size: 0.74rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--primary); margin-bottom: 0.6rem; }

.feat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem; height: 100%; transition: all .2s; box-shadow: var(--shadow-sm); }
.feat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: rgba(18,184,134,0.3); }
.feat-ic { width: 46px; height: 46px; border-radius: 12px; background: rgba(18,184,134,0.12); color: var(--primary); display: grid; place-items: center; font-size: 1.2rem; margin-bottom: 0.9rem; }
.feat-ic.gold { background: rgba(224,165,62,0.14); color: var(--gold-dark); }
.feat-ic.blue { background: rgba(59,130,246,0.1); color: var(--info); }
.feat-card h5 { font-weight: 700; margin-bottom: 0.4rem; font-size: 1.02rem; }
.feat-card p  { color: var(--muted); font-size: 0.9rem; margin: 0; line-height: 1.6; }

.step-card { display: flex; gap: 1.1rem; padding: 1.3rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-bottom: 1rem; }
.step-num { width: 42px; height: 42px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; font-family: var(--font-brand); }
.step-card h5 { font-weight: 700; margin-bottom: 0.2rem; font-size: 1rem; }
.step-card p { color: var(--muted); font-size: 0.9rem; margin: 0; }

/* Pricing */
.price-card { border-radius: var(--radius-lg); padding: 2.2rem; height: 100%; border: 1.5px solid var(--border); background: var(--surface); position: relative; transition: all .22s; }
.price-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.price-card.featured { border-color: var(--primary); background: var(--ink); color: #fff; box-shadow: 0 10px 44px rgba(18,184,134,0.22); }
.price-card .popular { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #fff; font-weight: 700; font-size: 0.68rem; padding: 5px 14px; border-radius: 100px; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.price-amount { font-size: 2.8rem; font-weight: 800; line-height: 1; letter-spacing: -0.04em; font-family: var(--font-brand); }
.price-amount sup { font-size: 1.1rem; margin-right: 2px; }
.price-amount .per { font-size: 0.85rem; font-weight: 400; opacity: .6; }
.price-features { list-style: none; padding: 0; margin: 1.4rem 0; }
.price-features li { display: flex; align-items: flex-start; gap: 9px; padding: 0.45rem 0; border-bottom: 1px solid rgba(0,0,0,0.06); font-size: 0.9rem; }
.price-card.featured .price-features li { border-color: rgba(255,255,255,0.1); }
.price-features li i { margin-top: 3px; flex-shrink: 0; color: var(--primary); }

/* ════════════════════════════════════════════════════════════════════════════
   Auth pages (login / cadastro)
   ════════════════════════════════════════════════════════════════════════════ */
.auth-page { min-height: 100vh; background: var(--ink); display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; position: relative; overflow: hidden; }
.auth-page::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 600px 500px at 50% 0%, rgba(18,184,134,0.12), transparent 60%); }
.auth-card { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); border-radius: var(--radius-lg); padding: 2.3rem; width: 100%; max-width: 430px; backdrop-filter: blur(10px); position: relative; z-index: 1; }
.auth-card .brand { text-align: center; margin-bottom: 1.5rem; }
.auth-card h2 { color: #fff; font-weight: 800; text-align: center; font-size: 1.5rem; margin-bottom: 0.4rem; }
.auth-card .sub { color: rgba(255,255,255,0.55); text-align: center; font-size: 0.9rem; margin-bottom: 1.75rem; }
.auth-field { margin-bottom: 1.1rem; }
.auth-field label { color: rgba(255,255,255,0.72); font-size: 0.83rem; font-weight: 600; margin-bottom: 0.35rem; display: block; }
.auth-field .form-control { background: rgba(255,255,255,0.06); border: 1.5px solid rgba(255,255,255,0.13); color: #fff; border-radius: var(--radius-sm); padding: 0.7rem 0.95rem; font-size: 0.93rem; }
.auth-field .form-control::placeholder { color: rgba(255,255,255,0.3); }
.auth-field .form-control:focus { background: rgba(255,255,255,0.09); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(18,184,134,0.16); color: #fff; outline: none; }
.auth-error { background: rgba(229,72,77,0.14); border: 1px solid rgba(229,72,77,0.3); color: #FCA5A5; border-radius: var(--radius-sm); padding: 0.7rem 0.95rem; font-size: 0.84rem; margin-bottom: 1rem; display: none; }
.auth-error.show { display: block; }
.auth-ok { background: rgba(18,184,134,0.12); border: 1px solid rgba(18,184,134,0.3); color: #6EE7B7; border-radius: var(--radius-sm); padding: 0.7rem 0.95rem; font-size: 0.84rem; margin-bottom: 1rem; display: none; }
.auth-ok.show { display: block; }
.auth-link { color: rgba(255,255,255,0.5); font-size: 0.88rem; text-align: center; margin-top: 1.4rem; }
.auth-link a { color: var(--primary); font-weight: 600; }
.grecaptcha-badge { visibility: hidden; }

/* ════════════════════════════════════════════════════════════════════════════
   Footer
   ════════════════════════════════════════════════════════════════════════════ */
.gs-footer { background: var(--ink); color: rgba(255,255,255,0.7); padding: 3rem 0 2rem; border-top: 3px solid rgba(18,184,134,0.3); }
.footer-brand { margin-bottom: 0.5rem; }
.footer-link { color: rgba(255,255,255,0.5); font-size: 0.88rem; display: block; padding: 0.2rem 0; }
.footer-link:hover { color: rgba(255,255,255,0.9); }
.gs-footer h6 { font-size: 0.74rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,0.4); margin-bottom: 0.7rem; font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════════════
   Responsivo
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 991px) {
  .app-sidebar { display: none; }
  .app-tabs-mobile-wrap { display: block; }
  .app-bottom-nav { display: flex; }
  .app-main { padding-bottom: 70px; }
  /* Sino + selo de trial/PRO + avatar: por padrão ficam colados à esquerda do
     menu recolhido, com um vão vazio grande à direita — parece bagunçado.
     Alinha à direita (mesmo lado do botão ☰ acima) e dá mais respiro. */
  .gs-navbar-actions { justify-content: flex-end; gap: 10px; width: 100%; }
  /* Topbar mobile: deixa o {% block topbar_actions %} cair pra linha de baixo
     quando os controles não cabem ao lado do título — assim a topbar não incha
     invadindo os cards de saldo (e o "Saldo anterior") logo abaixo. Fica
     `position: static` aqui (em vez de sticky) porque em telas estreitas ela já
     ocupa mais espaço (título + ações em 2 linhas) — a .gs-navbar continua
     sticky no topo pra navegação rápida. (O bug de overflow-x quebrando o
     sticky da topbar foi corrigido na raiz: ver comentário em .app-content.) */
  .app-topbar { position: static; top: auto; flex-wrap: wrap; row-gap: .55rem; padding-top: .65rem; padding-bottom: .65rem; }
  .app-topbar h1 { font-size: 1.02rem; flex: 1 1 auto; min-width: 0; }
  /* flex-wrap: sem ele, telas com várias ações (Relatórios: seletor de mês +
     "Exportar PDF") empurravam o último botão pra fora e criavam scroll
     horizontal na página inteira — a 360px o conteúdo passava de 469px. */
  .app-topbar > .ms-auto { width: 100%; margin-left: 0 !important; flex-wrap: wrap; row-gap: .5rem; }
}
@media (max-width: 575px) {
  /* Respiro extra entre a sticky topbar e o início do conteúdo: em mobile a
     topbar cresce pra 2 linhas (h1 + filtros) e o primeiro card visual ficava
     colado nela, dando a impressão de que o menu cobria as caixinhas. */
  .app-content { padding: 1.15rem 1rem 1rem; }
  .app-content > :first-child { scroll-margin-top: 165px; }
  .app-topbar { padding: 0.75rem 1rem; }
  .hero-stats { gap: 1.25rem; }
  .auth-card { padding: 1.75rem 1.25rem; }
}
@media (hover: none) and (pointer: coarse) {
  .app-bottom-nav { padding-bottom: env(safe-area-inset-bottom, 0); }
  .btn-gs-soft, .gs-pill-btn { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .fx-in, .fx-stagger > * { animation: none; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Polimento & Responsividade — tags, extrato, tabelas roláveis, respiro mobile
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Tags / etiquetas (chip pequeno) ─────────────────────────────────────── */
.gs-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(18,184,134,0.10);
  color: var(--ink);
  border: 1px solid rgba(18,184,134,0.22);
  border-radius: 100px;
  padding: 2px 9px;
  font-size: 0.72rem; font-weight: 600; line-height: 1.45;
  white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
}
.gs-tag i { font-size: 0.66rem; opacity: .85; }
.gs-tag.muted {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--border);
}

/* ── Tabelas: wrapper com rolagem horizontal em telas estreitas ──────────── */
.gs-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
}
.gs-table-wrap > .gs-table,
.gs-table-wrap > .extrato-table { min-width: 100%; }

/* ── Extrato ─────────────────────────────────────────────────────────────── */
.extrato-table { width: 100%; border-collapse: collapse; }
.extrato-table th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface-2);
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 700;
  padding: 0.6rem 0.6rem; text-align: left;
  border-bottom: 1px solid var(--border-2);
}
.extrato-table td {
  padding: 0.65rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem; vertical-align: middle;
}
.extrato-table tbody tr:hover { background: var(--surface-2); }
.extrato-table tr:last-child td { border-bottom: none; }

/* coluna de saldo (acumulado/previsto) — números tabulares, à direita */
.extrato-balcol {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-2);
}
.extrato-table th.extrato-balcol { color: var(--muted); }

/* linha "Saldo anterior" / linha de saldo destacada */
.extrato-saldo-row td {
  background: var(--surface-2);
  font-weight: 700;
  color: var(--text-2);
  border-bottom: 1px solid var(--border-2);
}
.extrato-saldo-row .extrato-balcol { color: var(--ink); }

/* ── Tabela → cards (opt-in via .gs-table-cards) ─────────────────────────── */
@media (max-width: 640px) {
  .gs-table-cards thead {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .gs-table-cards,
  .gs-table-cards tbody { display: block; width: 100%; }
  .gs-table-cards tbody tr {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 4px 12px;
    margin-bottom: 10px;
  }
  .gs-table-cards tbody td {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border: none;
    border-bottom: 1px solid var(--border);
    text-align: right;
    font-size: 0.88rem;
  }
  .gs-table-cards tbody tr td:last-child { border-bottom: none; }
  .gs-table-cards tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    text-align: left;
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted);
  }
  .gs-table-cards tbody td[data-label=""]::before,
  .gs-table-cards tbody td:not([data-label])::before { content: none; }
  .gs-table-cards .extrato-balcol { font-weight: 700; color: var(--ink); }
  .gs-table-cards.extrato-table .extrato-saldo-row td { background: transparent; }
  .gs-table-cards.extrato-table .extrato-saldo-row {
    background: var(--surface-2); border-color: var(--border-2);
  }
}

/* ── Respiro & toque em mobile ───────────────────────────────────────────── */
/* impede que valores grandes estourem o card */
.stat-card .val, .stat-card .num, .hero-stat .num, .num, .val {
  overflow-wrap: anywhere; max-width: 100%;
}

@media (max-width: 640px) {
  .app-content { padding: 1rem 0.9rem 1.4rem; }
  .dash-card { padding: 1.1rem; margin-bottom: 1rem; }
  .stat-card { padding: .45rem; column-gap: .45rem; min-height: 100px; }
  .stat-card .lbl { font-size: 0.70rem; }
  .stat-card .stat-ic { width: 24px; height: 24px; font-size: 0.85rem; }
  /* alvos de toque confortáveis (>= 40px) */
  .btn, .btn-gs-primary, .btn-gs-outline, .btn-gs-ghost, .btn-gs-gold,
  .btn-gs-soft, .btn-gs-danger-soft, .gs-pill-btn, .gs-segment button,
  .gs-chip, .gs-modal-foot .btn {
    min-height: 40px;
  }
  /* não inflar pílulas pequenas da navbar do topo */
  .gs-navbar .btn-sm, .gs-trial-pill { min-height: 32px; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Caixinhas clicáveis (navegação por card) + menu "Mais" (sheet mobile)
   ════════════════════════════════════════════════════════════════════════════ */
[data-nav] { cursor: pointer; }
.stat-card[data-nav], .dash-card[data-nav], .gs-card[data-nav] { position: relative; transition: transform .15s, box-shadow .15s, border-color .15s; }
.stat-card[data-nav]:hover, .dash-card[data-nav]:hover, .gs-card[data-nav]:hover {
  transform: translateY(-2px); box-shadow: var(--shadow); border-color: rgba(18,184,134,0.30);
}
[data-nav]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.card-nav-hint { position: absolute; bottom: .7rem; right: .8rem; color: var(--border-2); font-size: .72rem; transition: color .15s, transform .15s; }
[data-nav]:hover .card-nav-hint { color: var(--primary); transform: translateX(2px); }

/* item "Mais" da bottom-nav */
.gs-more-trigger { position: relative; }
.gs-more-dot { position: absolute; top: 6px; right: calc(50% - 18px); width: 8px; height: 8px; border-radius: 50%; background: var(--gold); border: 1.5px solid var(--ink); }

/* bottom sheet "Mais" */
.gs-sheet-backdrop { position: fixed; inset: 0; background: rgba(15,42,46,0.5); backdrop-filter: blur(2px); z-index: 1200; display: flex; align-items: flex-end; }
.gs-sheet-backdrop[hidden] { display: none; }
.gs-sheet { width: 100%; background: var(--surface); border-radius: 20px 20px 0 0; padding: 0.5rem 1rem calc(1rem + env(safe-area-inset-bottom, 0)); max-height: 86vh; overflow-y: auto; box-shadow: 0 -8px 40px rgba(0,0,0,0.25); animation: sheetUp .22s ease; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.gs-sheet-handle { width: 42px; height: 5px; border-radius: 3px; background: var(--border-2); margin: 6px auto 12px; }
.gs-sheet-ws { display: flex; align-items: center; gap: 12px; width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 0.7rem 0.9rem; margin-bottom: 0.5rem; }
.gs-sheet-ws .gs-ws-emoji { font-size: 1.35rem; }
.gs-sheet-ws-name { display: block; font-weight: 700; color: var(--text); font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-sheet-ws-sub { display: block; font-size: 0.72rem; color: var(--muted); }
.gs-sheet-ws #moreWsChevron { transition: transform .2s; color: var(--muted); }
.gs-sheet-ws.open #moreWsChevron { transform: rotate(180deg); }
.gs-sheet-wslist { list-style: none; margin: 0 0 0.5rem; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.gs-sheet-wslist[hidden] { display: none; }
.gs-sheet-wslist .ws-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: 0.9rem; color: var(--text); }
.gs-sheet-wslist .ws-item.active { background: rgba(18,184,134,0.12); color: var(--primary-dark); font-weight: 600; }
.gs-sheet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0.25rem 0 0.75rem; }
.gs-sheet-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0.9rem 0.4rem; border-radius: 14px; color: var(--text-2); font-size: 0.7rem; font-weight: 600; text-align: center; }
.gs-sheet-grid a i { font-size: 1.2rem; color: var(--ink); }
.gs-sheet-grid a:hover { background: var(--surface-2); }
.gs-sheet-grid a.active { background: rgba(18,184,134,0.12); color: var(--primary-dark); }
.gs-sheet-grid a.active i { color: var(--primary); }
.gs-sheet-logout { display: flex; align-items: center; justify-content: center; padding: 0.8rem; border-radius: 12px; color: var(--neg); font-weight: 600; background: rgba(229,72,77,0.06); border: 1px solid rgba(229,72,77,0.18); }
.gs-sheet-logout:hover { background: rgba(229,72,77,0.12); color: var(--neg); }
@media (min-width: 992px) { .gs-sheet-backdrop, .gs-more-trigger { display: none !important; } }

/* ════════════════════════════════════════════════════════════════════════════
   Tours guiados (um por tela) — ver static/js/tour.js
   O escurecimento é feito por um box-shadow gigante no "recorte": assim o
   elemento em destaque continua sendo o próprio elemento da página (com suas
   cores e estado), em vez de uma cópia desenhada por cima.
   ════════════════════════════════════════════════════════════════════════════ */
.gs-tour-block { position: fixed; inset: 0; z-index: 2000; cursor: default; }
.gs-tour-spot {
  position: fixed; z-index: 2001; border-radius: var(--radius-sm);
  box-shadow: 0 0 0 9999px rgba(9,28,31,0.66), 0 0 0 3px var(--primary);
  pointer-events: none; transition: all .28s cubic-bezier(.4,0,.2,1);
}
/* Sem alvo (abertura e fechamento): fica o escurecimento, sai o anel — o JS
   colapsa o recorte num ponto no centro da tela. */
.gs-tour-spot.no-target { box-shadow: 0 0 0 9999px rgba(9,28,31,0.66); }
/* Dentro do menu "Mais" o backdrop do sheet já escurece a tela — somar os dois
   deixava o fundo quase preto. */
.gs-tour-spot.over-sheet { box-shadow: 0 0 0 9999px rgba(9,28,31,0.34), 0 0 0 3px var(--primary); }

.gs-tour-balloon {
  position: fixed; z-index: 2002; width: min(330px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 1rem 1.05rem 0.9rem; outline: none;
  animation: tourIn .22s cubic-bezier(.4,0,.2,1);
}
@keyframes tourIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.gs-tour-balloon .tour-arrow {
  position: absolute; width: 12px; height: 12px; background: var(--surface);
  border: 1px solid var(--border); transform: rotate(45deg);
}
.gs-tour-balloon .tour-arrow.up    { border-right: 0; border-bottom: 0; top: -7px; }
.gs-tour-balloon .tour-arrow.down  { border-left: 0;  border-top: 0;    bottom: -7px; }
.gs-tour-balloon .tour-arrow.left  { border-right: 0; border-top: 0;    left: -7px; }
.gs-tour-balloon .tour-arrow.right { border-left: 0;  border-bottom: 0; right: -7px; }

.gs-tour-head { display: flex; align-items: center; gap: 8px; margin-bottom: .6rem; }
.gs-tour-dots { display: flex; gap: 5px; }
.gs-tour-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--border-2); transition: background .2s, width .2s; }
.gs-tour-dots i.on { background: var(--primary); width: 16px; border-radius: 3px; }
.gs-tour-count { margin-left: auto; font-size: .7rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

.gs-tour-balloon h6 {
  font-family: var(--font-brand); font-weight: 800; font-size: 1rem;
  letter-spacing: -.02em; color: var(--text); margin: 0 0 .3rem;
  display: flex; align-items: center; gap: 8px;
}
.gs-tour-balloon h6 i { color: var(--primary); font-size: .92rem; }
.gs-tour-balloon p { font-size: .855rem; line-height: 1.5; color: var(--text-2); margin: 0 0 .85rem; }

.gs-tour-foot { display: flex; align-items: center; gap: 8px; }
.gs-tour-skip {
  background: none; border: 0; padding: 4px 2px; font-size: .78rem;
  font-weight: 600; color: var(--muted); cursor: pointer;
}
.gs-tour-skip:hover { color: var(--text-2); text-decoration: underline; }
.gs-tour-nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.gs-tour-prev {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  width: 32px; height: 32px; border-radius: var(--radius-sm); cursor: pointer;
  display: grid; place-items: center; font-size: .78rem; transition: all .15s;
}
.gs-tour-prev:hover { border-color: var(--primary); color: var(--primary-dark); }
.gs-tour-prev:disabled { opacity: .4; cursor: default; }
.gs-tour-prev:disabled:hover { border-color: var(--border); color: var(--text-2); }
.gs-tour-next {
  background: var(--primary); border: 0; color: #fff; font-weight: 600; font-size: .84rem;
  padding: .48rem 1rem; border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s;
}
.gs-tour-next:hover { background: var(--primary-dark); }

/* Botão "?" ao lado do título — reabre o tour da tela. Discreto de propósito:
   quem já sabe usar a tela não deve tropeçar nele. */
.gs-tour-help {
  width: 22px; height: 22px; flex-shrink: 0; margin-left: .5rem; padding: 0;
  border-radius: 50%; border: 1px solid var(--border-2); background: var(--surface-2);
  color: var(--muted); font-size: .68rem; cursor: pointer;
  display: inline-grid; place-items: center; vertical-align: middle;
  transition: all .15s;
}
.gs-tour-help:hover { border-color: var(--primary); color: var(--primary-dark); background: rgba(18,184,134,.1); }
.gs-tour-help:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Tela estreita: o balão toma a largura toda e só se move na vertical. O corte
   é por LARGURA (não pelo breakpoint de layout), e casa com LARGURA_BALAO_LATERAL
   em tour.js — um celular deitado passa dos 560px e volta a posicionar o balão
   ao lado do destaque, que é onde há espaço quando a altura é curta. */
@media (max-width: 559px) {
  .gs-tour-balloon { width: calc(100vw - 20px); left: 10px !important; }
  .gs-tour-balloon .tour-arrow { display: none; }
}
/* Tela muito baixa (celular deitado): o balão encolhe para caber junto do
   destaque, e nunca passa da altura da viewport. A seta sai junto porque
   overflow:auto recortaria ela, que é desenhada fora da caixa. */
@media (max-height: 480px) {
  .gs-tour-balloon {
    max-height: calc(100vh - 16px); overflow-y: auto;
    padding: .7rem .85rem .65rem;
  }
  .gs-tour-balloon .tour-arrow { display: none; }
  .gs-tour-balloon .gs-tour-head { margin-bottom: .4rem; }
  .gs-tour-balloon h6 { font-size: .92rem; margin-bottom: .2rem; }
  .gs-tour-balloon p { font-size: .8rem; line-height: 1.4; margin-bottom: .6rem; }
  .gs-tour-next { padding: .4rem .85rem; }
  .gs-tour-prev { width: 28px; height: 28px; }
  /* O menu "Mais" cede altura enquanto o tour está aberto: a 86vh de sempre não
     deixava lugar nenhum para o balão dos passos que apontam para dentro dele.
     44vh é o que faz o balão do passo de texto mais longo caber acima do sheet
     numa tela de 360px de altura. O sheet rola por dentro. */
  body.gs-tour-aberto .gs-sheet { max-height: 44vh; }
}
@media (prefers-reduced-motion: reduce) {
  .gs-tour-spot { transition: none; }
  .gs-tour-balloon { animation: none; }
}
