:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --yellow: #f5c518;
  --yellow-dim: rgba(245, 197, 24, 0.12);
  --green: #22c55e;
  --red: #ef4444;
  --text: #ffffff;
  --muted: #6b7280;
  --muted2: #9ca3af;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; overflow-x: hidden; }
body, #app { overflow-x: hidden; max-width: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  font-family: Inter, Segoe UI, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

.layout { display: flex; min-height: 100dvh; }

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-logo { padding: 28px 24px 20px; border-bottom: 1px solid var(--border); }
.sidebar-logo h1 { font-size: 17px; font-weight: 800; letter-spacing: .5px; }
.sidebar-logo h1 span { color: var(--yellow); }
.sidebar-logo p {
  font-size: 11px; color: var(--muted); margin-top: 2px;
  text-transform: uppercase; letter-spacing: .8px;
}
nav { padding: 16px 12px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  min-height: 44px; padding: 10px 12px; border-radius: 6px;
  font-size: 13px; font-weight: 500; color: var(--muted2);
  margin-bottom: 2px; cursor: pointer;
}
.nav-link:hover { background: var(--surface2); color: var(--text); }
.nav-link.active { background: var(--yellow-dim); color: var(--yellow); }
.nav-link.active .nav-dot { background: var(--yellow); }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.sidebar-footer { padding: 16px 12px 20px; border-top: 1px solid var(--border); }
.sidebar-user { font-size: 12px; color: var(--muted2); margin-bottom: 10px; word-break: break-word; }
.sidebar-user strong { display: block; color: var(--text); margin-bottom: 2px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-header {
  padding: 32px 40px 24px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
}
.page-header h2 {
  font-size: 28px; font-weight: 900; letter-spacing: -.5px;
  line-height: 1; text-transform: uppercase;
}
.page-header p { margin-top: 8px; font-size: 12px; color: var(--muted); }
.page-content { padding: 28px 40px 48px; }

.section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 2px; color: var(--muted); margin: 0 0 14px;
  display: flex; align-items: center; gap: 10px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.btn {
  min-height: 44px; padding: 9px 16px; background: transparent;
  border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted2); font-size: 12.5px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { border-color: var(--yellow); color: var(--yellow); }
.btn-primary { background: var(--yellow); color: #000; border-color: var(--yellow); }
.btn-primary:hover { background: #e0b510; color: #000; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.period-tabs {
  display: flex; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; overflow: auto;
}
.period-btn {
  min-height: 44px; padding: 8px 16px; font-size: 12px; font-weight: 600;
  background: transparent; border: none; color: var(--muted2); cursor: pointer;
}
.period-btn.active { background: var(--yellow); color: #000; }

.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 32px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 20px;
}
.kpi-card.accent {
  border-color: rgba(245, 197, 24, .3);
  background: linear-gradient(135deg, rgba(245, 197, 24, .05) 0%, var(--surface) 100%);
}
.kpi-card-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted); margin-bottom: 10px;
}
.kpi-card-value {
  font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1;
  overflow-wrap: anywhere; word-break: break-word;
}
.kpi-card.accent .kpi-card-value { color: var(--yellow); font-size: 30px; }
.kpi-card-sub { margin-top: 6px; font-size: 11px; color: var(--muted); }
.kpi-skel {
  height: 28px; border-radius: 4px;
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; margin-top: 10px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; margin-bottom: 24px;
}
.panel-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.panel-header h3 {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted2);
}
.panel-body { padding: 20px; }

.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.badge-active { background: rgba(34, 197, 94, .12); color: var(--green); border: 1px solid rgba(34, 197, 94, .3); }
.badge-paid { background: rgba(34, 197, 94, .12); color: var(--green); border: 1px solid rgba(34, 197, 94, .3); }
.badge-pending { background: rgba(245, 197, 24, .12); color: var(--yellow); border: 1px solid rgba(245, 197, 24, .3); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); padding: 0 12px 12px;
}
td { padding: 12px; border-top: 1px solid var(--border); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

.alert {
  padding: 11px 14px; border-radius: 6px; font-size: 12.5px; font-weight: 500; margin-bottom: 18px;
}
.alert-error { background: rgba(239, 68, 68, .1); border: 1px solid rgba(239, 68, 68, .3); color: #f87171; }
.alert-success { background: rgba(34, 197, 94, .1); border: 1px solid rgba(34, 197, 94, .3); color: #4ade80; }
.hidden { display: none !important; }
.empty { color: var(--muted); font-size: 13px; padding: 12px 0; }

.login-wrap {
  min-height: 100dvh; display: grid;
  grid-template-columns: 1.05fr .95fr;
}
.login-hero {
  background: var(--bg); padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-hero h1 { font-size: 36px; font-weight: 900; letter-spacing: -.6px; line-height: 1.1; max-width: 520px; }
.login-hero p { margin-top: 16px; color: var(--muted2); max-width: 460px; }
.login-card-wrap { display: flex; align-items: center; background: #111; padding: 32px 24px; }
.login-card {
  width: 100%; max-width: 420px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 28px;
}
.login-card h2 { font-size: 24px; font-weight: 800; margin: 6px 0 8px; }
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 5px;
}
.form-group input {
  width: 100%; min-height: 44px; padding: 9px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text);
}
.form-group input:focus { outline: none; border-color: var(--yellow); }
.btn-full { width: 100%; }
.hint { margin-top: 16px; font-size: 12px; color: var(--muted2); background: var(--bg); border-radius: 8px; padding: 12px; }
.btn-install { margin-top: 10px; width: 100%; }

.install-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid rgba(245, 197, 24, .35);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 20px;
}
.install-banner strong { display: block; font-size: 13px; margin-bottom: 4px; }
.install-banner p { font-size: 12px; color: var(--muted2); }

.install-sheet {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.72);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px;
}
.install-sheet-card {
  width: 100%; max-width: 440px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px 16px 10px 10px; padding: 22px 20px 18px;
}
.install-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: 2px;
  text-transform: uppercase; color: var(--yellow); margin-bottom: 8px;
}
.install-sheet-card h3 { font-size: 20px; font-weight: 800; margin-bottom: 14px; }
.install-sheet-card ol {
  padding-left: 18px; margin: 0 0 20px;
  color: var(--muted2); font-size: 14px; line-height: 1.55;
}
.install-sheet-card li { margin-bottom: 10px; }
.install-sheet-card li::marker { color: var(--yellow); font-weight: 800; }

@media (min-width: 700px) {
  .install-sheet { align-items: center; }
  .install-sheet-card { border-radius: 12px; }
}

.amount-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 16px;
}
.amount-btn {
  min-height: 48px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-weight: 700; cursor: pointer;
}
.amount-btn.active { background: var(--yellow); color: #000; border-color: var(--yellow); }
.pix-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; margin-top: 8px;
}
.pix-qr {
  display: block; width: 220px; height: 220px; margin: 0 auto 16px;
  background: #fff; border-radius: 8px; padding: 8px;
}
.pix-code {
  font-size: 11px; word-break: break-all; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  color: var(--muted2); margin: 10px 0 14px;
}
.custom-amount {
  display: flex; gap: 8px; margin-bottom: 8px;
}
.custom-amount input { flex: 1; }

.report-intro {
  font-size: 13px; color: var(--muted2); margin: 0 0 16px; line-height: 1.5;
}
.stat-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.stat-row:last-child { border-bottom: 0; padding-bottom: 0; }
.stat-row span { color: var(--muted2); }
.stat-row strong { font-weight: 800; text-align: right; overflow-wrap: anywhere; }

.lead-card {
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.lead-card:last-child { border-bottom: 0; padding-bottom: 0; }
.lead-card strong { display: block; font-size: 14px; margin-bottom: 4px; }
.lead-card span { display: block; font-size: 12px; color: var(--muted2); }
.lead-url { overflow-wrap: anywhere; }

.download-page {
  min-height: 100dvh; max-width: 440px; margin: 0 auto;
  padding: 32px 20px 48px; text-align: center;
}
.download-icon {
  width: 88px; height: 88px; border-radius: 20px; margin: 0 auto 16px;
  display: block; background: #111;
}
.download-page h1 {
  font-size: 26px; font-weight: 900; letter-spacing: -.4px;
  margin: 8px 0 12px; line-height: 1.15;
}
.download-lead { color: var(--muted2); font-size: 14px; margin-bottom: 22px; }
.download-steps {
  text-align: left; margin-top: 28px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; padding: 18px 18px 8px;
}
.download-steps h2 {
  font-size: 13px; font-weight: 800; letter-spacing: .4px;
  text-transform: uppercase; color: var(--yellow); margin-bottom: 10px;
}
.download-steps ol {
  padding-left: 18px; color: var(--muted2); font-size: 14px; line-height: 1.55;
}
.download-steps li { margin-bottom: 10px; }
.download-steps li::marker { color: var(--yellow); font-weight: 800; }

.install-coach {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.82);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}
.install-coach.hidden { display: none !important; }
.install-coach-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px 18px 16px; max-height: 80dvh; overflow: auto;
}
.install-coach-card h2 { font-size: 22px; font-weight: 900; margin: 0 0 14px; text-align: left; }
.install-coach-card ol {
  text-align: left; padding-left: 22px; margin: 0 0 12px;
  color: var(--text); font-size: 16px; line-height: 1.5;
}
.install-coach-card li { margin-bottom: 14px; }
.install-coach-card li::marker { color: var(--yellow); font-weight: 800; }
.ios-share-hint {
  text-align: center; color: var(--yellow); font-weight: 800;
  font-size: 14px; letter-spacing: .3px; margin: 12px 0 0;
  animation: bounceDown 1.2s ease-in-out infinite;
}
@keyframes bounceDown {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; min-height: 0; }
  .sidebar-logo { padding: 16px 16px 12px; }
  nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px; overflow: visible; padding: 8px;
  }
  .nav-link {
    flex-direction: column; justify-content: center; gap: 4px;
    min-height: 48px; margin: 0; padding: 6px 2px;
    font-size: 10px; line-height: 1.15; text-align: center;
    white-space: normal;
  }
  .nav-dot { display: none; }
  .sidebar-footer { padding: 10px 12px 14px; }
  .page-header { padding: 16px 16px 14px; align-items: flex-start; }
  .page-header h2 { font-size: 22px; overflow-wrap: anywhere; }
  .page-content { padding: 16px 16px 40px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
  .kpi-card { padding: 14px 12px; }
  .kpi-card-value { font-size: 18px; }
  .kpi-card.accent .kpi-card-value { font-size: 20px; }
  .period-tabs { width: 100%; }
  .period-btn { flex: 1; padding: 8px 8px; font-size: 11px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .amount-grid { grid-template-columns: 1fr 1fr; }
  .pix-qr { width: min(220px, 70vw); height: auto; aspect-ratio: 1; }
  .btn { width: 100%; }
  .page-content > div[style*="flex"] { flex-direction: column; }
}

@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
