/* Base visual Forpay (SPEC 019): marca oficial — preto, ciano #00AEEF, Kanit nos títulos e valores, Barlow no texto.
   Experiência no estilo de banco premium: fundo claro, cartões brancos arredondados, atalhos com ícone, menu escuro.
   Fontes guardadas no projeto (a CSP não deixa buscar fora). Modo escuro fica para depois (SPEC 019, P3). */
@font-face { font-family: "Kanit"; font-weight: 300; font-display: swap; src: url("/shared/fonts/kanit-300.woff2") format("woff2"); }
@font-face { font-family: "Kanit"; font-weight: 400; font-display: swap; src: url("/shared/fonts/kanit-400.woff2") format("woff2"); }
@font-face { font-family: "Kanit"; font-weight: 500; font-display: swap; src: url("/shared/fonts/kanit-500.woff2") format("woff2"); }
@font-face { font-family: "Kanit"; font-weight: 600; font-display: swap; src: url("/shared/fonts/kanit-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("/shared/fonts/barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url("/shared/fonts/barlow-500.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("/shared/fonts/barlow-600.woff2") format("woff2"); }

:root {
  --font-title: "Kanit", system-ui, sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* marca */
  --forpay-blue: #00aeef;        /* ciano Forpay: ação principal, aba ativa */
  --forpay-blue-dark: #00739e;   /* ciano escuro: links e contornos (contraste AA sobre branco) */
  --forpay-black: #111214;       /* topo do app, menu escuro, trilho do backoffice */
  --forpay-graphite: #1e2024;    /* blocos sobre o preto */
  --forpay-graphite-2: #2a2d33;  /* item ativo sobre o preto */
  --forpay-ink: #1d1d1b;

  /* superfícies e texto */
  --bg: #f1f2f4;
  --surface: #ffffff;
  --surface-2: #f6f7f8;
  --text: #1d1d1b;
  --muted: #5f6368;
  --border: #e3e4e7;
  --brand: var(--forpay-blue);
  --brand-ink: #1d1d1b;          /* texto sobre o ciano */
  --brand-gradient: var(--brand); /* compatibilidade com as telas atuais até as etapas B e C */
  --link: var(--forpay-blue-dark);
  --header-bg: var(--forpay-black);
  --header-text: #ffffff;

  /* situação (sempre com ícone e palavra — nunca só cor) */
  --pos: #1f7a4d;   --pos-bg: #e2f4ea;
  --neg: #b3261e;   --neg-bg: #fdecea;
  --warn: #8a5a00;  --warn-bg: #fff1d6;
  --info: var(--forpay-blue-dark); --info-bg: #e3f4fc;
  --off: #5f6368;   --off-bg: #eeeff1;

  --radius: 16px;      /* cartões do backoffice */
  --radius-lg: 20px;   /* cartões do app */
  --radius-sm: 12px;   /* botões, campos, atalhos internos */
  --shadow: 0 1px 2px rgb(17 18 20 / 4%), 0 8px 24px -12px rgb(17 18 20 / 12%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.45 var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgb(0 174 239 / 25%); }
input, textarea { caret-color: var(--forpay-blue-dark); }
a { color: var(--link); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-title); font-weight: 500; letter-spacing: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.6rem; margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
.stat .value, .value { font-family: var(--font-title); font-weight: 500; }
.muted { color: var(--muted); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.money { font-family: var(--font-title); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ícones de linha (public/shared/icons.svg) */
svg.i { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
svg.i.sm { width: 18px; height: 18px; }
svg.i.lg { width: 30px; height: 30px; }

/* cartões e grades */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat .label { color: var(--muted); font-size: 0.85rem; }
.stat .value { font-size: 1.5rem; font-weight: 500; font-variant-numeric: tabular-nums; }

/* KPIs: números de resumo lado a lado */
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 16px; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label, .kpi .sub { font-size: 0.8rem; color: var(--muted); }
.kpi .value { display: block; font-size: 1.35rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* tabelas */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); }
.card .table-wrap, .card.table-wrap { box-shadow: none; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: 0.78rem; letter-spacing: .02em; color: var(--muted); font-weight: 600; background: var(--surface-2); } /* SPEC 040: cabeçalho cinza */
td.num, th.num { text-align: right; }
td.num { font-family: var(--font-title); font-weight: 400; }
tfoot td { font-weight: 600; background: var(--surface-2); border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td, tr.clickable:focus-visible td { background: var(--surface-2); }
tr.clickable:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }

/* botões */
button, .btn {
  font: inherit;
  font-weight: 600;
  border: 1.5px solid var(--forpay-ink);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none;
  transition: background-color .15s ease-out, filter .15s ease-out;
}
button:hover, .btn:hover { background: var(--surface-2); }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
button.primary:hover, .btn.primary:hover { filter: brightness(1.06); background: var(--brand); }
button.danger, .btn.danger { color: var(--neg); border-color: var(--neg); }
button.danger-solid { background: var(--neg); border-color: var(--neg); color: #fff; }
button.ghost { border-color: transparent; background: transparent; color: var(--link); }
button:disabled { opacity: .45; cursor: default; filter: none; }
button.busy { opacity: .7; cursor: progress; }

/* campos */
form .row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 12px; }
label { display: grid; gap: 4px; font-size: 0.85rem; color: var(--muted); }
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #c9ccd2;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: #6b7076; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--forpay-blue-dark); outline-offset: 2px;
}
input[aria-invalid="true"] { border-color: var(--neg); }

/* abas em pílula e controle segmentado */
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pills a, .pills button { border: 0; border-radius: 999px; padding: 7px 14px; font-size: .85rem; font-weight: 600; background: var(--surface); color: var(--muted); text-decoration: none; }
.pills .active, .pills [aria-current] { background: var(--forpay-black); color: #fff; }
.seg { display: flex; background: #e3e4e7; border-radius: var(--radius-sm); padding: 3px; }
.seg button, .seg a { flex: 1; border: 0; background: none; border-radius: 10px; padding: 7px 0; font-size: .85rem; color: var(--muted); text-align: center; text-decoration: none; }
.seg .active, .seg [aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(17 18 20 / 10%); }

/* etiqueta de situação: ícone + palavra (ui.js situacao()) — .badge antiga herda o mesmo visual */
.pill, .badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 3px 10px; font-size: .78rem; font-weight: 600; white-space: nowrap;
  background: var(--off-bg); color: var(--off);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; } /* SPEC 040: marcador de cor */
.pill svg.i { width: 15px; height: 15px; stroke-width: 2.2; margin-left: -3px; }
.pill.ok, .badge.PAGO, .badge.ATIVO, .badge.LIQUIDADO, .badge.APROVADO, .badge.APROVADA, .badge.PAGA { background: var(--pos-bg); color: var(--pos); }
.pill.wait, .badge.PENDENTE, .badge.AGENDADO, .badge.EM_ANALISE, .badge.AGUARDANDO, .badge.DEVOLVIDO { background: var(--warn-bg); color: var(--warn); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.ant, .badge.EM_ANTECIPACAO { background: var(--warn-bg); color: var(--warn); }
.pill.bad, .badge.RECUSADO, .badge.RECUSADA, .badge.REPROVADO, .badge.BLOQUEADO, .badge.CHARGEBACK { background: var(--neg-bg); color: var(--neg); }
.pill.off, .badge.CANCELADO, .badge.CANCELADA, .badge.ENCERRADO, .badge.DESCARTADA { background: var(--off-bg); color: var(--off); }

/* atalho: quadrado com ícone e legenda embaixo */
.shortcuts { display: flex; gap: 10px; overflow-x: auto; padding: 12px 2px 8px; scrollbar-width: none; }
.shortcut { flex: none; width: 72px; display: grid; justify-items: center; gap: 6px; font-size: .8rem; line-height: 1.2; text-align: center; color: var(--text); text-decoration: none; border: 0; background: none; padding: 0; font-weight: 500; }
.shortcut .sq { width: 62px; height: 62px; border-radius: 18px; background: var(--surface); display: grid; place-items: center; box-shadow: var(--shadow); position: relative; }
.shortcut.primary .sq { background: var(--brand); }
.shortcut .tag { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: var(--forpay-black); color: #fff; font-size: .75rem; font-weight: 700; border-radius: 6px; padding: 1px 6px; white-space: nowrap; }

/* bloco grande no escuro (menu do app) */
.blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.block { background: var(--forpay-graphite); color: #fff; border: 0; border-radius: 22px; min-height: 128px; padding: 16px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; font-size: 1.05rem; font-weight: 500; text-decoration: none; text-align: left; }
.block:hover { background: var(--forpay-graphite-2); }
.block.wide { grid-column: span 2; min-height: 112px; }
.block.primary { background: var(--brand); color: var(--brand-ink); }

/* linha do tempo (saque, pagamento) */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.timeline li { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.timeline .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #c9ccd2; display: grid; place-items: center; flex: none; }
.timeline .done .dot { background: var(--pos); border-color: var(--pos); color: #fff; }
.timeline .dot svg.i { width: 13px; height: 13px; stroke-width: 3; }

/* zona de emergência: ações raras e perigosas, separadas das comuns */
.danger-zone { border: 1.5px solid var(--neg); background: #fff6f5; border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.danger-zone strong { color: var(--neg); font-family: var(--font-title); font-weight: 500; }
.danger-zone p { margin: 0; flex: 1; min-width: 220px; font-size: .9rem; color: var(--muted); }

/* avisos e vazios */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--forpay-black); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm);
  max-width: calc(100vw - 32px); z-index: 10; box-shadow: 0 10px 30px -10px rgb(0 0 0 / 40%);
}
.toast.error { background: var(--neg); color: #fff; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; }

.login { max-width: 380px; margin: 10vh auto; padding: 0 16px; }
.login form { display: grid; gap: 12px; }
.error-msg { color: var(--neg); min-height: 1.2em; font-size: 0.9rem; }
.hidden { display: none !important; }

.dlg { border: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text); padding: 22px; width: min(440px, calc(100vw - 32px)); box-shadow: 0 24px 60px -20px rgb(0 0 0 / 45%); }
.dlg::backdrop { background: rgb(17 18 20 / 55%); }
.dlg form { display: grid; gap: 14px; }
.dlg h2 { margin: 0; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.nav-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 99px; background: var(--brand); color: var(--brand-ink); font-size: 0.75rem; font-weight: 700; text-align: center; }
.recover-form { display: grid; gap: 12px; }
.recover-link, .recover .link-btn { border: 0; background: none; color: var(--link); padding: 4px 0; font-weight: 600; cursor: pointer; justify-self: start; }

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

/* SPEC 032: valores com %, cores por significado e simulador */
:root { --ant: #b45309; --ant-bg: #fff3e0; }
.ant { color: var(--ant); }
.vp { display: inline-grid; justify-items: end; line-height: 1.15; }
.vp small { font-size: max(.8em, .75rem); color: var(--muted); font-weight: 400; }
.vp.neg { color: var(--neg); } .vp.pos { color: var(--pos); } .vp.ant { color: var(--ant); }
.rate-pill { display: inline-block; background: var(--warn-bg); color: var(--warn); border-radius: 6px; padding: 1px 7px; font-size: .78rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.sim-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.sim-head { display: flex; gap: 12px; align-items: center; background: var(--forpay-black); color: #fff; padding: 14px 18px; }
.sim-head strong { display: block; font-family: var(--font-title); font-weight: 500; font-size: 1.1rem; }
.sim-head span { font-size: .82rem; opacity: .8; }
.sim-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); }
.sim-body { padding: 14px 18px; display: grid; gap: 12px; }
.sim-amount > span:first-child { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sim-amount-in { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 4px 12px; }
.sim-amount-in b { color: var(--muted); }
.sim-amount-in input { border: 0; font-size: 1.25rem; font-weight: 600; padding: 6px 0; outline: none; width: 100%; background: transparent; }
.sim-models { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sim-models label { position: relative; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; }
.sim-models input { position: absolute; opacity: 0; }
.sim-models small { color: var(--muted); font-size: .76rem; }
.sim-models label:has(input:checked) { border-color: var(--forpay-ink); background: var(--info-bg); }
.sim-models label:has(input:focus-visible) { outline: 2px solid var(--link); }
.sim-toggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--warn-bg); border: 1px solid #f3d9a4; border-radius: var(--radius-sm); padding: 10px 14px; }
.sim-toggle span { display: grid; } .sim-toggle small { color: var(--ant); font-size: .78rem; }
.sim-toggle input { appearance: none; width: 46px; height: 26px; border-radius: 999px; background: #cfd3da; position: relative; cursor: pointer; flex: none; margin: 0; padding: 0; border: 0; }
.sim-toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.sim-toggle input:checked { background: var(--pos); } .sim-toggle input:checked::after { left: 23px; }
.sim-toggle input:disabled { opacity: .7; cursor: default; }
.sim-table-wrap { overflow-x: auto; }
.sim-table { font-size: .86rem; }
.sim-table th { text-transform: uppercase; font-size: .75rem; letter-spacing: .05em; }
.sim-table td, .sim-table th { padding: 7px 10px; white-space: nowrap; vertical-align: middle; }
.sim-table tbody tr:hover td { background: var(--pos-bg); }
.sim-table .sub { font-size: .75rem; color: var(--muted); white-space: normal; }
