/* Portal do afiliado — celular primeiro (coluna de até 480px até 899px);
   a partir de 900px vira layout de desktop com barra lateral (bloco no fim).
   Sem estilo inline (CSP): tudo por classe. Tema escuro por prefers-color-scheme. */

/* Identidade: preto com subtom esverdeado em três superfícies (fundo, barra lateral,
   cartões), verde só para ações e indicadores. Plus Jakarta Sans em títulos e valores,
   Inter no resto. Só tema escuro. */
:root {
  color-scheme: dark;
  --bg: #080A09;            /* fundo geral */
  --bg-outer: #080A09;
  --bg-sidebar: #151917;    /* barra lateral e cabeçalhos */
  --card: #1C221F;          /* saldo, comissões, movimentações */
  --elevated: #272F2A;      /* hover e botões secundários */
  --text: #F5F7F5;
  --muted: #929C95;
  --dim: #66736A;
  --line: #2A312C;
  --line-strong: #39423B;
  --input: #151917;
  --brand: #42E568;         /* verde principal: CTAs e positivos */
  --brand-hover: #61EF80;
  --brand-text: #95F5A8;    /* verde suave: destaques e links */
  --brand-soft: #25452E;    /* superfície verde escura: item ativo, selos */
  --btn: #42E568;
  --btn-hover: #61EF80;
  --btn-text: #07170B;
  --ring: #42E568;
  --pos: #42E568;
  --pos-soft: #25452E;
  --neg: #FF8A7A;
  --neg-soft: #3A1F1C;
  --neg-solid: #C2362A;
  --warn: #F5C64B;
  --warn-soft: #3A2F11;
  --info: #95F5A8;
  --info-soft: #1E2E24;
  --neutral-soft: #272F2A;
  --sk: #272F2A;
  --shadow: 0 0 0 1px var(--line);
  --shadow-up: 0 -6px 24px rgba(0, 0, 0, .5);
  --grad: #1C221F;          /* sem gradiente: superfície escura */
  --radius: 14px;
  --radius-btn: 9px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-heading: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-outer);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, dl, dd, ul { margin: 0; }
h1, h2, h3, .big, .balance-value, .metric-value, .card-title, .section-title, .hello-name, .profile-name,
.entry-amt, .calc-row.is-total dd, .notice-title, .state-title, .input-money, .daily .is-total td { font-family: var(--font-heading); }
ul { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--card); color: var(--text);
  padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow);
  font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

.app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
}
@media (min-width: 520px) {
  .app { box-shadow: 0 0 0 1px var(--line); }
}

.boot {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  color: var(--muted); font-size: 15px;
}
.boot-dot {
  width: 40px; height: 40px; border-radius: 12px; background: var(--brand);
  animation: pulse 1.2s ease-in-out infinite;
}
.noscript { max-width: 480px; margin: 24px auto; padding: 0 16px; }

.ic { width: 24px; height: 24px; flex: none; }

/* ---------- textos utilitários */

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .04em; font-weight: 700; }
.big {
  font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15;
  font-variant-numeric: tabular-nums; margin: 6px 0 4px;
}
.intro { color: var(--muted); font-size: 15px; margin: 0 4px 12px; }
.link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px;
  color: var(--brand-text); font-weight: 600; font-size: 15px; text-decoration: none;
}
.link:hover { text-decoration: underline; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.stack-sm { display: grid; gap: 12px; }

/* ---------- moldura das telas */

.screen { min-height: 100vh; min-height: 100dvh; }
.screen.with-nav { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.content { padding: 16px 16px 0; display: grid; gap: 12px; }
.screen.is-home .content { padding: 0; display: block; }
.pad { padding: 0 16px; }

.topbar {
  background: var(--bg-sidebar);
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding: calc(14px + env(safe-area-inset-top)) 12px 18px;
  border-radius: 0 0 24px 24px;
}
.topbar-row { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 0 8px; }
.topbar h1 { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.topbar .icon-btn { margin-left: -8px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  color: inherit; text-decoration: none;
  background: transparent; border: 0; cursor: pointer;
}
.icon-btn:hover { background: var(--elevated); }

/* ---------- modo "ver como" (somente leitura) */

.viewas {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: calc(4px + env(safe-area-inset-top)) 8px 4px 14px;
  background: #f59e0b; color: #1c1200;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
  font-size: 14px; font-weight: 650; line-height: 1.3;
}
.viewas-ic { display: grid; place-items: center; flex: none; }
.viewas-ic .ic { width: 20px; height: 20px; }
.viewas-text { flex: 1; min-width: 0; padding: 6px 0; overflow-wrap: anywhere; }
.viewas-btn {
  flex: none; min-height: 44px; padding: 8px 16px;
  border-radius: 12px; border: 1.5px solid #1c1200;
  background: transparent; color: #1c1200;
  font-weight: 700; font-size: 14px; cursor: pointer;
}
.viewas-btn:hover:not(:disabled) { background: rgba(28, 18, 0, .1); }
.viewas-btn:disabled { opacity: .6; cursor: not-allowed; }
.viewas :focus-visible { outline-color: #1c1200; }
/* a faixa já ocupa a área segura do topo */
.is-viewas .topbar, .is-viewas .hero { padding-top: 14px; }

.action.is-disabled { opacity: .5; cursor: not-allowed; }

/* ---------- barra inferior */

.bottom-nav {
  position: fixed; z-index: 20;
  left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card);
  border-top: 1px solid var(--line);
  box-shadow: var(--shadow-up);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; border-radius: 14px;
  color: var(--muted); text-decoration: none;
  font-size: 12px; font-weight: 600;
}
.nav-ic { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 999px; transition: background-color .15s; }
.nav-item .ic { width: 22px; height: 22px; }
.nav-item[aria-current="page"] { color: var(--brand-text); }
.nav-item[aria-current="page"] .nav-ic { background: var(--brand-soft); }
.nav-item:hover { color: var(--text); }
.nav-item[aria-current="page"]:hover { color: var(--brand-text); }

/* ---------- cartões */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }

.state-card { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 20px 18px; }
.state-card .btn { margin-top: 6px; }
.state-ic {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--elevated); color: var(--muted);
}
.state-ic .ic { width: 20px; height: 20px; }
.empty-line {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  color: var(--muted); font-size: 14px;
}
.empty-line .ic { width: 20px; height: 20px; flex: none; color: var(--dim); }
.state-ic.is-bad { background: var(--neg-soft); color: var(--neg); }
.state-title { font-weight: 700; font-size: 17px; }

.note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 14px;
  background: var(--brand-soft); color: var(--text); font-size: 14px;
}
.note .ic { width: 20px; height: 20px; color: var(--brand-text); margin-top: 1px; }
.note-warn { background: var(--warn-soft); }
.note-warn .ic { color: var(--warn); }
.card .note { margin-top: 12px; }

/* ---------- botões */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 20px;
  border-radius: var(--radius-btn); border: 1px solid transparent;
  font-weight: 650; font-size: 16px; line-height: 1.2;
  text-decoration: none; text-align: center;
  cursor: pointer; background: transparent; color: var(--text);
  transition: background-color .15s, border-color .15s, transform .05s;
}
.btn:active:not(:disabled) { transform: scale(.985); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .ic { width: 20px; height: 20px; }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.btn-primary { background: var(--btn); color: var(--btn-text); }
.btn-primary:hover:not(:disabled) { background: var(--btn-hover); }
.btn-outline { border-color: var(--line-strong); background: var(--elevated); }
.btn-outline:hover:not(:disabled) { border-color: var(--brand); color: var(--brand-text); }
.btn-ghost { color: var(--brand-text); }
.btn-ghost:hover:not(:disabled) { background: var(--brand-soft); }
.btn-danger { background: var(--neg-solid); color: #fff; }
.btn-outline-danger { border-color: var(--line-strong); background: var(--card); color: var(--neg); }
.btn-outline-danger:hover:not(:disabled) { border-color: var(--neg); background: var(--neg-soft); }
.card .btn-block { margin-top: 14px; }
.card .btn-block + .btn-block { margin-top: 8px; }
.form .btn-block { margin-top: 0; }
.form .btn-block + .btn-block { margin-top: -8px; }

/* ---------- selos */

.badge {
  display: inline-flex; align-items: center; flex: none;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 1.3; white-space: nowrap;
}
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-ok { background: var(--pos-soft); color: var(--pos); }
.badge-bad { background: var(--neg-soft); color: var(--neg); }
.badge-muted { background: var(--neutral-soft); color: var(--muted); }

/* ---------- listas chave/valor */

.kv { display: grid; margin-top: 12px; }
.kv-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 11px 0; border-top: 1px solid var(--line);
}
.kv-row:first-child { border-top: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { text-align: right; font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* ---------- seções */

.section { display: grid; gap: 8px; margin-top: 20px; }
.content > .section { margin-top: 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 4px; }
.section-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }

.how {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}
.how summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 0 18px; cursor: pointer;
  font-weight: 650; list-style: none; border-radius: var(--radius);
}
.how summary::-webkit-details-marker { display: none; }
.how-ic { width: 20px; height: 20px; color: var(--muted); transition: transform .2s; }
.how[open] .how-ic { transform: rotate(180deg); }
.how ul { padding: 0 18px 16px 36px; list-style: disc; color: var(--muted); font-size: 14px; display: grid; gap: 6px; }

/* ---------- formulários */

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.label { font-weight: 600; font-size: 15px; }
.hint { color: var(--muted); font-size: 13px; }
.field-error { color: var(--neg); font-size: 14px; font-weight: 600; }
.input {
  width: 100%; min-height: 50px;
  padding: 12px 14px;
  font-size: 16px; /* evita zoom no iOS */
  background: var(--input); color: var(--text);
  border: 1.5px solid var(--line-strong); border-radius: 12px;
  appearance: none; -webkit-appearance: none;
}
.input::placeholder { color: var(--muted); opacity: .75; }
.input:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; border-color: var(--brand); }
.input[readonly] { background: var(--neutral-soft); color: var(--muted); }
.input[aria-invalid="true"] { border-color: var(--neg); }

.input-wrap { position: relative; }
.has-toggle .input { padding-right: 56px; }
.pw-toggle {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 10px; color: var(--muted); cursor: pointer;
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle .ic { width: 22px; height: 22px; }
.has-prefix .input { padding-left: 46px; }
.prefix {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 600; pointer-events: none;
}
.input-money { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.money-row { display: flex; gap: 8px; align-items: stretch; }
.money-row .input-wrap { flex: 1; min-width: 0; }
.money-row .btn { flex: none; min-height: 50px; }
.select-wrap { position: relative; }
.select-wrap .input { padding-right: 44px; cursor: pointer; }
.select-ic { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--muted); pointer-events: none; }

.form-error {
  display: flex; gap: 8px; align-items: flex-start;
  color: var(--neg); font-weight: 600; font-size: 15px;
}
.form-error:not(:empty) { background: var(--neg-soft); padding: 12px 14px; border-radius: 12px; }
.form-error:empty { margin: 0; padding: 0; }
.form-error .ic { width: 20px; height: 20px; margin-top: 1px; }
.form > .form-error:empty { margin-top: -16px; }
.card .form-error:not(:empty) { margin-top: 10px; }
.form .form-error:not(:empty) { margin-top: 0; }

.flash {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--brand-soft); padding: 12px 14px; border-radius: 12px; font-size: 15px;
}
.flash .ic { width: 20px; height: 20px; color: var(--brand-text); margin-top: 1px; }
.help { color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- login e convite */

.auth { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.auth-hero {
  background: var(--bg-sidebar); color: var(--text); text-align: center; border-bottom: 1px solid var(--line);
  padding: calc(40px + env(safe-area-inset-top)) 20px 88px;
  border-radius: 0 0 32px 32px;
}
.brand-mark {
  display: inline-grid; place-items: center; width: 60px; height: 60px; border-radius: 18px;
  background: var(--brand-soft); color: var(--brand); border: 1px solid var(--line);
}
.brand-mark .ic { width: 32px; height: 32px; stroke-width: 2.6; }
.brand-name { margin-top: 12px; font-size: 14px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.auth-hero h1 { margin-top: 4px; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.auth-card { margin: -56px 16px 0; position: relative; padding: 22px 20px; }
.auth-card .card-title { font-size: 20px; line-height: 1.3; }
.auth-card .state-card { padding: 8px 0; }
.auth-foot { margin: 20px 24px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- início */

.hero {
  background: var(--card); color: var(--text);
  padding: calc(14px + env(safe-area-inset-top)) 20px 72px;
  border-radius: 0 0 24px 24px; border-bottom: 1px solid var(--line);
}
.hero-empty { min-height: 180px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hello-sub { font-size: 14px; color: var(--muted); }
.hello-name { font-size: 20px; font-weight: 750; letter-spacing: -.01em; line-height: 1.2; }
.hero-btn {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: var(--text); background: var(--elevated); border: 1px solid var(--line);
}
.hero-btn:hover { background: var(--brand-soft); color: var(--brand-text); }
.hero-btn .ic { width: 22px; height: 22px; }

.balance { text-align: center; margin-top: 22px; }
.balance-label {
  display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted);
}
.balance-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.balance-value {
  font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15;
  font-variant-numeric: tabular-nums; margin-top: 2px; overflow-wrap: anywhere;
}
.balance-note { font-size: 13px; color: var(--muted); margin-top: 2px; }
.pill {
  display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 8px;
  max-width: 100%; margin-top: 14px; padding: 7px 14px;
  border-radius: 999px; background: var(--elevated); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}
.pill-code { color: var(--brand-text); }
.pill-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; font-weight: 700; }
.pill-sep { opacity: .7; }
.pill-camp { overflow-wrap: anywhere; }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 22px; }
.action {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-height: 44px; color: var(--text); text-decoration: none;
  font-size: 13px; font-weight: 600; border-radius: 16px; padding: 2px 0;
}
.action-ic {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  background: var(--elevated); border: 1px solid var(--line);
  transition: background-color .15s;
}
.action:hover .action-ic { background: var(--brand-soft); color: var(--brand-text); }
.action-primary .action-ic { background: var(--brand); color: var(--btn-text); border-color: var(--brand); }
.action-primary:hover .action-ic { background: var(--brand-hover); color: var(--btn-text); }

.overlap { margin-top: -48px; position: relative; }
.week-card .big { font-size: 30px; margin: 4px 0 2px; }
.week-facts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
}
.week-facts dt { color: var(--muted); font-size: 12px; }
.week-facts dd { font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.week-nodeal { margin-top: 12px; }
.week-card .btn-block { margin-top: 14px; }

.notice { padding: 16px 18px; }
.notice-row { display: flex; gap: 12px; align-items: flex-start; }
.notice-ic {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--warn-soft); color: var(--warn);
}
.notice.is-info .notice-ic { background: var(--info-soft); color: var(--info); }
.notice-ic .ic { width: 20px; height: 20px; }
.notice-main { display: grid; gap: 2px; min-width: 0; }
.notice-title { font-size: 16px; font-weight: 700; }
.notice .cancel-ctl { margin-top: 12px; padding-left: 52px; }

/* ---------- movimentações e saques */

.list { padding: 4px 16px; }
.list > li + li { border-top: 1px solid var(--line); }
.entry { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-height: 64px; }
.entry-ic {
  display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 50%;
  background: var(--neutral-soft); color: var(--muted);
}
.entry-ic .ic { width: 20px; height: 20px; }
.entry-ic.is-credit { background: var(--pos-soft); color: var(--pos); }
.entry-main { flex: 1; min-width: 0; }
.entry-title { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.entry-sub { color: var(--muted); font-size: 13px; }
.entry-amt { font-weight: 700; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.entry-amt.pos { color: var(--pos); }

.wd { padding-bottom: 12px; }
.wd .entry { padding-bottom: 6px; align-items: flex-start; }
.wd .entry .badge { margin-top: 2px; }
.wd-line { color: var(--muted); font-size: 14px; padding-left: 54px; }
.wd-line.is-bad { color: var(--neg); }
.wd .cancel-ctl { margin-top: 10px; padding-left: 54px; }

.cancel-ctl { display: grid; gap: 10px; justify-items: start; }
.cancel-q { font-size: 15px; font-weight: 600; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- aparelhos conectados (Conta) */

.list.list-flush { padding: 4px 0; margin-top: 8px; } /* vence o .list do desktop */
.devices .badge { margin-top: 4px; }
.devices .entry-main { min-width: 0; }
.devices-all { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

.more { display: grid; gap: 10px; margin-top: 4px; }
.more:empty { display: none; }

/* ---------- saque */

.balance-card .big { margin: 2px 0; }
.success { text-align: center; display: grid; justify-items: center; gap: 8px; }
.success .kv { width: 100%; text-align: left; }
.success-ic {
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%;
  background: var(--pos-soft); color: var(--pos);
}
.success-ic .ic { width: 30px; height: 30px; stroke-width: 2.6; }

/* ---------- comissões */

.week-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 68px; padding: 12px 0;
  color: inherit; text-decoration: none; border-radius: 12px;
}
.week-item:hover .entry-title { color: var(--brand-text); }
.week-right { display: grid; justify-items: end; gap: 4px; }
.chev { width: 18px; height: 18px; color: var(--muted); }

.calc { display: grid; margin-top: 8px; }
.calc-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.calc-row:first-child { border-top: 0; }
.calc-row dt { color: var(--muted); font-size: 15px; display: grid; }
.calc-row dd { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-row.is-sub dt { color: var(--text); font-weight: 600; }
.calc-row.is-sub dd { font-weight: 700; }
.calc-note { color: var(--muted); font-size: 13px; font-weight: 400; }
.calc-row.is-total { border-top: 2px solid var(--text); margin-top: 4px; padding-top: 14px; }
.calc-row.is-total dt { color: var(--text); font-weight: 700; font-size: 16px; }
.calc-row.is-total dd { font-weight: 800; font-size: 20px; }

/* ---------- indicadores */

.pills {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 10px -12px 0; padding: 2px 20px 4px;
  scroll-padding: 0 20px;
}
.pills::-webkit-scrollbar { display: none; }
.pill-btn {
  flex: none; min-height: 40px; padding: 8px 16px;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--elevated); color: var(--muted);
  font-size: 14px; font-weight: 650; cursor: pointer;
}
.pill-btn:hover { background: var(--brand-soft); color: var(--brand-text); }
.pill-btn[aria-pressed="true"] { background: var(--brand); color: var(--btn-text); border-color: var(--brand); }
/* área de toque de 44px sem aumentar a pílula */
.pill-btn { position: relative; }
.pill-btn::after { content: ""; position: absolute; inset: -3px -2px; }

.period-range { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 600; padding: 0 4px; }
.period-range .ic { width: 18px; height: 18px; }

.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.span2 { grid-column: 1 / -1; }
.metric { padding: 16px; display: grid; align-content: start; gap: 2px; min-width: 0; }
.metric-title { font-size: 14px; font-weight: 650; color: var(--muted); }
.metric-value {
  font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2;
  font-variant-numeric: tabular-nums; margin-top: 2px; overflow-wrap: anywhere;
}
.metric:not(.span2) .metric-value { font-size: 21px; }
.metric-value.sm { font-size: 20px; }
.metric-label { font-size: 13px; color: var(--muted); }
.explain { color: var(--muted); font-size: 13px; margin-top: 6px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.split-part { min-width: 0; }
.split-part + .split-part { border-left: 1px solid var(--line); padding-left: 12px; }
.split-top { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }

.delta { font-size: 13px; font-weight: 650; margin-top: 2px; }
.delta.good { color: var(--pos); }
.delta.bad { color: var(--neg); }
.delta.flat { color: var(--muted); font-weight: 500; }

.updated { color: var(--muted); font-size: 13px; text-align: center; padding: 4px 8px 8px; }

/* ---------- relatório por dia */

.ind-head { flex-wrap: wrap; }
.ind-head .pills { margin: 0; padding: 0; overflow: visible; flex-wrap: wrap; }
.metrics-compact .metric-value { font-size: 20px; }
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.daily {
  width: 100%; border-collapse: collapse; white-space: nowrap;
  font-size: 13.5px; font-variant-numeric: tabular-nums;
}
.daily th, .daily td { padding: 10px 12px; text-align: right; border-top: 1px solid var(--line); }
.daily thead th {
  border-top: 0; color: var(--muted); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .04em; background: var(--bg-sidebar);
}
.daily .is-left { text-align: left; }
.daily tbody th {
  text-align: left; font-weight: 600; position: sticky; left: 0; z-index: 1;
  background: var(--card); box-shadow: 1px 0 0 var(--line);
}
.daily thead th:first-child { position: sticky; left: 0; z-index: 2; }
.daily .is-total td, .daily .is-total th { background: var(--elevated); font-weight: 700; }
.daily .neg { color: var(--neg); }
.daily .pos { color: var(--brand-text); }
.daily .zero { color: var(--dim); }
.daily .strong { font-weight: 700; }
.daily-foot { color: var(--muted); font-size: 13px; padding: 10px 14px; border-top: 1px solid var(--line); }

/* ---------- conta */

.profile { display: flex; align-items: center; gap: 14px; }
.avatar {
  display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 50%;
  background: var(--brand-soft); color: var(--brand-text); font-weight: 800; font-size: 20px; letter-spacing: .02em;
}
.avatar-sm { width: 40px; height: 40px; font-size: 15px; }
/* barra lateral e colunas: só ganham forma no desktop */
.sidenav { display: none; }
.col { display: grid; gap: 12px; align-content: start; }
.profile-main { min-width: 0; }
.profile-name { font-size: 19px; font-weight: 750; overflow-wrap: anywhere; }
.profile .muted { overflow-wrap: anywhere; }
.deal-campaign { margin-top: 6px; font-weight: 700; color: var(--brand-text); }
.deal-list { display: grid; gap: 10px; margin-top: 12px; }
.deal-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.li-ic { width: 20px; height: 20px; color: var(--pos); margin-top: 1px; }

/* ---------- carregamento */

.skeleton { display: grid; gap: 12px; }
.skeleton > div { display: grid; gap: 12px; }
.sk { background: var(--sk); border-radius: 14px; animation: pulse 1.4s ease-in-out infinite; }
.sk-hero { height: 330px; background: var(--card); border-radius: 0 0 24px 24px; }
.sk-card { height: 170px; border-radius: var(--radius); }
.sk-overlap { margin-top: -48px; position: relative; }
.sk-line { height: 20px; width: 55%; }
.sk-row { height: 64px; }
.sk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sk-tile { height: 120px; border-radius: var(--radius); }
.is-home .skeleton .pad { display: grid; gap: 12px; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}

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

/* ---------- telas bem estreitas */

@media (max-width: 360px) {
  .balance-value { font-size: 34px; }
  .action-ic { width: 50px; height: 50px; }
  .action { font-size: 12px; }
  .metric:not(.span2) .metric-value { font-size: 18px; }
  .metric-value { font-size: 23px; }
}

/* ---------- desktop (a partir de 900px): barra lateral + conteúdo largo */

@media (min-width: 900px) {
  :root { --radius: 14px; }
  body { background: var(--bg); }

  .app {
    max-width: none;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    box-shadow: none;
  }
  .app.is-auth { display: block; }

  /* faixa "ver como" ocupa as duas colunas; a barra lateral fica abaixo dela */
  .viewas {
    grid-column: 1 / -1;
    min-height: 52px; padding: 4px 20px 4px 20px; gap: 14px;
    font-size: 15px;
  }
  .viewas-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0; }
  .viewas-btn { min-height: 40px; }

  .sidenav {
    display: flex; flex-direction: column; gap: 8px;
    position: sticky; top: 0; height: 100vh; height: 100dvh;
    padding: 20px 16px 16px;
    background: var(--bg-sidebar); border-right: 1px solid var(--line);
  }
  .is-viewas .sidenav { top: 52px; height: calc(100vh - 52px); height: calc(100dvh - 52px); }
  .side-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 8px 18px; text-decoration: none; color: inherit;
  }
  .side-brand .brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); border: 0; color: var(--brand); }
  .side-brand .brand-mark .ic { width: 24px; height: 24px; }
  .side-brand-text { display: grid; line-height: 1.2; }
  .side-brand-name { font-weight: 800; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; }
  .side-brand-sub { color: var(--muted); font-size: 13px; }

  .side-nav { display: grid; gap: 4px; }
  .side-item {
    display: flex; align-items: center; gap: 12px;
    min-height: 46px; padding: 0 14px; border-radius: 12px;
    color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px;
    transition: background-color .15s, color .15s;
  }
  .side-item .ic { width: 22px; height: 22px; }
  .side-item:hover { background: var(--neutral-soft); color: var(--text); }
  .side-item[aria-current="page"] { background: var(--brand-soft); color: var(--brand-text); }

  .side-foot { margin-top: auto; display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
  .side-user {
    display: flex; align-items: center; gap: 10px;
    padding: 8px; border-radius: 12px; text-decoration: none; color: inherit; min-width: 0;
  }
  .side-user:hover { background: var(--neutral-soft); }
  .side-user-text { display: grid; min-width: 0; line-height: 1.25; }
  .side-user-name { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-user-code { color: var(--muted); font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; }
  .side-logout { justify-content: flex-start; color: var(--muted); padding: 0 12px; }
  .side-logout:hover:not(:disabled) { color: var(--neg); background: var(--neg-soft); }

  .bottom-nav { display: none; }
  .screen.with-nav { padding-bottom: 0; }
  .screen { min-height: 0; }

  /* cabeçalho das telas internas: sem faixa roxa, só título e ações */
  .topbar {
    background: none; color: var(--text);
    padding: 36px 40px 0; border-radius: 0;
    max-width: 1200px;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px;
  }
  .topbar-row { padding: 0; gap: 8px; }
  .topbar h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
  .topbar .icon-btn { margin-left: -10px; color: var(--muted); }
  .topbar .icon-btn:hover { background: var(--neutral-soft); color: var(--text); }
  .topbar { border-bottom: 0; }

  .content { padding: 20px 40px 56px; gap: 16px; max-width: 1200px; }
  .content-narrow { max-width: 800px; }
  .content-two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .content-two > .section, .content-two > .col { margin-top: 0; }
  .content-side { grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; max-width: 1000px; }
  .content-side > .balance-card { position: sticky; top: 24px; }
  .is-viewas .content-side > .balance-card { top: 76px; }
  .content-side > .card.state-card { grid-column: 2; }
  .content > .section { margin-top: 0; }
  .content .skeleton { grid-column: 1 / -1; }
  .intro { margin: 0 0 4px; }
  .col { gap: 16px; }

  /* início: carteira como cartão largo, ações em linha e duas colunas embaixo */
  .screen.is-home .content { padding: 36px 40px 56px; display: grid; gap: 24px; max-width: 1200px; }
  .is-viewas .screen.is-home .content { padding-top: 28px; }
  .hero {
    display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "balance" "actions";
    align-items: end; column-gap: 32px;
    padding: 26px 32px 28px; border-radius: 18px;
    border: 1px solid var(--line);
  }
  .hero-empty { min-height: 200px; }
  .hero-top { grid-area: top; }
  .hero-btn { display: none; }
  .hello-sub { font-size: 15px; }
  .hello-name { font-size: 22px; }
  .balance { grid-area: balance; text-align: left; margin-top: 18px; }
  .balance-value { font-size: 44px; }
  .pill { margin-top: 12px; }
  .actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
  .action {
    flex-direction: row; gap: 10px; align-items: center;
    min-height: 52px; padding: 8px 18px 8px 10px; border-radius: 14px;
    background: var(--elevated); border: 1px solid var(--line);
    font-size: 14px; transition: background-color .15s, border-color .15s;
  }
  .action:hover { background: var(--brand-soft); border-color: var(--brand-soft); color: var(--brand-text); }
  .action-ic { width: 34px; height: 34px; background: transparent; border: 0; }
  .action:hover .action-ic { background: transparent; color: inherit; }
  .action-ic .ic { width: 22px; height: 22px; }
  .action.is-disabled:hover { background: var(--elevated); border-color: var(--line); color: var(--text); }
  .action-primary { background: var(--brand); border-color: var(--brand); color: var(--btn-text); }
  .action-primary .action-ic { background: transparent; color: inherit; }
  .action-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--btn-text); }

  .home-grid { padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .overlap { margin-top: 0; }
  .home-grid .section { margin-top: 0; }
  .home-grid .overlap.stack { gap: 16px; }
  .section-head { min-height: 40px; }
  .card { padding: 22px 24px; }
  .week-card .big { font-size: 34px; }
  .ind-section { grid-column: 1 / -1; }
  .metrics.metrics-compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metrics-compact .metric-value { font-size: 22px; }
  .screen.is-home .content > .pad { padding: 0; }

  .sk-hero { height: 220px; border-radius: 18px; }
  .sk-overlap { margin-top: 0; }
  .is-home .skeleton > div { gap: 24px; }

  /* indicadores: seletor de período no cabeçalho, grade de 4 colunas */
  .pills { margin: 0; padding: 0; overflow: visible; flex-wrap: wrap; }
  .pill-btn {
    min-height: 38px; padding: 6px 14px;
    background: var(--card); color: var(--muted); border-color: var(--line-strong);
  }
  .pill-btn:hover { background: var(--neutral-soft); color: var(--text); }
  .pill-btn[aria-pressed="true"] { background: var(--btn); color: var(--btn-text); border-color: var(--btn); }
  .period-range { font-size: 15px; }
  .metrics { gap: 16px; }
  .metric { padding: 20px 22px; }
  .metric-value, .metric:not(.span2) .metric-value { font-size: 28px; }
  .metric-value.sm { font-size: 24px; }
  .updated { text-align: left; padding: 0 4px; }

  /* comissões: detalhe com o cálculo ao lado do resumo */
  .detail-grid {
    display: grid; gap: 24px; align-items: start;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-rows: auto 1fr; /* o "como é calculado" cola no resumo, não no pé do cálculo */
    grid-template-areas: "hero calc" "how calc";
  }
  .detail-grid .week-hero { grid-area: hero; }
  .detail-grid .calc-card { grid-area: calc; }
  .detail-grid .how { grid-area: how; }
  .week-hero .big { font-size: 36px; }
  .week-item { min-height: 72px; padding: 14px 4px; }
  .list { padding: 4px 24px; }

  /* conta e login */
  .profile .avatar { width: 64px; height: 64px; font-size: 22px; }
  .auth { max-width: 460px; margin: 0 auto; padding: 56px 0 40px; min-height: 0; }
  .auth-hero { border-radius: 18px; border: 1px solid var(--line); padding: 40px 20px 88px; }
  .auth-card { margin: -56px 0 0; padding: 26px 28px; }
  .auth-foot { margin: 20px 8px 0; }
}

/* ---------- desktop largo (a partir de 1280px): carteira e ações lado a lado, indicadores em 4 colunas */

@media (min-width: 1280px) {
  .hero { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "top top" "balance actions"; }
  .actions { margin-top: 0; flex-wrap: nowrap; }
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metrics.metrics-compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .span2 { grid-column: span 2; }
  .metric:not(.span2) .metric-value { font-size: 24px; }
}

/* ---------- desktop muito largo (a partir de 1600px): os seis números da Início numa linha */

@media (min-width: 1600px) {
  .metrics.metrics-compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .metrics-compact .metric { padding: 16px 18px; }
  .metrics-compact .metric-value { font-size: 20px; letter-spacing: -.01em; white-space: nowrap; overflow-wrap: normal; }
}
