:root {
  --bg: #0c0c10;
  --surface: #15151c;
  --surface-2: #1d1d27;
  --line: #2a2a36;
  --text: #f2f1ec;
  --muted: #9a99a6;
  --accent: #d4ff3a;
  --accent-ink: #0c0c10;
  --pending: #ffb547;
  --ok: #3ddc97;
  --danger: #ff5a5a;
  --radius: 16px;
  --display: 'Anton', 'Impact', 'Arial Narrow', sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
.display { font-family: var(--display); font-weight: 400; letter-spacing: .01em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 22px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.hide { display: none !important; }

/* ---------- botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface-2);
  padding: 11px 16px; border-radius: 12px; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: transform .08s, background .15s, opacity .15s;
}
.btn:hover { background: #262632; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #c6f02c; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.icon-btn { background: none; border: 0; padding: 6px; cursor: pointer; color: var(--muted); border-radius: 8px; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

label.field { display: block; }
label.field > span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 13px; outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--accent); }
textarea.input { min-height: 90px; resize: vertical; }
input[type=color].input { padding: 4px; height: 44px; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 560px) { .grid-2.collapse, .grid-3.collapse { grid-template-columns: 1fr; } }

/* ---------- cartões ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.flat { background: transparent; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 2px 10px; }
.section-title h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.section-title a { font-size: 13px; color: var(--accent); text-decoration: none; font-weight: 600; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge.pending { color: var(--pending); border-color: color-mix(in srgb, var(--pending) 35%, transparent); background: color-mix(in srgb, var(--pending) 10%, transparent); }
.badge.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.badge.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ---------- layout do parceiro ---------- */
.bro-shell { max-width: 540px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 14px; position: sticky; top: 0; z-index: 5; background: linear-gradient(var(--bg) 70%, transparent); }
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--display); font-size: 17px; }
.logo-text { font-family: var(--display); font-size: 19px; letter-spacing: .02em; text-transform: uppercase; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; font-size: 14px; text-decoration: none; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav .inner { max-width: 540px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 10px 0 9px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; }
.bottom-nav a.on { color: var(--accent); }
.bottom-nav svg { width: 22px; height: 22px; }

.hello h1 { font-size: 30px; }
.saldo-card { position: relative; overflow: hidden; background: var(--accent); color: var(--accent-ink); border-radius: 22px; padding: 20px; }
.saldo-card .label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.saldo-card .valor { font-family: var(--display); font-size: 64px; line-height: 1; margin: 6px 0 4px; }
.saldo-card .valor small { font-family: var(--body); font-size: 16px; font-weight: 700; margin-left: 4px; }
.saldo-card .pend { display: inline-flex; gap: 6px; align-items: center; background: rgba(12,12,16,.12); padding: 6px 10px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.saldo-card .deco { position: absolute; right: -30px; top: -30px; font-family: var(--display); font-size: 190px; line-height: 1; opacity: .08; pointer-events: none; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.stat .v { font-family: var(--display); font-size: 28px; line-height: 1.05; }
.stat .l { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 2px; }

.atualizado { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.atualizado::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }

.codigo-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; }
.codigo-card .sw { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.codigo-pill { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 700; letter-spacing: .06em; font-size: 14px; }

.festa-card { display: block; border-radius: 20px; overflow: hidden; text-decoration: none; border: 1px solid var(--line); background: var(--surface); }
.festa-card .capa { position: relative; height: 150px; padding: 16px; display: flex; flex-direction: column; justify-content: flex-end; background-size: cover; background-position: center; }
.festa-card .capa h3 { font-family: var(--display); font-size: 40px; text-transform: uppercase; line-height: .95; text-shadow: 0 2px 20px rgba(0,0,0,.35); }
.festa-card .capa .data-chip { position: absolute; top: 14px; left: 14px; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.festa-card .capa .pts-chip { position: absolute; top: 14px; right: 14px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.festa-card .info { padding: 12px 16px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.hero { border-radius: 22px; overflow: hidden; padding: 20px; min-height: 220px; display: flex; flex-direction: column; justify-content: flex-end; background-size: cover; background-position: center; position: relative; }
.hero h1 { font-family: var(--display); font-size: 56px; text-transform: uppercase; line-height: .92; }
.hero .meta { font-weight: 600; margin-top: 8px; opacity: .92; }

.codigo-grande { border: 2px dashed var(--accent); border-radius: 18px; padding: 18px; text-align: center; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.codigo-grande .c { font-family: var(--display); font-size: 46px; letter-spacing: .04em; color: var(--accent); line-height: 1; margin: 6px 0 12px; word-break: break-all; }

.artes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.arte-thumb { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); cursor: pointer; background: var(--surface-2); aspect-ratio: 9 / 16; padding: 0; }
.arte-thumb canvas { width: 100%; height: 100%; display: block; }
.arte-thumb .lbl { position: absolute; left: 8px; bottom: 8px; right: 8px; background: rgba(0,0,0,.6); backdrop-filter: blur(6px); padding: 6px 8px; border-radius: 9px; font-size: 12px; font-weight: 700; text-align: left; }

.lista { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lista .item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; }
.lista .item + .item { border-top: 1px solid var(--line); }
.lista .item.me { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.mov-valor { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mov-valor.pos { color: var(--ok); }
.mov-valor.neg { color: var(--danger); }
.mov-valor.pend { color: var(--pending); }

.pos-n { width: 28px; font-family: var(--display); font-size: 20px; color: var(--muted); text-align: center; flex: none; }
.podio { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: end; }
.podio .p { background: var(--surface); border: 1px solid var(--line); border-radius: 16px 16px 8px 8px; padding: 14px 8px; text-align: center; }
.podio .p .medal { font-size: 26px; }
.podio .p .n { font-weight: 700; font-size: 13.5px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podio .p .pts { font-family: var(--display); font-size: 22px; margin-top: 2px; }
.podio .p1 { padding-top: 26px; border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.podio .p1 .pts { color: var(--accent); }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); }
.tab.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.loja-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.produto { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.produto .emoji { font-size: 34px; line-height: 1; }
.produto .nome { font-weight: 700; line-height: 1.25; }
.produto .custo { font-family: var(--display); font-size: 24px; color: var(--accent); margin-top: auto; padding-top: 6px; }
.produto .falta { font-size: 12px; color: var(--muted); }
.progress { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .box { width: 100%; max-width: 400px; }
.auth h1 { font-family: var(--display); font-size: 58px; text-transform: uppercase; line-height: .9; }
.auth h1 em { font-style: normal; color: var(--accent); }

/* ---------- admin ---------- */
.admin-shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.sidebar .logo { margin: 0 6px 18px; }
.sidebar a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.sidebar a.nav:hover { background: var(--surface); color: var(--text); }
.sidebar a.nav.on { background: var(--surface-2); color: var(--text); }
.sidebar a.nav svg { width: 18px; height: 18px; flex: none; }
.sidebar .count { margin-left: auto; background: var(--pending); color: #000; font-size: 11px; font-weight: 800; border-radius: 99px; padding: 1px 7px; }
.sidebar .foot { margin-top: auto; padding: 10px; font-size: 13px; }
.admin-main { padding: 26px 30px 60px; max-width: 1180px; width: 100%; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; font-family: var(--display); text-transform: uppercase; letter-spacing: .01em; font-weight: 400; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.tile .v { font-family: var(--display); font-size: 32px; line-height: 1.05; margin-top: 4px; }
.tile .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols-form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr); gap: 20px; align-items: start; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.off td { opacity: .45; }
table.t td.r, table.t th.r { text-align: right; }
.sw-dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 6px; }

.admin-mobile-nav { display: none; }
@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .admin-mobile-nav { display: flex; gap: 6px; overflow-x: auto; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; scrollbar-width: none; }
  .admin-mobile-nav a { flex: none; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; font-size: 13px; font-weight: 600; color: var(--muted); }
  .admin-mobile-nav a.on { background: var(--text); color: var(--bg); }
  .admin-main { padding: 18px 16px 50px; }
  .cols, .cols-form { grid-template-columns: 1fr; }
}

/* ---------- modal e toast ---------- */
#modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.72); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(4px); }
#modal[hidden] { display: none; }
#modal .sheet { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; width: 100%; max-width: 480px; max-height: calc(100vh - 32px); overflow: auto; padding: 18px; }
#modal .sheet.arte { max-width: 420px; }
#modal .sheet.arte canvas { width: 100%; border-radius: 12px; display: block; }
#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; transition: all .2s; z-index: 60; background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; pointer-events: none; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.erro { background: var(--danger); color: #fff; }

.loading { display: grid; place-items: center; min-height: 40vh; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.lista .item.off { opacity: .5; }
