/* App do cliente (SPEC 019): fundo claro com cartões brancos, topo preto da marca e menu de blocos no escuro.
   Cores, letras e componentes comuns vêm de /shared/style.css. */
body { background: var(--bg); }
.small { font-size: 0.85rem; }
.brand-logo { display: block; height: 64px; width: auto; margin: 0 0 20px; }
.brand-logo.on-dark { display: none; }

/* ---- Casca: topo + conteúdo com rolagem + barra de abas sempre visível.
   A barra faz parte do fluxo (não é position:fixed), o que evita sumir no app instalado no iPhone. ---- */
html, body { height: 100%; }
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.shell.hidden { display: none; }
.top {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 16px;
  background: var(--header-bg); color: var(--header-text);
}
.top .who { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; color: inherit; text-decoration: none; }
.top .top-logo, .top .logo { height: 30px; width: auto; flex: none; }
.top .muted { color: inherit; opacity: .75; }
.who-text { min-width: 0; }
.who-text .small { opacity: .75; }
.avatar {
  width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--forpay-ink); font-family: var(--font-title); font-size: 1rem; font-weight: 500;
}
.hello { font-family: var(--font-title); font-weight: 500; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; width: 100%; padding: 16px 14px 28px; }
.app-main > * { max-width: 640px; margin-left: auto; margin-right: auto; }
.app-main.dark { background: var(--forpay-black); color: #fff; }
.app-main.dark h1, .app-main.dark .muted { color: #c9ccd2; }
@media (display-mode: standalone) { .top { padding-top: calc(12px + env(safe-area-inset-top)); } }

.tabbar {
  flex: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 16px; text-decoration: none; color: var(--muted); font-size: 0.75rem; font-weight: 500; }
.tab-ico { display: grid; place-items: center; height: 26px; }
.tabbar a.active { background: var(--brand); color: var(--brand-ink); font-weight: 600; }

/* ---- Títulos de tela e voltar ---- */
.app-main h1 { font-size: 1.35rem; margin-top: 4px; margin-bottom: 14px; }
.app-main h2 { font-size: 1.05rem; margin-top: 22px; margin-bottom: 10px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text); text-decoration: none; font-weight: 600; margin-bottom: 6px; }

/* ---- Cartão de saldo ---- */
.balance-card { background: var(--surface); border-radius: var(--radius-lg); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.balance-card .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.balance-card .label, .balance-card .muted { color: var(--muted); font-size: 0.85rem; }
.balance-card .value { font-family: var(--font-title); font-size: 2.1rem; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.15; }
.balance-card .split { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.balance-card .split > * { color: inherit; text-decoration: none; }
.balance-card .split > * + * { border-left: 1px solid var(--border); padding-left: 12px; }
.balance-card .split strong { display: block; font-family: var(--font-title); font-weight: 500; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.eye { border: 0; background: var(--surface-2); color: var(--text); border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; }

/* ---- Listas em cartão ---- */
.list { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item .t { font-weight: 600; }
.item .s { color: var(--muted); font-size: 0.82rem; }
.item .v { font-family: var(--font-title); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.item .v .pill { font-family: var(--font-body); margin-top: 4px; }
.day { display: flex; justify-content: space-between; padding: 16px 6px 6px; color: var(--muted); font-size: 0.82rem; }
.day b { color: var(--text); font-family: var(--font-title); font-weight: 500; }
a.item, a.item:hover { color: inherit; text-decoration: none; }
a.item:hover { background: var(--surface-2); }
.list-link { display: flex; justify-content: space-between; align-items: center; color: var(--link); font-weight: 600; text-decoration: none; }

/* ---- Menu (blocos no escuro) ---- */
.menu-head { display: flex; justify-content: space-between; align-items: center; margin: 2px auto 14px; }
.menu-head h1 { margin: 0; color: #fff !important; }
.block svg.i { color: var(--brand); }
.block.primary svg.i { color: var(--brand-ink); }
/* Menu (referência do Caio, 2026-10-30): barra do Pix, 2 grandes por linha, 3 pequenos por linha, perfil e ajuda deitados */
.block.bar { flex-direction: row; justify-content: flex-start; align-items: center; gap: 14px; min-height: 64px; width: 100%; margin-bottom: 10px; }
.menu-big .block { min-height: 112px; }
.menu-small { grid-template-columns: repeat(6, 1fr); margin-top: 10px; }
.menu-small .block { grid-column: span 2; min-height: 96px; font-size: .92rem; border-radius: 20px; padding: 13px; }
.menu-small .block.inline { grid-column: span 3; flex-direction: row; justify-content: flex-start; align-items: center; gap: 12px; min-height: 60px; }
.menu-logout { display: block; width: 100%; margin: 18px auto 0; padding: 13px; color: #fff; background: transparent; border-color: var(--forpay-graphite-2); }
.menu-logout:hover { background: var(--forpay-graphite); }

/* ---- Formulários ---- */
.form-card { background: var(--surface); border-radius: var(--radius-lg); padding: 18px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opts label { display: flex; align-items: center; justify-content: center; gap: 6px; border: 1.5px solid #c9ccd2; border-radius: var(--radius-sm); padding: 10px; color: var(--text); font-size: 0.95rem; font-weight: 600; cursor: pointer; }
.opts input { width: auto; accent-color: var(--forpay-blue-dark); }
.opts label:has(input:checked) { border-color: var(--forpay-ink); background: var(--forpay-ink); color: #fff; }
.opts label:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.summary { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.summary .tot { font-weight: 700; }
button.wide { width: 100%; padding: 14px; font-size: 1rem; margin-top: 8px; }
.warn-box { margin: 14px 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn); }
.warn-box p { margin: 0; }
.warn-box p + p { margin-top: 6px; }
textarea { resize: vertical; }
.install { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-top: 20px;
  background: var(--surface); border-radius: var(--radius-lg); padding: 14px; position: relative; box-shadow: var(--shadow); }
.install .primary { flex: none; }
.install-close { position: absolute; top: 4px; right: 6px; border: 0; background: none; color: var(--muted); padding: 4px; }

/* ---- Andamento (saque, pagamento) ---- */
.status-card { background: var(--surface); border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow); display: grid; gap: 10px; justify-items: start; }
.status-card .amount { font: 500 2rem var(--font-title); font-variant-numeric: tabular-nums; }
.status-card .timeline { width: 100%; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }
details.item { display: block; }
details.item > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; }
details.item > summary::-webkit-details-marker { display: none; }
details.item[open] > summary { padding-bottom: 10px; }

/* ---- Perfil ---- */
.profile-head { display: flex; align-items: center; gap: 16px; margin: 4px 0 20px; }
.profile-head h1 { margin: 0 0 2px; font-size: 1.3rem; }
.avatar.big { width: 64px; height: 64px; font-size: 1.4rem; background: var(--forpay-black); color: #fff; }
.row-actions { display: flex; gap: 10px; margin: 12px 0 24px; flex-wrap: wrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.key-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.key-main > svg { color: var(--forpay-blue-dark); margin-top: 2px; }
.key-main > div { min-width: 0; }
.mono-s { word-break: break-all; }
.key-actions { display: flex; gap: 4px; align-items: center; }
.icon-btn { border: 0; background: transparent; color: var(--muted); padding: 8px; border-radius: 10px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.add-key { margin: 12px 0 6px; }
.add-key summary { color: var(--link); font-weight: 600; cursor: pointer; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq .item { display: block; }
.faq p { margin: 8px 0 0; color: var(--muted); }

/* ---- Pagar ---- */
.round-opt { display: grid; justify-items: center; gap: 8px; background: none; border: 0; color: var(--text); padding: 4px; font-size: 0.85rem; text-align: center; }
.item-btn { width: 100%; font: inherit; color: inherit; background: var(--surface); border: 0; border-radius: 0; border-bottom: 1px solid var(--border); text-align: left; cursor: pointer; }
.item-btn:hover { background: var(--surface-2); }
.item-btn:last-child { border-bottom: 0; }
.item.col { flex-direction: column; align-items: stretch; gap: 4px; }
.big-amount { font-family: var(--font-title); font-size: 1.6rem; }
.confirm h2 { margin-top: 20px; }

/* sobreposição em tela cheia (câmera, senha) */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgb(17 18 20 / 70%); display: grid; place-items: end center; }
.pin-pad {
  width: 100%; max-width: 480px; background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 8px; position: relative; text-align: center;
}
.pin-pad h2 { margin: 6px 0 0; }
.pin-pad p { margin: 0 0 6px; }
.pin-close { position: absolute; top: 12px; right: 14px; background: none; border: 0; color: var(--muted); }
.pin-lock svg { width: 40px; height: 40px; color: var(--forpay-blue-dark); }
.pin-dots { display: flex; gap: 14px; margin: 10px 0 14px; }
.pin-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); }
.pin-dots span.on { background: var(--forpay-ink); border-color: var(--forpay-ink); }
.pin-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; max-width: 320px; }
.pin-keys button { font: 500 1.5rem var(--font-title); padding: 12px 0; border-radius: 16px; background: var(--surface-2); border: 0; color: var(--text); }
.pin-keys button:active { background: var(--border); }
.pin-login { justify-items: stretch; text-align: left; }

.scanner { position: fixed; inset: 0; background: #000; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; left: 8%; right: 8%; top: 22%; bottom: 30%; border: 3px solid var(--forpay-blue); border-radius: 18px; box-shadow: 0 0 0 100vmax rgb(0 0 0 / 45%); overflow: hidden; }
.scan-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--forpay-blue); animation: scan 2s ease-in-out infinite; }
@keyframes scan { 0%, 100% { top: 10%; } 50% { top: 90%; } }
@media (prefers-reduced-motion: reduce) { .scan-line { animation: none; top: 50%; } }
.scan-close { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgb(0 0 0 / 55%); color: #fff; }
.scan-hint { position: absolute; top: calc(70px + env(safe-area-inset-top)); left: 20px; right: 20px; text-align: center; color: #fff; margin: 0; text-shadow: 0 1px 4px #000; }
.scan-actions { position: absolute; left: 16px; right: 16px; bottom: calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.scan-btn { display: block; text-align: center; padding: 14px; border-radius: 14px; background: rgb(255 255 255 / 14%); color: #fff; border: 1px solid rgb(255 255 255 / 30%); font: 500 1rem var(--font-body); cursor: pointer; }

/* comprovante (só quando pago) */
.receipt { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; display: grid; gap: 10px; justify-items: start; box-shadow: var(--shadow); }
.receipt-head { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.receipt-head img { height: 30px; background: var(--forpay-black); padding: 4px 6px; border-radius: 8px; }
.receipt-amount { font: 500 2rem var(--font-title); }
.receipt-kv { width: 100%; margin-top: 8px; }
.receipt-kv dd { word-break: break-word; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }

/* ---- Agenda e antecipação (SPEC 002) ---- */
.item.pick { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; cursor: pointer; }
.item.pick input { width: auto; accent-color: var(--forpay-blue-dark); }
.item.pick.nopick { cursor: default; }
.item.pick .pill { margin-top: 4px; }
.nobox { width: 18px; }
.check { display: flex; gap: 8px; align-items: center; flex-direction: row; color: var(--text); }
.check input { width: auto; accent-color: var(--forpay-blue-dark); }
.stack { display: grid; gap: 12px; }
.stack .item.pick { background: var(--surface); border-radius: var(--radius-lg); border: 1.5px solid transparent; box-shadow: var(--shadow); }
.stack .item.pick:has(input:checked) { border-color: var(--forpay-ink); }
.ant-bar { display: grid; gap: 10px; padding: 14px; margin: 8px 0 16px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 2; }
.ant-amount { display: flex; gap: 8px; align-items: center; flex-direction: row; color: var(--text); }
.ant-amount input { max-width: 140px; }
.terms { background: var(--surface); border-radius: var(--radius-lg); padding: 16px; color: var(--muted); font-size: .9rem; }

/* ---- Portal no computador (SPEC 019, B8): trilho lateral no lugar da barra de baixo, conteúdo mais largo ---- */
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 236px 1fr; grid-template-rows: auto 1fr; }
  .top { grid-column: 1 / -1; padding: 14px 28px; }
  .tabbar {
    grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: 4px; align-self: stretch;
    padding: 20px 12px; border-top: 0; border-right: 1px solid var(--border); overflow-y: auto;
  }
  .tabbar a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-sm); font-size: .95rem; }
  .tabbar a:hover:not(.active) { background: var(--surface-2); color: var(--text); }
  .tab-ico { height: auto; }
  .app-main { grid-column: 2; grid-row: 2; padding: 28px 36px 40px; }
  .app-main > * { max-width: 980px; }
  .app-main h1 { font-size: 1.7rem; }
  .shortcuts { overflow: visible; flex-wrap: wrap; gap: 16px; margin-bottom: 18px; }
  .shortcut { width: 92px; font-size: .85rem; }
  .balance-card { padding: 24px 28px; }
  .balance-card .value { font-size: 2.6rem; }
  .blocks { grid-template-columns: repeat(3, 1fr); }
  .blocks.menu-big { grid-template-columns: 1fr 1fr; gap: 14px; }
  .menu-big .block { min-height: 130px; font-size: 1.15rem; }
  .menu-small { grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 14px; }
  .menu-small .block, .menu-small .block.inline { grid-column: span 1; flex-direction: column; justify-content: space-between; align-items: flex-start; min-height: 116px; font-size: 1.05rem; }
  .menu-small .d1 { order: 1; } .menu-small .d2 { order: 2; } .menu-small .d3 { order: 3; } .menu-small .d4 { order: 4; }
  .menu-small .d5 { order: 5; } .menu-small .d6 { order: 6; } .menu-small .d7 { order: 7; } .menu-small .d8 { order: 8; } .menu-small .d9 { order: 9; }
  .block.bar { min-height: 76px; font-size: 1.1rem; margin-bottom: 14px; }
  /* formulários estreitos, alinhados à esquerda da coluna de conteúdo */
  .app-main > .form-card, .app-main > .status-card, .app-main > .receipt { max-width: 560px; margin-left: max(0px, calc((100% - 980px) / 2)); }
  .pin-pad { border-radius: 24px; margin-bottom: 10vh; }
}

/* Vendas: período escolhido e 2ª via do comprovante (SPEC 021) */
.date-range { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin-bottom: 14px; }
.date-range[hidden] { display: none; }
.date-range label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
.date-range p { flex-basis: 100%; margin: 0; }
.receipt-sheet {
  width: 100%; max-width: 420px; max-height: 92vh; overflow-y: auto; background: var(--surface-2); border-radius: 24px 24px 0 0;
  padding: 44px 16px calc(16px + env(safe-area-inset-bottom)); position: relative; display: grid; gap: 14px;
}
.filipeta { background: #fff; color: #111; padding: 18px 16px; border-radius: 4px; box-shadow: var(--shadow); font-size: .86rem; line-height: 1.45; }
.filipeta-logo { display: block; height: 52px; margin: 0 auto 10px; }
.filipeta .fl { display: flex; justify-content: space-between; gap: 10px; overflow-wrap: anywhere; }
.filipeta .fl.c { justify-content: center; text-align: center; }
.filipeta .fl.b { font-weight: 600; }
.filipeta .fl.big { font-size: 1.35rem; margin: 2px 0; }
.filipeta .fl.small { font-size: .72rem; color: #555; }
.filipeta hr { border: 0; border-top: 1px dashed #999; margin: 10px 0; }
.receipt-actions { display: grid; grid-auto-flow: column; gap: 10px; }


/* SPEC 031: comparação dos modos */
.mode-compare { background: var(--surface); border-radius: var(--radius-sm); padding: 12px 14px; display: grid; gap: 6px; }
.mode-compare table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.mode-compare td, .mode-compare th { padding: 4px 0; border-bottom: 1px solid var(--border); text-align: left; }
.mode-compare .num { text-align: right; }

/* SPEC 035: modo representante */
.rep-tabbar { grid-template-columns: repeat(4, 1fr); }
.rep-chart { background: var(--surface); border-radius: var(--radius-lg); padding: 14px 14px 8px; box-shadow: var(--shadow); }
.rep-chart svg { display: block; width: 100%; height: auto; }
.rep-chart .bar { fill: var(--forpay-blue, #00aeef); }
.rep-chart .bar.open { fill: var(--muted); opacity: .45; }
.rep-chart text { font-size: 11px; fill: var(--muted); font-family: var(--font-body); }
.rep-note { color: var(--muted); font-size: 0.82rem; margin: 8px auto 0; padding: 0 2px; }
.twofa-qr { display: grid; place-items: center; background: #fff; border-radius: 12px; padding: 12px; }
.twofa-qr img { width: 200px; height: 200px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; padding: 12px; background: var(--surface-2); border-radius: 8px; font-size: 1.05rem; letter-spacing: .04em; }
.rep-switch { display: flex; align-items: center; gap: 8px; color: var(--link); font-weight: 600; text-decoration: none; margin: 4px 2px 12px; }
.app-main .list + .primary { margin-top: 12px; }

/* Cobranças (SPEC 042): QR Code do Pix sobre fundo branco também no tema escuro */
.form-card img.qr { justify-self: center; background: #fff; padding: 8px; border-radius: var(--radius); }

/* ---- Cobrança digital (SPEC 044) ---- */
.cob-head { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cob-head .muted { display: inline-flex; align-items: center; gap: 6px; }
.cob-ref { font: 600 1rem var(--font-title); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.status-card img.qr { justify-self: center; background: #fff; padding: 8px; border-radius: var(--radius); }
.cob-cc { width: 100%; }
.cob-detail { max-width: 560px; }
.cob-detail > .status-card { max-width: none; }
@media (min-width: 900px) { .app-main > .cob-detail { margin-left: max(0px, calc((100% - 980px) / 2)); } }
