/* CLUPESIL Gestão — barra lateral à esquerda, conteúdo em tabelas; cores do escudo do clube (verde, amarelo e vermelho) */
:root {
  --bg: #f4f6f2; --surface: #ffffff; --surface2: #f8faf6; --fg: #182418; --muted: #5d6b5c; --line: #dbe3d8;
  --accent: #127a33; --accent-fg: #ffffff; --accent-soft: #e0f1e3; --side: #0d4d22; --side-fg: #eef6ee; --sand: #f4c518; --red: #d7262b;
  --ok: #1f7a45; --ok-soft: #e1f2e7; --bad: #b3372b; --bad-soft: #f8e3e0; --warn: #8a5f00; --warn-soft: #fbf0d4;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1810; --surface: #172318; --surface2: #131e14; --fg: #e6efe5; --muted: #98a996; --line: #283a29;
    --accent: #5fcf7c; --accent-fg: #0b1d0f; --accent-soft: #1a3a21; --side: #0a150b; --side-fg: #d6e8d5; --red: #f0625f;
    --ok: #6fd39a; --ok-soft: #173326; --bad: #f08a7e; --bad-soft: #3a1d1a; --warn: #f0c463; --warn-soft: #352a12;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0f1810; --surface: #172318; --surface2: #131e14; --fg: #e6efe5; --muted: #98a996; --line: #283a29;
    --accent: #5fcf7c; --accent-fg: #0b1d0f; --accent-soft: #1a3a21; --side: #0a150b; --side-fg: #d6e8d5; --red: #f0625f;
    --ok: #6fd39a; --ok-soft: #173326; --bad: #f08a7e; --bad-soft: #3a1d1a; --warn: #f0c463; --warn-soft: #352a12;
    color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font: 15px/1.45 var(--body); }
button, input, select, textarea { font: inherit; color: inherit; }
.carregando { padding: 40px; color: var(--muted); }

/* ---------- estrutura ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
aside { border-right: 4px solid var(--sand); background: var(--side); color: var(--side-fg); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.marca { font-family: var(--display); font-weight: 700; font-size: 28px; letter-spacing: .05em; padding: 0 10px; }
.marca img { display: block; height: 96px; width: auto; margin: 0 auto 8px; }
aside .marca { text-align: center; }
.marca small { display: block; font: 400 12px/1.3 var(--body); letter-spacing: 0; opacity: .75; margin-bottom: 14px; }
aside a { color: var(--side-fg); text-decoration: none; padding: 8px 10px; border-radius: 8px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; opacity: .85; }
aside a:hover { background: rgba(255,255,255,.07); opacity: 1; }
aside a.on { background: rgba(255,255,255,.14); opacity: 1; }
aside .badge { background: var(--sand); color: #3b2a00; border-radius: 999px; padding: 0 7px; font-size: 12px; }
aside .rodape { margin-top: auto; padding: 10px; font-size: 13px; opacity: .8; display: flex; flex-direction: column; gap: 6px; }
aside .rodape button { background: transparent; border: 1px solid rgba(255,255,255,.3); color: var(--side-fg); border-radius: 8px; padding: 5px 10px; cursor: pointer; }
aside select { background: rgba(255,255,255,.1); color: var(--side-fg); border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 5px 8px; }
aside select option { color: #14282c; }
main { padding: 22px clamp(16px, 3vw, 36px) 60px; min-width: 0; }
.demo { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  aside { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  aside .marca { width: 100%; }
  aside .marca img { height: 64px; }
  aside .rodape { margin-top: 0; flex-direction: row; flex-wrap: wrap; align-items: center; }
}

/* ---------- tipografia ---------- */
h1 { font-family: var(--display); font-size: 32px; margin: 0 0 4px; letter-spacing: .01em; text-wrap: balance; }
h2 { font-family: var(--display); font-size: 21px; margin: 26px 0 10px; letter-spacing: .02em; }
h3 { font-size: 16px; margin: 0 0 6px; }
p.lead { color: var(--muted); margin: 0 0 18px; max-width: 75ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); } .neg { color: var(--bad); }

/* ---------- blocos ---------- */
.topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tile .lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tile .val { font-family: var(--display); font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile .sub { font-size: 13px; color: var(--muted); }
.tile.alerta { border-color: var(--bad); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid2 > * { min-width: 0; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }

.tbl { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface2); position: sticky; top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }
td.c, th.c { text-align: center; }
tr.total td { font-weight: 700; background: var(--surface2); }
tr.clicavel { cursor: pointer; }
tr.clicavel:hover td { background: var(--accent-soft); }
td.hist { max-width: 420px; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; margin: 1px 2px 1px 0; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.pill.cinza { background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }

.bars { display: flex; flex-direction: column; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.bar { display: grid; grid-template-columns: minmax(110px, 190px) 1fr 100px; gap: 10px; align-items: center; font-size: 14px; }
.bar .t { height: 11px; background: var(--accent-soft); border-radius: 6px; overflow: hidden; }
.bar .t i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.bar.desp .t i { background: var(--bad); }
.bar .v { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- formulários ---------- */
.barra { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.barra .esp { flex: 1; }
input, select, textarea { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-width: 0; }
textarea { width: 100%; min-height: 70px; resize: vertical; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
button { cursor: pointer; border-radius: 8px; padding: 8px 14px; border: 1px solid transparent; font-weight: 600; background: var(--accent); color: var(--accent-fg); }
button.sec { background: transparent; color: var(--accent); border-color: var(--line); }
button.perigo { background: transparent; color: var(--bad); border-color: var(--bad); }
button.perigo.confirmar { background: var(--bad); color: #fff; }
button.mini { padding: 3px 9px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--sand); outline-offset: 2px; }
label.campo { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
label.campo > input, label.campo > select, label.campo > textarea { color: var(--fg); font-weight: 400; font-size: 15px; }
.campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.campos .largo { grid-column: 1 / -1; }

/* ---------- janela (modal) ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 40px); background: var(--surface); color: var(--fg); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.largo { width: min(1150px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(8, 25, 28, .55); }
#modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.m-topo { padding: 16px 20px 8px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.m-topo h2 { margin: 0; font-size: 24px; }
.m-corpo { padding: 6px 20px 16px; overflow-y: auto; }
.m-rodape { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.m-rodape .esp { flex: 1; }
.fechar { background: transparent; color: var(--muted); font-size: 22px; padding: 0 8px; border: 0; }
.erro { color: var(--bad); font-weight: 600; font-size: 14px; }

.itens { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.item { display: grid; grid-template-columns: 1fr 1.4fr 120px 36px; gap: 8px; align-items: center; }
.item .i-quem { display: flex; min-width: 0; }
.item .i-quem select { width: 100%; }
.item select, .item input { width: 100%; }
@media (max-width: 700px) { .item { grid-template-columns: 1fr 1fr; } }
.falta { font-size: 14px; font-weight: 600; }

/* ---------- etapas ---------- */
.grade td.mes { text-align: center; padding: 4px; }
.cel { width: 30px; height: 28px; border-radius: 6px; border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 0; font-weight: 700; }
.cel.sim { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.abas button { background: transparent; color: var(--muted); border-radius: 8px 8px 0 0; border: 0; border-bottom: 3px solid transparent; }
.abas button.on { color: var(--fg); border-bottom-color: var(--accent); }

.cartao { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.lista-eventos { display: flex; flex-direction: column; gap: 16px; }

#aviso { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: calc(100vw - 32px); }
#aviso.vis { opacity: 1; }
#aviso.erro { background: var(--bad); color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--side), var(--accent)); border-top: 6px solid var(--red); }
.login form { background: var(--surface); padding: 28px; border-radius: 14px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login .marca { color: var(--accent); padding: 0; text-align: center; }
.login .marca img { height: 130px; }
.cab-rel { display: flex; align-items: center; gap: 12px; }
.cab-rel img { height: 56px; width: auto; }

@media print {
  aside, .barra, .nao-imprimir, .demo { display: none !important; }
  .shell { display: block; }
  main { padding: 0; }
  body { background: #fff; color: #000; font-size: 12px; }
  .tbl, .tile, .bars { border-color: #bbb; }
  h2 { break-after: avoid; }
  .tbl { break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) { #aviso { transition: none; } }

.th-mes { background: none; border: 0; padding: 2px 6px; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; border-radius: 6px; }
.th-mes:hover { background: var(--accent-soft); color: var(--accent); }
