:root {
  color-scheme: dark;
  --bg: #030505;
  --bg-soft: #080b0d;
  --panel: #0b0f12;
  --panel-strong: #11161a;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f5f7f8;
  --muted: #aeb5bb;
  --muted-2: #717980;
  --green: #62ff4d;
  --green-2: #32d61f;
  --red: #ff4750;
  --red-2: #d92e38;
  --gray: #d4d7dc;
  --amber: #f2c14e;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
  --shadow-hover: 0 18px 44px rgba(0, 0, 0, 0.5);
  --radius: 16px;
  --radius-sm: 11px;
  --sidebar-width: 176px;
  --content-max: 1400px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  font-size: 14.5px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(ellipse 70% 45% at 15% -8%, rgba(98, 255, 77, 0.07), transparent),
    radial-gradient(ellipse 55% 40% at 92% 8%, rgba(46, 144, 250, 0.055), transparent),
    radial-gradient(circle at 50% 118%, rgba(98, 255, 77, 0.05), transparent 36rem),
    linear-gradient(165deg, #020604 0%, #04090b 34%, #071012 62%, #0b1512 100%);
  background-attachment: fixed;
  color: var(--text);
  letter-spacing: 0;
}

body.light-theme {
  --bg: #eff4f2;
  --bg-soft: #edf2f0;
  --panel: #ffffff;
  --panel-strong: #f7faf8;
  --line: rgba(11, 17, 16, 0.12);
  --line-strong: rgba(11, 17, 16, 0.18);
  --text: #0b1110;
  --muted: #4c555c;
  --muted-2: #68737a;
  --shadow: 0 16px 34px rgba(12, 20, 18, 0.12);
  background:
    radial-gradient(circle at 50% 115%, rgba(54, 224, 38, 0.16), transparent 34rem),
    linear-gradient(180deg, #f8fbfa 0%, #edf4f1 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.main-content {
  width: 100%;
  max-width: var(--content-max);
  padding: 40px 28px 32px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}

.topbar-title {
  min-width: 0;
}

.topbar-title h1 {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  line-height: 1.05;
  text-transform: uppercase;
}

.topbar-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.topbar-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.select-control,
.date-control,
.input-control,
.button {
  min-height: 44px;
  font-size: 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(15, 19, 23, 0.72);
  color: var(--text);
  outline: none;
}

body.light-theme .select-control,
body.light-theme .date-control,
body.light-theme .input-control,
body.light-theme .button {
  background: rgba(255, 255, 255, 0.82);
}

.select-control,
.date-control,
.input-control {
  padding: 0 16px;
}

.date-control {
  color-scheme: dark;
}

body.light-theme .date-control {
  color-scheme: light;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.button:hover,
.button:focus-visible,
.select-control:focus,
.date-control:focus,
.input-control:focus,
textarea:focus {
  border-color: rgba(98, 255, 77, 0.55);
}

.button:hover {
  transform: translateY(-1px);
  background: rgba(25, 31, 35, 0.9);
}

.button.primary {
  border-color: rgba(98, 255, 77, 0.45);
  background: linear-gradient(135deg, rgba(48, 218, 34, 0.94), rgba(107, 255, 83, 0.78));
  color: #061006;
  font-weight: 800;
}

.button.danger {
  border-color: rgba(255, 71, 80, 0.55);
  color: var(--red);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 19, 23, 0.72);
  color: var(--text);
}

.menu-toggle {
  display: none;
}

.page-grid {
  display: grid;
  gap: 14px;
}

.two-column {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-title {
  margin: 0 0 14px;
  font-size: 0.8rem;
  letter-spacing: 0.07em;
  color: var(--muted);
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.success-text {
  color: var(--green);
}

.danger-text {
  color: var(--red);
}

.warning-text {
  color: var(--amber);
}

.divider {
  height: 1px;
  margin: 18px 0;
  background: var(--line);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  height: 260px;
}

.canvas-wrap.small {
  height: 210px;
}

/* O painel "Meus Investimentos" define seu próprio tamanho quadrado
   em dashboard.css — não deixamos essa regra genérica sobrescrever. */
.investments-strip .canvas-wrap.small {
  height: auto;
}

.canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  padding: 18px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  min-width: 240px;
  max-width: 360px;
  padding: 14px 16px;
  border: 1px solid rgba(98, 255, 77, 0.34);
  border-radius: var(--radius);
  background: rgba(10, 14, 16, 0.95);
  box-shadow: var(--shadow);
  color: var(--text);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

/* ---------- Animações de entrada ---------- */
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main-content > section {
  animation: cardIn 420ms ease both;
}

.main-content > section:nth-of-type(2) { animation-delay: 60ms; }
.main-content > section:nth-of-type(3) { animation-delay: 120ms; }
.main-content > section:nth-of-type(4) { animation-delay: 180ms; }
.main-content > section:nth-of-type(5) { animation-delay: 240ms; }

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

/* ============================================================
   POLIMENTO PREMIUM v2 — brilho, profundidade e detalhes
   ============================================================ */

/* filete de luz no topo dos cards */
.card {
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  pointer-events: none;
}

.card:hover::before {
  background: linear-gradient(90deg, transparent, rgba(98, 255, 77, 0.4), transparent);
}

/* sidebar com item ativo brilhando */
.sidebar-nav .nav-link.active,
.sidebar-nav .nav-link[aria-current="page"] {
  box-shadow: inset 3px 0 0 var(--green), 0 0 18px rgba(98, 255, 77, 0.08);
}

.sidebar-nav .nav-link {
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.sidebar-nav .nav-link:hover {
  box-shadow: inset 3px 0 0 rgba(98, 255, 77, 0.4);
}

/* título da topbar com gradiente sutil */
.topbar-title h1 {
  background: linear-gradient(90deg, #f5f7f8 30%, rgba(98, 255, 77, 0.85));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* botões primários com gradiente e brilho */
.button.primary {
  background: linear-gradient(135deg, var(--green), var(--green-2));
  border: none;
  color: #04120a;
  box-shadow: 0 6px 18px rgba(98, 255, 77, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.button.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(98, 255, 77, 0.32);
}

/* barra de rolagem elegante */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(98, 255, 77, 0.35);
  background-clip: content-box;
}

/* dica de páginas de visualização (Entradas/Despesas) */
.view-hint .hint-text {
  color: var(--muted);
  line-height: 1.7;
  margin: 4px 0 18px;
}

.view-hint .hint-text strong {
  color: var(--text);
}

.view-hint .button {
  text-decoration: none;
  display: inline-block;
}

.empty-state a {
  color: var(--green);
  font-weight: 700;
}

/* inputs com foco verde consistente */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(98, 255, 77, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(98, 255, 77, 0.1);
}

/* ============================================================
   PRO-GATE — vitrine bloqueada + faixa de assinatura
   ============================================================ */
.pro-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(153, 69, 255, 0.14), rgba(153, 69, 255, 0.05));
  border: 1px solid rgba(153, 69, 255, 0.35);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 16px;
  animation: cardRise 0.4s ease both;
}

.pro-banner-icon {
  font-size: 1.1rem;
}

.pro-banner-text {
  flex: 1;
  min-width: 200px;
  font-size: 0.86rem;
  color: var(--text);
}

.pro-banner-text strong {
  color: #b98cff;
}

.pro-banner-btn {
  flex: 0 0 auto;
  padding: 9px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.84rem;
  color: #fff;
  background: linear-gradient(135deg, #9945FF, #7b2ff7);
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(153, 69, 255, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pro-banner-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(153, 69, 255, 0.4);
}

/* Zonas de edição travadas — a pessoa vê, mas não mexe */
body.mdf-locked [data-mdf-lock-zone] {
  position: relative;
  pointer-events: none;
  opacity: 0.5;
  filter: grayscale(0.35);
  user-select: none;
}

body.mdf-locked [data-mdf-lock-zone]::after {
  content: "👑 Exclusivo PRO";
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(153, 69, 255, 0.9);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
  z-index: 2;
}
