/* VF Aurora: presentation only. Scope excludes every unauthenticated login state.
   Theme keys and storage continue to be owned by the existing theme manager. */
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) {
  --vf-motion-fast: 160ms;
  --vf-motion-base: 200ms;
  --vf-motion-slow: 220ms;
  --vf-motion-ease-smooth: cubic-bezier(.22, .68, .3, 1);
  --vf-ambient: radial-gradient(ellipse at 78% 0%, rgba(142, 69, 220, .15), transparent 55%), radial-gradient(ellipse at 0% 80%, rgba(103, 71, 197, .09), transparent 55%);
  --vf-glass: linear-gradient(145deg, rgba(206, 172, 255, .045), transparent 58%);
  --vf-elevation: inset 0 1px rgba(228, 205, 255, .045), 0 10px 30px rgba(9, 5, 23, .16);
  --vf-line: rgba(201, 177, 235, .16);
  --vf-line-strong: rgba(209, 180, 243, .28);
  --vf-radius-control: 11px;
  --theme-scroll-thumb: #79618f;
  --vf-scrollbar-thumb: #79618f;
  --vf-scrollbar-thumb-hover: #aa7bc9;
  --vf-scrollbar-thumb-active: #be8ede;
  background: var(--vf-ambient), var(--vf-bg) !important;
}
body.vf-premium.theme-dark:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) {
  --vf-bg: #111216;
  --vf-panel: rgba(28, 29, 35, .95);
  --vf-panel-soft: #18191f;
  --vf-panel-raised: #27282f;
  --vf-line: rgba(195, 193, 212, .14);
  --vf-line-strong: rgba(195, 193, 212, .27);
  --vf-muted: #b5b2c1;
  --vf-ambient: radial-gradient(ellipse at 78% 0%, rgba(130, 95, 164, .045), transparent 55%);
  --vf-glass: linear-gradient(145deg, rgba(230, 224, 255, .025), transparent 58%);
}
body.vf-premium.theme-light:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) {
  --vf-line: rgba(101, 66, 140, .14);
  --vf-line-strong: rgba(101, 66, 140, .28);
}
body.vf-premium.theme-dark:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .side-panel .nav-btn.active {
  color: var(--vf-ink) !important;
}
body.vf-premium.theme-dark:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .side-panel .nav-btn.active * {
  color: inherit !important;
}
/* The ambient layer belongs to the scroll surface; no fixed overlay or hit targets. */
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(.main-panel, .compact-main-stage, #loginScreen.admin-authenticated) {
  background: var(--vf-ambient), var(--vf-bg) !important;
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(.side-card, .metric-card, .planilha-summary-card, .faturamento-kpi-card, .expenses-day-summary, .expenses-section, .fat-composition, .cashback-overview-card, .cashback-summary-card, .admin-dashboard-card) {
  background: var(--vf-glass), var(--vf-panel) !important;
  border-color: var(--vf-line) !important;
  border-radius: 16px !important;
  box-shadow: var(--vf-elevation) !important;
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(button, input, select, textarea, .nav-btn) {
  transition: background-color 180ms var(--vf-motion-ease-smooth), border-color 180ms var(--vf-motion-ease-smooth), color 180ms ease, box-shadow 180ms ease, transform 180ms var(--vf-motion-ease-smooth);
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(.primary-btn, .expenses-button.is-primary, .fat-button.is-primary, .accounting-action-button.is-primary):not(.danger):not(.is-danger) {
  background: linear-gradient(180deg, rgba(255,255,255,.13), transparent 55%), var(--vf-gradient-primary) !important;
  border: 1px solid rgba(234, 194, 255, .32) !important;
  box-shadow: inset 0 1px rgba(255,255,255,.2), inset 0 -1px rgba(58,16,94,.2), 0 5px 18px rgba(142,54,211,.22) !important;
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(.primary-btn, .expenses-button.is-primary, .fat-button.is-primary, .accounting-action-button.is-primary):hover:not(:disabled):not(.danger):not(.is-danger) {
  background: linear-gradient(180deg, rgba(255,255,255,.17), transparent 55%), var(--vf-gradient-primary-hover) !important;
  box-shadow: inset 0 1px rgba(255,255,255,.25), 0 7px 22px rgba(142,54,211,.27) !important;
  transform: translateY(-1px);
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(.secondary-btn, .shortcut-btn, .expenses-button.is-secondary, .fat-button:not(.is-primary)) {
  border-radius: var(--vf-radius-control) !important;
  background: var(--vf-glass), var(--vf-panel-raised) !important;
  box-shadow: inset 0 1px rgba(235,211,255,.06) !important;
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(input, select, textarea):focus-visible {
  border-color: var(--vf-border-active) !important;
  box-shadow: 0 0 0 4px var(--vf-accent-wash), inset 0 1px rgba(255,255,255,.04) !important;
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) select option { background: var(--vf-panel-soft); color: var(--vf-ink); }
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(.pill, .status, .expenses-count-badge, .expenses-status-badge, .accounting-tag, .fat-month-chip) { border-radius: 999px; }
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) table th { background: var(--vf-panel-raised) !important; }
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) tbody tr { transition: background-color 160ms ease; }
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) tbody tr:hover { background-color: var(--vf-accent-wash); }
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(.empty-state, .empty-message, .expenses-empty-state, .table-empty) { color: var(--vf-muted); line-height: 1.7; }
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(div.table-empty, .expenses-empty-state, .empty-state) {
  background: var(--vf-glass), var(--vf-panel-soft) !important;
  border: 1px dashed var(--vf-line-strong);
  border-radius: 14px;
  padding: 28px 24px;
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(.modal-content, .medicos-modal-content, .expenses-modal) {
  background: var(--vf-glass), var(--vf-panel-soft) !important;
  border: 1px solid var(--vf-line-strong) !important;
  box-shadow: inset 0 1px rgba(232,208,255,.09), 0 24px 80px rgba(8,4,22,.45) !important;
  animation: vf-aurora-enter 200ms var(--vf-motion-ease-smooth);
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) dialog::backdrop { background: rgba(13, 8, 27, .65); backdrop-filter: blur(8px); }
@keyframes vf-aurora-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
/* Stable month matrix: twelve months form complete rows at each breakpoint. */
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(#abaPlanilhas, #abaResultados) :is(.planilha-month-grid, .resultados-month-grid) {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 1fr; gap: 16px; align-items: stretch;
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .planilha-month-card {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  min-width: 0; min-height: 120px; height: 100%; box-sizing: border-box; padding: 20px;
  background: var(--vf-glass), var(--vf-panel-soft) !important;
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .planilha-month-card small {
  display: inline-flex; padding: 4px 9px; border: 1px solid var(--vf-line); border-radius: 999px;
  font-size: 11px; line-height: 1.5; background: var(--vf-accent-wash); color: var(--vf-muted);
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .planilha-month-card.is-current {
  background: linear-gradient(125deg, rgba(158,78,232,.25), rgba(219,75,173,.09)), var(--vf-panel-soft) !important;
  box-shadow: inset 3px 0 var(--vf-magenta), inset 0 1px rgba(242,210,255,.12), 0 6px 22px rgba(117,49,180,.12) !important;
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .planilhas-stage-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .config-theme-preview.is-default { background: linear-gradient(135deg, #302048, #171329) !important; border-color: #8754b0; }
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .config-theme-preview.is-dark { background: #111216 !important; }
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .config-theme-card:is(.active, [aria-pressed="true"]) { border-color: var(--vf-border-active) !important; box-shadow: 0 0 0 2px var(--vf-accent-wash) !important; }
@media (min-width: 901px) {
  body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .side-panel.left-panel {
    background: var(--vf-glass), var(--vf-panel-soft) !important;
    box-shadow: 8px 0 30px rgba(9,5,23,.1) !important;
    backdrop-filter: blur(14px);
  }
  body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .side-panel .nav-btn.active {
    background: linear-gradient(105deg, rgba(147,65,227,.32), rgba(205,63,156,.13)) !important;
    box-shadow: inset 3px 0 #da68bf, inset 0 1px rgba(236,202,255,.08), 0 3px 14px rgba(91,40,145,.12) !important;
  }
  body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .sidebar-profile-shortcut-card {
    padding: 10px 8px !important; border: 1px solid var(--vf-line) !important; border-radius: 12px !important;
    background: var(--vf-glass), var(--vf-panel) !important;
  }
}
@media (min-width: 1600px) {
  body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(#abaPlanilhas, #abaResultados) :is(.planilha-month-grid, .resultados-month-grid) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(#abaPlanilhas, #abaResultados) :is(.planilha-month-grid, .resultados-month-grid) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) :is(#abaPlanilhas, #abaResultados) :is(.planilha-month-grid, .resultados-month-grid) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) .planilha-month-card { padding: 14px; min-height: 106px; }
}
@media (prefers-reduced-motion: reduce) {
  body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) *,
  body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) *::before,
  body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Bridge page-local palettes to the selected internal theme. */
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) #abaDespesas {
  --expenses-surface: var(--vf-panel);
  --expenses-field: var(--vf-panel-soft);
  --expenses-border: var(--vf-line);
  --expenses-text: var(--vf-ink);
  --expenses-muted: var(--vf-muted);
  --expenses-purple: var(--vf-accent);
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) #abaFaturamento {
  --fat-surface: var(--vf-panel);
  --fat-border: var(--vf-line);
  --fat-text: var(--vf-ink);
  --fat-muted: var(--vf-muted);
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) #abaDespesas .expenses-empty-state {
  background: var(--vf-glass), var(--vf-panel-soft);
  border: 1px dashed var(--vf-line-strong);
  border-radius: 16px;
}
body.vf-premium:where(:not(:has(#loginScreen.active:not(.admin-authenticated)))) #abaDespesas .expenses-spinner {
  border-color: var(--vf-line-strong);
  border-top-color: var(--vf-accent);
}
