/* Caderno do Treinador / Caderno do Coordenador — camada por cima do Bootstrap 5.3 */
:root {
  --brand: #1f8a4c;
  --brand-dark: #14653a;
  --brand-rgb: 31, 138, 76;
  --brand-soft: #e4f4eb;
  --side-bg: #0f2a1c;
  --side-fg: #c9e4d3;
  --side-active: #1f8a4c;
  --bs-primary: var(--brand);
  --bs-primary-rgb: var(--brand-rgb);
  --bs-link-color: var(--brand-dark);
  --bs-link-hover-color: var(--brand);
  --side-w: 258px;
}
body.tema-coordenador {
  --brand: #c2570c;
  --brand-dark: #8f3f06;
  --brand-rgb: 194, 87, 12;
  --brand-soft: #fcebdc;
  --side-bg: #3d1d08;
  --side-fg: #f1d6c0;
  --side-active: #c2570c;
}
body { background: #f4f6f5; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body.tema-coordenador { background: #f7f4f1; }

.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark); }
.text-brand { color: var(--brand) !important; }
.bg-brand-soft { background: var(--brand-soft) !important; }
.text-bg-primary { background-color: var(--brand) !important; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .2); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.nav-pills .nav-link.active { background: var(--brand); }
.nav-tabs .nav-link.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.nav-tabs .nav-link { color: #555; }

/* ---------- estrutura ---------- */
.app { min-height: 100vh; }
.lateral { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side-bg); color: var(--side-fg); display: flex; flex-direction: column;
  z-index: 1040; transition: transform .2s ease; overflow-y: auto; }
.lateral .marca { padding: 1.1rem 1.2rem; display: flex; align-items: center; gap: .7rem; color: #fff; font-weight: 700; font-size: 1.05rem; line-height: 1.15; }
.lateral .marca .logo { width: 38px; height: 38px; border-radius: 10px; background: var(--side-active); display: grid; place-items: center; font-size: 1.3rem; flex: none; }
.lateral .grupo { padding: .9rem 1.2rem .3rem; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; opacity: .55; }
.lateral a.item { display: flex; align-items: center; gap: .7rem; padding: .55rem 1.2rem; color: var(--side-fg); text-decoration: none; border-left: 3px solid transparent; font-size: .94rem; }
.lateral a.item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.lateral a.item.ativo { background: rgba(255, 255, 255, .12); color: #fff; border-left-color: var(--side-active); font-weight: 600; }
.lateral a.item .bi { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.lateral .rodape { margin-top: auto; padding: 1rem 1.2rem; border-top: 1px solid rgba(255, 255, 255, .1); font-size: .85rem; }
.principal { margin-left: var(--side-w); min-height: 100vh; display: flex; flex-direction: column; }
.topo { background: #fff; border-bottom: 1px solid #e3e7e5; padding: .6rem 1.25rem; display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 1020; }
.conteudo { padding: 1.5rem 1.25rem 3rem; max-width: 1400px; width: 100%; }
.pagina-titulo { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.1rem; }
.pagina-titulo h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.pagina-titulo .acoes { margin-left: auto; display: flex; flex-wrap: wrap; gap: .5rem; }
#menu-btn { display: none; }
.cortina { display: none; }
@media (max-width: 991.98px) {
  .lateral { transform: translateX(-100%); }
  .lateral.aberta { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .principal { margin-left: 0; }
  #menu-btn { display: inline-block; }
  .cortina.aberta { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 1030; }
  .conteudo { padding: 1rem .85rem 3rem; }
}

/* ---------- componentes ---------- */
.card { border-radius: 14px; }
.card-header { border-bottom-color: #eef0ef; }
.stat-icone { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; flex: none; }
.bg-brand-soft.stat-icone, .stat-icone.bg-brand-soft { background: var(--brand-soft); }
.stat-icone.bg-brand-soft { color: var(--brand); }
.bg-danger-soft { background: #fde8e8; } .bg-warning-soft { background: #fff3d6; } .bg-info-soft { background: #dff3fa; } .bg-success-soft { background: #e1f5e8; }
.bg-secondary-soft { background: #eceeef; } .bg-primary-soft { background: var(--brand-soft); }
.linha-clicavel { cursor: pointer; }
.avatar { border-radius: 50%; object-fit: cover; flex: none; }
.avatar-txt { background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; }
.cartao-jogador { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.cartao-jogador:hover { transform: translateY(-3px); box-shadow: 0 .6rem 1.2rem rgba(0, 0, 0, .1) !important; }
.cartao-jogador .foto { aspect-ratio: 1 / 1; width: 100%; object-fit: cover; border-radius: 14px 14px 0 0; background: var(--brand-soft); }
.cartao-jogador .foto-txt { display: grid; place-items: center; font-size: 3rem; font-weight: 700; color: var(--brand-dark); }
.cartao-jogador .numero { position: absolute; top: .5rem; left: .5rem; background: rgba(0, 0, 0, .65); color: #fff; border-radius: 8px; padding: .05rem .5rem; font-weight: 700; font-size: .9rem; }
.alerta-item { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .75rem; border-radius: 10px; margin-bottom: .45rem; font-size: .92rem; text-decoration: none; color: inherit; }
.alerta-item.perigo { background: #fde8e8; } .alerta-item.aviso { background: #fff6dc; } .alerta-item.info { background: #e6f3fa; }
.alerta-item .bi { margin-top: .1rem; }
.alerta-item.perigo .bi { color: #c0392b; } .alerta-item.aviso .bi { color: #b8860b; }
.grafico-caixa svg { max-width: 100%; height: auto; }
.grafico-caixa { background: #fff; border-radius: 10px; padding: .5rem; overflow-x: auto; }
.mini-barra { height: 8px; border-radius: 4px; background: #e6e9e8; overflow: hidden; min-width: 70px; }
.mini-barra > span { display: block; height: 100%; background: var(--brand); }
.pill-select { max-width: 260px; }
.sel-linha { display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem; border-bottom: 1px solid #eef0ef; }
.sel-linha:last-child { border-bottom: 0; }
.sel-linha .nome { flex: 1; min-width: 0; }
.evento-item { border-left: 3px solid var(--brand); padding: .4rem .75rem; margin-bottom: .5rem; background: #fff; border-radius: 0 10px 10px 0; }
.evento-item.nao-lido { background: var(--brand-soft); }

/* ---------- entrada ---------- */
body.sem-sessao { background: linear-gradient(135deg, var(--side-bg), var(--brand)); min-height: 100vh; }
.entrada { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.entrada-cartao { width: 100%; max-width: 460px; border-radius: 20px; }
.logo-grande { width: 68px; height: 68px; border-radius: 18px; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-size: 2rem; }

/* ---------- página inicial ---------- */
.heroi { background: linear-gradient(135deg, #0f2a1c, #1f8a4c); color: #fff; padding: 4.5rem 0 5rem; }
.heroi h1 { font-weight: 800; letter-spacing: -.02em; }
.cartao-entrada { border-radius: 20px; transition: transform .15s, box-shadow .15s; text-decoration: none; color: inherit; display: block; }
.cartao-entrada:hover { transform: translateY(-4px); box-shadow: 0 1rem 2rem rgba(0, 0, 0, .15) !important; color: inherit; }

@media print { .lateral, .topo, .acoes { display: none !important; } .principal { margin: 0; } }

/* ---------- rede de segurança (só entra em ação se o CSS do Bootstrap não carregar) ---------- */
.modal { position: fixed; inset: 0; z-index: 1055; overflow-y: auto; }
.modal-backdrop { position: fixed; inset: 0; z-index: 1050; background: #000; opacity: .5; }
.modal-dialog { max-width: 520px; margin: 1.75rem auto; position: relative; }
.modal-dialog.modal-lg { max-width: 800px; } .modal-dialog.modal-xl { max-width: 1140px; } .modal-dialog.modal-sm { max-width: 300px; }
.modal-content { background: #fff; border-radius: 14px; }
.d-none { display: none !important; }

/* ---------- Treinador IA ---------- */
.ia-chat { height: min(58vh, 560px); min-height: 280px; overflow-y: auto; border: 1px solid var(--bs-border-color, #dee2e6); border-radius: 14px; background: #fff; padding: .9rem; display: flex; flex-direction: column; gap: .7rem; margin-bottom: .75rem; }
.ia-bolha { max-width: 92%; padding: .6rem .85rem; border-radius: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.ia-ia { background: var(--brand-soft, #e7f5ec); align-self: flex-start; }
.ia-eu { background: #eef1f6; align-self: flex-end; }
.ia-erro { background: #fdecea; color: #842029; align-self: flex-start; }
.ia-quem { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .65; margin-bottom: .15rem; }
.ia-li { padding-left: .9rem; text-indent: -.9rem; }
.ia-painel { border: 1px solid var(--brand, #1f8a4c); background: #f6fbf8; border-radius: 12px; padding: .8rem 1rem; margin-bottom: .75rem; }
.ia-faixa { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.ia-anexo-mini { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid #dee2e6; border-radius: 8px; padding: 2px 6px; background: #fff; }
.ia-anexo-mini img { height: 44px; width: auto; border-radius: 4px; }
.logo-equipa { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; }

/* ---------- Quadro tático ---------- */
.q-corpo { display: flex; gap: .75rem; align-items: flex-start; }
.q-paleta { width: 188px; flex: none; max-height: 66vh; overflow-y: auto; background: #fff; border: 1px solid #dee2e6; border-radius: 10px; padding: .4rem; }
.q-grupo { font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #6c757d; margin: .6rem .3rem .2rem; }
.q-grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.q-ferr { border: 2px solid transparent; background: #fff; border-radius: 8px; padding: 2px; display: flex; flex-direction: column; align-items: center; font-size: .62rem; line-height: 1.1; cursor: pointer; }
.q-ferr svg { max-width: 100%; height: auto; border-radius: 4px; }
.q-ferr.q-sel { width: 100%; flex-direction: row; justify-content: center; font-size: .85rem; font-weight: 700; padding: .45rem; margin-bottom: .2rem; border-color: #e9ecef; }
.q-ferr.q-ativo { border-color: var(--brand, #1f8a4c); background: var(--brand-soft, #e7f5ec); }
.q-area { flex: 1 1 auto; min-width: 0; }
@media (max-width: 767px) { .q-corpo { flex-direction: column; } .q-paleta { width: 100%; max-height: 190px; } .q-grade { grid-template-columns: repeat(6, 1fr); } }

/* ---------- Licença ---------- */
.faixa-licenca { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .55rem 1.25rem; font-size: .92rem; }
.faixa-licenca.aviso { background: #fff3cd; color: #664d03; border-bottom: 1px solid #ffe69c; }
.faixa-licenca.fim { background: #842029; color: #fff; }

/* ---------- Logótipo ---------- */
.logo-img { width: 84px; height: 84px; border-radius: 20px; display: inline-block; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.lateral .marca .logo-img-menu { width: 40px; height: 40px; border-radius: 10px; flex: none; }

/* animações: fita de passos */
.q-fita { margin-top: .6rem; padding: .6rem; background: #f1f4f2; border: 1px solid #dee2e6; border-radius: 10px; }
.q-tira { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; }
.q-passo { position: relative; flex: none; width: 128px; padding: 0; border: 3px solid transparent; border-radius: 8px; background: #12351d; cursor: pointer; overflow: hidden; line-height: 0; }
.q-passo canvas { border-radius: 5px; }
.q-passo-ativo { border-color: var(--brand, #1f8a4c); box-shadow: 0 0 0 2px #fff inset; }
.q-passo-n { position: absolute; left: 4px; top: 4px; min-width: 20px; height: 20px; border-radius: 10px; background: rgba(0,0,0,.65); color: #fff; font-size: .72rem; line-height: 20px; text-align: center; font-weight: 700; }
