/* ==========================================================================
   Kapta · Amazon, páginas públicas (entrada, registo, recuperação)
   Conceito: folha de transformação. A linha do relatório Amazon passa a
   rascunho InvoiceXpress à vista de quem chega; à volta, tinta sobre papel.
   O vermelho Kapta aparece em dois sítios só: o ponto do logótipo e a
   moldura do acesso. Só tema claro, como kapta.pt.
   ========================================================================== */

/* Fontes Kapta alojadas na app (Fontshare, ITF Free Font License): a CSP só aceita 'self'. */
@font-face { font-family: 'Satoshi'; src: url('../fonts/satoshi-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Satoshi'; src: url('../fonts/satoshi-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'General Sans'; src: url('../fonts/general-sans-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'General Sans'; src: url('../fonts/general-sans-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }

body.is-public {
    --paper:       #f6f5f2;   /* fundo: cinza quente, não creme */
    --sheet:       #ffffff;   /* folhas e cartões */
    --ink:         #161616;   /* tinta Kapta */
    --ink-2:       #4a4946;   /* texto secundário */
    --mute:        #6b6964;   /* legendas, 4.7:1 sobre o papel */
    --rule:        #e2e0db;   /* filetes */
    --rule-strong: #c6c3bc;   /* contornos de campos */
    --red:         #e22726;   /* ponto Kapta */
    --red-wash:    #fcebea;   /* realce do mapeamento ao passar o cursor */
    --ok:          #2e6b41;

    --display: 'Satoshi', 'General Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --text:    'General Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --mono:    ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

    /* tokens herdados de base.css e amazon.css */
    --bg: var(--paper); --surface: var(--sheet); --black: var(--ink); --ink-soft: var(--ink-2);
    --muted: var(--mute); --muted-2: var(--mute); --line: var(--rule); --line-soft: var(--rule);

    background: var(--paper);
    color: var(--ink);
    font-family: var(--text);
    font-size: 15px;
    line-height: 1.6;
    font-feature-settings: normal;
}
.is-public ::selection { background: var(--red-wash); }
.is-public :focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.is-public .main { padding: 0 0 24px; }

/* ------------------------------------------------------------------ topo */

.is-public .topbar { padding-top: 22px; }
.is-public .topbar__row { padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.is-public .brand { display: inline-flex; align-items: baseline; gap: 10px; font-family: var(--display); font-size: 25px; letter-spacing: -.045em; line-height: 1; }
.is-public .brand b { font-weight: 700; }
.is-public .brand b::after { content: '.'; color: var(--red); }
.is-public .brand span { display: none; }
.is-public .brand i { font-family: var(--text); font-size: 15px; font-weight: 400; letter-spacing: 0; color: var(--mute); }
.is-public .topbar__tools { gap: 18px; }
.is-public .language-switch { border-color: var(--rule-strong); background: transparent; }
.is-public .language-switch button { font-family: var(--text); color: var(--ink-2); }
.is-public .language-switch button[aria-pressed="true"] { background: var(--ink); color: var(--sheet); }
.public-link { font-size: 14px; font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.public-link:hover { text-decoration-color: var(--red); }

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

.is-public h1, .is-public h2, .is-public h3 { font-family: var(--display); font-weight: 500; text-wrap: balance; }
.is-public .eyebrow { font-family: var(--mono); font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink-2); margin-bottom: 18px; }
.is-public .display { font-family: var(--display); font-weight: 500; letter-spacing: -.04em; line-height: 1; }
.is-public .display--sm { font-size: clamp(34px, 4.4vw, 48px); }
.is-public .lead { font-size: 17px; font-weight: 400; line-height: 1.55; color: var(--ink-2); max-width: 52ch; }
.is-public .text-link { font-size: 14px; text-decoration-thickness: 1px; }
.is-public .text-link:hover { text-decoration-color: var(--red); }
.is-public .muted { color: var(--mute); }

.is-public label { font-size: 13px; font-weight: 500; color: var(--ink); }
.is-public input:not([type=checkbox]):not([type=hidden]):not([type=file]) {
    border: 1px solid var(--rule-strong); border-radius: 4px; background: var(--sheet);
    min-height: 48px; margin-top: 8px; font-family: var(--text); font-size: 15px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.is-public input:not([type=checkbox]):not([type=hidden]):not([type=file]):focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22, 22, 22, .1); }
.is-public small { color: var(--mute); font-size: 12px; }

.is-public .btn { font-family: var(--text); font-size: 14px; font-weight: 500; height: 46px; padding: 0 22px; border-color: var(--ink); background: transparent; box-shadow: none; }
.is-public .btn:hover { transform: none; box-shadow: none; background: var(--sheet); }
.is-public .btn--dark { background: var(--ink); color: var(--sheet); }
.is-public .btn--dark:hover { background: #000; }
.is-public .btn--block { width: 100%; height: 50px; }

.is-public .alert { border-radius: 4px; font-size: 13px; padding: 12px 14px; margin: 0; }

/* registo, recuperar e redefinir: a mesma moldura do acesso */
.is-public .narrow { max-width: 560px; margin: 0 auto; padding-block: clamp(40px, 7vw, 88px); }
.is-public .narrow > .alert { margin-bottom: 20px; }
.is-public .card { background: var(--sheet); border: 1px solid var(--ink); border-radius: 0; box-shadow: 10px 10px 0 var(--red); }
.is-public .card__body { padding: 32px; }
.is-public .main > .wrap > .alert { max-width: 560px; margin: 32px auto 0; }

/* ----------------------------------------------------------------- herói */

.lp-hero {
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr);
    gap: clamp(40px, 6vw, 96px); align-items: center;
    padding-block: clamp(48px, 8vw, 104px) clamp(64px, 9vw, 120px);
}
.lp-hero__copy { min-width: 0; }
.lp-kicker { display: flex; flex-wrap: wrap; gap: 10px; font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.lp-kicker span { color: var(--mute); }
.lp-title { margin-top: 24px; font-size: clamp(48px, 7vw, 92px); line-height: .96; letter-spacing: -.05em; }
.lp-lead { margin-top: 30px; max-width: 44ch; font-size: 18px; line-height: 1.55; color: var(--ink-2); }
.lp-meta { margin-top: 18px; font-size: 13.5px; color: var(--mute); }

.lp-access {
    justify-self: end; width: 100%; max-width: 420px; padding: 32px;
    background: var(--sheet); border: 1px solid var(--ink); box-shadow: 10px 10px 0 var(--red);
    display: flex; flex-direction: column; gap: 22px;
}
.lp-access h2 { font-size: 24px; letter-spacing: -.025em; line-height: 1.2; }
.lp-access h2 + p { margin-top: -18px; font-size: 14px; color: var(--mute); }
.lp-form { display: flex; flex-direction: column; gap: 18px; }
.lp-form .btn { margin-top: 4px; }
.lp-access__links { display: flex; flex-direction: column; gap: 8px; padding-top: 18px; border-top: 1px solid var(--rule); font-size: 14px; color: var(--mute); }
.lp-access__links .text-link { color: var(--ink); }

/* ------------------------------------------------------ cabeçalho de secção */

.lp-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 64px; align-items: end; margin-bottom: 40px; }
.lp-head h2 { font-size: clamp(28px, 3.4vw, 40px); line-height: 1.08; letter-spacing: -.035em; max-width: 18ch; }
.lp-head p { max-width: 52ch; color: var(--ink-2); font-size: 15.5px; }
.lp-section { padding-block: clamp(64px, 9vw, 112px) 0; }

/* ------------------------------------------- espécime: relatório → fatura */

.lp-band {
    padding-block: clamp(56px, 8vw, 96px);
    background: var(--sheet);
    box-shadow: 0 0 0 100vmax var(--sheet), 0 -1px 0 100vmax var(--rule), 0 1px 0 100vmax var(--rule);
    clip-path: inset(-1px -100vmax);
    overflow-x: clip;
}

/* Palco: folha de cálculo à esquerda, fatura à direita. O cursor de seleção
   percorre as células e os valores saltam para a fatura (assets/js/public.js).
   Sem JavaScript, ou com movimento reduzido, fica o estado final. */
.stage { position: relative; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 32px 56px; align-items: center; }
.sheet, .paper { margin: 0; min-width: 0; background: var(--sheet); border: 1px solid var(--ink); }
.sheet__bar, .paper__bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--ink); font-size: 12px; color: var(--mute); white-space: nowrap; }
.sheet__tab { font-family: var(--mono); color: var(--ink); }
.paper__bar > :first-child { color: var(--ink); font-weight: 500; }

.sheet__scroll { overflow-x: auto; }
.sheet__grid { position: relative; }
.sheet__table { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.sheet__table th, .sheet__table td { padding: 9px 10px; border: solid var(--rule); border-width: 0 1px 1px 0; background: transparent; color: var(--ink-2); font-weight: 400; letter-spacing: 0; text-transform: none; white-space: nowrap; vertical-align: middle; }
.sheet__table thead th { padding: 4px 10px; background: var(--paper); color: var(--mute); font-size: 10.5px; text-align: center; }
.sheet__table tbody th { width: 1%; padding: 9px 8px; background: var(--paper); color: var(--mute); font-size: 10.5px; text-align: center; transition: background-color .3s ease, color .3s ease; }
.sheet__table tr > :last-child { border-right: 0; }
.sheet__table tbody tr:last-child > * { border-bottom: 0; }
.sheet__table .sheet__head td { color: var(--ink); font-weight: 500; }
.sheet__table tr.is-other td { transition: opacity .4s ease; }
.stage.is-reading .sheet__table tr.is-other td { opacity: .28; }
.sheet__table tr.is-picked th { background: var(--ink); color: var(--sheet); }

/* cursor de seleção, com a pega de preenchimento das folhas de cálculo */
.sheet__sel { position: absolute; left: 0; top: 0; border: 2px solid var(--red); background: rgba(226, 39, 38, .07); pointer-events: none; opacity: 0; transition: opacity .25s ease; }
.sheet__sel::after { content: ''; position: absolute; right: -5px; bottom: -5px; width: 7px; height: 7px; background: var(--red); border: 1px solid var(--sheet); }
.sheet__sel.is-on { opacity: 1; }

.paper { position: relative; overflow: hidden; box-shadow: 10px 10px 0 var(--red); transition: box-shadow .55s cubic-bezier(.2, .9, .3, 1.25); }
.paper__body { position: relative; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.paper__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.paper__head > div { display: grid; justify-items: start; }
.paper__label { font-size: 12px; color: var(--mute); }
.paper__head strong { font-family: var(--mono); font-size: 15px; font-weight: 500; }
.paper__client { font-size: 13px; text-align: right; line-height: 1.45; }
.paper__client span { color: var(--mute); }
.paper__lines { font-size: 13px; }
.paper__lines th { padding: 0 0 8px; background: transparent; font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--mute); border-bottom: 1px solid var(--ink); }
.paper__lines td { padding: 10px 0; border-top: 0; border-bottom: 1px solid var(--rule); color: var(--ink); }
.paper__lines small { display: block; margin-top: 1px; font-family: var(--mono); font-size: 11px; color: var(--mute); }
.paper__lines .num { text-align: right; padding-left: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.paper__totals { margin: 0; display: grid; gap: 4px; justify-items: end; font-size: 13px; }
.paper__totals > div { display: flex; justify-content: space-between; gap: 32px; width: min(100%, 230px); padding: 2px 0; font-variant-numeric: tabular-nums; }
.paper__totals dt { color: var(--mute); }
.paper__totals dd { margin: 0; }
.paper__totals .paper__total { margin-top: 4px; padding: 8px 6px 2px; margin-right: -6px; width: min(100%, 242px); border-top: 1px solid var(--ink); font-family: var(--display); font-size: 18px; font-weight: 500; letter-spacing: -.02em; transition: background-color .3s ease; }
.paper__totals .paper__total dt { color: var(--ink); }
.paper__total.is-match { background: var(--red-wash); }
.paper__check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ok); transition: opacity .3s ease; }
.paper__check svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.paper__check path { stroke-dasharray: 16; stroke-dashoffset: 0; transition: stroke-dashoffset .5s .1s ease; }
.paper__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.paper__stamp { flex-shrink: 0; margin-right: 4px; padding: 5px 12px; border: 2px solid var(--ink); font-family: var(--display); font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink); transform: rotate(-7deg); transition: transform .4s cubic-bezier(.3, 1.6, .5, 1), opacity .15s ease; }

/* estado em branco: só a estrutura da fatura, com barras no lugar dos valores */
.stage [data-slot] { position: relative; transition: color .35s ease; }
.stage [data-slot]::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: .72em; transform: translateY(-50%); background: var(--rule); opacity: 0; transition: opacity .35s ease; pointer-events: none; }
.stage [data-slot].is-empty, .stage [data-slot].is-empty * { color: transparent; }
.stage [data-slot].is-empty::after { opacity: 1; }
.stage .paper__client[data-slot]::after { top: 3px; bottom: 3px; height: auto; transform: none; background: repeating-linear-gradient(var(--rule) 0 11px, transparent 11px 19px); }
.stage .paper__check[data-slot]::after { content: none; }
.stage .paper__check.is-empty { opacity: 0; }
.stage .paper__check.is-empty path { stroke-dashoffset: 16; }
.stage.is-blank .paper { box-shadow: 0 0 0 var(--red); }
.stage.is-blank .paper__stamp { opacity: 0; transform: rotate(-7deg) scale(1.9); }

/* célula em voo: a mesma moldura da Kapta, em miniatura */
.fly { position: absolute; left: 0; top: 0; z-index: 4; margin: -4px 0 0 -8px; padding: 3px 7px; border: 1px solid var(--ink); background: var(--sheet); box-shadow: 3px 3px 0 var(--red); font-family: var(--mono); font-size: 12px; line-height: 1.4; color: var(--ink); white-space: nowrap; pointer-events: none; transform-origin: 0 0; will-change: transform; }
.fly__tag { position: absolute; left: -1px; bottom: calc(100% + 5px); padding: 2px 7px; background: var(--ink); color: var(--sheet); font-size: 10.5px; line-height: 1.4; white-space: nowrap; }

.stage__bar { grid-column: 1 / -1; display: flex; align-items: center; gap: 18px; min-height: 44px; padding-top: 16px; border-top: 1px solid var(--rule); }
.stage__dots { display: flex; gap: 4px; flex-shrink: 0; }
.stage__dots i { width: 22px; height: 3px; background: var(--rule); transition: background-color .3s ease; }
.stage__dots i.is-done { background: var(--ink); }
.stage__dots i.is-now { background: var(--red); }
.stage__caption { min-width: 0; font-size: 14.5px; color: var(--ink-2); transition: opacity .2s ease, transform .2s ease; }
.stage__caption.is-swapping { opacity: 0; transform: translateY(4px); }
.stage__replay { margin-left: auto; flex-shrink: 0; border: 0; background: none; padding: 6px 0; font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.stage__replay:hover { text-decoration-color: var(--red); }

/* ----------------------------------------------------------------- passos */

.lp-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.lp-steps li { padding: 22px 28px 0 0; display: flex; flex-direction: column; gap: 10px; }
.lp-steps li + li { padding-left: 28px; border-left: 1px solid var(--rule); }
.lp-steps__n { font-family: var(--mono); font-size: 12px; color: var(--mute); }
.lp-steps h3 { font-size: 24px; letter-spacing: -.03em; line-height: 1.15; }
.lp-steps p { font-size: 14.5px; color: var(--ink-2); }

.lp-limits { margin: 56px 0 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-block: 1px solid var(--rule); }
.lp-limits > div { padding: 16px 20px 16px 0; display: grid; gap: 2px; }
.lp-limits > div + div { padding-left: 20px; border-left: 1px solid var(--rule); }
.lp-limits dt { font-size: 12px; color: var(--mute); }
.lp-limits dd { margin: 0; font-size: 14px; font-weight: 500; }

/* ------------------------------------------------------------------ regras */

.lp-facts { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 64px; }
.lp-facts > div { padding: 22px 0 26px; border-top: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 8px; }
.lp-facts dt { font-family: var(--display); font-size: 19px; font-weight: 500; letter-spacing: -.02em; }
.lp-facts dd { margin: 0; color: var(--ink-2); font-size: 14.5px; max-width: 52ch; }

/* ------------------------------------------------------------------ fecho */

.lp-close {
    margin-top: clamp(64px, 9vw, 112px); padding-block: 40px;
    border-top: 1px solid var(--ink);
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 48px; align-items: center;
}
.lp-close h2 { font-size: clamp(26px, 3vw, 34px); letter-spacing: -.035em; line-height: 1.1; }
.lp-close p { margin-top: 8px; color: var(--ink-2); }
.lp-close__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.lp-close .lp-scope { grid-column: 1 / -1; margin-top: 0; font-size: 13px; color: var(--mute); }

/* ---------------------------------------------------------- páginas legais */

.is-public .legal { padding-block: clamp(40px, 6vw, 72px) 24px; }
.is-public .legal__tabs a { border-color: var(--rule-strong); }
.is-public .legal__company { border: 1px solid var(--ink); border-radius: 0; }
.is-public .legal__company h2 { font-size: 16px; letter-spacing: -.01em; }
.is-public .legal__table { border-radius: 0; }
.is-public .legal__body h2 { font-size: 20px; letter-spacing: -.02em; }

/* ----------------------------------------------------------------- rodapé */

.public-footer { padding: 0 0 32px; font-size: 13px; }
.public-footer .wrap { align-items: baseline; border-top: 1px solid var(--rule); padding-top: 24px; }
.public-footer__mark { font-family: var(--display); font-weight: 700; font-size: 18px; letter-spacing: -.045em; color: var(--ink); }
.public-footer__mark::after { content: '.'; color: var(--red); }
.public-footer__links { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-left: auto; }
.public-footer a:hover { color: var(--ink); }

/* ------------------------------------------------------------- responsivo */

@media (max-width: 1080px) {
    .lp-limits { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lp-limits > div:nth-child(4) { border-left: 0; padding-left: 0; }
    .lp-limits > div:nth-child(n+4) { border-top: 1px solid var(--rule); }
}
@media (max-width: 960px) {
    .stage { grid-template-columns: minmax(0, 1fr); gap: 40px; }
    .paper { max-width: 560px; }
}
@media (max-width: 900px) {
    .lp-hero { grid-template-columns: minmax(0, 1fr); }
    .lp-access { justify-self: start; max-width: 520px; }
    .lp-head { grid-template-columns: minmax(0, 1fr); }
    .lp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lp-steps li:nth-child(3) { border-left: 0; padding-left: 0; }
    .lp-steps li:nth-child(n+3) { margin-top: 28px; border-top: 1px solid var(--rule); }
    .lp-facts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
    .is-public .topbar__tools { gap: 12px; }
    .is-public .brand i { display: none; }
    .lp-hero { padding-block: 36px 56px; gap: 40px; }
    .lp-lead { font-size: 16.5px; }
    .lp-access { padding: 24px; box-shadow: 8px 8px 0 var(--red); max-width: calc(100% - 8px); }
    .is-public .card { box-shadow: 8px 8px 0 var(--red); margin-right: 8px; }
    .is-public .card__body { padding: 24px; }
    .sheet__table { font-size: 11px; }
    .sheet__table th, .sheet__table td { padding: 7px 6px; }
    .sheet__table thead th { padding: 3px 6px; }
    .sheet__table .sheet__head td { white-space: normal; }
    .paper { margin-right: 10px; }
    .paper__head { flex-direction: column; gap: 10px; }
    .paper__client { text-align: left; }
    .stage__bar { flex-wrap: wrap; row-gap: 10px; }
    .stage__caption { order: 3; flex-basis: 100%; }
    .lp-steps { grid-template-columns: minmax(0, 1fr); }
    .lp-steps li, .lp-steps li + li { padding: 20px 0 0; border-left: 0; }
    .lp-steps li + li { margin-top: 20px; border-top: 1px solid var(--rule); }
    .lp-limits { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lp-limits > div, .lp-limits > div + div { padding: 14px 16px 14px 0; border-left: 0; border-top: 1px solid var(--rule); }
    .lp-limits > div:nth-child(-n+2) { border-top: 0; }
    .lp-limits > div:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--rule); }
    .lp-close { grid-template-columns: minmax(0, 1fr); }
    .public-footer .wrap { flex-direction: column; gap: 8px; }
    .public-footer .wrap > span:nth-child(2) { display: inline; }
    .public-footer__links { margin-left: 0; }
}
