:root {
  --bg: #0d0f12; --panel: #161a20; --line: #262c36; --text: #eef1f5; --mut: #8b95a5;
  --acc: #c8f24a; --acc-ink: #10140a; --bad: #ff7a6b; --r: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
h1 { font-size: clamp(1.5rem, 6vw, 2.4rem); line-height: 1.15; margin: 0 0 24px; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; margin: 0 0 16px; } h3 { font-size: 1rem; margin: 24px 0 8px; color: var(--mut); font-weight: 600; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.mark { width: 22px; height: 22px; border-radius: 7px; background: conic-gradient(from 210deg, var(--acc), #4ad6f2, var(--acc)); }
.saldo { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; }

main { max-width: 760px; margin: 0 auto; padding: 20px 16px; }
.auth { padding-top: 12vh; max-width: 420px; }
form { display: grid; gap: 14px; }
label, legend { display: grid; gap: 6px; font-size: .85rem; color: var(--mut); }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
input, textarea, select { width: 100%; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; font: inherit; font-size: 16px; }
textarea { resize: vertical; min-height: 110px; }
:is(input, textarea, select, button, a):focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
button { font: inherit; cursor: pointer; }
.primary { background: var(--acc); color: var(--acc-ink); border: 0; border-radius: var(--r); padding: 16px; font-weight: 700; min-height: 52px; }
.primary:disabled { opacity: .5; cursor: default; }
.ghost { background: none; color: var(--text); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-height: 48px; }
.err { color: var(--bad); margin: 0; min-height: 1.2em; font-size: .9rem; }
.hint { color: var(--mut); font-size: .85rem; margin: 0; }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 4px; }
.seg button { background: none; border: 0; color: var(--mut); padding: 12px; border-radius: 10px; font-weight: 600; }
.seg button[aria-selected="true"] { background: var(--line); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { display: block; }
.chips input { position: absolute; opacity: 0; width: 0; }
.chips span { display: block; padding: 10px 16px; min-height: 44px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-size: .95rem; cursor: pointer; }
.chips input:checked + span { border-color: var(--acc); color: var(--acc); }
.chips input:focus-visible + span { outline: 2px solid var(--acc); outline-offset: 2px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 24px; }
.tile { position: relative; aspect-ratio: 3/4; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; padding: 0; color: var(--mut); text-align: left; }
.tile :is(img, video) { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .st { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; padding: 12px; text-align: center; font-size: .85rem; }
.tile .tag { position: absolute; left: 8px; bottom: 8px; background: #000a; color: #fff; border-radius: 6px; padding: 2px 8px; font-size: .75rem; }
.tile.failed .st { color: var(--bad); }
.spin { width: 26px; height: 26px; margin: 0 auto; border: 3px solid var(--line); border-top-color: var(--acc); border-radius: 50%; animation: s 1s linear infinite; }
@keyframes s { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 4s; } }

.card { display: grid; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card strong { font-size: 2rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.extrato { list-style: none; padding: 0; margin: 0 0 24px; }
.extrato li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .92rem; font-variant-numeric: tabular-nums; }
.extrato .pos { color: var(--acc); }

.tabs { position: fixed; inset: auto 0 0 0; z-index: 5; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--panel); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.tabs a { padding: 16px 8px; min-height: 56px; text-align: center; color: var(--mut); text-decoration: none; font-weight: 600; font-size: .9rem; }
.tabs a[aria-current="page"] { color: var(--acc); }

dialog { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; max-width: min(96vw, 900px); }
dialog::backdrop { background: #000c; }
dialog :is(img, video) { max-width: 100%; max-height: 76vh; display: block; margin: 0 auto; border-radius: 10px; }
dialog p { margin: 10px 4px 4px; font-size: .9rem; color: var(--mut); overflow-wrap: anywhere; }
dialog .close { float: right; background: none; border: 0; color: var(--text); font-size: 1.6rem; width: 44px; height: 44px; }
dialog a { color: var(--acc); }

@media (min-width: 800px) {
  body { padding-bottom: 0; display: flex; flex-direction: column; }
  main { order: 2; width: 100%; }
  .tabs { order: 1; position: static; width: 100%; max-width: 760px; margin: 0 auto; background: none; border: 0; grid-template-columns: repeat(3, auto); justify-content: start; gap: 8px; padding: 16px 16px 0; }
  .tabs a { min-height: 0; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); }
}
