/* Pontuação de Eventos — estilo base. Cores do evento entram por variáveis (js/ui.js → aplicarMarca). */
:root {
  --pri: #14213D;      /* cor primária do evento */
  --sec: #1F3A93;      /* secundária */
  --acc: #E9B44C;      /* destaque */
  --on-pri: #fff;
  --on-acc: #1b1b1b;
  --bg: #F3F5F9;
  --card: #FFFFFF;
  --ink: #0F172A;
  --muted: #5B6476;
  --line: #E2E6EE;
  --ok: #15803D;
  --ok-bg: #DCFCE7;
  --warn: #B45309;
  --warn-bg: #FEF3C7;
  --err: #B91C1C;
  --err-bg: #FEE2E2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 2px 10px rgba(15, 23, 42, .05);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
a { color: var(--sec); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.tiny { font-size: .72rem; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.wrap-page { max-width: 760px; margin: 0 auto; padding: 12px 16px 96px; }

/* ── topo ─────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--pri); color: var(--on-pri);
  padding: 10px 16px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar .logo { width: 36px; height: 36px; border-radius: 8px; object-fit: contain; background: rgba(255,255,255,.12); flex-shrink: 0; }
.topbar .t1 { font-weight: 800; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .t2 { font-size: .74rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .btn-ghost { color: var(--on-pri); border-color: rgba(255,255,255,.35); }

/* ── cartões ──────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.card + .card { margin-top: 12px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: 10px; }
.section-label { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 18px 2px 8px; }

/* ── botões ───────────────────────────────────────── */
.btn {
  appearance: none; border: 1.5px solid transparent; border-radius: 12px;
  padding: .7rem 1rem; font: inherit; font-weight: 700; cursor: pointer;
  background: var(--sec); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-acc { background: var(--acc); color: var(--on-acc); }
.btn-pri { background: var(--pri); color: var(--on-pri); }
.btn-ok { background: var(--ok); }
.btn-err { background: var(--err); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-soft { background: #EEF1F7; color: var(--ink); }
.btn-sm { min-height: 34px; padding: .35rem .7rem; font-size: .82rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 1.05rem; }

/* ── formulários ──────────────────────────────────── */
label.f { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 10px; padding: .6rem .7rem; min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--sec) 45%, transparent); border-color: var(--sec); }
input[type=color] { width: 48px; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; }
.check { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--sec); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ── selos ────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 800; padding: .2rem .55rem; border-radius: 999px; background: #EEF1F7; color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.acc { background: color-mix(in srgb, var(--acc) 25%, #fff); color: #6b4a00; }
.pill.pri { background: var(--pri); color: var(--on-pri); }

/* ── abas ─────────────────────────────────────────── */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1; min-width: max-content; border: 1.5px solid var(--line); background: #fff; color: var(--ink); border-radius: 12px; padding: .6rem .9rem; font: inherit; font-weight: 800; cursor: pointer; }
.tab.active { background: var(--pri); color: var(--on-pri); border-color: var(--pri); }

/* ── chips de participantes ───────────────────────── */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.chip { flex-shrink: 0; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: .5rem .75rem; font: inherit; font-weight: 700; cursor: pointer; text-align: left; max-width: 200px; }
.chip .n { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .s { display: block; font-size: .7rem; font-weight: 700; color: var(--muted); }
.chip.sel { border-color: var(--sec); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sec) 25%, transparent); }
.chip.done .s { color: var(--ok); }
.chip.live { border-color: var(--acc); }

/* ── banner "agora" ───────────────────────────────── */
.live-banner { background: linear-gradient(120deg, var(--pri), var(--sec)); color: var(--on-pri); border-radius: var(--radius); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff4d4d; box-shadow: 0 0 0 0 rgba(255,77,77,.7); animation: pulse 1.6s infinite; flex-shrink: 0; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(255,77,77,0); } 100% { box-shadow: 0 0 0 0 rgba(255,77,77,0); } }

/* ── critérios ────────────────────────────────────── */
.crit { border-top: 1px solid var(--line); padding: 12px 0; }
.crit:first-child { border-top: 0; padding-top: 0; }
.crit-head { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; margin-bottom: 8px; }
.crit-name { font-weight: 700; }
.crit-val { font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.crit-val .max { font-size: .8rem; color: var(--muted); font-weight: 700; }
.scale { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.scale button { min-height: 44px; border-radius: 10px; border: 1.5px solid var(--line); background: #F8FAFC; font: inherit; font-weight: 800; cursor: pointer; font-variant-numeric: tabular-nums; }
.scale button.sel { background: var(--sec); color: #fff; border-color: var(--sec); }
.scale button.def { border-style: dashed; border-color: var(--sec); }

/* ── deméritos ────────────────────────────────────── */
.dem { display: flex; align-items: center; gap: .6rem; border-top: 1px solid var(--line); padding: 10px 0; flex-wrap: wrap; }
.dem:first-child { border-top: 0; }
.dem > .grow:first-child { flex-basis: 100%; }
.dem .stepper + .btn { flex: 1; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.stepper button { width: 44px; height: 44px; border: 0; background: #F1F4F9; font-size: 1.2rem; font-weight: 900; cursor: pointer; }
.stepper input { width: 60px; border: 0; text-align: center; font-weight: 800; min-height: 44px; border-radius: 0; }
.lanc { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: 8px 10px; border-radius: 10px; background: #F8FAFC; margin-top: 6px; }
.lanc.cancel { opacity: .55; text-decoration: line-through; }

/* ── cronômetro ───────────────────────────────────── */
.timer { font-size: 3rem; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1; padding: 6px 0; }
.timer.in { color: var(--ok); }
.timer.out { color: var(--err); }
.window { display: flex; justify-content: center; gap: .5rem; }

/* ── sorteio ──────────────────────────────────────── */
.draw { text-align: center; padding: 10px 0; }
.draw .letter { font-size: 5rem; font-weight: 900; line-height: 1; color: var(--pri); font-variant-numeric: tabular-nums; }
.draw .letter.spin { color: var(--muted); }
.draw .letter.land { animation: land .5s cubic-bezier(.2, 1.6, .4, 1); color: var(--sec); }
@keyframes land { 0% { transform: scale(.4); } 100% { transform: scale(1); } }
.cmds { text-align: left; margin: 10px 0 0; padding-left: 1.4rem; }
.cmds li { padding: 2px 0; }

/* ── sincronização ────────────────────────────────── */
.sync { display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 800; padding: .3rem .6rem; border-radius: 999px; cursor: pointer; border: 0; background: rgba(255,255,255,.16); color: var(--on-pri); white-space: nowrap; }
.sync.pend { background: #FDE68A; color: #78350F; }
.sync.err { background: #FECACA; color: #7F1D1D; }

/* ── tabelas ──────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.t th, table.t td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.t th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 800; white-space: nowrap; }
table.t td.r, table.t th.r { text-align: right; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #F8FAFC; }
.pos { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #EEF1F7; font-weight: 900; font-size: .85rem; }
.pos.p1 { background: #F5C518; color: #3b2f00; }
.pos.p2 { background: #CBD5E1; color: #1e293b; }
.pos.p3 { background: #E2A26B; color: #3b1d00; }
.bar { height: 6px; border-radius: 6px; background: #EEF1F7; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--sec); }

/* ── admin ────────────────────────────────────────── */
.shell { display: flex; min-height: 100dvh; }
.side { width: 240px; background: var(--pri); color: var(--on-pri); padding: 14px 10px; position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; z-index: 40; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.side.open { transform: none; }
.side-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; display: none; }
.side-overlay.open { display: block; }
.side a { color: inherit; text-decoration: none; display: flex; gap: .6rem; align-items: center; padding: .65rem .8rem; border-radius: 10px; font-weight: 700; opacity: .8; }
.side a.active, .side a:hover { background: rgba(255,255,255,.14); opacity: 1; }
.side .brand { display: flex; align-items: center; gap: .6rem; padding: 4px 6px 14px; }
.side .brand img { width: 40px; height: 40px; object-fit: contain; border-radius: 8px; background: rgba(255,255,255,.12); }
.main { flex: 1; min-width: 0; }
.main .wrap-page { max-width: 1100px; }
.burger { display: inline-flex; }
@media (min-width: 980px) {
  .side { position: sticky; top: 0; height: 100dvh; transform: none; }
  .side-overlay { display: none !important; }
  .burger { display: none; }
}

/* ── modal / toast ────────────────────────────────── */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 18px 16px 22px; }
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 200; background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 12px; font-weight: 700; font-size: .9rem; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--sec); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.cred { font-family: ui-monospace, Menlo, monospace; background: #F1F4F9; padding: .6rem .8rem; border-radius: 10px; font-size: .95rem; }

/* ── login ────────────────────────────────────────── */
.login-bg { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: linear-gradient(160deg, var(--pri), var(--sec)); }
.login-card { background: #fff; border-radius: 20px; padding: 22px; width: 100%; max-width: 360px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-logo { width: 120px; height: 120px; object-fit: contain; margin-bottom: 10px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.3)); }

@media print {
  .no-print, .side, .topbar, .burger { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; padding: 0; }
}
