/* ==========================================================================
   AutoWallet · wallet.auto-pay.cloud
   Usa os tokens do ac-base.css (mesmo visual do AutoCloud). Destaque azul-céu.
   Regras: hover = fundo/elevação (sem brilho); entrada = blur rápido, sem subir.
   ========================================================================== */

:root {
  --aw-azul: #38bdf8;
  --aw-azul-suave: rgba(56, 189, 248, .12);
  --aw-azul-borda: rgba(56, 189, 248, .28);
  --aw-larg: 1080px;
  --aw-topo: 60px;
  --aw-gutter: 24px;
}
@media (max-width: 640px) { :root { --aw-gutter: 16px; } }

body.aw { min-height: 100vh; min-height: 100dvh; background: var(--bg); overflow-x: hidden; }
.aw-pular { position: absolute; left: -999px; top: 8px; z-index: 100; padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface-3); }
.aw-pular:focus { left: 8px; }
.aw [hidden] { display: none !important; }

/* ---------- topo ---------- */
.aw-topo {
  position: sticky; top: 0; z-index: 40; height: calc(var(--aw-topo) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--aw-gutter), calc((100vw - var(--aw-larg)) / 2)) 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(5, 5, 5, .78); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--border-subtle);
}
.aw-marca { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 600; letter-spacing: -.01em; }
.aw-marca__ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--aw-azul); background: var(--aw-azul-suave); border: 1px solid var(--aw-azul-borda); }
.aw-marca--grande .aw-marca__ico { width: 40px; height: 40px; border-radius: 12px; }
.aw-marca--grande .aw-marca__ico svg { width: 22px; height: 22px; }
.aw-marca--grande .aw-marca__txt { font-size: 18px; }
.aw-topo__dir { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* troca de loja (dropdown próprio) */
.aw-troca { position: relative; min-width: 0; }
.aw-troca__btn {
  display: inline-flex; align-items: center; gap: 8px; max-width: 240px; height: 36px; padding: 0 10px 0 6px;
  border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface-2); cursor: pointer;
  transition: background var(--t-fast);
}
.aw-troca__btn:hover { background: var(--surface-3); }
.aw-troca__btn img { width: 24px; height: 24px; border-radius: 50%; flex: none; background: var(--surface-4); }
.aw-troca__btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.aw-troca__btn svg { flex: none; color: var(--text-3); transition: transform var(--t-fast) var(--ease); }
.aw-troca__btn[aria-expanded="true"] svg { transform: rotate(180deg); }
@media (max-width: 480px) { .aw-troca__btn { max-width: 150px; } }

.aw-perfil { position: relative; }
.aw-perfil__btn { width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; overflow: hidden; transition: transform var(--t-fast) var(--ease); }
.aw-perfil__btn:hover { transform: translateY(-1px); }
.aw-perfil__btn img { width: 100%; height: 100%; object-fit: cover; display: block; }

.aw-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px; z-index: 60;
  border-radius: var(--r); border: 1px solid var(--border); background: rgba(17, 17, 19, .92);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--sombra-alta);
  animation: aw-blur var(--t) var(--ease);
}
.aw-menu__cab { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--divider); margin-bottom: 4px; }
.aw-menu__cab strong { font-size: 14px; }
.aw-menu__cab span { font-size: 12px; color: var(--text-3); }
.aw-menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 0 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-2); text-decoration: none; font-size: 13px; text-align: left; cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.aw-menu__item:hover, .aw-menu__item[aria-selected="true"] { background: var(--surface-3); color: var(--text); }
.aw-menu__item img { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-4); }
.aw-menu__item .aw-menu__saldo { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--text-3); }
.aw-menu__item--sair { color: var(--erro); }
.aw-menu__item--sair:hover { color: var(--erro); background: var(--erro-bg); }

/* ---------- layout ---------- */
.aw-main { width: 100%; max-width: calc(var(--aw-larg) + 2 * var(--aw-gutter)); margin: 0 auto; padding: 28px var(--aw-gutter) calc(48px + env(safe-area-inset-bottom)); outline: none; }
.aw-entra { animation: aw-blur var(--t-slow) var(--ease) both; }
@keyframes aw-blur { from { opacity: 0; filter: blur(6px); } to { opacity: 1; filter: blur(0); } }

.aw-cab { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.aw-cab__ico { width: 48px; height: 48px; border-radius: 14px; flex: none; background: var(--surface-3); object-fit: cover; }
.aw-cab__txt { min-width: 0; }
.aw-cab h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-cab p { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }

/* ---------- saldo ---------- */
.aw-saldo {
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 20px; padding: 24px;
  border-radius: var(--r-xl); border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  box-shadow: var(--sombra);
}
.aw-saldo__rot { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.aw-saldo__valor { margin-top: 6px; font-size: clamp(34px, 7vw, 46px); font-weight: 700; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.aw-saldo__valor small { font-size: .5em; font-weight: 600; color: var(--text-2); margin-right: 4px; letter-spacing: 0; }
.aw-saldo__info { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.aw-saldo__acoes { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 180px; }
.aw-saldo__nota { font-size: 12px; color: var(--text-3); text-align: center; }
@media (max-width: 640px) {
  .aw-saldo { grid-template-columns: 1fr; padding: 20px; }
  .aw-saldo__acoes { min-width: 0; }
}

.aw-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface-3); border: 1px solid var(--border-subtle);
}
.aw-chip svg { width: 13px; height: 13px; }
.aw-chip--ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-bd); }
.aw-chip--aviso { color: var(--aviso); background: var(--aviso-bg); border-color: var(--aviso-bd); }
.aw-chip--mono { font-family: var(--font-mono); font-size: 11.5px; }

/* ---------- botões ---------- */
.aw-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; position: relative;
  transition: background var(--t-fast), transform var(--t-fast) var(--ease), box-shadow var(--t-fast), opacity var(--t-fast);
}
.aw-btn:hover { background: var(--surface-3); transform: translateY(-1px); }
.aw-btn:active { transform: translateY(0); }
.aw-btn:disabled, .aw-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.aw-btn--primario { background: var(--aw-azul); border-color: transparent; color: #04121b; box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 6px 18px rgba(0, 0, 0, .4); }
.aw-btn--primario:hover { background: #5cc8fa; }
.aw-btn--primario:disabled { background: var(--surface-4); color: var(--text-3); box-shadow: none; }
.aw-btn--bloco { width: 100%; }
.aw-btn--fantasma { background: transparent; border-color: transparent; color: var(--text-2); }
.aw-btn--fantasma:hover { background: var(--surface-3); color: var(--text); }
.aw-btn svg { width: 18px; height: 18px; flex: none; }
.aw-btn .aw-spin { display: none; }
.aw-btn[data-carregando] > :not(.aw-spin) { visibility: hidden; }
.aw-btn[data-carregando] .aw-spin { display: block; position: absolute; }
.aw-spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: aw-gira .7s linear infinite; }
@keyframes aw-gira { to { transform: rotate(360deg); } }

/* ---------- números ---------- */
.aw-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 24px; margin: 28px 4px; }
.aw-kpi__rot { font-size: 12.5px; color: var(--text-3); }
.aw-kpi__val { margin-top: 4px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.aw-kpi__sub { margin-top: 2px; font-size: 12px; color: var(--text-3); }
.aw-kpi__sub--sobe { color: var(--ok); }
.aw-kpi__sub--desce { color: var(--erro); }
@media (max-width: 760px) { .aw-kpis { grid-template-columns: repeat(2, 1fr); gap: 18px 16px; } }

/* ---------- painéis ---------- */
.aw-painel { border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface-1); overflow: hidden; }
.aw-painel + .aw-painel { margin-top: 16px; }
.aw-painel__cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--divider); flex-wrap: wrap; }
.aw-painel__cab h2 { margin: 0; font-size: 15px; font-weight: 600; }
.aw-painel__cab p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }

/* gráfico */
.aw-graf { position: relative; padding: 18px 18px 12px; }
.aw-graf svg { display: block; width: 100%; height: 160px; overflow: visible; touch-action: pan-y; }
.aw-graf__eixos { position: relative; height: 18px; margin-top: 6px; }
.aw-graf__eixos span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--text-3); white-space: nowrap; }
.aw-graf__eixos span:last-child { transform: translateX(-80%); }
.aw-graf__barra { fill: var(--surface-5); transition: fill var(--t-fast); }
.aw-graf__barra--tem { fill: rgba(56, 189, 248, .55); }
.aw-graf__barra--ativa { fill: var(--aw-azul); }
.aw-graf__linha { stroke: var(--divider); stroke-width: 1; }
.aw-graf__eixo { font-size: 10.5px; fill: var(--text-3); font-family: var(--font-sans); }
.aw-graf__dica {
  position: absolute; top: 8px; pointer-events: none; padding: 8px 10px; border-radius: var(--r-sm); white-space: nowrap;
  background: rgba(30, 30, 34, .95); border: 1px solid var(--border); box-shadow: var(--sombra); font-size: 12px; transform: translateX(-50%);
  transition: left 80ms linear, opacity var(--t-fast);
}
.aw-graf__dica strong { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.aw-graf__dica span { color: var(--text-3); }

/* abas */
.aw-abas { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border-subtle); position: relative; }
.aw-aba { position: relative; z-index: 1; height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; cursor: pointer; transition: color var(--t-fast); }
.aw-aba:hover { color: var(--text); }
.aw-aba[aria-selected="true"] { color: var(--text); background: var(--surface-4); }

/* extrato */
.aw-lista { list-style: none; margin: 0; padding: 0; }
.aw-item { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--divider); transition: background var(--t-fast); }
.aw-item:first-child { border-top: 0; }
.aw-item:hover { background: var(--surface-2); }
.aw-item__ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.aw-item__ico svg { width: 17px; height: 17px; }
.aw-item__ico--entrada { color: var(--ok); background: var(--ok-bg); }
.aw-item__ico--saida { color: var(--text); background: var(--surface-4); }
.aw-item__txt { min-width: 0; }
.aw-item__tit { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-item__sub { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-item__val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.aw-item__val small { display: block; font-weight: 400; font-size: 11.5px; color: var(--text-3); }
.aw-item__val--entrada { color: var(--ok); }
.aw-mais { display: flex; justify-content: center; padding: 10px; border-top: 1px solid var(--divider); }

.aw-vazio { padding: 40px 20px; text-align: center; color: var(--text-3); font-size: 13.5px; }
.aw-vazio__ico { width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.aw-vazio strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

.aw-rodape { margin-top: 20px; font-size: 12.5px; color: var(--text-3); display: flex; gap: 8px; align-items: flex-start; }
.aw-rodape svg { flex: none; width: 15px; height: 15px; margin-top: 2px; }
.aw-rodape code { color: var(--text-2); }

/* ---------- lista de lojas ---------- */
.aw-titulo { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; }
.aw-subtitulo { margin: 0 0 22px; color: var(--text-3); }
.aw-lojas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.aw-loja {
  display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; padding: 16px; text-decoration: none;
  border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface-1);
  transition: background var(--t-fast), transform var(--t-fast) var(--ease), box-shadow var(--t-fast);
}
.aw-loja:hover { background: var(--surface-2); transform: translateY(-2px); box-shadow: var(--sombra); }
.aw-loja img { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); object-fit: cover; }
.aw-loja__nome { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-loja__sub { font-size: 12px; color: var(--text-3); }
.aw-loja__saldo { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.aw-loja__saldo small { display: block; font-weight: 400; font-size: 11.5px; color: var(--text-3); }
.aw-loja__seta { color: var(--text-3); transition: transform var(--t-fast) var(--ease); }
.aw-loja:hover .aw-loja__seta { transform: translateX(3px); color: var(--text-2); }

/* ---------- esqueleto ---------- */
.aw-sk { display: block; border-radius: 8px; background: var(--surface-3); position: relative; overflow: hidden; }
.aw-sk::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .045), transparent);
  animation: aw-sk 1.4s ease-in-out infinite; animation-delay: calc(var(--sk-t, 0) * 1ms);
}
@keyframes aw-sk { to { transform: translateX(100%); } }

/* ---------- folha de saque ---------- */
.aw-fundo { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: aw-fade var(--t) var(--ease); }
@keyframes aw-fade { from { opacity: 0; } }
.aw-folha {
  width: 100%; max-width: 420px; border-radius: var(--r-xl); border: 1px solid var(--border); background: var(--surface-1);
  box-shadow: var(--sombra-alta); padding: 22px; animation: aw-blur var(--t) var(--ease);
}
.aw-folha__alca { display: none; }
.aw-folha h2 { margin: 0 0 4px; font-size: 18px; }
.aw-folha > p { margin: 0 0 18px; color: var(--text-3); font-size: 13px; }
.aw-conta { border-radius: var(--r); border: 1px solid var(--border-subtle); background: var(--surface-2); }
.aw-conta__linha { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; font-size: 13.5px; }
.aw-conta__linha + .aw-conta__linha { border-top: 1px solid var(--divider); }
.aw-conta__linha span { color: var(--text-2); }
.aw-conta__linha strong { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.aw-conta__linha--total strong { font-size: 16px; color: var(--ok); }
.aw-folha__acoes { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin-top: 18px; }
.aw-folha__erro { margin-top: 14px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--erro-bg); border: 1px solid var(--erro-bd); color: var(--erro); font-size: 13px; }
.aw-folha__ok { text-align: center; padding: 6px 0 2px; }
.aw-folha__ok-ico { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); }
.aw-folha__ok-ico svg { width: 28px; height: 28px; }
.aw-folha__ok h2 { margin-bottom: 6px; }
.aw-folha__ok p { margin: 0 0 18px; color: var(--text-2); font-size: 13.5px; }
@media (max-width: 640px) {
  .aw-fundo { place-items: end stretch; padding: 0; }
  .aw-folha { max-width: none; border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); animation: aw-sobe 320ms cubic-bezier(.2, 1.1, .3, 1); }
  .aw-folha__alca { display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--surface-5); margin: 0 auto 14px; }
  @keyframes aw-sobe { from { transform: translateY(100%); } }
}

/* ---------- avisos (toasts) ---------- */
.aw-avisos { position: fixed; z-index: 90; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.aw-aviso { padding: 12px 14px; border-radius: var(--r); background: rgba(30, 30, 34, .96); border: 1px solid var(--border); box-shadow: var(--sombra-alta); font-size: 13.5px; animation: aw-blur var(--t) var(--ease); }
.aw-aviso--ok { border-color: var(--ok-bd); }
.aw-aviso--erro { border-color: var(--erro-bd); color: #fecaca; }

/* ---------- entrar ---------- */
.aw-entrar { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.aw-entrar__caixa { width: 100%; max-width: 400px; text-align: center; animation: aw-blur var(--t-slow) var(--ease) both; }
.aw-entrar .aw-marca { justify-content: center; margin-bottom: 28px; }
.aw-entrar__titulo { margin: 0 0 10px; font-size: 28px; line-height: 1.15; letter-spacing: -.03em; }
.aw-entrar__texto { margin: 0 0 26px; color: var(--text-2); }
.aw-entrar__rodape { margin: 16px 0 0; font-size: 12.5px; color: var(--text-3); }

/* ---------- aviso de instalar (iPhone) ---------- */
.aw-dica { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 18px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--aw-azul-borda); background: var(--aw-azul-suave); font-size: 13px; color: var(--text-2); }
.aw-dica svg { flex: none; width: 18px; height: 18px; color: var(--aw-azul); margin-top: 1px; }
.aw-dica strong { color: var(--text); }
.aw-dica button { margin-left: auto; flex: none; border: 0; background: transparent; color: var(--text-3); cursor: pointer; padding: 2px; border-radius: 6px; }
.aw-dica button:hover { color: var(--text); background: var(--surface-3); }

@media (prefers-reduced-motion: reduce) {
  .aw *, .aw *::before, .aw *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
