@import url('tokens.css');

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
}
h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-3); }
h4 { font-size: var(--step-2); }
p { margin: 0 0 1em; color: var(--ink-soft); }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--coral);
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: 0.9em;
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: var(--coral);
  display: inline-block;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--step-0);
  padding: 0.85em 1.5em;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--coral); color: #fff; box-shadow: 0 6px 16px -6px rgba(226,84,43,.55); }
.btn-primary:hover { background: var(--coral-ink); }
.btn-dark { background: var(--jade); color: #fff; }
.btn-dark:hover { background: var(--jade-2); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn-ghost-light:hover { border-color: #fff; }
.btn-sm { padding: 0.55em 1.1em; font-size: var(--step--1); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(238,235,223,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.nav .container { display: flex; align-items: center; justify-content: space-between; padding-top: 1rem; padding-bottom: 1rem; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand-mark { width: 30px; height: 30px; flex-shrink: 0; }
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a { text-decoration: none; font-size: var(--step--1); font-weight: 500; color: var(--ink-soft); }
.nav-links a:hover { color: var(--ink); }
.nav-cta { display: flex; gap: 0.6rem; align-items: center; flex-shrink: 0; }
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--ink);
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line-soft);
    box-shadow: var(--shadow-pop);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: .5rem var(--gutter) 1rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .85rem 0; border-bottom: 1px solid var(--line-soft); font-size: var(--step-0); }
  .nav-links a:last-child { border-bottom: none; }
}

@media (max-width: 420px) {
  .nav-cta .btn-ghost { display: none; }
  .brand { font-size: 1.05rem; }
}

.nav-link-mobile-only { display: none; }
@media (max-width: 860px) { .nav-link-mobile-only { display: block; } }

/* ---------- Hero ---------- */
.hero {
  background: radial-gradient(120% 140% at 15% -10%, #1B4238 0%, var(--jade) 55%, #0C221D 100%);
  color: #fff;
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(4rem, 10vw, 7rem);
  overflow: hidden;
  position: relative;
}
.hero .container { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
.hero h1 { color: #fff; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero p.lead { color: rgba(255,255,255,.72); font-size: var(--step-1); max-width: 46ch; }
.hero-cta { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 2rem; }
.hero-proof { margin-top: 2.75rem; display: flex; gap: clamp(1.5rem, 4vw, 3rem); flex-wrap: wrap; }
.hero-proof div strong { display: block; font-family: var(--font-display); font-size: var(--step-2); color: var(--gold); }
.hero-proof div span { font-size: var(--step--1); color: rgba(255,255,255,.6); }

@media (max-width: 900px) {
  .hero .container { grid-template-columns: 1fr; }
}

/* ---------- Roda do giro (signature element) ---------- */
.roda-wrap { position: relative; aspect-ratio: 1/1; max-width: 460px; width: 100%; margin: 0 auto; }
@media (max-width: 480px) { .roda-wrap { max-width: 300px; } .roda-center .valor { font-size: var(--step-2); } }
.roda-wrap svg { width: 100%; height: 100%; }
.roda-node circle { fill: #0F2E28; stroke: rgba(255,255,255,.25); stroke-width: 1.5; transition: all .4s var(--ease); }
.roda-node.contemplado circle { fill: var(--gold); stroke: var(--gold); }
.roda-node text { fill: rgba(255,255,255,.65); font-family: var(--font-mono); font-size: 11px; text-anchor: middle; }
.roda-node.contemplado text { fill: var(--jade); font-weight: 700; }
.roda-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; pointer-events: none; }
.roda-center .valor { font-family: var(--font-display); font-size: var(--step-3); color: var(--gold); }
.roda-center .label { font-family: var(--font-mono); font-size: var(--step--1); color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .1em; }
.roda-ring { animation: spin-in 1.4s var(--ease) both; transform-origin: center; }
@keyframes spin-in { from { opacity: 0; transform: rotate(-50deg) scale(.9); } to { opacity: 1; transform: rotate(0) scale(1); } }

/* ---------- Sections ---------- */
section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section-head { max-width: 640px; margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.section-alt { background: var(--bg-soft); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.section-dark { background: var(--jade); color: #fff; }
.section-dark p { color: rgba(255,255,255,.7); }
.section-dark h2, .section-dark h3 { color: #fff; }

/* ---------- Grid de passos ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; counter-reset: step; }
.step-card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-md); padding: 1.6rem; }
.step-num { font-family: var(--font-mono); color: var(--coral); font-size: var(--step--1); margin-bottom: 0.8rem; }
.step-card h4 { font-size: var(--step-1); margin-bottom: 0.35em; }
.step-card p { font-size: var(--step--1); margin: 0; }
@media (max-width: 980px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .steps { grid-template-columns: 1fr; } }

/* ---------- Cards / grid geral ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 980px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-3 { grid-template-columns: 1fr; } }

.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; }
@media (max-width: 860px) { .split-2 { grid-template-columns: 1fr; gap: 2rem; } }

.split-form { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { .split-form { grid-template-columns: 1fr; } }

#wallet-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 1.5rem; align-items: start; }
@media (max-width: 860px) { #wallet-grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
}

/* ---------- Recibo (exemplo de taxa) ---------- */
.receipt {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 2rem 2.2rem;
  max-width: 460px;
  box-shadow: var(--shadow-pop);
  font-family: var(--font-mono);
}
.receipt-title { font-family: var(--font-display); font-size: var(--step-1); font-weight: 700; margin-bottom: 1.2rem; color: var(--ink); }
.receipt-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.55rem 0; border-bottom: 1px dashed var(--line); font-size: var(--step--1); }
.receipt-row.total { border-bottom: none; border-top: 2px solid var(--ink); margin-top: 0.4rem; padding-top: 0.9rem; font-weight: 700; font-size: var(--step-0); }
.receipt-row .v { color: var(--ink); font-weight: 600; }
.receipt-row.total .v { color: var(--coral); }

/* ---------- Badges / status ---------- */
.badge { display: inline-flex; align-items: center; gap: .4em; font-family: var(--font-mono); font-size: var(--step--1); padding: .3em .8em; border-radius: var(--radius-pill); font-weight: 600; }
.badge-ok { background: #DCEFE1; color: var(--green-ok); }
.badge-warn { background: var(--gold-soft); color: var(--gold-ink); }
.badge-alert { background: var(--coral-soft); color: var(--coral-ink); }
.badge-neutral { background: var(--bg-soft); color: var(--ink-soft); border: 1px solid var(--line); }

/* ---------- Footer ---------- */
footer.site-footer { background: var(--jade); color: rgba(255,255,255,.6); padding: 3rem 0 2rem; font-size: var(--step--1); }
footer.site-footer a { color: rgba(255,255,255,.85); text-decoration: none; }
.footer-grid { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2rem; padding-bottom: 2rem; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 1.5rem; }
.footer-cols { display: flex; gap: 3.5rem; flex-wrap: wrap; }
.footer-cols h5 { font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: rgba(255,255,255,.4); margin-bottom: .9rem; }
.footer-cols li { list-style: none; margin-bottom: .5rem; }
.footer-cols ul { margin: 0; padding: 0; }

/* ---------- Forms (auth, app) ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--jade); color: #fff; padding: clamp(2rem,5vw,4rem); display: flex; flex-direction: column; justify-content: space-between; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: clamp(2rem,5vw,4rem); }
@media (max-width: 900px) { .auth-shell { grid-template-columns: 1fr; } .auth-side { display: none; } }

.form-card { width: 100%; max-width: 420px; }
.field { margin-bottom: 1.15rem; }
.field label { display: block; font-size: var(--step--1); font-weight: 600; margin-bottom: 0.4rem; color: var(--ink); }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.75em 0.9em; border-radius: var(--radius-sm); border: 1px solid var(--line);
  font-family: var(--font-body); font-size: var(--step-0); background: var(--surface); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--coral); outline-offset: 1px; border-color: var(--coral); }
.field-hint { font-size: var(--step--1); color: var(--ink-faint); margin-top: 0.35rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-msg { font-size: var(--step--1); padding: 0.8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1.1rem; display: none; }
.form-msg.show { display: block; }
.form-msg.error { background: var(--coral-soft); color: var(--coral-ink); }
.form-msg.ok { background: #DCEFE1; color: var(--green-ok); }
.check-row { display: flex; align-items: flex-start; gap: 0.6rem; font-size: var(--step--1); color: var(--ink-soft); }

@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .auth-form-wrap, .form-card { padding-left: 0; padding-right: 0; }
}

/* ---------- App shell (dashboard) ---------- */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.app-sidebar { background: var(--jade); color: #fff; padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.app-sidebar .brand { color: #fff; padding: 0.5rem 0.75rem 1.5rem; }
.app-sidebar a { display: flex; align-items: center; gap: 0.7rem; padding: 0.75rem 0.85rem; border-radius: var(--radius-sm); text-decoration: none; color: rgba(255,255,255,.7); font-size: var(--step--1); font-weight: 500; }
.app-sidebar a:hover { background: rgba(255,255,255,.06); color: #fff; }
.app-sidebar a.active { background: rgba(255,255,255,.1); color: #fff; }
.app-main { padding: clamp(1.25rem, 3vw, 2.5rem); max-width: 1100px; }
.app-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; margin-bottom: 2rem; }
.stat-card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-md); padding: 1.25rem 1.4rem; }
.stat-card .label { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin-bottom: .5rem; }
.stat-card .value { font-family: var(--font-display); font-size: var(--step-2); word-break: break-word; }

/* Mobile topbar + off-canvas sidebar drawer (injetados via app-shell.js) */
.mobile-topbar {
  display: none;
  position: sticky; top: 0; z-index: 50;
  background: var(--jade); color: #fff;
  align-items: center; justify-content: space-between;
  padding: .8rem 1rem;
}
.mobile-topbar .brand { color: #fff; font-size: 1.05rem; padding: 0; }
.mobile-topbar .hamburger {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.22); border-radius: 8px;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #fff;
  flex-shrink: 0;
}
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(12,34,29,.55); z-index: 65; }
.sidebar-backdrop.open { display: block; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .mobile-topbar { display: flex; }
  .app-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(78vw, 280px); z-index: 70;
    transform: translateX(-100%);
    transition: transform .25s var(--ease);
    overflow-y: auto;
  }
  .app-sidebar.open { transform: translateX(0); box-shadow: var(--shadow-pop); }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stat-grid { gap: .75rem; }
  .stat-card { padding: 1rem 1.1rem; }
}

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-simple { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.table-scroll .table-simple { min-width: 520px; }
.table-simple th { text-align: left; font-family: var(--font-mono); text-transform: uppercase; font-size: 0.72rem; letter-spacing: .05em; color: var(--ink-faint); padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); }
.table-simple td { padding: 0.75rem 0.8rem; border-bottom: 1px solid var(--line-soft); }
.table-simple tr:last-child td { border-bottom: none; }

.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--ink-faint); }

.skeleton { background: linear-gradient(90deg, var(--line-soft) 25%, var(--bg) 37%, var(--line-soft) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
