/* ==========================================================================
   Gestão Financeira — v231 "Executivo"
   Nova arquitetura visual: sidebar grafite + topbar de vidro + tab bar
   mobile. Carregado DEPOIS de styles.css — sobrescreve a base.
   A camada de comportamento (stepper de mês, tab bar) vive em theme-v231.js.
   ========================================================================== */

:root {
  color-scheme: light;

  /* fundo e superfícies */
  --bg: #f4f5f8;
  --bg-soft: #eef0f4;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-2: #f3f5f9;
  --surface-ghost: rgba(16, 22, 35, 0.04);

  /* tinta */
  --text: #131a28;
  --muted: #5d6575;

  /* traços */
  --border: #e5e8ef;
  --border-strong: #ccd2df;
  --border-soft: #eef0f5;

  /* sombras de papel */
  --shadow: 0 18px 40px -24px rgba(15, 23, 42, 0.18);
  --shadow-soft: 0 10px 24px -18px rgba(15, 23, 42, 0.14);
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 28px -22px rgba(15, 23, 42, 0.14);

  /* acentos */
  --primary: #1d4ed8;
  --primary-soft: #3b6fe4;
  --primary-strong: #14306e;
  --secondary: #0f766e;
  --accent: #b97b1f;
  --success: #0f9d6e;
  --danger: #d43d51;
  --danger-strong: #c22f43;
  --ring: rgba(29, 78, 216, 0.32);

  /* geometria firme */
  --radius-xl: 16px;
  --radius-lg: 14px;
  --radius-md: 11px;
  --radius-sm: 9px;

  /* frame */
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --tabbar-h: 62px;
  --sidebar-bg: #0e1526;
  --sidebar-bg-2: #101a30;
  --sidebar-text: #e7ecf6;
  --sidebar-muted: #8b96ad;
  --sidebar-line: rgba(231, 236, 246, 0.09);

  /* ícones (lucide-style, stroke) usados por sidebar e tab bar */
  --icon-dashboard: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='7' height='9' rx='1.5'/><rect x='14' y='3' width='7' height='5' rx='1.5'/><rect x='14' y='12' width='7' height='9' rx='1.5'/><rect x='3' y='16' width='7' height='5' rx='1.5'/></svg>");
  --icon-goals: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9'/><circle cx='12' cy='12' r='5'/><circle cx='12' cy='12' r='1'/></svg>");
  --icon-receivables: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='8' cy='8' r='5'/><path d='M18.09 10.37A5 5 0 1 1 10.34 18'/><path d='M7 6h1v4'/><path d='m16.71 13.88.7.71-2.82 2.82'/></svg>");
  --icon-indicators: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 3v18h18'/><path d='M7 15v-4'/><path d='M12 15V8'/><path d='M17 15v-7'/></svg>");
  --icon-audit: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z'/><path d='m9 12 2 2 4-4'/></svg>");
  --icon-logout: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/><polyline points='16 17 21 12 16 7'/><line x1='21' y1='12' x2='9' y2='12'/></svg>");
  --icon-chevron-left: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='15 18 9 12 15 6'/></svg>");
  --icon-chevron-right: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 18 15 12 9 6'/></svg>");
  --icon-bell: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'/><path d='M10.3 21a1.94 1.94 0 0 0 3.4 0'/></svg>");
  --icon-zap: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polygon points='13 2 3 14 12 14 11 22 21 10 12 10 13 2'/></svg>");
  --icon-close: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><line x1='18' y1='6' x2='6' y2='18'/><line x1='6' y1='6' x2='18' y2='18'/></svg>");
  --icon-pie: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M21.21 15.89A10 10 0 1 1 8 2.83'/><path d='M22 12A10 10 0 0 0 12 2v10z'/></svg>");
  --icon-compare: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='16 3 21 3 21 8'/><line x1='4' y1='20' x2='21' y2='3'/><polyline points='8 21 3 21 3 16'/><line x1='15' y1='15' x2='21' y2='21'/><line x1='4' y1='4' x2='9' y2='9'/></svg>");
}

html {
  background: var(--bg);
}

body,
body.is-authenticated {
  background: var(--bg);
  color: var(--text);
  letter-spacing: -0.004em;
}

.ambient {
  display: none;
}

/* ------------------------------------------------------------------ tipos */

h1, h2, h3 {
  letter-spacing: -0.024em;
  text-wrap: balance;
}

.eyebrow {
  letter-spacing: 0.14em;
  font-size: 0.66rem;
  color: var(--muted);
}

strong, dd, .receivable-card-amount {
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  backdrop-filter: none;
}

/* ------------------------------------------------------------- login gate */

.auth-gate {
  background:
    radial-gradient(circle at 82% -20%, rgba(29, 78, 216, 0.10), transparent 46%),
    var(--bg);
}

.auth-card {
  border-top: 3px solid var(--primary);
}

/* =================================================================== FRAME
   Topbar de vidro (injetada pelo theme-v231.js)
   ========================================================================= */

.gf-topbar {
  position: sticky;
  top: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--topbar-h);
  padding: 0.55rem 0.25rem;
  margin-bottom: 0.9rem;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border-bottom: 1px solid var(--border);
}

.gf-topbar-title {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
  margin-right: auto;
}

.gf-topbar-title .gf-crumb {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.gf-topbar-title strong {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.024em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* seletor de mês compacto: ‹ Julho 2026 › + Hoje */
.gf-month {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
}

.gf-month.gf-month--off {
  visibility: hidden;
}

.gf-month-btn,
.gf-month-today {
  border: 0;
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text);
}

.gf-month-btn {
  width: 34px;
  height: 34px;
  position: relative;
}

.gf-month-btn::before {
  content: "";
  position: absolute;
  inset: 8px;
  background: currentColor;
  -webkit-mask: var(--gf-ic) center / contain no-repeat;
  mask: var(--gf-ic) center / contain no-repeat;
}

.gf-month-btn[data-dir="-1"] { --gf-ic: var(--icon-chevron-left); }
.gf-month-btn[data-dir="1"] { --gf-ic: var(--icon-chevron-right); }

.gf-month-btn:hover,
.gf-month-today:hover {
  background: var(--surface-2);
}

.gf-month-label {
  border: 0;
  background: transparent;
  min-width: 132px;
  text-align: center;
  font-weight: 700;
  font-size: 0.94rem;
  letter-spacing: -0.01em;
  padding: 0.35rem 0.3rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  cursor: default;
}

.gf-month-today {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.42rem 0.7rem;
}

.gf-icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  position: relative;
  cursor: pointer;
  color: var(--muted);
}

.gf-icon-btn::before {
  content: "";
  position: absolute;
  inset: 9px;
  background: currentColor;
  -webkit-mask: var(--gf-ic) center / contain no-repeat;
  mask: var(--gf-ic) center / contain no-repeat;
}

.gf-icon-btn:hover {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.gf-logout { --gf-ic: var(--icon-logout); }
.gf-bell { --gf-ic: var(--icon-bell); }
.gf-actions-trigger { --gf-ic: var(--icon-zap); }

.gf-bell:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.gf-actions-trigger:hover {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

/* badge do sininho — espelha o total de alertas do mês */
.gf-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--surface);
}

.gf-badge.gf-badge--off {
  display: none;
}

/* ===================================================== PAINEL DE AÇÕES
   "Ações e inteligência" vira um módulo próprio em slide-over
   ========================================================================= */

.gf-actions-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1290;
  background: rgba(14, 21, 38, 0.38);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.gf-actions-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1300;
  width: min(400px, 100vw);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.15rem 1.4rem;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -28px 0 64px rgba(15, 23, 42, 0.22);
  transform: translateX(102%);
  transition: transform 220ms cubic-bezier(0.32, 0.72, 0.22, 1);
  overflow-y: auto;
}

body.gf-actions-open .gf-actions-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.gf-actions-open .gf-actions-panel {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .gf-actions-panel,
  .gf-actions-backdrop {
    transition: none;
  }
}

.gf-actions-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.gf-actions-head h2 {
  margin: 0.1rem 0 0;
  font-size: 1.14rem;
}

.gf-actions-close {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  position: relative;
  cursor: pointer;
  color: var(--muted);
}

.gf-actions-close::before {
  content: "";
  position: absolute;
  inset: 8px;
  background: currentColor;
  -webkit-mask: var(--icon-close) center / contain no-repeat;
  mask: var(--icon-close) center / contain no-repeat;
}

.gf-actions-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

/* o grupo de botões original migra para cá e vira uma lista de linhas */
.gf-actions-panel .action-group {
  display: grid;
  gap: 0.45rem;
}

.gf-actions-panel .action-group button {
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: none;
}

.gf-actions-panel .action-group button:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
}

/* a linha "Ações e inteligência" sai do painel principal */
.toolbar-row--executive {
  display: none !important;
}

/* ------------------------------------------- drawers do app sobre o frame */
/* BI, alertas e configurações precisam cobrir a topbar (z 950) */

.summary-backdrop,
.alerts-backdrop,
.settings-backdrop {
  z-index: 1305;
}

.summary-drawer,
.alerts-drawer,
.settings-drawer {
  z-index: 1310;
}

.summary-drawer .summary-panel--drawer,
.alerts-drawer .alerts-panel,
.settings-drawer {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: -28px 0 64px rgba(15, 23, 42, 0.25);
}

/* ================================================= SIDEBAR · seção Análise */

.gf-side-section {
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--sidebar-line);
  display: grid;
  gap: 2px;
}

.gf-side-section-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  padding: 0 0.75rem 0.35rem;
}

.gf-side-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--sidebar-muted);
  padding: 0.6rem 0.75rem;
  font-weight: 600;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}

.gf-side-link::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background: currentColor;
  -webkit-mask: var(--gf-ic) center / contain no-repeat;
  mask: var(--gf-ic) center / contain no-repeat;
}

.gf-side-link:hover {
  background: rgba(231, 236, 246, 0.07);
  color: var(--sidebar-text);
}

.gf-side-link[data-icon="chart"] { --gf-ic: var(--icon-indicators); }
.gf-side-link[data-icon="pie"] { --gf-ic: var(--icon-pie); }
.gf-side-link[data-icon="compare"] { --gf-ic: var(--icon-compare); }
.gf-side-link[data-icon="bell"] { --gf-ic: var(--icon-bell); }

/* o seletor de mês nativo e as grades de 12 meses saem de cena:
   o stepper da topbar assume o papel */
.hero-month-board,
.receivables-hero-shortcuts,
.hero-reference-picker {
  display: none !important;
}

/* =================================================================== HERO
   O hero do dashboard saiu de cena: a topbar já diz página, mês e
   resumo. O input #monthFilter continua no DOM (o stepper depende dele).
   ========================================================================= */

.app-page--dashboard > .hero {
  display: none !important;
}

/* heros internos claros, com respiro menor */
.goals-hero,
.receivables-hero,
.indicators-hero,
.audit-hero {
  padding: 1.15rem 1.35rem;
}

/* --------------------------------------------------------------- KPIs */

.summary-grid > .metric {
  /* as variantes da base (.metric-income etc.) têm gradientes com
     especificidade maior — o !important zera todas de uma vez */
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-left: 3px solid var(--border-strong) !important;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card) !important;
}

.summary-grid > .metric::before,
.summary-grid > .metric::after {
  display: none;
}

.summary-grid > .metric .metric-label {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-grid > .metric strong {
  letter-spacing: -0.03em;
}

.summary-grid > .metric.metric-income { border-left-color: var(--success) !important; }
.summary-grid > .metric.metric-expense { border-left-color: var(--danger) !important; }
.summary-grid > .metric.metric-balance { border-left-color: var(--primary) !important; }
.summary-grid > .metric.metric-savings.metric-savings-positive { border-left-color: var(--success) !important; }
.summary-grid > .metric.metric-savings.metric-savings-negative { border-left-color: var(--danger) !important; }
.summary-grid > .metric.metric-planned-balance { border-left-color: var(--accent) !important; }

.summary-grid > .metric.metric-income strong { color: var(--success); }
.summary-grid > .metric.metric-expense strong { color: var(--danger); }
.summary-grid > .metric.metric-balance strong { color: var(--primary); }

.value-positive { color: var(--success); }
.value-negative { color: var(--danger); }

/* --------------------------------------------------------------- controles */

button.primary,
.receivable-action--paid {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 8px 18px -8px rgba(29, 78, 216, 0.45);
}

button.primary:hover,
button.primary:focus-visible,
.receivable-action--paid:hover,
.receivable-action--paid:focus-visible {
  background: var(--primary-soft);
}

input,
select,
textarea {
  background: #ffffff;
  border-color: var(--border-strong);
  color: var(--text);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .card,
  button,
  .page-nav-link,
  .gf-tab {
    transition: background 140ms ease, border-color 140ms ease, box-shadow 180ms ease, color 140ms ease, transform 140ms ease;
  }
}

/* ============================================================== SIDEBAR
   Drawer vira sidebar de app: marca, ícones, rows compactas
   ========================================================================= */

.page-nav-drawer {
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  border-right: 1px solid var(--sidebar-line);
  box-shadow: 24px 0 56px rgba(8, 13, 25, 0.35);
  color: var(--sidebar-text);
  gap: 0.75rem;
}

/* marca injetada pelo theme-v231.js */
.gf-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.25rem 0.35rem 0.85rem;
  border-bottom: 1px solid var(--sidebar-line);
}

.gf-brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--primary-soft), var(--primary-strong));
  color: #ffffff;
  font-weight: 800;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 22px -10px rgba(29, 78, 216, 0.7);
}

.gf-brand-copy {
  min-width: 0;
  margin-right: auto;
}

.gf-brand strong {
  display: block;
  color: var(--sidebar-text);
  font-size: 0.95rem;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.gf-brand small {
  color: var(--sidebar-muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

/* botão de recolher/expandir o menu */
.gf-collapse {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid var(--sidebar-line);
  border-radius: 8px;
  background: rgba(231, 236, 246, 0.05);
  position: relative;
  cursor: pointer;
  color: var(--sidebar-muted);
}

.gf-collapse::before {
  content: "";
  position: absolute;
  inset: 6px;
  background: currentColor;
  -webkit-mask: var(--icon-chevron-left) center / contain no-repeat;
  mask: var(--icon-chevron-left) center / contain no-repeat;
}

.gf-collapse:hover {
  color: var(--sidebar-text);
  background: rgba(231, 236, 246, 0.1);
}

body.gf-side-collapsed .gf-collapse::before {
  -webkit-mask-image: var(--icon-chevron-right);
  mask-image: var(--icon-chevron-right);
}

/* o cabeçalho textual antigo do drawer sai — a marca assume */
.page-nav-head > div {
  display: none;
}

.page-nav-head {
  display: flex;
  justify-content: flex-end;
}

.page-nav-links {
  display: grid;
  gap: 2px;
}

.page-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  box-shadow: none;
  color: var(--sidebar-muted);
  padding: 0.66rem 0.75rem;
}

.page-nav-link small {
  display: none;
}

/* ícone no lugar do trilho decorativo antigo */
.page-nav-link::before {
  content: "";
  position: static;
  inset: auto;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  border-radius: 0;
  opacity: 1;
  background: currentColor;
  -webkit-mask: var(--gf-ic, var(--icon-dashboard)) center / contain no-repeat;
  mask: var(--gf-ic, var(--icon-dashboard)) center / contain no-repeat;
}

#goDashboardPage { --gf-ic: var(--icon-dashboard); }
#goGoalsPage { --gf-ic: var(--icon-goals); }
#goReceivablesPage { --gf-ic: var(--icon-receivables); }
#goIndicatorsPage { --gf-ic: var(--icon-indicators); }
#goAuditPage { --gf-ic: var(--icon-audit); }

.page-nav-link .page-nav-link-label {
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: -0.008em;
  color: inherit;
}

.page-nav-link:hover {
  background: rgba(231, 236, 246, 0.07);
  color: var(--sidebar-text);
}

.page-nav-link.active {
  background: rgba(59, 111, 228, 0.18);
  border-color: rgba(59, 111, 228, 0.38);
  box-shadow: none;
  transform: none;
  color: #ffffff;
}

.page-nav-link.active .page-nav-link-label {
  color: #ffffff;
}

.page-nav-footer {
  margin-top: auto;
}

.page-nav-profile {
  background: rgba(231, 236, 246, 0.05);
  border: 1px solid var(--sidebar-line);
  border-radius: var(--radius-md);
}

.page-nav-profile strong {
  color: var(--sidebar-text);
}

.page-nav-profile .profile-label,
.page-nav-profile small {
  color: var(--sidebar-muted);
}

.page-nav-logout {
  background: rgba(231, 236, 246, 0.06);
  color: var(--sidebar-text);
  border-color: var(--sidebar-line);
}

.drawer-close {
  background: rgba(231, 236, 246, 0.08);
  border: 1px solid var(--sidebar-line);
  color: var(--sidebar-text);
}

/* hambúrguer não existe mais neste design: sidebar no desktop,
   tab bar no mobile */
.page-menu-button {
  display: none !important;
}

/* ------------------------------------------------ desktop: sidebar fixa */

@media (min-width: 1100px) {
  .page-nav-backdrop,
  .drawer-close {
    display: none !important;
  }

  /* sem login não há app frame: a sidebar só existe autenticada */
  body:not(.is-authenticated) .page-nav-drawer,
  body:not(.is-authenticated) .page-nav-drawer.hidden {
    display: none !important;
  }

  .page-nav-drawer,
  .page-nav-drawer.hidden {
    display: flex !important;
    flex-direction: column;
    transform: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: var(--sidebar-w);
    border-radius: 0;
    padding: 1.15rem 0.85rem 1.1rem;
  }

  .page-nav-head {
    display: none;
  }

  .page-nav-footer {
    margin-top: auto;
  }

  body.page-nav-open {
    overflow: auto;
  }

  .app-shell {
    width: auto;
    margin: 0;
    padding: 0 2rem 2.6rem calc(var(--sidebar-w) + 2rem);
    max-width: calc(var(--sidebar-w) + 1560px);
  }

  .gf-tabbar {
    display: none;
  }

  @media (prefers-reduced-motion: no-preference) {
    .page-nav-drawer {
      transition: width 200ms ease;
    }

    .app-shell {
      transition: padding-left 200ms ease;
    }
  }

  /* ------------------------------------------ sidebar recolhida (ícones) */

  body.gf-side-collapsed {
    --sidebar-w: 76px;
  }

  body.gf-side-collapsed .page-nav-drawer {
    padding-inline: 0.6rem;
  }

  body.gf-side-collapsed .gf-brand {
    flex-direction: column;
    gap: 0.55rem;
    padding-inline: 0;
  }

  body.gf-side-collapsed .gf-brand-copy {
    display: none;
  }

  body.gf-side-collapsed .gf-brand-mark {
    width: 38px;
    height: 38px;
  }

  body.gf-side-collapsed .page-nav-link {
    justify-content: center;
    padding-inline: 0;
  }

  body.gf-side-collapsed .page-nav-link .page-nav-link-label {
    display: none;
  }

  body.gf-side-collapsed .gf-side-section-label {
    display: none;
  }

  body.gf-side-collapsed .gf-side-link {
    justify-content: center;
    padding-inline: 0;
  }

  body.gf-side-collapsed .gf-side-link span {
    display: none;
  }

  body.gf-side-collapsed .page-nav-profile {
    display: none !important;
  }

  body.gf-side-collapsed .page-nav-logout {
    font-size: 0;
    padding: 0.6rem 0;
    display: grid;
    place-items: center;
  }

  body.gf-side-collapsed .page-nav-logout::before {
    content: "";
    width: 18px;
    height: 18px;
    background: currentColor;
    -webkit-mask: var(--icon-logout) center / contain no-repeat;
    mask: var(--icon-logout) center / contain no-repeat;
  }
}

/* ------------------------------------------------- mobile: tab bar de app */

@media (max-width: 1099.98px) {
  .app-shell {
    padding-top: 0;
    padding-bottom: calc(var(--tabbar-h) + 1.6rem + env(safe-area-inset-bottom, 0px));
  }

  .gf-topbar {
    margin-inline: 0;
  }

  /* topbar em duas linhas: título + ícones, depois o stepper inteiro */
  .gf-topbar {
    flex-wrap: wrap;
    row-gap: 0.55rem;
    padding-block: 0.65rem;
  }

  .gf-topbar-title {
    order: 1;
    flex: 1 1 auto;
  }

  .gf-crumb {
    display: none;
  }

  .gf-icon-btn {
    order: 2;
  }

  .gf-month {
    order: 3;
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .gf-month-label {
    min-width: 108px;
    font-size: 0.9rem;
  }

  body:not(.is-authenticated) .gf-tabbar {
    display: none;
  }

  /* a régua de busca do quadro de cobranças estourava a viewport móvel */
  .receivables-board-actions {
    flex-wrap: wrap;
    min-width: 0;
    max-width: 100%;
  }

  .workspace-search-field,
  .workspace-search-field input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .gf-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 980;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: color-mix(in srgb, #ffffff 88%, transparent);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border-top: 1px solid var(--border);
    box-shadow: 0 -12px 32px -20px rgba(15, 23, 42, 0.25);
  }

  .gf-tab {
    display: grid;
    justify-items: center;
    gap: 3px;
    border: 0;
    background: transparent;
    border-radius: var(--radius-sm);
    padding: 6px 2px 5px;
    color: var(--muted);
    cursor: pointer;
  }

  .gf-tab::before {
    content: "";
    width: 21px;
    height: 21px;
    background: currentColor;
    -webkit-mask: var(--gf-ic) center / contain no-repeat;
    mask: var(--gf-ic) center / contain no-repeat;
  }

  .gf-tab span {
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.02em;
  }

  .gf-tab.active {
    color: var(--primary);
  }

  .gf-tab[data-icon="dashboard"] { --gf-ic: var(--icon-dashboard); }
  .gf-tab[data-icon="goals"] { --gf-ic: var(--icon-goals); }
  .gf-tab[data-icon="receivables"] { --gf-ic: var(--icon-receivables); }
  .gf-tab[data-icon="indicators"] { --gf-ic: var(--icon-indicators); }
  .gf-tab[data-icon="audit"] { --gf-ic: var(--icon-audit); }
}

/* -------------------------------------------------- faturas e cartões */
/* a base pintava a seção "Faturas do mês" com texto quase branco
   (resquício do tema escuro) — ilegível no fundo claro */

.invoice-section--current .invoice-section-title-row .eyebrow {
  color: var(--muted);
}

.invoice-section--current .invoice-section-head strong {
  color: var(--text);
}

.invoice-section--current .invoice-priority-chip,
.invoice-priority-chip {
  color: var(--primary);
  background: rgba(29, 78, 216, 0.08);
  border: 1px solid rgba(29, 78, 216, 0.18);
}

/* os cards de cartão (Nubank/MC Black) colapsavam em larguras estreitas:
   o nome ficava com largura zero e o chip "Vence" sobrepunha o texto.
   Layout refeito em pilha: marca → vencimento → valor → tags. */

.invoice-card .invoice-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.55rem;
}

.invoice-card .invoice-card-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.invoice-card .invoice-card-brand-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 0.1rem;
}

.invoice-card .invoice-card-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invoice-card .invoice-card-head-aside {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.3rem 0.6rem;
  margin: 0;
  text-align: left;
}

.invoice-card .invoice-card-due {
  position: static;
}

/* ------------------------------------------------------- estados e badges */

.badge {
  border-radius: 7px;
  letter-spacing: 0.02em;
}

.receivable-card--atrasado {
  border-color: rgba(212, 61, 81, 0.35);
  box-shadow: var(--shadow-card);
}

.receivable-card--compensado {
  border-color: rgba(185, 123, 31, 0.4);
  box-shadow: var(--shadow-card);
}

.receivable-card--encontro-efetuado,
.receivable-card--pago {
  opacity: 0.92;
}

/* ---------------------------------------------------------------- rodapé */

.app-shell footer,
.site-footer {
  color: var(--muted);
}
