:root {
  color-scheme: dark;
  --bg: #06080d;
  --panel: rgba(14, 20, 31, 0.88);
  --panel-2: #101824;
  --line: rgba(226, 190, 104, 0.18);
  --text: #f6f3eb;
  --muted: #9aa5b4;
  --gold: #d8b66b;
  --gold-2: #f0d58b;
  --green: #27c08a;
  --red: #ff6868;
  --blue: #54a8ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(216, 182, 107, 0.12), transparent 32rem),
    radial-gradient(circle at top right, rgba(39, 192, 138, 0.12), transparent 28rem),
    var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}
.auth-hero {
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(216, 182, 107, .13), rgba(39, 192, 138, .07));
  border-right: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; font-weight: 800; letter-spacing: .02em; }
.brand-logo { width: min(330px, 100%); height: auto; display: block; }
.mark {
  width: 44px; height: 44px; border: 1px solid rgba(216, 182, 107, .55); border-radius: 14px;
  display: grid; place-items: center; color: var(--gold); background: rgba(216, 182, 107, .08);
}
.hero-copy h1 { font-size: clamp(36px, 6vw, 72px); line-height: .95; margin: 0 0 24px; }
.hero-copy p { max-width: 720px; color: var(--muted); font-size: 18px; line-height: 1.7; margin: 0 0 14px; }
.auth-card {
  width: min(520px, calc(100% - 32px));
  margin: auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(9, 13, 21, .78);
  box-shadow: var(--shadow);
}
.tabs { display: flex; gap: 8px; padding: 5px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: rgba(255,255,255,.04); }
.tab { flex: 1; border: 0; color: var(--muted); background: transparent; border-radius: 10px; padding: 11px; }
.tab.active { color: #111; background: linear-gradient(135deg, var(--gold), var(--gold-2)); font-weight: 800; }
.form { display: grid; gap: 14px; margin-top: 20px; }
.field { display: grid; gap: 8px; }
.field label { color: var(--muted); font-size: 13px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 13px;
  background: rgba(255,255,255,.045);
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(216, 182, 107, .75); }
.check { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); font-size: 13px; line-height: 1.4; }
.check input { margin-top: 3px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid rgba(216, 182, 107, .3);
  border-radius: 13px;
  padding: 12px 16px;
  color: var(--text);
  background: rgba(255,255,255,.055);
  transition: .2s ease;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(216, 182, 107, .7); }
.btn.primary { color: #101010; border: 0; font-weight: 800; background: linear-gradient(135deg, var(--gold), var(--gold-2)); }
.btn.danger { border-color: rgba(255,104,104,.35); color: #ffdada; }
.btn.green { border-color: rgba(39,192,138,.45); color: #bfffe7; }
.btn.small { padding: 8px 10px; border-radius: 10px; font-size: 12px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 24px 18px;
  background: rgba(8, 11, 18, .9); border-right: 1px solid var(--line);
}
.nav { display: grid; gap: 8px; margin-top: 28px; }
.nav button {
  text-align: left; border: 0; border-radius: 13px; padding: 12px 14px;
  color: var(--muted); background: transparent;
}
.nav button.active, .nav button:hover { color: var(--text); background: rgba(216, 182, 107, .1); }
.main { padding: 28px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.topbar h1 { margin: 0; font-size: clamp(24px, 3vw, 36px); }
.muted { color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: 0 16px 50px rgba(0,0,0,.18);
  padding: 20px;
}
.card h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.metric { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 14px; }
.search { min-width: 260px; flex: 1; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 820px; background: rgba(255,255,255,.02); }
th, td { padding: 13px 14px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.07); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
td { font-size: 14px; }
.badge { display: inline-flex; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.08); color: var(--muted); }
.badge.active, .badge.paid, .badge.paid_with_balance { color: #c9ffe9; background: rgba(39,192,138,.18); }
.badge.pending, .badge.partially_paid_with_balance { color: #ffe9bd; background: rgba(216,182,107,.18); }
.badge.overdue, .badge.cancelled, .badge.refunded, .badge.inactive { color: #ffd0d0; background: rgba(255,104,104,.16); }
.actions { display: flex; flex-wrap: wrap; gap: 7px; }
.notice { border: 1px solid rgba(216,182,107,.24); border-radius: 16px; padding: 14px; background: rgba(216,182,107,.08); color: #f9e9bf; }
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 50;
  max-width: 420px; padding: 14px 16px; border-radius: 14px; background: #142033; border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.62); display: grid; place-items: center; padding: 20px; z-index: 40; }
.modal { width: min(680px, 100%); max-height: 90vh; overflow: auto; border-radius: 22px; background: #0d1420; border: 1px solid var(--line); padding: 22px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.risk { color: #dfd3b4; font-size: 12px; line-height: 1.55; }
.hide { display: none !important; }

@media (max-width: 980px) {
  .auth-shell, .app-shell { grid-template-columns: 1fr; }
  .auth-hero { min-height: 40vh; padding: 28px; }
  .sidebar { position: static; height: auto; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cards, .grid.two { grid-template-columns: 1fr; }
  .main { padding: 18px; }
  .split { grid-template-columns: 1fr; }
}

/* Ajustes Capital Back - responsivo */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
img, svg { max-width: 100%; }
.auth-shell, .app-shell, .main, .card, .auth-card { min-width: 0; }
.brand-logo { opacity: 1; filter: contrast(1.08) saturate(1.08); }
.topbar { flex-wrap: wrap; }
.topbar > div:last-child { display: flex; gap: 10px; flex-wrap: wrap; }
.card, .notice, .modal { overflow-wrap: anywhere; }
.field input, .field select, .field textarea { min-width: 0; }

@media (max-width: 1180px) {
 .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
 .app-shell { grid-template-columns: 240px 1fr; }
 .sidebar { padding: 20px 14px; }
}

@media (max-width: 980px) {
 .auth-shell, .app-shell { grid-template-columns: 1fr; }
 .auth-hero { min-height: auto; padding: 28px 20px; gap: 42px; border-right: 0; border-bottom: 1px solid var(--line); }
 .brand-logo { width: min(280px, 100%); }
 .hero-copy h1 { font-size: clamp(34px, 11vw, 58px); line-height: 1; }
 .hero-copy p { font-size: 16px; line-height: 1.6; }
 .auth-card { width: min(100% - 28px, 520px); padding: 22px; margin: 24px auto; }
 .sidebar { position: static; height: auto; padding: 18px; }
 .sidebar .brand-logo { width: min(220px, 100%); }
 .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
 .nav button { text-align: center; padding: 11px 10px; }
 .main { padding: 18px; }
 .grid.cards, .grid.two { grid-template-columns: 1fr; }
 .split { grid-template-columns: 1fr; }
 .toolbar { align-items: stretch; }
 .toolbar .btn, .toolbar .search { width: 100%; min-width: 0; }
 table { min-width: 760px; }
}

@media (max-width: 560px) {
 .auth-hero { padding: 22px 16px; }
 .auth-card { width: calc(100% - 20px); padding: 18px; border-radius: 18px; }
 .tabs { gap: 4px; }
 .tab { padding: 10px 8px; }
 .main { padding: 14px; }
 .topbar { align-items: flex-start; gap: 12px; }
 .topbar h1 { font-size: 24px; }
 .nav { grid-template-columns: 1fr; }
 .card { padding: 16px; border-radius: 16px; }
 .metric { font-size: 24px; }
 .modal-backdrop { padding: 10px; }
 .modal { padding: 16px; border-radius: 18px; }
 .toast { left: 12px; right: 12px; max-width: none; }
}


/* Contatos flutuantes do painel */
.admin-floating-contact {
 position: fixed;
 right: 18px;
 bottom: 18px;
 z-index: 90;
 display: grid;
 gap: 10px;
}
.admin-float {
 min-height: 44px;
 display: inline-flex;
 align-items: center;
 justify-content: center;
 border-radius: 999px;
 padding: 11px 15px;
 color: #fff;
 font-weight: 800;
 box-shadow: 0 16px 40px rgba(0,0,0,.34);
}
.admin-float.whatsapp { background: linear-gradient(135deg, #1faf5f, #24d366); }
.admin-float.instagram { background: linear-gradient(135deg, #833ab4, #fd1d1d 55%, #fcb045); }
@media (max-width: 560px) {
 .admin-floating-contact { right: 12px; bottom: 12px; }
 .admin-float { width: 46px; height: 46px; padding: 0; overflow: hidden; font-size: 0; }
 .admin-float.whatsapp::before { content: 'WA'; font-size: 12px; }
 .admin-float.instagram::before { content: 'IG'; font-size: 12px; }
}

.support-line a { color: var(--gold-2); font-weight: 800; }
.support-line a:hover { text-decoration: underline; }
.plan-summary { padding: 18px 0; border-top: 1px solid rgba(255,255,255,.07); }
.plan-summary:first-of-type { border-top: 0; }
.plan-summary h3 { margin: 0 0 10px; color: var(--text); font-size: 20px; }
.plan-summary .grid.cards { margin: 18px 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.plan-summary .grid.cards > div { display: grid; gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); }
.plan-summary .grid.cards b { font-size: 15px; }
.xp-account-banner {
 display: flex; align-items: center; justify-content: space-between; gap: 24px;
 margin-bottom: 16px; padding: 22px 24px; border: 1px solid rgba(216,182,107,.42);
 border-radius: 14px; background: #111720; box-shadow: 0 14px 40px rgba(0,0,0,.2);
}
.xp-account-banner span { color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.xp-account-banner h2 { margin: 6px 0; font-size: 21px; }
.xp-account-banner p { margin: 0; max-width: 650px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.xp-account-banner .btn { min-width: 170px; white-space: nowrap; }
@media (max-width: 720px) {
 .plan-summary .grid.cards { grid-template-columns: 1fr; }
 .xp-account-banner { align-items: stretch; flex-direction: column; padding: 18px; }
 .xp-account-banner .btn { width: 100%; }
}

/* Dashboard administrativo */
.dashboard { display: grid; gap: 18px; }
.dashboard-heading, .chart-title {
 display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.dashboard-heading h2, .chart-title h2 { margin: 0 0 5px; font-size: 20px; }
.dashboard-heading p, .chart-title p { margin: 0; font-size: 13px; }
.dashboard-period {
 padding: 7px 11px; border: 1px solid var(--line); border-radius: 999px;
 color: var(--gold-2); background: rgba(216,182,107,.07); font-size: 12px; font-weight: 700;
}
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi-card { position: relative; overflow: hidden; min-height: 142px; }
.kpi-card .kpi-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gold); }
.kpi-card.green .kpi-accent { background: var(--green); }
.kpi-card.blue .kpi-accent { background: var(--blue); }
.kpi-card.red .kpi-accent { background: var(--red); }
.kpi-card h3 { margin-top: 6px; }
.kpi-card .metric { margin: 13px 0 8px; font-size: clamp(23px, 2vw, 31px); }
.kpi-card > span { color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 16px; }
.chart-card { min-height: 310px; }
.chart-title > b { color: var(--gold-2); font-size: 18px; white-space: nowrap; }
.bar-chart { height: 220px; display: flex; align-items: stretch; gap: clamp(8px, 2vw, 22px); padding-top: 24px; }
.bar-column { flex: 1; min-width: 0; display: grid; grid-template-rows: 20px 1fr 20px; gap: 7px; text-align: center; }
.bar-column > span { min-width: 0; overflow: hidden; color: var(--muted); font-size: 10px; white-space: nowrap; }
.bar-column > b { color: var(--muted); font-size: 11px; text-transform: capitalize; }
.bar-track { position: relative; overflow: hidden; border-radius: 6px 6px 3px 3px; background: rgba(255,255,255,.035); }
.bar-track i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--gold-2), #a47a21); }
.payment-chart { min-height: 225px; display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 24px; }
.donut {
 width: 145px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
 background: conic-gradient(var(--green) 0 var(--paid), var(--gold) var(--paid) var(--pending), var(--red) var(--pending) var(--overdue), #596273 var(--overdue) 360deg);
}
.donut::before { content: ""; grid-area: 1/1; width: 102px; aspect-ratio: 1; border-radius: 50%; background: #0d1420; }
.donut > div { z-index: 1; grid-area: 1/1; display: grid; text-align: center; }
.donut b { font-size: 26px; }
.donut span { color: var(--muted); font-size: 11px; }
.chart-legend { display: grid; gap: 12px; }
.chart-legend > span { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.chart-legend b { color: var(--text); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #596273; }
.dot.green { background: var(--green); }.dot.gold { background: var(--gold); }.dot.red { background: var(--red); }.dot.blue { background: var(--blue); }
.horizontal-chart { display: grid; gap: 17px; margin-top: 25px; }
.plan-bar > div:first-child { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; font-size: 12px; }
.plan-bar > div:first-child span { color: var(--muted); }
.plan-bar > div:last-child { overflow: hidden; height: 8px; border-radius: 999px; background: rgba(255,255,255,.06); }
.plan-bar i { display: block; height: 100%; min-width: 3px; border-radius: inherit; background: var(--gold); }
.client-progress { overflow: hidden; height: 12px; margin: 34px 0 18px; border-radius: 999px; background: rgba(216,182,107,.2); }
.client-progress div { height: 100%; border-radius: inherit; background: var(--green); }
.client-stats { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.client-stats span { display: flex; align-items: center; gap: 7px; }
.client-stats b { color: var(--text); }
.referral-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 30px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.07); }
.referral-summary span { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.referral-summary b { color: var(--text); font-size: 14px; }
.recent-card { padding-bottom: 10px; }
.activity-list { display: grid; margin-top: 12px; }
.activity-item { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 12px; padding: 12px 2px; border-top: 1px solid rgba(255,255,255,.06); }
.activity-item > i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(216,182,107,.08); }
.activity-item > div { display: grid; gap: 3px; }
.activity-item b { font-size: 13px; }.activity-item span, .activity-item time { color: var(--muted); font-size: 11px; }

/* Financeiro */
.finance-page { display: grid; gap: 18px; }
.finance-result { display: grid; gap: 12px; margin-top: 12px; }
.finance-result span {
 display: flex; align-items: center; justify-content: space-between; gap: 12px;
 padding: 12px 0; border-top: 1px solid rgba(255,255,255,.07); color: var(--muted);
}
.finance-result span:first-child { border-top: 0; }
.finance-result b { color: var(--text); font-size: 18px; }
.finance-result .positive b { color: #c9ffe9; }
.finance-result .negative b { color: #ffd0d0; }
.finance-table { min-width: 680px; }

@media (max-width: 1180px) {
 .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
 .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
 .kpi-grid { grid-template-columns: 1fr; }
 .kpi-card { min-height: 125px; }
 .payment-chart { grid-template-columns: 1fr; justify-items: center; }
 .chart-legend { width: 100%; }
 .client-stats, .dashboard-heading { align-items: flex-start; flex-direction: column; }
 .referral-summary { grid-template-columns: 1fr; }
 .activity-item { grid-template-columns: 9px 1fr; }
 .activity-item time { grid-column: 2; }
}
