:root {
  --bg: #f4f5f1;
  --card: #ffffff;
  --ink: #1b2420;
  --muted: #66716b;
  --line: #dfe3dc;
  --accent: #1f7a4d;
  --accent-ink: #ffffff;
  --soft: #e8f2ec;
  --danger: #b3261e;
  --live: #d9480f;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121614;
    --card: #1b211e;
    --ink: #e9eeea;
    --muted: #98a39c;
    --line: #2c3530;
    --accent: #4cc38a;
    --accent-ink: #0c1a13;
    --soft: #203229;
    --danger: #ff8a80;
    --live: #ff922b;
  }
}
* { box-sizing: border-box; }
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;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3, p { margin: 0; }

.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand h1 { font-size: 19px; line-height: 1.2; }
.brand p { color: var(--muted); font-size: 13px; }
.logo { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 34px; height: 34px; flex: none; }
.logo i { border-radius: 4px; }
.logo i:nth-child(1) { background: #e8739a; }
.logo i:nth-child(2) { background: #f2b33d; }
.logo i:nth-child(3) { background: #c8642d; }
.logo i:nth-child(4) { background: #4a90c2; }
.top-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.status.err { color: var(--danger); font-weight: 600; }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600;
  padding: 10px 12px; border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap;
}
.tabs button.on { color: var(--accent); border-color: var(--accent); }

main.wrap { padding-top: 16px; padding-bottom: 64px; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.bar .grow { flex: 1; }
.empty { color: var(--muted); text-align: center; padding: 36px 12px; }
.hint { color: var(--muted); font-size: 13px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 8px; }
.section-title:first-child { margin-top: 0; }

.btn {
  font: inherit; font-weight: 600; border-radius: 9px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px; cursor: pointer; white-space: nowrap;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn.plain { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.danger { background: transparent; border-color: var(--line); color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 10px; max-width: 100%;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
label.f input, label.f select { width: 100%; font-weight: 400; }
label.chk { display: flex; gap: 8px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.cards { display: grid; gap: 10px; }
.cards.cols { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

/* Jogos */
.game-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.game-meta b { color: var(--ink); }
.pill { border-radius: 99px; padding: 1px 9px; font-size: 12px; font-weight: 700; background: var(--soft); color: var(--accent); }
.pill.live { background: var(--live); color: #fff; }
.pill.done { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.match { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 10px; align-items: center; }
.team { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; }
.team span.nm { overflow: hidden; text-overflow: ellipsis; }
.team.b { justify-content: flex-end; text-align: right; }
.team.win .nm { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 1px solid rgba(0,0,0,.15); }
.score { display: flex; align-items: center; gap: 8px; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.score .x { font-size: 14px; color: var(--muted); font-weight: 600; }
.score input { width: 58px; text-align: center; font-size: 20px; font-weight: 800; padding: 6px 4px; }
.game-admin { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.game-admin .grow { flex: 1; }

/* Tabelas */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 8px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 700; }
td.l, th.l { text-align: left; }
td.pts { font-weight: 800; }
tr:last-child td { border-bottom: 0; }
td .team { font-weight: 600; }

/* Times */
.team-head { display: flex; align-items: center; gap: 8px; }
.team-head h3 { font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.members { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13.5px; }
.members li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.members li:last-child { border-bottom: 0; }
.members small, .pick small { color: var(--muted); white-space: nowrap; }

.editor { display: grid; grid-template-columns: 1fr 1.25fr; gap: 14px; align-items: start; }
@media (max-width: 760px) { .editor { grid-template-columns: 1fr; } }
.filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.filters input { grid-column: 1 / -1; }
@media (max-width: 520px) { .filters { grid-template-columns: 1fr 1fr; } }
.picklist { max-height: 56vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; }
.pick { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; padding: 8px 10px; cursor: pointer; }
.pick:last-child { border-bottom: 0; }
.pick:hover { background: var(--soft); }
.pick .other { color: var(--live); font-size: 12px; }
.x-btn { border: 0; background: none; color: var(--danger); font: inherit; font-weight: 700; cursor: pointer; padding: 0 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px dashed var(--line); background: none; color: var(--ink); font: inherit; font-size: 13px; border-radius: 99px; padding: 4px 11px; cursor: pointer; }
.rowlist { display: grid; gap: 6px; }
.rowlist .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rowlist .row label.chk { white-space: nowrap; }
.rowlist .row input { flex: 1; min-width: 0; }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink); padding: 0; width: min(520px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog form { padding: 18px; display: grid; gap: 12px; }
dialog h2 { font-size: 17px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.checks { display: grid; gap: 4px; max-height: 40vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }

/* Telão */
.tabs a { color: var(--muted); font-weight: 600; padding: 10px 12px; text-decoration: none; white-space: nowrap; margin-left: auto; }
.telao .top { display: none; }
.telao main.wrap { max-width: none; padding: 2vw 2.5vw; font-size: clamp(15px, 1.25vw, 26px); }
.t-head { display: flex; align-items: center; gap: 1.2vw; margin-bottom: 1.5vw; }
.t-head .grow { flex: 1; min-width: 0; }
.t-head h1 { font-size: clamp(22px, 2.6vw, 56px); line-height: 1.1; }
.t-head p { color: var(--muted); }
.t-head .logo { width: clamp(34px, 3.4vw, 70px); height: clamp(34px, 3.4vw, 70px); }
.t-clock { font-size: clamp(22px, 2.6vw, 56px); font-weight: 800; font-variant-numeric: tabular-nums; }
.t-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 2vw; align-items: start; }
@media (max-width: 800px) { .t-grid { grid-template-columns: 1fr; } }
.telao .section-title { font-size: clamp(12px, 1vw, 20px); }
.telao .pill { font-size: inherit; padding: 2px 14px; }
.telao .game-meta { font-size: clamp(13px, 1.1vw, 22px); }
.t-main article .team { font-size: clamp(20px, 2.6vw, 54px); }
.t-main article .score { font-size: clamp(44px, 6.5vw, 130px); line-height: 1; }
.t-main article .dot, .t-head .dot { width: 1em; height: 1em; }
.t-main article.card { padding: 1.4vw 1.8vw; }
.mini { padding: .5em 0; border-bottom: 1px solid var(--line); }
.mini:last-child { border-bottom: 0; }
.mini small { color: var(--muted); }
.mini .score { font-size: 1.25em; }
.telao .score .x { font-size: .4em; }
.telao .mini .score .x { font-size: .7em; }
.t-grid > section { min-width: 0; }

/* Queimados */
.outs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.outs > div { min-width: 0; }
.outs .b { text-align: right; }
.outs small { color: var(--muted); display: block; margin-bottom: 4px; }
.ochip { display: inline-block; border: 1px solid var(--line); border-radius: 99px; padding: 1px 10px; margin: 2px; color: var(--muted); text-decoration: line-through; font-size: .92em; }
.ochip.last { color: var(--live); border-color: var(--live); font-weight: 700; }
.pchip { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 9px; padding: 8px 10px; margin: 3px; cursor: pointer; }
.pchip.dead { background: var(--danger); border-color: var(--danger); color: var(--card); text-decoration: line-through; }
@media (max-width: 520px) { .outs.marcar { grid-template-columns: 1fr; } }
.t-main .outs { font-size: clamp(14px, 1.5vw, 30px); }
.t-main .outs small { font-size: .8em; }

/* Fotos */
.av { position: relative; display: inline-grid; place-items: center; flex: none; width: 2.3em; height: 2.3em; border-radius: 50%; overflow: hidden; background: var(--soft); color: var(--accent); font-size: .78em; font-weight: 700; vertical-align: middle; }
.av::before { content: attr(data-i); }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.pn { display: flex; align-items: center; gap: 8px; min-width: 0; text-align: left; }
.pchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 5px; }
.pchip.dead .av img { filter: grayscale(1); }
.ochip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 2px; }
.ochip .av img { filter: grayscale(1); }
.ochip.last .av img { filter: none; }
.t-main .ochip { flex-direction: column; border: 0; padding: 0; margin: .3em .4em; width: 5.2em; text-align: center; line-height: 1.15; font-size: .8em; vertical-align: top; }
.t-main .ochip .av { font-size: 1.6em; }
.t-main .ochip.last .av { outline: .12em solid var(--live); }

/* Aviso de endereço novo (só aparece no endereço antigo) */
.aviso { background: var(--live); color: #fff; padding: 12px 16px; text-align: center; font-weight: 700; font-size: 16px; }
.aviso a { color: #fff; text-decoration: underline; }
.telao .aviso { font-size: clamp(18px, 2vw, 40px); padding: 1.2vw; }

/* Seletor de turno */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 8px 14px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
a.btn { text-decoration: none; display: inline-block; }
