/* ============================================================
   SafeVault Design System — safevault.css v1.0
   Based on SafeVault Brand & Design System v1.1
   ============================================================ */

/* ------------------------------------------------------------
   1. Design Tokens
   ------------------------------------------------------------ */
:root {
  color-scheme: dark;

  /* Brand */
  --sv-gold: #C8A050;
  --sv-gold-light: #E2B96A;
  --sv-gold-dim: rgba(200, 160, 80, .15);

  /* Backgrounds */
  --sv-bg: #000000;
  --sv-surface: #111111;
  --sv-surface-2: #181818;

  /* Text */
  --sv-text: rgba(255, 255, 255, .88);
  --sv-muted: rgba(255, 255, 255, .55);

  /* Borders */
  --sv-line: rgba(255, 255, 255, .10);

  /* Semantic */
  --sv-success: #27C16F;
  --sv-info: #4FA8E6;
  --sv-warning: #F59E0B;
  --sv-error: #D9534F;

  /* Typography */
  --sv-font: 'Montserrat', ui-sans-serif, system-ui, sans-serif;
  --sv-font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;

  /* Radius */
  --sv-radius-sm: 8px;
  --sv-radius: 10px;
  --sv-radius-lg: 16px;
  --sv-radius-xl: 18px;

  /* Transitions */
  --sv-transition: 150ms ease;
}

/* ------------------------------------------------------------
   2. Reset & Base
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* The `hidden` attribute has to beat the components that set an explicit
   display (grid/flex), otherwise hidden elements stay on screen. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--sv-text);
  font: 15px/1.5 var(--sv-font);
  background:
    radial-gradient(52rem 32rem at 50% -12%, rgba(200, 160, 80, .11), transparent 62%),
    var(--sv-bg);
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
}

p {
  color: var(--sv-muted);
  margin: 0;
}

/* ------------------------------------------------------------
   3. Layout
   ------------------------------------------------------------ */
.sv-header {
  max-width: 1080px;
  margin: auto;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sv-main {
  max-width: 1080px;
  margin: 34px auto;
  padding: 0 24px 60px;
}

.sv-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

/* ------------------------------------------------------------
   4. Brand
   ------------------------------------------------------------ */
.sv-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.sv-brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--sv-radius);
  background: var(--sv-gold);
  color: #080705;
  font-weight: 800;
}

.sv-brand-sub {
  color: var(--sv-muted);
  font-weight: 500;
}

/* ------------------------------------------------------------
   5. Components — sv-card
   ------------------------------------------------------------ */
.sv-card {
  padding: 21px;
  border: 1px solid var(--sv-line);
  border-radius: var(--sv-radius-lg);
  background: linear-gradient(135deg, var(--sv-surface), #070707);
}

.sv-card--auth {
  width: min(100%, 440px);
  padding: 7px;
  background: rgba(17, 17, 17, .92);
  border: 1px solid var(--sv-line);
  border-radius: var(--sv-radius-xl);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}

/* ------------------------------------------------------------
   6. Components — sv-button
   ------------------------------------------------------------ */
/* `text-decoration: none` nos dois: um <a> com cara de botão vinha sublinhado
   pela UA stylesheet, porque nada aqui reseta âncora. Mesma família da pegadinha
   do [hidden] — o que o navegador traz de fábrica só perde para quem declara. */
.sv-button-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sv-gold-light);
  border-radius: var(--sv-radius);
  background: var(--sv-gold);
  color: #080705;
  padding: 12px 15px;
  font: 700 15px var(--sv-font);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--sv-transition), box-shadow var(--sv-transition);
}

.sv-button-primary:hover {
  background: var(--sv-gold-light);
  box-shadow: 0 0 16px rgba(200, 160, 80, .25);
}

.sv-button-primary:focus-visible {
  outline: 2px solid var(--sv-gold-light);
  outline-offset: 2px;
}

/* `cursor: wait` só vale onde desabilitado significa ENVIANDO. Todo botão
   desabilitado por REGRA (como o de resgate da rewards.html, que nasce sem
   pontos suficientes) precisa sobrescrever com `not-allowed` — ampulheta em
   botão que nunca vai destravar sozinho lê como "carregando", e o usuário
   espera por algo que não vem. */
.sv-button-primary:disabled,
.sv-button-secondary:disabled {
  opacity: .55;
  cursor: wait;
}

.sv-button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--sv-line);
  border-radius: var(--sv-radius-sm) + 1px;
  border-radius: 9px;
  color: var(--sv-text);
  background: transparent;
  padding: 9px 12px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color var(--sv-transition), color var(--sv-transition);
}

.sv-button-secondary:hover {
  border-color: var(--sv-gold);
  color: var(--sv-gold-light);
}

.sv-button-secondary:focus-visible {
  outline: 2px solid var(--sv-gold-light);
  outline-offset: 2px;
}

/* ------------------------------------------------------------
   7. Components — sv-input
   ------------------------------------------------------------ */
.sv-input {
  width: 100%;
  border: 1px solid var(--sv-line);
  border-radius: var(--sv-radius);
  padding: 12px;
  background: #050505;
  color: var(--sv-text);
  font: inherit;
  outline: none;
  transition: border-color var(--sv-transition), box-shadow var(--sv-transition);
}

.sv-input:focus {
  border-color: var(--sv-gold);
  box-shadow: 0 0 0 3px var(--sv-gold-dim);
}

/* Campo que EXIBE um fato já resolvido (ex.: o cupom vinculado, que é
   permanente). Continua selecionável e copiável — de propósito: `disabled` o
   tiraria do foco e do teclado, e o cinza pesado diria "quebrado" onde a verdade
   é "já resolvido". Some a moldura de foco, que promete uma edição que não vem. */
.sv-input:read-only {
  border-style: dashed;
  color: var(--sv-muted);
  cursor: default;
}

.sv-input:read-only:focus {
  border-color: var(--sv-line);
  box-shadow: none;
}

.sv-input::placeholder {
  color: var(--sv-muted);
}

/* Campo de senha com botão "olho" para revelar/ocultar. O wrap posiciona o
   botão sobre a borda direita do input; o input reserva o espaço com padding. */
.sv-pass-wrap {
  position: relative;
  display: block;
}

.sv-pass-wrap .sv-input {
  padding-right: 44px;
}

.sv-pass-eye {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--sv-muted);
  cursor: pointer;
  border-radius: 8px;
  transition: color var(--sv-transition);
}

.sv-pass-eye:hover { color: var(--sv-text); }
.sv-pass-eye:focus-visible { outline: 2px solid var(--sv-gold); outline-offset: 2px; }
.sv-pass-eye svg { width: 20px; height: 20px; display: block; }
.sv-pass-eye .sv-eye-off { display: none; }
.sv-pass-eye[aria-pressed="true"] .sv-eye-on { display: none; }
.sv-pass-eye[aria-pressed="true"] .sv-eye-off { display: block; }

/* ------------------------------------------------------------
   8. Components — sv-tabs
   ------------------------------------------------------------ */
.sv-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 17px;
}

.sv-tab {
  border: 0;
  padding: 10px;
  border-radius: 11px;
  color: var(--sv-muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
  transition: color var(--sv-transition), background var(--sv-transition);
}

.sv-tab:hover {
  color: var(--sv-text);
}

.sv-tab.active {
  color: var(--sv-gold-light);
  background: var(--sv-gold-dim);
}

/* ------------------------------------------------------------
   9. Components — sv-badge
   ------------------------------------------------------------ */
.sv-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--sv-line);
  border-radius: 999px;
  background: var(--sv-surface-2);
  color: var(--sv-muted);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .11em;
  white-space: nowrap;
}

.sv-badge--gold {
  border-color: rgba(200, 160, 80, .45);
  background: var(--sv-gold-dim);
  color: var(--sv-gold-light);
}

.sv-badge--success {
  border-color: rgba(39, 193, 111, .4);
  background: rgba(39, 193, 111, .12);
  color: var(--sv-success);
}

/* Badge de contagem "estilo notificação não-lida do iPhone": um círculo pequeno
   pinado no canto superior direito do badge de status (ex.: "Disponível"), meio
   pra fora da quina. Fundo #171717 — a MESMA cor da .sv-benefit-tag, o outro
   badge que já transborda o canto à la notificação. */
.sv-notif-anchor {
  position: relative;
  display: inline-block;
}
.sv-notif-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #171717;
  border: 1px solid var(--sv-gold);
  color: var(--sv-gold-light);
  font-size: .68rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--sv-bg);
}

/* Campanha ativa — card dourado no simulador (account.html). Preenchido por
   renderCampaign a partir do `quote.campaign`; some quando não há campanha. */
.sv-campaign {
  border: 1px solid rgba(200, 160, 80, .45);
  border-left: 3px solid var(--sv-gold);
  background: var(--sv-gold-dim);
  border-radius: 10px;
  padding: 14px 16px;
}
.sv-campaign-title {
  color: var(--sv-gold-light);
  font-weight: 600;
  margin-bottom: 6px;
}
.sv-campaign-window { color: var(--sv-muted); font-size: .8rem; font-weight: 400; white-space: nowrap; margin-left: 8px; }
.sv-campaign-line { color: var(--sv-text); font-size: .85rem; margin-top: 4px; }
.sv-campaign-hint { color: var(--sv-muted); font-size: .8rem; margin-top: 4px; }

/* Benefícios da campanha na SIMULAÇÃO — um card por benefício, COMPACTO (mesmo
   dourado direto do badge de pontos). O badge do nome da campanha TRANSBORDA o
   canto superior direito, meio pra fora (grudado na quina, à la notificação).
   Preenchido por renderBenefits. */
/* Container dos cards de benefício da simulação: coluna com espaço CONSTANTE
   entre os itens. O `gap` (não o margin por item) garante que dois cards nunca
   fiquem mais grudados que outros — a tag que transborda o topo é absoluta e não
   entra na conta; o `padding-top` reserva o espaço dela no primeiro card. */
.sv-benefits {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 18px;
}
/* Wrapper de posição — o pill de dentro é um .sv-badge--gold REAL (mesma altura
   exata do "+1,6"). `fit-content` deixa cada um na largura do texto, na sua linha. */
.sv-benefit {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
}
/* Badge da campanha transbordando o canto: texto e borda dourados, fundo #171717. */
.sv-benefit-tag {
  position: absolute;
  top: -15px;
  right: -14px;
  max-width: calc(100% + 40px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid var(--sv-gold);
  background: #171717;
  color: var(--sv-gold-light);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: .62rem; font-weight: 600; letter-spacing: .04em;
}

/* ------------------------------------------------------------
   10. Components — sv-progress
   A single track with milestone marks pinned along it. The fill
   width and the `reached` marks are driven by the page.
   ------------------------------------------------------------ */
.sv-progress {
  position: relative;
  height: 8px;
  border: 1px solid var(--sv-line);
  border-radius: 999px;
  background: #050505;
}

.sv-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sv-gold), var(--sv-gold-light));
  transition: width 600ms ease;
}

.sv-progress-mark {
  position: absolute;
  top: 50%;
  width: 13px;
  height: 13px;
  border: 1px solid var(--sv-line);
  border-radius: 50%;
  background: var(--sv-surface-2);
  transform: translate(-50%, -50%);
  transition: background var(--sv-transition), border-color var(--sv-transition);
}

.sv-progress-mark.reached {
  border-color: var(--sv-gold-light);
  background: var(--sv-gold-light);
  box-shadow: 0 0 10px rgba(200, 160, 80, .5);
}

.sv-progress-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.sv-progress-step {
  position: relative;
  padding-left: 12px;
  padding-right: 20px;
  border-left: 2px solid var(--sv-line);
  color: var(--sv-muted);
  font-size: .8rem;
}

.sv-progress-step.reached {
  border-left-color: var(--sv-gold);
  color: var(--sv-text);
}

.sv-progress-step b {
  display: block;
  color: var(--sv-gold-light);
  font-size: .95rem;
}

/* Nome do nível (Vault / Fortress / Citadel) — marca, não se traduz. */
.sv-step-name {
  display: block;
  text-transform: uppercase;
  letter-spacing: .09em;
  font-size: .68rem;
  color: var(--sv-muted);
  margin-bottom: 3px;
}

.sv-progress-step.reached .sv-step-name {
  color: var(--sv-gold-light);
}

/* Check verde no canto superior direito — só nos níveis conquistados. */
.sv-step-check {
  position: absolute;
  top: 0;
  right: 0;
  color: var(--sv-success);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

/* ------------------------------------------------------------
   11. Components — sv-table
   ------------------------------------------------------------ */
.sv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

/* Tabela larga rola DENTRO da própria caixa (Sprint 7). Sem isto ela empurra a
   PÁGINA: o body ganha scroll horizontal e o layout inteiro se desloca por causa
   de uma coluna a mais. Achado dirigindo a affiliate.html no mobile — o extrato
   dela tem 6 colunas, duas a mais que o da rewards.html, e é exatamente uma coluna
   o que separa "cabe" de "rasga".

   `max-content` e não um número: é a largura em que nada quebra, medida do próprio
   conteúdo. Um `min-width: 460px` chutado servia para 5 colunas e espremia a 6ª —
   o hash da transação quebrava em duas linhas e sumia na borda. Espremer não é
   caber. Assim cada tabela pede o que precisa e a próxima não depende de alguém
   lembrar de recalibrar o chute. */
.sv-table-scroll {
  overflow-x: auto;
}

.sv-table-scroll > .sv-table {
  min-width: max-content;
}

/* A calha entre colunas. O `.sv-table` nasceu com padding horizontal ZERO e nunca
   precisou de mais: com `width: 100%` sempre sobrava espaço e o navegador o
   distribuía sozinho. Sob `max-content` não sobra nada por definição — a tabela
   tem a largura exata do conteúdo —, e as colunas passaram a se encostar:
   "PAGAMENTOCOMISSÃO" no cabeçalho do extrato. A calha tem que ser dita, não
   herdada de uma folga que deixou de existir. */
.sv-table th:not(:last-child),
.sv-table td:not(:last-child) {
  padding-right: 22px;
}

/* Link de texto. NÃO EXISTIA regra de `a` no sistema, então o único link solto das
   páginas — o hash da transação, na account.html desde a Sprint 4 e agora também
   no extrato do afiliado — saía no azul padrão do navegador, sublinhado, sobre
   fundo preto. Mesma família da pegadinha do `[hidden]` e do sublinhado que os
   `.sv-button-*` levavam da UA stylesheet: o que o autor não declara, a UA declara
   por ele, e ela não conhece a marca.

   Os `.sv-button-*` não são afetados — a classe tem specificity maior e já define
   cor e text-decoration. */
a {
  color: var(--sv-gold-light);
  text-decoration: underline;
  text-decoration-color: var(--sv-gold-dim);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--sv-gold-light);
}

.sv-table th {
  padding: 0 0 10px;
  border-bottom: 1px solid var(--sv-line);
  color: var(--sv-muted);
  font-size: .7rem;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .11em;
}

.sv-table td {
  padding: 12px 0;
  border-bottom: 1px solid var(--sv-line);
}

.sv-table tbody tr:last-child td {
  border-bottom: 0;
}

/* ------------------------------------------------------------
   12. Utilities
   ------------------------------------------------------------ */
.sv-eyebrow {
  color: var(--sv-gold);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .13em;
  font-weight: 750;
  margin-bottom: 14px;
}

.sv-label {
  color: var(--sv-muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.sv-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 4px 0 14px;
}

.sv-hint {
  font-size: .78rem;
  color: var(--sv-muted);
}

/* Machine strings the user must read, copy or compare character by character:
   wallet addresses, tx hashes. Monospace so 0/O and 1/l can't hide, and
   break-all so a 42-char address never widens the card on a phone. */
.sv-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem;
  line-height: 1.5;
  word-break: break-all;
  background: #050505;
  border: 1px solid var(--sv-line);
  border-radius: var(--sv-radius-sm);
  padding: 11px 12px;
  color: var(--sv-text);
  user-select: all;
}

/* Vermelho é ERRO (sistema ou validação): a falha de rede, o código do worker, a
   senha que não confere. As mensagens FUNCIONAIS — "encontrado", "já creditado",
   "aguardando confirmações" — são douradas (.sv-message--ok): dar-lhes vermelho
   passava falsa impressão de falha quando nada deu errado. */
.sv-message {
  min-height: 22px;
  font-size: .88rem;
  color: var(--sv-error);
}

.sv-message--ok {
  color: var(--sv-gold-light);
}

.sv-empty {
  padding: 16px 0;
  color: var(--sv-muted);
}

/* Badge + text side by side, wrapping on narrow screens. */
.sv-inline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* Form de envio do card (rewards.html): cidade/estado/CEP/país dividem uma linha
   e os labels têm alturas diferentes ("Estado / Província" quebra em duas). Para
   que os INPUTS fiquem alinhados pela base numa linha só, cada célula vira coluna
   flex e o input é empurrado para o fundo da célula (todas com a mesma altura). */
#card-form .sv-grid > [class*="sv-col-"] {
  display: flex;
  flex-direction: column;
}
#card-form .sv-grid > [class*="sv-col-"] > .sv-input {
  margin-top: auto;
}

/* Label / value rows — profile and summary panels. */
.sv-rows {
  display: grid;
}

.sv-row {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--sv-line);
}

.sv-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.sv-row-label {
  color: var(--sv-muted);
  font-size: .85rem;
}

.sv-row-value {
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------
   13. Forms
   ------------------------------------------------------------ */
.sv-form {
  display: grid;
  gap: 13px;
  padding: 0 10px 10px;
}

.sv-form label {
  display: grid;
  gap: 6px;
  color: var(--sv-muted);
  font-size: .85rem;
}

/* ------------------------------------------------------------
   14. Page-specific — Hero
   ------------------------------------------------------------ */
.sv-hero {
  max-width: 650px;
  margin: 75px 0 32px;
}

.sv-hero h1 {
  font-size: clamp(2.25rem, 5vw, 4.25rem);
  line-height: 1.04;
  letter-spacing: -.055em;
  margin: 0 0 18px;
}

/* ------------------------------------------------------------
   15. Page-specific — App (post-login)
   ------------------------------------------------------------ */
.sv-topline {
  display: flex;
  gap: 18px;
  justify-content: space-between;
  align-items: end;
  margin: 20px 0 26px;
}

.sv-topline h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.04;
  letter-spacing: -.055em;
}

/* Quatro por linha (Sprint 7). ⚠️ Toda coluna nova precisa entrar TAMBÉM no
   @media lá embaixo: sem a regra, ela não colapsa e o conteúdo que não encolhe
   (um input[type=date], por exemplo) rasga a página para fora da viewport. */
.sv-col-2 { grid-column: span 2; }
.sv-col-3 { grid-column: span 3; }
.sv-col-4 { grid-column: span 4; }
.sv-col-6 { grid-column: span 6; }
.sv-col-8 { grid-column: span 8; }
.sv-col-12 { grid-column: span 12; }

/* ------------------------------------------------------------
   16. Page-specific — Wallets
   ------------------------------------------------------------ */
.sv-wallet-add {
  display: flex;
  gap: 9px;
  margin: 18px 0 12px;
}

.sv-wallet-add .sv-input {
  min-width: 0;
}

.sv-wallet-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.sv-wallet-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 11px;
  background: #050505;
  border: 1px solid var(--sv-line);
  border-radius: var(--sv-radius-sm);
  font-family: var(--sv-font-mono);
  font-size: .85rem;
  overflow-wrap: anywhere;
}

.sv-remove {
  margin-left: 10px;
  border: 0;
  color: var(--sv-error);
  background: transparent;
  font: inherit;
  cursor: pointer;
  transition: opacity var(--sv-transition);
}

.sv-remove:hover {
  opacity: .7;
}

/* ------------------------------------------------------------
   17. Responsive
   ------------------------------------------------------------ */
@media (max-width: 700px) {
  .sv-header,
  .sv-main {
    padding-left: 18px;
    padding-right: 18px;
  }

  .sv-hero {
    margin-top: 42px;
  }

  .sv-col-2,
  .sv-col-3,
  .sv-col-4,
  .sv-col-6,
  .sv-col-8 {
    grid-column: span 12;
  }

  .sv-progress-legend {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .sv-topline {
    align-items: start;
  }

  .sv-wallet-add {
    flex-direction: column;
  }
}
