:root {
  --brand-primary: #5546df;
  --brand-secondary: #273b91;
  --brand-accent: #12b943;
  --success: #169b52;
  --warning: #d18a00;
  --danger: #d93636;
  --ink: #181b20;
  --muted: #6c7079;
  --line: #e8e9ec;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { background: #f4f4f5; }
body { margin: 0; color: var(--ink); font-family: Arial, Helvetica, sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
:focus-visible { outline: 3px solid #ffbf47; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.brand-logo { display: block; object-fit: contain; }
.brand-logo--placeholder { color: currentColor; }
.icon { width: 1.35em; height: 1.35em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menu-button { display: inline-grid; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 12px; background: transparent; color: currentColor; }
.menu-button .icon { width: 25px; height: 25px; }

/* Intro: composição do cartão da referência, inteiramente dentro da página web. */
.intro-page { min-height: 100svh; background: radial-gradient(circle at 48% 28%, #3b3c42 0, #17181b 42%, #070809 78%); color: #fff; }
.intro-shell { width: min(100%, 440px); min-height: 100svh; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 12px calc(18px + var(--safe-bottom)); display: flex; flex-direction: column; justify-content: flex-end; }
.intro-ambient { flex: 1 1 12vh; min-height: 42px; position: relative; }
.intro-ambient::after { content: ''; position: absolute; left: 50%; bottom: 6px; width: 52%; height: 1px; transform: translateX(-50%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.18), transparent); }
.verify-card { overflow: hidden; border: 1px solid rgba(255,255,255,.14); border-radius: 34px; background: #292a2d; box-shadow: 0 26px 72px rgba(0,0,0,.48); }
.verify-hero { min-height: 296px; position: relative; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 30px 28px 32px; background: linear-gradient(138deg, #f7f2e8 0 48%, #e2dfd6 48% 63%, #b9b5ad 63%); color: #231d18; }
.verify-hero::before { content: ''; position: absolute; inset: auto -12% -25% 20%; height: 59%; border-radius: 55% 0 0 0; background: linear-gradient(145deg, color-mix(in srgb, var(--brand-primary) 90%, #111), var(--brand-secondary)); transform: rotate(-4deg); }
.verify-hero::after { content: ''; position: absolute; right: -55px; top: 60px; width: 205px; height: 220px; opacity: .23; background: repeating-linear-gradient(90deg, #151515 0 5px, transparent 5px 17px), repeating-linear-gradient(#151515 0 5px, transparent 5px 17px); transform: perspective(330px) rotateY(-22deg) rotateZ(-1deg); }
.hero-logo { width: 112px; height: 48px; margin-left: auto; position: relative; z-index: 2; color: var(--brand-primary); }
.hero-copy { position: relative; z-index: 2; max-width: 305px; }
.hero-kicker { margin: 0 0 7px; font-size: clamp(37px, 10vw, 48px); line-height: .93; letter-spacing: -2.3px; font-weight: 900; text-transform: uppercase; }
.hero-kicker strong { display: block; color: var(--brand-primary); }
.hero-sub { width: 210px; margin: 23px 0 0; padding-top: 14px; border-top: 3px solid var(--brand-accent); font-size: 15px; line-height: 1.28; }
.hero-sub strong { display: block; }
.verify-card-body { padding: 24px 25px 22px; }
.intro-action { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.intro-action h1 { margin: 0 0 4px; font-size: 31px; line-height: 1.05; }
.intro-action p { margin: 0; color: #d9d9db; font-size: 18px; }
.open-button { min-width: 122px; min-height: 62px; display: inline-grid; place-items: center; border-radius: 999px; background: #0799ee; color: white; font-size: 21px; text-decoration: none; font-weight: 700; box-shadow: inset 0 1px rgba(255,255,255,.2); }
.provider { margin-top: 24px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.18); display: flex; align-items: center; gap: 12px; }
.provider-mark { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; background: linear-gradient(145deg, var(--brand-primary), var(--brand-secondary)); font-weight: 900; }
.provider small { display: block; color: #aeb0b5; font-size: 13px; }
.provider strong { display: block; margin-top: 2px; font-size: 16px; }

/* Scanner */
.scanner-page { min-height: 100svh; background: linear-gradient(180deg, var(--brand-secondary), var(--brand-primary) 55%, #4138c5); color: #fff; }
.scanner-shell { width: min(100%, 440px); min-height: 100svh; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px calc(26px + var(--safe-bottom)); display: flex; flex-direction: column; }
.scanner-header { min-height: 102px; position: relative; display: grid; grid-template-columns: 48px 1fr 48px; align-items: start; }
.scanner-header .menu-button { background: #fff; color: #283041; }
.scanner-logo { width: 110px; height: 66px; margin: 0 auto; color: #fff; }
.scanner-stage { position: relative; min-height: 286px; overflow: hidden; border: 1px solid rgba(255,255,255,.75); border-radius: 14px; background: #333743; }
#reader { display: block; width: 100%; height: 286px; min-height: 286px; background: #171a20; object-fit: cover; }
.scanner-stage::after { content: ''; pointer-events: none; position: absolute; inset: 19px; background:
  linear-gradient(var(--brand-accent),var(--brand-accent)) 0 0/42px 3px no-repeat,
  linear-gradient(var(--brand-accent),var(--brand-accent)) 0 0/3px 42px no-repeat,
  linear-gradient(var(--brand-accent),var(--brand-accent)) 100% 0/42px 3px no-repeat,
  linear-gradient(var(--brand-accent),var(--brand-accent)) 100% 0/3px 42px no-repeat,
  linear-gradient(var(--brand-accent),var(--brand-accent)) 0 100%/42px 3px no-repeat,
  linear-gradient(var(--brand-accent),var(--brand-accent)) 0 100%/3px 42px no-repeat,
  linear-gradient(var(--brand-accent),var(--brand-accent)) 100% 100%/42px 3px no-repeat,
  linear-gradient(var(--brand-accent),var(--brand-accent)) 100% 100%/3px 42px no-repeat; border-radius: 12px; }
.camera-placeholder { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle, #535866, #292d37); text-align: center; }
.camera-placeholder[hidden] { display: none; }
.primary-button, .secondary-button { min-height: 50px; border: 0; border-radius: 10px; padding: 0 22px; cursor: pointer; font-weight: 700; }
.primary-button { background: linear-gradient(90deg, #15ac37, #59de67); color: #fff; }
.secondary-button { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.55); color: #fff; }
.camera-tools { position: absolute; z-index: 4; right: 10px; bottom: 10px; display: flex; gap: 8px; }
.round-button { width: 48px; height: 48px; border: 1px solid rgba(255,255,255,.55); border-radius: 50%; display: none; place-items: center; background: #303751; color: #fff; }
.round-button.is-visible { display: grid; }
.activity { height: 4px; margin: 24px 2px 0; overflow: hidden; border-radius: 9px; background: rgba(255,255,255,.78); }
.activity span { display: block; width: 33%; height: 100%; border-radius: inherit; background: var(--brand-accent); animation: scan 1.6s ease-in-out infinite alternate; }
.activity.is-idle span { width: 0; animation: none; }
@keyframes scan { from { transform: translateX(0); } to { transform: translateX(205%); } }
.scan-status { min-height: 154px; padding: 20px 8px 10px; text-align: center; }
.status-symbol { width: 33px; height: 33px; margin: 0 auto 12px; display: grid; place-items: center; border: 2px solid currentColor; border-radius: 50%; font-weight: 800; }
.scan-status h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.scan-status p { max-width: 320px; margin: 14px auto 0; color: rgba(255,255,255,.94); font-size: 17px; line-height: 1.45; font-weight: 700; }
.scan-status.is-error h1, .scan-status.is-error .status-symbol { color: #ffdfdf; }
.scan-options { display: grid; gap: 10px; margin-top: auto; }
.scan-options-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.file-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); opacity: 0; pointer-events: none; }
.code-panel { padding: 13px; border-radius: 12px; background: rgba(0,0,0,.18); }
.code-panel[hidden] { display: none; }
.code-panel label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.code-row input { width: 100%; min-width: 0; height: 48px; border: 1px solid transparent; border-radius: 9px; padding: 0 12px; font-family: Consolas, monospace; }

/* Resultado */
.result-page { min-height: 100svh; background: #fff; }
.result-shell { width: min(100%, 520px); min-height: 100svh; margin: 0 auto; background: #fff; display: flex; flex-direction: column; }
.result-header { height: 59px; display: grid; grid-template-columns: 54px 1fr 74px; align-items: center; padding: max(7px, env(safe-area-inset-top)) 10px 7px; border-bottom: 1px solid var(--line); }
.result-logo { width: 61px; height: 37px; margin: 0 auto; color: var(--brand-primary); }
.locale-pill { justify-self: end; padding: 7px 10px; border: 1px solid #d3d5da; border-radius: 999px; font-size: 12px; font-weight: 700; }
.product-title { margin: 0; padding: 12px 18px; border-bottom: 1px solid var(--line); text-align: center; font-size: 17px; line-height: 1.2; }
.result-band { min-height: 72px; display: grid; grid-template-columns: 48px 1fr; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.shield { width: 44px; height: 50px; color: var(--success); }
.result-band h1 { margin: 0; color: var(--tone); font-size: 20px; line-height: 1.05; }
.result-code { margin: 5px 0 0; font-size: 12px; font-weight: 800; letter-spacing: .1px; }
.issuer { grid-column: 2; margin-top: -4px; color: var(--muted); font-size: 11px; }
.product-visual { min-height: 292px; display: grid; place-items: center; padding: 26px 24px 14px; }
.product-visual img { width: 100%; max-width: 335px; height: 270px; object-fit: contain; }
.result-content { padding: 0 18px 25px; }
.guidance { margin: 0 0 18px; color: #6f737a; font-size: 14px; line-height: 1.62; }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin: 0; }
.details div { min-width: 0; }
.details dt { margin-bottom: 4px; color: #8b8e94; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.details dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.result-actions { margin-top: auto; padding: 14px 16px calc(18px + var(--safe-bottom)); border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-action { min-height: 67px; display: grid; place-items: center; gap: 4px; color: var(--brand-primary); text-decoration: none; text-align: center; font-size: 12px; font-weight: 700; }
.result-action .action-icon { width: 42px; height: 42px; padding: 8px; border-radius: 50%; background: var(--brand-primary); color: #fff; }
.verify-again { grid-column: 1/-1; margin-top: 3px; color: var(--muted); font-size: 13px; }
.state-message { margin: 16px 18px 0; padding: 14px; border: 1px solid color-mix(in srgb, var(--tone) 30%, #fff); border-radius: 10px; background: color-mix(in srgb, var(--tone) 7%, #fff); color: #43464c; line-height: 1.45; }

/* Mensagem/certificado */
.message-page { min-height: 100svh; display: grid; place-items: center; padding: 24px; background: #f3f4f7; }
.message-card { width: min(100%, 440px); padding: 34px; border-radius: 24px; background: #fff; box-shadow: 0 20px 65px rgba(25,29,48,.12); text-align: center; }
.message-card h1 { margin: 0 0 12px; font-size: 26px; }
.message-card p { color: var(--muted); line-height: 1.55; }
.certificate-page { padding: 32px; background: #eceff3; }
.certificate { width: min(100%, 780px); margin: 0 auto; padding: 48px; border: 1px solid #d9dde3; background: #fff; box-shadow: 0 18px 60px rgba(0,0,0,.08); }
.certificate-head { display: flex; justify-content: space-between; gap: 24px; align-items: center; padding-bottom: 28px; border-bottom: 3px solid var(--brand-primary); }
.certificate-logo { width: 150px; height: 65px; color: var(--brand-primary); }
.certificate h1 { margin: 28px 0 7px; font-size: 30px; }
.certificate-status { color: var(--tone); font-size: 22px; font-weight: 900; }
.certificate dl { display: grid; grid-template-columns: 180px 1fr; gap: 11px 20px; margin: 30px 0; }
.certificate dt { color: #747983; }
.certificate dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.print-button { border: 0; border-radius: 8px; padding: 13px 20px; background: var(--brand-primary); color: #fff; font-weight: 700; }
@media (max-width: 359px) {
  .intro-shell { padding-inline: 8px; }
  .verify-card { border-radius: 28px; }
  .verify-hero { min-height: 335px; padding-inline: 22px; }
  .hero-kicker { font-size: 34px; }
  .intro-action { grid-template-columns: 1fr; }
  .open-button { min-height: 54px; }
  .scanner-shell { padding-inline: 10px; }
  .details { grid-template-columns: 1fr; }
}
@media (min-width: 700px) {
  .intro-shell, .scanner-shell { padding-block: 28px; }
  .result-shell { margin-block: 26px; min-height: calc(100svh - 52px); box-shadow: 0 15px 55px rgba(25,29,48,.12); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media print {
  .certificate-page { padding: 0; background: #fff; }
  .certificate { width: 100%; box-shadow: none; border: 0; }
  .print-button { display: none; }
}
