:root {
    --bg: #0f172a;
    --panel: #1e293b;
    --accent: #38bdf8;
    --text: #e2e8f0;
    --muted: #94a3b8;
}

/* O padding passa a ser incluído na largura declarada, em vez de se
   somar a ela — sem isto, qualquer elemento com "width:100%" e algum
   padding fica sempre um pouco mais largo do que o ecrã (foi isto que
   estava a cortar ligeiramente o lado direito do cabeçalho e do body
   em ecrãs pequenos). */
*, *::before, *::after {
    box-sizing: border-box;
}

/* iPhone/iPad (Safari): impede o aumento automático do texto (text autosizing),
   que fazia o conteúdo dos quadrados da tática crescer e ficar cortado */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}



body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
}

.body-entrada {
     background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
         url('/images/stadium-1137e9c5202d7a03205f60aa1712f764.jpg') no-repeat center center/cover;
     place-items: center;
 }

.body-jogo {
     background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
         url('/images/stadium-1137e9c5202d7a03205f60aa1712f764.jpg') no-repeat center center/cover;
 }

.hero {
    margin-top: 24px;
}

.hero-eyebrow {
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--muted);
    margin-bottom: 6px;
}

.hero-titulo {
    font-size: 52px;
    font-weight: 700;
    font-family: 'Fredoka', 'Segoe UI', sans-serif;
    text-align: center;
    margin: 0 0 10px;
    background: linear-gradient(135deg, var(--accent) 0%, #a78bfa 60%, #f59e0b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1.1;
}

.hero-logo {
    margin: 0 0 16px;
    text-align: center;
}

.hero-logo img {
    width: 260px;
    max-width: 70%;
    height: auto;
    display: inline-block;
}

.hero p {
    font-size: 18px;
    margin-bottom: 40px;
    text-align: center;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
    display: flex;
}

.form-group label {
    width: 140px; /* espaço fixo para todas as labels */
    text-align: left;
    margin-right: 10px;
}

.form-group-registo {
    margin-bottom: 15px;
    text-align: left;
    display: flex;
}

.form-group-registo label {
    width: 240px; /* espaço fixo para todas as labels */
    text-align: left;
    margin-right: 10px;
}

.form-group-registo input {
    width: 232px; /* espaço fixo para todas as labels */
}

.form-group-registo select {
    width: 240px; /* espaço fixo para todas as labels */
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: black !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
    color: black !important;
}

.select2-container--default .select2-results__option {
    color: black !important;
}

.social-login {
    margin-top: 20px;
}

.social-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    padding: 10px;
    border-radius: 5px;
    text-decoration: none;
    color: white;
    font-weight: bold;

    transition: 0.3s;
}

.social-btn i {
    font-size: 18px;
}

/* Google */
.google {
    background-color: #db4437;
}

.google:hover {
    background-color: #c23321;
}

/* Facebook */
.facebook {
    background-color: #1877f2;
}

.facebook:hover {
    background-color: #145dbf;
}

.register-btn {
    display: inline-block;
    margin-top: 15px;

    padding: 10px 15px;
    border-radius: 6px;

    background: var(--bg);
    color: white;
    font-weight: bold;
    text-decoration: none;

    transition: all 0.3s ease;
}

/* Hover */
.register-btn:hover {
    background: var(--bg);
    transform: scale(1.05);
}

/* Clique */
.register-btn:active {
    transform: scale(0.97);
}

/* 🔴 ERRO */
.error {
    background-color: #ff4d4d;
    color: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
    border-left: 5px solid #cc0000;
    width: 450px;
}

/* SUCESSO */
.sucess {
    background-color: #4db34d;
    color: white;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
    border-left: 5px solid #00cc00;
    width: 450px;
}

/* Layout */
.container {
    display: flex;
}

.sidebar {
    width: 250px;
    /* Marca de água do logo no topo do menu, por baixo do nome (fixa, não acompanha o scroll do menu; fica acima do bloco de publicidade) */
    background: #020617 url('/images/marca-agua-menu-79b5615efbf41f4c835544334b6a98f6.png') no-repeat center 100px / 200px auto;
    min-height: 100vh;
    padding: 20px;
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.sidebar a {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: var(--text);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 5px;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.sidebar a:hover {
    background: var(--panel);
    transform: translateX(2px);
}

.sidebar-reportar {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #1e293b;
    width: 100%;
    background: none;
    border-left: none;
    border-right: none;
    border-bottom: none;
    font-family: inherit;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    color: var(--muted);
    display: flex;
    align-items: center;
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: 10px;
    border-radius: 8px;
    transition: color 0.15s, background 0.15s;
}
.sidebar-reportar:hover {
    color: var(--accent);
    background: var(--panel);
}

.reporte-contador {
    font-size: 11px;
    color: var(--muted);
    text-align: right;
    margin-top: -4px;
}
.reporte-contador-limite {
    color: #f87171;
    font-weight: bold;
}

/* Item correspondente à página actual */
.sidebar a.sidebar-ativo {
    background: var(--panel);
    border-left-color: var(--accent);
    font-weight: bold;
    color: var(--accent);
}

/* Alerta (bolinha) — ex: receitas de patrocinadores por recolher */
.sidebar-alerta {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    margin-left: auto;
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.7);
}

/* Separador visual antes dos itens soltos finais (Transferências) */
a.sidebar-link[href="/transferencias"] {
    margin-top: 14px;
    position: relative;
}
a.sidebar-link[href="/transferencias"]::before {
    content: '';
    position: absolute;
    top: -9px;
    left: 4px;
    right: 4px;
    border-top: 1px solid #1e293b;
}

/* ── Grupos "Clube" / "Competições" — abrem submenu ao passar o rato ──── */
.sidebar-grupo {
    position: relative;
    margin-bottom: 5px;
}

.sidebar-grupo-titulo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    color: var(--text);
    border-radius: 8px;
    cursor: default;
    user-select: none;
    border-left: 3px solid transparent;
    transition: background 0.15s;
    font-weight: 600;
}

.sidebar-grupo-titulo::after {
    content: '▸';
    color: var(--muted);
    font-size: 12px;
    margin-left: 8px;
    transition: transform 0.15s;
}

.sidebar-grupo:hover > .sidebar-grupo-titulo {
    background: var(--panel);
}

.sidebar-grupo:hover > .sidebar-grupo-titulo::after {
    transform: rotate(90deg);
}

/* Grupo que contém a página actual fica sempre visivelmente marcado */
.sidebar-grupo.sidebar-grupo-ativo > .sidebar-grupo-titulo {
    border-left-color: var(--accent);
    color: var(--accent);
}

.sidebar-submenu {
    display: none;
    flex-direction: column;
    padding-left: 14px;
    border-left: 2px solid #1e293b;
    margin: 2px 0 2px 12px;
}

.sidebar-grupo:hover .sidebar-submenu,
.sidebar-grupo.sidebar-grupo-ativo .sidebar-submenu {
    display: flex;
}

.sidebar-submenu a {
    font-size: 14px;
    padding: 8px 10px;
}

/* ── Submenus do menu lateral em dispositivos SEM "hover" (telemóvel) ──
   Em ecrãs tácteis o :hover fica "preso" ao último toque e o submenu só
   fechava depois de um primeiro toque noutro botão — que acabava por
   falhar o alvo, porque o menu encolhia. Aqui o submenu abre e fecha por
   uma classe controlada em app.js. A consulta (hover: none) só é
   verdadeira em dispositivos cujo ponteiro principal não faz hover, por
   isso o PC (mesmo com ecrã táctil, mas com rato) mantém o :hover. */
@media (hover: none) {
    .sidebar-grupo:hover .sidebar-submenu {
        display: none;
    }
    .sidebar-grupo.sidebar-grupo-ativo .sidebar-submenu,
    .sidebar-grupo.sidebar-grupo-aberto .sidebar-submenu {
        display: flex;
    }
    .sidebar-grupo:hover > .sidebar-grupo-titulo {
        background: transparent;
    }
    .sidebar-grupo:hover > .sidebar-grupo-titulo::after {
        transform: none;
    }
    .sidebar-grupo.sidebar-grupo-aberto > .sidebar-grupo-titulo {
        background: var(--panel);
    }
    .sidebar-grupo.sidebar-grupo-aberto > .sidebar-grupo-titulo::after {
        transform: rotate(90deg);
    }
    .sidebar-grupo-titulo {
        cursor: pointer;
    }
}

/* Header */
.header {
    background: var(--panel);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1e293b;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 20px;
    margin-bottom: 16px;
    border-bottom: 1px solid #1e293b;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.15s;
}
.sidebar-logo:hover {
    opacity: 0.85;
}

/* Logo (escudo ECM) no topo do menu; o mesmo ícone é usado no cabeçalho da página de entrada */
.sidebar-logo-emblema {
    width: 44px;
    height: auto;
    flex-shrink: 0;
    display: block;
}

.sidebar-logo-nome {
    white-space: nowrap;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.header-equipa {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.team-name {
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 0.02em;
}

.manager-name {
    font-size: 13px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.manager-icon {
    font-size: 12px;
    opacity: 0.8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-btn {
    background: transparent;
    color: #f87171;
    border: 1px solid #7f1d1d;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.logout-btn:hover {
    background: #7f1d1d;
    border-color: #ef4444;
    color: #fff;
}

.general-btn {
    background: #0f172a;
    color: var(--text);
    border: 1px solid #334155;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    position: relative;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.header-badge-nao-lidas {
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    margin-left: -2px;
}

.general-btn span {
    white-space: nowrap;
}

.general-btn:hover {
    background: #1e293b;
    border-color: var(--accent);
    transform: translateY(-1px);
}

.general-btn:active {
    transform: translateY(0);
}

.general-btn-premium {
    border-color: #f59e0b;
    color: #fbbf24;
}
.general-btn-premium:hover {
    background: #422f0a;
    border-color: #f59e0b;
}

/* Ecrãs mais estreitos — esconder o texto dos botões, manter só o ícone */
@media (max-width: 900px) {
    .general-btn span { display: none; }
    .general-btn { padding: 8px 10px; }
}

.link-btn {
    color: var(--accent);
}

/* Cards */
.card {
    background: var(--panel);
    padding: 15px;
    border-radius: 10px;
    margin: 10px;
}

.grid {
    display: flex;
    flex-wrap: wrap;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

td, th {
    padding: 8px;
    border-bottom: 1px solid #334155;
}

/* Buttons */

button {
    background: var(--accent);
    border: none;
    padding: 8px 12px;
    color: black;
    border-radius: 6px;
    cursor: pointer;
}

.entrada-btn {
    width: 100%;
    padding: 10px;
    background-color: #00c853;
    border: none;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

/* Modal — aberta via style="display:flex" pelo JS */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    overflow-y: auto;
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 10px;
    box-sizing: border-box;
}

/* A modal do jogador deve aparecer sempre por cima de outras modais
   (ex.: aberta a partir do relatório do jogo, das formações, etc.),
   que usam o z-index base de 1000 */
#playerModal {
    z-index: 1050;
}

/* Bloqueia o scroll do fundo enquanto uma modal está aberta — evita que
   o utilizador perca a modal de vista ao arrastar a página por baixo,
   sobretudo em ecrãs pequenos */
body.modal-aberta {
    overflow: hidden;
}

.modal-content {
    background: var(--panel);
    margin: 0 auto;
    padding: 20px;
    width: 90%;
    max-width: 1100px;
    border-radius: 10px;
    flex-shrink: 0;
}


.badge-posicao {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    background: #334155;
    color: var(--text);
}

.badge-posicao.GR { background: #7c3aed; }
.badge-posicao.DC,
.badge-posicao.DD,
.badge-posicao.DE { background: #0369a1; }
.badge-posicao.MC,
.badge-posicao.MD,
.badge-posicao.ME { background: #065f46; }
.badge-posicao.AV { background: #b45309; }

/* Estrelas */
.estrelas {
    display: inline-flex;
    gap: 1px;
    line-height: 1;
}

.estrela { font-size: 16px; }
.estrela.cheia { color: #f59e0b !important; }
.estrela.meia  { color: #f59e0b !important; opacity: 0.55; }
.estrela.vazia { color: #334155 !important; }

/* Cabeçalho da modal */
.player-modal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.player-modal-header .badge-posicao {
    font-size: 16px;
    padding: 4px 12px;
}

/* Grelha de duas colunas */
.player-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 16px;
}

/* Secção dentro da modal */
.player-modal-section h4 {
    color: var(--accent);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    border-bottom: 1px solid #334155;
    padding-bottom: 6px;
}

/* Linha de detalhe */
.player-modal-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid #1e293b;
}

.player-modal-row > span:first-child { color: var(--muted); }
.player-modal-row > span:last-child  { font-weight: bold; }

/* Atributos com barra */
.atributo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    font-size: 14px;
}

.atributo-label {
    width: 130px;
    color: var(--muted);
    flex-shrink: 0;
}

.atributo-barra {
    flex: 1;
    height: 8px;
    background: #334155;
    border-radius: 4px;
    overflow: hidden;
}

.atributo-barra-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
}

.atributo-barra-fill.alto  { background: #22c55e; }
.atributo-barra-fill.medio { background: #f59e0b; }
.atributo-barra-fill.baixo { background: #ef4444; }

.atributo-val {
    width: 28px;
    text-align: right;
    font-weight: bold;
    font-size: 13px;
}

/* Botão fechar modal (✕) — partilhado */
.btn-fechar-tatica {
    background: transparent;
    border: 1px solid #334155;
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    line-height: 1;
    flex-shrink: 0;
}

.btn-fechar-tatica:hover {
    color: var(--text);
    border-color: var(--text);
}

/* overflow-x for tatica modal scroll */
.modal {
    overflow-x: auto;
}

/* Condição física — partilhado entre plantel, treino, tática e modal */
.cond-alta  { color: #22c55e; font-weight: bold; }
.cond-media { color: #f59e0b; font-weight: bold; }
.cond-baixa { color: #ef4444; font-weight: bold; }

/* Valores monetários com tooltip — partilhado */
.valor-monetario {
    cursor: help;
    border-bottom: 1px dotted var(--muted);
    text-decoration: none;
}

/* ── Tags de jogador — formação, transferência, lesão ──── */
.tag-formacao,
.tag-transferencia,
.tag-lesao,
.tag-amarelos,
.tag-suspensao {
    font-size: 13px;
    cursor: help;
    vertical-align: middle;
    white-space: nowrap;
}

.tag-lesao {
    color: #fca5a5;
    font-weight: bold;
    font-size: 12px;
}

.tag-amarelos {
    color: #f59e0b;
    font-weight: bold;
    font-size: 12px;
}

.tag-suspensao {
    color: #ef4444;
    font-weight: bold;
    font-size: 12px;
}

/* ── Histórico do jogador na modal ──────────────────────── */
.player-modal-historico {
    margin-top: 20px;
    padding-top: 0;
}

.player-modal-historico h4 {
    color: var(--accent);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 12px;
    border-bottom: 1px solid #334155;
    padding-bottom: 6px;
}

.tabela-historico {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tabela-historico th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding: 6px 8px;
    border-bottom: 2px solid #334155;
    font-weight: bold;
    text-align: left;
}

.tabela-historico th[title] { cursor: help; }

.tabela-historico td {
    padding: 6px 8px;
    border-bottom: 1px solid #1e293b;
    vertical-align: middle;
}

.tabela-historico .col-num {
    text-align: center;
    width: 40px;
}

.tabela-historico tbody tr:hover { background: #1e293b; }

.hist-transfer-null { color: var(--muted); font-style: italic; }

/* ── Ações de transferência na modal do jogador ─────────── */
.pm-transferencia-acoes-header {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-pm-transfer {
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.btn-pm-transfer:hover { opacity: 0.85; }

.btn-pm-vender  { background: #f59e0b; color: #0f172a; }
.btn-pm-remover { background: #475569; color: #f1f5f9; }
.btn-pm-comprar { background: #15803d; color: #f0fdf4; }

/* ── Modais de confirmação ──────────────────────────────── */
.modal-confirm { z-index: 1100; } /* acima da modal do jogador */

.modal-confirm-content {
    max-width: 420px;
    padding: 20px 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-confirm-content h3 { margin: 0; font-size: 16px; }

.modal-confirm-content p {
    margin: 0;
    font-size: 14px;
    color: var(--text);
}

.confirm-nota {
    font-size: 12px;
    color: var(--muted);
    background: #1e293b;
    border: 1px solid #334155;
    border-left: 3px solid #f59e0b;
    padding: 8px 12px;
    border-radius: 6px;
    line-height: 1.5;
}

.confirm-acoes {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-bottom: 0;
}

.btn-confirm-ok {
    background: var(--accent);
    color: #0f172a;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    cursor: pointer;
    font-size: 13px;
}
.btn-confirm-ok:hover { opacity: 0.85; }

.confirm-erro {
    font-size: 12px;
    color: #fca5a5;
    background: #7f1d1d;
    border: 1px solid #ef4444;
    border-radius: 6px;
    padding: 8px 12px;
}

/* ══════════════════════════════════════════════════════
   Caixa de selecção com setas de navegação (anterior/seguinte)
   — usado em Campeonato, Taça, Mundial de Clubes, Jogos,
   Transferências (Histórico) e Finanças.
   ══════════════════════════════════════════════════════ */
.select-com-setas {
    display: flex;
    align-items: center;
    gap: 0;
}

.select-com-setas select {
    flex: 1;
    border-radius: 0;
}

.select-com-setas .btn-seta-select:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.select-com-setas select + .btn-seta-select {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
}

.btn-seta-select {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    background: #0f172a;
    color: var(--text);
    border: 1px solid #334155;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
    z-index: 1;
}

.btn-seta-select:hover:not(:disabled) {
    border-color: var(--accent);
    background: #1e293b;
    z-index: 2;
}

.btn-seta-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Cabeçalho da página de entrada ──────────────────────────── */
.entrada-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 28px;
    background: var(--panel);
    border-bottom: 1px solid #1e293b;
}

.entrada-header-titulo {
    font-weight: 800;
    font-size: 15px;
    color: var(--text);
}

.entrada-header-esquerda {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Logo (escudo ECM) no cabeçalho da entrada, registo e dados da equipa */
.entrada-header-logo {
    width: 44px;
    height: auto;
    display: block;
}

.entrada-header-manual {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 7px 14px;
    transition: background 0.15s, color 0.15s;
}
.entrada-header-manual:hover {
    background: var(--accent);
    color: #0f172a;
}

/* ── Banner de consentimento de cookies/RGPD ─────────────────── */
.cookie-consent-banner {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 900;
    background: #0f172a;
    border-top: 1px solid #334155;
    padding: 16px 24px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
.cookie-consent-banner p {
    margin: 0;
    font-size: 13px;
    color: var(--text);
    max-width: 760px;
    line-height: 1.5;
}
.cookie-consent-botoes {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
.cookie-consent-aceitar, .cookie-consent-recusar {
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #334155;
}
.cookie-consent-aceitar {
    background: var(--accent);
    color: #0f172a;
    border-color: var(--accent);
}
.cookie-consent-recusar {
    background: transparent;
    color: var(--muted);
}
.cookie-consent-recusar:hover {
    color: var(--text);
}

/* ── Espaços reservados para publicidade (passiva, futura) ──────
   Marcados de forma bem visível de propósito, para se perceber já
   o impacto no layout — quando os anúncios reais forem activados,
   este estilo passa a discreto/neutro. Nunca aparecem para
   utilizadores com Premium activo. */
.ad-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-linear-gradient(45deg, #1e293b, #1e293b 10px, #172033 10px, #172033 20px);
    border: 2px dashed #475569;
    border-radius: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.ad-placeholder-topo {
    height: 90px;
    margin: 16px 20px 0;
}

.ad-placeholder-sidebar {
    height: 250px;
    margin: 16px 0;
}

.ad-placeholder-label {
    background: rgba(15,23,42,0.75);
    padding: 6px 12px;
    border-radius: 6px;
}

/* ══════════════════════════════════════════════════════════════
   MENU LATERAL — painel deslizante em ecrãs pequenos
   ══════════════════════════════════════════════════════════════ */
.sidebar-toggle-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    padding: 6px;
    margin-right: 10px;
    flex-shrink: 0;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
}
.sidebar-backdrop-visivel {
    display: block;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVO — tablets e telemóveis
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    /* Impede que a PÁGINA (não um elemento em particular) fique alguma
       vez mais larga do que o ecrã. É esse arrastamento horizontal do
       documento todo — normalmente causado por algum conteúdo largo
       nalgum sítio — que faz o cabeçalho "fixed" parecer deslizar
       junto com o resto da página em vários browsers móveis. Qualquer
       conteúdo demasiado largo passa a ser cortado aqui, em vez de
       alargar a página; os elementos que já têm o próprio scroll
       interno (tabelas, timeline, etc.) continuam a funcionar na mesma. */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    .container {
        overflow-x: hidden;
    }

    .sidebar-toggle-btn {
        display: block;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 20px rgba(0,0,0,0.4);
    }
    .sidebar.sidebar-aberta {
        transform: translateX(0);
    }

    .header {
        padding: 8px 10px;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 10px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 500;
    }
    /* Espaço reservado no topo do conteúdo, já que o cabeçalho passou a
       "fixed" (fica sempre no mesmo sítio, mesmo com arrastamento
       horizontal do resto da página) e sai do fluxo normal */
    .main-content {
        padding-top: var(--altura-header-mobile, 90px);
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        overflow-y: visible;
    }
    .main-content .ad-placeholder-topo {
        margin-top: 0 !important;
    }
    .sidebar-toggle-btn {
        padding: 4px;
        margin-right: 6px;
    }
    .sidebar-toggle-btn svg {
        width: 18px;
        height: 18px;
    }
    .team-name {
        font-size: 15px;
    }
    .manager-name {
        font-size: 11px;
    }
    /* Botão "Sair" mais pequeno, para caber junto com o resto dos
       botões (incluindo o de Fóruns) sem ficar cortado */
    .logout-btn {
        padding: 6px 8px;
        font-size: 11px;
    }
    .logout-btn svg {
        width: 13px;
        height: 13px;
        margin-right: 0 !important;
    }
    /* Cabeçalho no telemóvel: [menu] [nome da equipa] [botões] [Sair], tudo na mesma linha, com o Sair sempre no
       canto superior direito. O nome da equipa ocupa o espaço que sobra e quebra a linha dentro da sua coluna se for
       comprido, em vez de empurrar os botões para baixo. */
    .sidebar-toggle-btn { order: 0; flex: 0 0 auto; }
    .header-equipa {
        order: 1;
        flex: 1 1 0;
        min-width: 0;
    }
    .team-name { overflow-wrap: anywhere; }
    .header-actions {
        order: 2;
        flex: 0 0 auto;
        gap: 3px;
        flex-wrap: nowrap;
        justify-content: flex-end;
    }
    .header > form {
        order: 3;
        flex: 0 0 auto;
        margin: 0;
    }
    .header-actions .general-btn span {
        display: none;
    }
    .header-actions .general-btn {
        padding: 6px;
        font-size: 12px;
    }
    .logout-btn span {
        display: none;
    }

    .body-jogo {
        padding: 12px !important;
        width: 100%;
        max-width: 100vw;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    .card {
        margin: 6px 0;
        padding: 12px;
    }

    .grid {
        gap: 10px;
    }

    /* Formulários — label por cima do campo em vez de lado a lado */
    .form-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .form-group label {
        width: auto;
        margin-right: 0;
    }

    /* Tabelas largas — scroll horizontal em vez de sobreposição/esmagamento */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Modais — nunca mais largas do que o ecrã */
    .modal-content {
        width: 94vw;
        max-width: 94vw;
        max-height: 90vh;
        overflow-y: auto;
        padding: 16px;
    }

    .ad-placeholder-topo {
        height: 60px;
        margin: 10px 12px 0;
        font-size: 10px;
    }

    /* Estatísticas do hero (Informação Geral / Equipa) — menos colunas */
    .geral-hero-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Modal do jogador — os botões do canto superior direito (fechar e
       transferência) ficam empilhados na vertical e só com o ícone, para
       o nome do jogador ter a largura toda da linha. Só no telemóvel. */
    .player-modal-header {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: start;
        column-gap: 10px;
        row-gap: 6px;
    }
    .player-modal-header .badge-posicao { grid-column: 1; grid-row: 1; }
    .player-modal-header h2             { grid-column: 2; grid-row: 1 / span 3; min-width: 0; overflow-wrap: anywhere; }
    .player-modal-header .btn-fechar-tatica { grid-column: 3; grid-row: 1; justify-self: end; }
    .player-modal-header .pm-transferencia-acoes-header {
        grid-column: 3;
        grid-row: 2;
        flex-direction: column;
        align-items: stretch;
    }
    /* Comparar: por baixo dos outros botões, à direita, só com o símbolo */
    .player-modal-header .pm-comparar-wrap {
        grid-column: 3;
        grid-row: 3;
        justify-self: end;
    }
    .player-modal-header .btn-pm-comparar span { display: none; }
    .player-modal-header .btn-pm-comparar { padding: 7px 10px; font-size: 14px; }
    .btn-pm-transfer span {
        display: none;
    }
    .btn-pm-transfer {
        padding: 7px 10px;
        font-size: 14px;
    }

    /* Modal do jogador — barras de atributos maiores e mais legíveis */
    .atributo-row {
        gap: 8px;
    }
    .atributo-label {
        width: 92px;
        font-size: 12px;
    }
    .atributo-barra {
        height: 14px;
    }
    .player-modal-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Ecrãs muito estreitos: o Sair fica na 1.ª linha (canto superior direito) e os botões passam para uma
   2.ª linha, alinhados à direita */
@media (max-width: 380px) {
    .header > form { order: 2; }
    .header-actions {
        order: 3;
        flex: 1 0 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .team-name {
        font-size: 15px;
    }
    .hero-titulo {
        font-size: 34px;
    }
    .header-actions .general-btn-premium span {
        display: none;
    }

    .geral-hero-stats {
        grid-template-columns: 1fr !important;
    }
}

/* ── Botão de táctica de um jogo — partilhado por Informação Geral,
   Jogos, Campeonato, Taça e Mundial de Clubes (estava só em
   campeonato.css, por isso não aparecia estilizado nas páginas que
   não carregam esse ficheiro) ─────────────────────────────────── */
.btn-jornada-tatica {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
    background: var(--accent);
    color: #0f172a;
}

.btn-jornada-tatica:hover { opacity: 0.85; }

.btn-jornada-tatica.btn-tatica-definida {
    background: #065f46;
    color: #6ee7b7;
    border: 1px solid #22c55e;
}

.btn-jornada-tatica.btn-tatica-definida:hover {
    background: #047857;
    opacity: 1;
}

.btn-jornada-tatica:disabled {
    background: #334155;
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Botão de relatório de um jogo — partilhado (estava só em
   campeonato.css, com o mesmo problema do botão de táctica acima) */
.btn-jornada-relatorio {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 5px;
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 4px;
}
.btn-jornada-relatorio:hover { background: rgba(56,189,248,0.1); }

/* ── Aviso com o "title" de um elemento, mostrado também ao toque
   (telemóvel/tablet) — ver jogo-utils.js ────────────────────────── */
.toque-title-toast {
    display: none;
    position: fixed;
    z-index: 99999;
    max-width: min(300px, calc(100vw - 16px));
    background: #0f172a;
    color: var(--text);
    border: 1px solid #334155;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-line;      /* respeita as quebras de linha do texto (listas, critérios, ...) */
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    pointer-events: none;
}
.toque-title-toast.toque-title-toast-visivel {
    display: block;
}

/* ── Etiqueta Casa/Fora/Neutro de um jogo — partilhada por Informação
   Geral, Jogos, Consulta de Outras Equipas (estava só em jogos.css,
   por isso não aparecia com fundo nas páginas que não carregam esse
   ficheiro, como a Informação Geral) ─────────────────────────────── */
.badge-local {
    display: inline-block;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
    text-transform: uppercase;
}

.badge-local.casa {
    background: #065f46;
    color: #6ee7b7;
}

.badge-local.fora {
    background: #1e3a5f;
    color: #93c5fd;
}

.badge-local.neutro {
    background: #422f0a;
    color: #fbbf24;
}

/* ── Rodapé com links legais (Privacidade/Termos) — entrada e layout ── */
.rodape-legal {
    text-align: center;
    padding: 16px 10px;
    font-size: 12px;
    color: var(--muted);
}
.rodape-legal a {
    color: var(--muted);
    text-decoration: none;
}
.rodape-legal a:hover {
    color: var(--accent);
    text-decoration: underline;
}
.rodape-legal span {
    margin: 0 8px;
}

/* ── Aceitação dos Termos/Privacidade no registo ─────────────────── */
.form-group-aceitar-termos {
    display: block;
}
.form-group-aceitar-termos label.label-aceitar-termos {
    display: flex;
    width: auto;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    font-weight: normal;
    cursor: pointer;
    line-height: 1.5;
    margin-right: 0;
}
.label-aceitar-termos input[type="checkbox"] {
    width: auto;
    margin-top: 3px;
    flex-shrink: 0;
    cursor: pointer;
}
.label-aceitar-termos a {
    color: var(--accent);
}

/* ── Aviso de versão de testes — página de Entrada ───────────────── */
.aviso-versao-testes {
    background: #422f0a;
    color: #fbbf24;
    border-bottom: 1px solid #78350f;
    text-align: center;
    padding: 10px 16px;
    font-size: 13px;
    line-height: 1.5;
}
.aviso-versao-testes strong {
    color: #fde68a;
}

/* ── Bloqueio global de botões enquanto há pedidos POST pendentes ───────
   O bloqueio em si é feito em JavaScript (app.js ignora os cliques); isto
   só dá o aspecto. A lista acompanha SELETOR_BOTOES em app.js. O atraso
   de 150 ms (em app.js) evita que os botões "pisquem" em pedidos rápidos. */
html.ui-bloqueada :is(button,
                      input[type="button"],
                      input[type="submit"],
                      input[type="reset"],
                      input[type="image"],
                      [role="button"],
                      a[class*="btn"]):not([data-sem-bloqueio], [data-sem-bloqueio] *) {
    opacity: 0.55;
    cursor: progress;
}

/* ── Modal do jogador: botão e menu "Comparar" ─────────────── */
.pm-comparar-wrap {
    position: relative;
    flex-shrink: 0;
}
.btn-pm-comparar {
    background: #1e293b;
    border: 1px solid #334155;
    color: var(--text);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}
.btn-pm-comparar:hover { border-color: var(--accent); color: var(--accent); }
.pm-comparar-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 20;
    min-width: 250px;
    max-width: 90vw;
    max-height: 320px;
    overflow-y: auto;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    padding: 4px 0;
}
.pm-cmp-titulo {
    padding: 8px 14px 4px;
    font-size: 11px;
    color: var(--muted);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.pm-cmp-item, .pm-cmp-equipa, .pm-cmp-voltar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
}
.pm-cmp-item:hover, .pm-cmp-equipa:hover, .pm-cmp-voltar:hover,
.pm-cmp-item:focus-visible, .pm-cmp-equipa:focus-visible, .pm-cmp-voltar:focus-visible {
    background: #263348;
    outline: none;
}
.pm-cmp-item .badge-posicao { font-size: 11px; padding: 1px 6px; min-width: 26px; text-align: center; }
.pm-cmp-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-cmp-equipa { justify-content: space-between; font-weight: bold; color: var(--accent); }
.pm-cmp-voltar { color: var(--muted); }
.pm-cmp-sep { border-top: 1px solid #334155; margin: 4px 0; }
.pm-cmp-vazio { padding: 8px 14px; font-size: 12px; color: var(--muted); font-style: italic; }

/* ── Modal de comparação (por cima da modal do jogador) ───── */
#compareModal { z-index: 1080; }
.cmp-content { max-width: 720px; }
.cmp-topo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.cmp-titulo { margin: 0; font-size: 16px; }
.cmp-tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid #334155;
    margin-bottom: 12px;
}
.cmp-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}
.cmp-tab:hover { color: var(--text); }
.cmp-tab-ativa { color: var(--accent); border-bottom-color: var(--accent); }

.cmp-linha {
    display: grid;
    grid-template-columns: 1fr 110px 1fr;
    align-items: center;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid #1e293b;
    font-size: 14px;
}
.cmp-cabecalho { border-bottom: 2px solid #334155; padding-bottom: 10px; }
.cmp-jogador { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.cmp-jogador-nome { font-weight: bold; overflow-wrap: anywhere; }
.cmp-label { text-align: center; color: var(--muted); font-size: 12px; }
.cmp-val { text-align: center; font-weight: bold; min-width: 0; overflow-wrap: anywhere; }
.cmp-melhor { color: #22c55e; }
/* Títulos das secções: o mesmo aspeto dos <h4> da modal do jogador */
.cmp-secao {
    color: var(--accent);
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 16px 0 12px;
    border-bottom: 1px solid #334155;
    padding-bottom: 6px;
}
/* Atributos: nome à esquerda e uma barra única partilhada pelos dois jogadores */
.cmp-atrib-linha {
    display: grid;
    grid-template-columns: 110px 1fr;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #1e293b;
    font-size: 14px;
}
.cmp-atrib-nome { color: var(--muted); font-size: 13px; }
.cmp-atrib-corpo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cmp-atrib-nomes { justify-content: space-between; align-items: flex-start; }
.cmp-atrib-num { width: 24px; text-align: center; font-weight: bold; flex-shrink: 0; }
.cmp-barra-unica {
    position: relative;
    flex: 1;
    height: 12px;
    background: #334155;
    border-radius: 6px;
    overflow: hidden;
}
.cmp-fill { position: absolute; top: 0; bottom: 0; background: #22c55e; }
.cmp-fill-esq { right: 50%; }   /* cresce do meio para a esquerda (jogador da esquerda mais forte) */
.cmp-fill-dir { left: 50%; }    /* cresce do meio para a direita */
.cmp-meio {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    margin-left: -1px;
    background: var(--panel);
}
.cmp-melhor.cmp-atrib-num { color: #22c55e; }

@media (max-width: 900px) {
    .cmp-linha { grid-template-columns: 1fr 84px 1fr; gap: 4px; font-size: 13px; }
    .cmp-atrib-linha { grid-template-columns: 82px 1fr; gap: 4px; }
    .cmp-atrib-nome { font-size: 12px; }
    .cmp-label { font-size: 11px; }
    .pm-comparar-menu { max-height: 260px; }
}


/* ══════════════════════════════════════════════════════════════════════
   LISTAS EM VEZ DE TABELAS — só no telemóvel (até 700px)
   Plantel, Jogos, Treino (Individual) e Transferências.
   Sem cabeçalhos: cada jogador passa a ser um cartão com várias linhas, que
   só usa a largura do ecrã (sem scroll horizontal). No computador nada muda.
   Os cartões são desenhados por lista-movel.js (só no telemóvel, no lugar da
   tabela) e a ordenação faz-se com a barra .lm-ordenar (critério + sentido).
   ══════════════════════════════════════════════════════════════════════ */

/* Fora do telemóvel não existem a lista nem a barra de ordenação */
.lm-lista,
.lm-ordenar { display: none; }

@media (max-width: 700px) {

    .lm-lista { display: block; }
    table.lista-movel { display: none !important; }

    /* ── Barra de ordenação: critério + sentido (como na tática) ── */
    .lm-ordenar {
        display: flex;
        align-items: center;
        gap: 8px;
        margin: 0 0 10px;
    }
    .pf-wrap .lm-ordenar { margin: 0 10px 10px; }   /* o Plantel tem margens laterais próprias */
    .lm-ordenar-label {
        font-size: 12px;
        color: var(--muted);
        font-weight: bold;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        flex-shrink: 0;
    }
    .lm-criterio {
        flex: 0 1 auto;   /* nunca passa a largura máxima; só encolhe */
        width: 220px;
        max-width: 100%;
        min-width: 0;
        background: #0f172a;
        color: var(--text);
        border: 1px solid #334155;
        border-radius: 6px;
        padding: 7px 10px;
        font-size: 14px;
    }
    .lm-criterio:focus { outline: none; border-color: var(--accent); }
    .lm-sentido {
        flex-shrink: 0;
        width: 40px;
        padding: 7px 0;
        background: #1e293b;
        color: var(--text);
        border: 1px solid #334155;
        border-radius: 6px;
        font-size: 13px;
        cursor: pointer;
    }

    /* ── Cartão do jogador ─────────────────────────────────────── */
    .lm-cartao {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding: 10px 12px;
        border-bottom: 1px solid #334155;
    }
    .lm-cartao:last-child { border-bottom: 0; }
    .lm-cartao.pf-linha,
    .lm-cartao[data-id] { cursor: pointer; }
    .lm-cartao.pf-linha:active,
    .lm-cartao[data-id]:active { background: rgba(56, 189, 248, 0.08); }

    /* 1.ª linha: posição + nome */
    .lm-cab {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
    }
    .lm-c-pos { flex: 0 0 auto; }
    .lm-c-nome {
        flex: 1 1 0;
        min-width: 0;
        font-size: 15px;
        font-weight: 600;
        overflow-wrap: anywhere;
    }

    /* Linhas de fluxo: os itens ficam lado a lado se couberem; senão, passam para a linha de baixo.
       Um grupo (.lm-unid, ex.: Idade + Condição) nunca se separa. */
    .lm-linha,
    .lm-unid {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px 16px;
        font-size: 13px;
        min-width: 0;
    }
    .lm-item {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        min-width: 0;
    }
    .lm-rot { color: var(--muted); font-size: 11px; flex-shrink: 0; }
    .lm-acao { margin-left: auto; }

    /* Grelhas uniformes: 5 valores por linha, distribuídos por toda a largura */
    .lm-grade {
        display: grid;
        grid-template-columns: repeat(var(--n, 5), 1fr);
        gap: 6px 4px;
        text-align: center;
    }
    .lm-cel {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1px;
        min-width: 0;
    }
    .lm-cel .lm-val { font-size: 14px; }

    /* Estatísticas: uma linha por competição, com o símbolo só no início */
    .lm-grade-rotulo {
        grid-template-columns: auto repeat(var(--n, 5), 1fr);
        align-items: center;
    }
    .lm-grade-sim { font-size: 16px; padding-right: 6px; }
    .lm-grade-rotulo + .lm-grade-rotulo {
        border-top: 1px solid #1e293b;
        padding-top: 6px;
    }

    /* Treino: a caixa do atributo cresce/encolhe nos ecrãs pequenos, sem crescer demasiado nos maiores */
    .lm-i-atribTreino { flex: 1 1 200px; max-width: 320px; }
    .lm-i-atribTreino .lm-val { flex: 1; min-width: 0; }
    .lm-i-atribTreino .select-atributo { width: 100%; max-width: 240px; }

    /* "Sem jogadores / sem resultados" */
    .lm-lista .sem-jogadores,
    .lm-lista .trf-sem-resultados {
        text-align: center;
        padding: 24px 8px;
        color: var(--muted);
        font-size: 14px;
    }

    /* ── Jogos: competição + data / adversário + resultado / ação ── */
    table.tabela-jogos,
    table.tabela-jogos tbody {
        display: block !important;
        width: 100% !important;
        overflow: visible !important;
        white-space: normal !important;
    }
    table.tabela-jogos thead { display: none !important; }

    table.tabela-jogos tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "comp data"
            "adv  res"
            "acao acao";
        align-items: center;
        gap: 6px 12px;
        padding: 10px 12px;
        border-bottom: 1px solid #334155;
    }
    table.tabela-jogos tbody tr:last-child { border-bottom: 0; }

    table.tabela-jogos td {
        padding: 0 !important;
        border: 0 !important;
        text-align: left !important;
        min-width: 0;
        white-space: normal !important;
    }
    table.tabela-jogos td.jogo-comp { grid-area: comp; }
    table.tabela-jogos td.jogo-data { grid-area: data; text-align: right !important; }
    table.tabela-jogos td.jogo-adv  { grid-area: adv; font-weight: 600; overflow-wrap: anywhere; }
    table.tabela-jogos td.jogo-res  { grid-area: res; text-align: right !important; }
    table.tabela-jogos td.jogo-acao { grid-area: acao; text-align: right !important; }
    /* sem resultado ainda: não mostra o "—" */
    table.tabela-jogos td.jogo-sem-resultado { display: none; }
    table.tabela-jogos td.sem-jogos {
        grid-area: auto;
        grid-column: 1 / -1;
        text-align: center !important;
        padding: 24px 8px !important;
    }
}


/* ── Páginas de entrada/registo/recuperação: logo completo e ajuste ao ecrã ───────── */
.hero-logo.compacto { margin: 0 0 10px; }
.hero-logo.compacto img { width: auto; max-width: 100%; height: 130px; }
.body-entrada .hero:has(.hero-logo.compacto) { margin-top: 14px; }
.body-entrada .hero:has(.hero-logo.compacto) p { margin-bottom: 20px; }

/* Entrada: tudo num só ecrã, sem scroll (logo à esquerda, acesso à direita) */
body.pagina-entrada {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}
body.pagina-entrada .entrada-fit {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(24px, 6vw, 90px);
    padding: 12px 24px;
}
.entrada-fit .hero {
    margin: 0;
    flex: 0 1 420px;
    min-width: 0;
}
.entrada-fit .hero-eyebrow { margin-bottom: 2px; }
.entrada-fit .hero-logo { margin: 0 0 8px; }
.entrada-fit .hero-logo img {
    width: auto;
    max-width: 100%;
    height: clamp(200px, 46vh, 400px);
}
.entrada-fit .hero p {
    font-size: 16px;
    margin: 0;
}
.entrada-coluna {
    flex: 0 0 340px;
    width: 340px;
    max-width: 100%;
}
.entrada-coluna form { display: block; }
.entrada-coluna .grid { display: block; }
.entrada-coluna .card {
    width: auto !important;
    margin: 0 0 12px;
    box-sizing: border-box;
}
.entrada-coluna .card h2 { margin: 0 0 10px; }
.entrada-coluna .sucess,
.entrada-coluna .error { margin: 0 0 10px; }
.entrada-coluna .social-login { margin-top: 12px; }
.entrada-coluna .social-login p { margin: 0 0 6px; }
.entrada-coluna .register-btn { margin-top: 6px; }
.entrada-coluna .card > p { margin: 0 0 4px; }

/* Ecrãs baixos (portáteis): compactar */
@media (max-height: 720px) {
    .entrada-header { padding: 8px 24px; }
    .entrada-header-logo { width: 34px; }
    body.pagina-entrada .aviso-versao-testes { font-size: 12px; line-height: 1.35; padding: 6px 16px; }
    body.pagina-entrada .rodape-legal { padding: 8px 10px; }
    .entrada-fit .hero-logo img { height: clamp(160px, 42vh, 400px); }
    .entrada-fit .hero p { font-size: 14px; }
    .entrada-coluna .card { padding: 10px 14px; margin-bottom: 8px; }
    .entrada-coluna .card h2 { font-size: 20px; margin-bottom: 6px; }
    .entrada-coluna .form-group { margin-bottom: 8px; }
    .entrada-coluna .social-login { margin-top: 8px; }
}

/* Telemóvel / ecrãs estreitos: logo ao lado do texto de boas-vindas */
@media (max-width: 900px) {
    body.pagina-entrada .entrada-fit {
        flex-direction: column;
        justify-content: flex-start;
        gap: 8px;
        padding: 8px 12px;
    }
    .entrada-fit .hero {
        flex: 0 0 auto;
        display: block;
        max-width: 420px;
        text-align: center;
    }
    .entrada-fit .hero-eyebrow { margin: 0 0 2px; font-size: 12px; text-align: center; }
    .entrada-fit .hero-logo { margin: 0 0 4px; }
    .entrada-fit .hero-logo img { height: 124px; }
    .entrada-fit .hero p { font-size: 13px; line-height: 1.3; margin: 0; text-align: center; }
    .hero-logo.compacto img { height: 100px; }
    .entrada-header { padding: 8px 14px; }
    .entrada-header-logo { width: 32px; }
    body.pagina-entrada .aviso-versao-testes { font-size: 11px; line-height: 1.3; padding: 6px 10px; }
    body.pagina-entrada .rodape-legal { padding: 8px 10px; }
    .entrada-coluna { flex: 0 0 auto; width: 100%; max-width: 380px; }
    .entrada-coluna .card { padding: 10px 14px; margin-bottom: 8px; }
    .entrada-coluna .card h2 { font-size: 19px; margin-bottom: 6px; }
    .entrada-coluna .form-group { margin-bottom: 8px; }
    .entrada-coluna .social-login { margin-top: 8px; }
}

/* Marca de água do menu no telemóvel: tamanho intermédio, por baixo do nome e acima do bloco de publicidade */
@media (max-width: 900px) {
    .sidebar {
        background-position: center 92px;
        background-size: 160px auto;
    }
}

/* ── Telemóvel (escala 1): elementos maiores, aproveitando a altura do ecrã ───── */
@media (max-width: 900px) {
    body.pagina-entrada .entrada-fit {
        justify-content: space-evenly;
        gap: 0;
        padding: 6px 14px;
    }
    .entrada-fit .hero-eyebrow { font-size: 13px; }
    .entrada-fit .hero-logo img { height: clamp(100px, 19dvh, 190px); }
    .entrada-fit .hero p { font-size: 15px; line-height: 1.3; }
    .entrada-coluna { max-width: 420px; }
    .entrada-coluna .card { padding: 14px 16px; margin-bottom: 10px; }
    .entrada-coluna .card h2 { font-size: 22px; margin-bottom: 10px; }
    .entrada-coluna .form-group { flex-direction: row; align-items: center; gap: 0; margin-bottom: 10px; }
    .entrada-coluna .form-group label { width: 112px; margin-right: 8px; font-size: 16px; }
    .entrada-coluna .form-group input { flex: 1; min-width: 0; height: 38px; font-size: 16px; box-sizing: border-box; }
    .entrada-coluna .entrada-btn { padding: 12px; font-size: 16px; }
    .entrada-coluna .link-btn { display: inline-block; margin: 8px 0 2px; font-size: 15px; }
    .entrada-coluna .social-btn { padding: 12px; font-size: 16px; }
    .entrada-coluna .social-login p { font-size: 15px; }
    .entrada-coluna .card > p { font-size: 16px; }
    .entrada-coluna .register-btn { font-size: 16px; padding: 11px 16px; }
    .entrada-header-titulo { font-size: 16px; }
    /* Aviso de testes: 2 linhas; tocar para ver tudo */
    body.pagina-entrada .aviso-versao-testes {
        font-size: 12px;
        cursor: pointer;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        padding: 0 10px;
        border-top: 6px solid #422f0a;
        border-bottom: 6px solid #422f0a;
    }
    body.pagina-entrada .aviso-versao-testes.aberto { display: block; }
    body.pagina-entrada .rodape-legal { font-size: 13px; }
}
/* Telemóveis de ecrã baixo: dispensar a frase de boas-vindas */
@media (max-width: 900px) and (max-height: 780px) {
    .entrada-fit .hero p { display: none; }
}

/* Registo, dados da equipa e recuperação de palavra-passe no telemóvel */
@media (max-width: 900px) {
    .body-entrada .grid .card { width: auto !important; max-width: 520px; box-sizing: border-box; }
    .body-entrada .grid { justify-content: center; }
    .form-group-registo { flex-direction: column; align-items: stretch; gap: 4px; margin-bottom: 12px; }
    .form-group-registo label { width: auto; margin-right: 0; font-size: 16px; }
    .form-group-registo input,
    .form-group-registo select { width: 100%; box-sizing: border-box; height: 40px; font-size: 16px; }
    .form-group-registo .select2-container { width: 100% !important; }
    .body-entrada .card .entrada-btn { padding: 13px; font-size: 16px; }
    .body-entrada .card .register-btn { font-size: 16px; }
    .hero-logo.compacto img { height: 120px; }
    .body-entrada .hero:has(.hero-logo.compacto) p { font-size: 15px; padding: 0 12px; margin-bottom: 14px; }
}

/* Telemóvel: ajustes finos (não encolher cabeçalho/aviso/rodapé; cartão "Criar Conta" numa linha) */
@media (max-width: 900px) {
    body.pagina-entrada > header,
    body.pagina-entrada > .aviso-versao-testes,
    body.pagina-entrada > .rodape-legal { flex-shrink: 0; }
    .entrada-coluna .form-group label { width: 126px; font-size: 15px; white-space: nowrap; }
    .entrada-coluna form .grid:last-child .card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    .entrada-coluna form .grid:last-child .card > p { margin: 0; }
    .entrada-coluna form .grid:last-child .register-btn { margin: 0; white-space: nowrap; }
    .entrada-coluna .card h2 { margin-bottom: 8px; }
    .entrada-coluna .form-group { margin-bottom: 8px; }
}
@media (max-width: 900px) and (max-height: 720px) {
    .entrada-fit .hero-logo img { height: 92px; }
    .entrada-fit .hero-eyebrow { font-size: 12px; }
    .entrada-coluna .card { padding: 10px 14px; margin-bottom: 8px; }
    .entrada-coluna .card h2 { font-size: 20px; margin-bottom: 6px; }
    .entrada-coluna .form-group input { height: 34px; }
    .entrada-coluna .entrada-btn,
    .entrada-coluna .social-btn { padding: 9px; }
    .entrada-coluna .social-login { margin-top: 6px; }
    .entrada-header { padding: 6px 14px; }
}
@media (max-width: 900px) and (max-height: 640px) {
    .entrada-fit .hero-logo img { height: 74px; }
    .entrada-coluna .card { padding: 8px 12px; margin-bottom: 6px; }
    .entrada-coluna .form-group { margin-bottom: 6px; }
}
@media (max-width: 900px) {
    .body-entrada:not(.entrada-fit) .grid .card { margin: 10px 12px; }
}

/* Link do Manual no rodapé da entrada */
.rodape-legal a.rodape-manual { color: var(--accent); font-weight: 600; }

/* Cartão "Ainda não tem conta?" / "Já tem conta?" — numa só linha no telemóvel */
@media (max-width: 900px) {
    .card.card-conta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
    }
    .grid > .card.card-conta { flex: 1 1 0; }
    .card.card-conta > p { margin: 0; font-size: 16px; }
    .card.card-conta .register-btn { margin: 0; white-space: nowrap; font-size: 16px; padding: 11px 16px; }
}

/* Registo: linha de aceitação dos termos legível no telemóvel */
@media (max-width: 900px) {
    .form-group-aceitar-termos { display: block; }
    .form-group-aceitar-termos label.label-aceitar-termos {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        font-size: 15px;
        line-height: 1.45;
        width: auto;
    }
    .label-aceitar-termos input[type="checkbox"] {
        width: 22px;
        height: 22px;
        margin: 1px 0 0;
        flex: 0 0 22px;
    }
    .label-aceitar-termos span { flex: 1; min-width: 0; }
}
