/* ── Reset & variáveis ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:      #16a34a;
    --primary-dark: #15803d;
    --primary-light:#dcfce7;
    --accent:       #f59e0b;
    --accent-light: #fef3c7;
    --danger:       #dc2626;
    --danger-light: #fee2e2;
    --success:      #16a34a;
    --success-light:#dcfce7;
    --bg:           #f0fdf4;
    --surface:      #ffffff;
    --border:       #d1fae5;
    --border-dark:  #a7f3d0;
    --text:         #1c1917;
    --text-muted:   #6b7280;
    --text-light:   #9ca3af;
    --radius:       10px;
    --radius-sm:    6px;
    --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg:    0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
    --transition:   0.18s ease;
}

html { font-size: 16px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

.main-content {
    flex: 1;
    padding: 1.5rem 1rem 3rem;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
    background: var(--surface);
    border-bottom: 2px solid var(--border-dark);
    padding: .75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    overflow: visible;
}
.header-inner { overflow: visible; }

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo { display: flex; align-items: center; text-decoration: none; }
.logo:hover { opacity: .85; }
.logo-img { height: 80px; width: auto; display: block; margin: -16px 0; }

.header-nav { display: flex; gap: .5rem; align-items: center; }

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: .25rem;
    z-index: 101;
}
.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .25s ease, opacity .25s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 600px) {
    .nav-toggle { display: flex; }

    .header-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        border-bottom: 2px solid var(--border-dark);
        padding: .75rem 1rem;
        gap: .5rem;
        box-shadow: var(--shadow-md);
        z-index: 100;
    }
    .header-nav.is-open { display: flex; }
    .site-header { position: relative; }
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: .85rem;
    margin-top: auto;
}

/* ── Botões ─────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1.25rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-success {
    background: #059669;
    color: #fff;
    border-color: #059669;
}
.btn-success:hover { background: #047857; }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-dark);
}
.btn-ghost:hover { background: var(--border); color: var(--text); }

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger-light); }

.btn-sm  { padding: .35rem .85rem; font-size: .8rem; }
.btn-lg  { padding: .75rem 1.75rem; font-size: 1rem; }
.btn-full { width: 100%; }

/* ── Alertas ─────────────────────────────────────────────────────────────────── */
.alert {
    padding: .85rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: .9rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--success-light); color: #166534; border-color: #bbf7d0; }
.alert-error   { background: var(--danger-light);  color: #991b1b; border-color: #fca5a5; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ── Badges ──────────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.4;
}
.badge-success { background: var(--success-light); color: #166534; }
.badge-warning { background: var(--accent-light);  color: #92400e; }
.badge-neutral { background: #f3f4f6;              color: #374151; }
.badge-danger  { background: var(--danger-light);  color: #991b1b; }

/* ── Formulários ─────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: .4rem;
    font-size: .9rem;
    color: var(--text);
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group select,
.form-group textarea,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="tel"],
select {
    width: 100%;
    padding: .6rem .85rem;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-size: .95rem;
    font-family: var(--font);
    background: var(--surface);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22,163,74,.15);
}
.required { color: var(--danger); }
.hint { color: var(--text-muted); font-size: .85rem; margin-top: .35rem; }
.mt-1 { margin-top: 1rem; }

.form-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
}
.form-inline label { font-weight: 600; white-space: nowrap; }
.form-inline select { width: auto; }

/* ── Login ───────────────────────────────────────────────────────────────────── */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}
.brand-icon { font-size: 3rem; display: block; margin-bottom: .5rem; }
.login-brand h1 { font-size: 1.75rem; color: var(--primary); }
.login-brand p  { color: var(--text-muted); margin-top: .5rem; }
.login-logo { width: 260px; height: auto; display: block; margin: 0 auto; }

.login-form .btn { margin-top: .5rem; }

.login-footer {
    margin-top: 1.25rem;
    text-align: center;
    font-size: .875rem;
    color: var(--text-muted);
}
.login-footer a { color: var(--primary); text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }

.login-hint {
    margin-top: 1.25rem;
    text-align: center;
    font-size: .82rem;
    color: var(--text-muted);
}
.login-hint code {
    background: #f3f4f6;
    padding: .1rem .35rem;
    border-radius: 4px;
    font-size: .82rem;
}

/* ── Dashboard ───────────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: .75rem;
}
.page-header h1 { font-size: 1.75rem; }

.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}
.empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state h2 { font-size: 1.4rem; color: var(--text); margin-bottom: .5rem; }
.empty-state p  { margin-bottom: 1.5rem; }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.torneio-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}
.torneio-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-top {
    padding: 1.25rem 1.25rem .75rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
}
.card-title { font-size: 1.1rem; font-weight: 700; line-height: 1.3; flex: 1; }
.card-body { padding: 0 1.25rem .75rem; }
.card-meta {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    font-size: .85rem;
    color: var(--text-muted);
}
.campeao-destaque {
    margin-top: .75rem;
    padding: .5rem .75rem;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    color: #78350f;
}

.card-footer { padding: .75rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: .5rem; margin-top: auto; }
.card-footer form { margin: 0; width: 100%; }

/* ── Wizard ──────────────────────────────────────────────────────────────────── */
.wizard-container {
    max-width: 680px;
    margin: 0 auto;
}

.wizard-header { margin-bottom: 1.5rem; }
.wizard-header h1 { font-size: 1.6rem; margin-top: .5rem; }
.back-link { font-size: .9rem; color: var(--text-muted); }
.back-link:hover { color: var(--primary); }

.wizard-steps-bar {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: .25rem;
}

.wizard-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .3rem;
    opacity: .45;
    transition: opacity var(--transition);
    min-width: 60px;
}
.wizard-step-item.active { opacity: 1; }
.wizard-step-item.done   { opacity: .7; }

.step-circle {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--border-dark);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .85rem;
    transition: background var(--transition), color var(--transition);
}
.wizard-step-item.active .step-circle { background: var(--primary); color: #fff; }
.wizard-step-item.done   .step-circle { background: var(--primary); color: #fff; }
.wizard-step-item span { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }

.step-connector {
    flex: 1;
    height: 2px;
    background: var(--border-dark);
    min-width: 16px;
    margin-bottom: 1.1rem;
}

.wizard-pane { display: none; }
.wizard-pane.active { display: block; }
.wizard-pane h2 { margin-bottom: 1.25rem; font-size: 1.3rem; }

.wizard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}

/* Radio cards */
.radio-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.radio-cards.vertical {
    grid-template-columns: 1fr;
}

.radio-card {
    cursor: pointer;
    display: block;
}
.radio-card input[type="radio"] { display: none; }

.radio-card-content {
    border: 2px solid var(--border-dark);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    transition: border-color var(--transition), background var(--transition);
    background: var(--surface);
}
.radio-card-content:hover { border-color: var(--primary); }
.radio-card input:checked + .radio-card-content {
    border-color: var(--primary);
    background: var(--primary-light);
}

.radio-card-icon { font-size: 1.75rem; margin-bottom: .4rem; }
.radio-card-content strong { display: block; font-size: 1rem; margin-bottom: .25rem; }
.radio-card-content p { font-size: .82rem; color: var(--text-muted); line-height: 1.4; margin: 0; }

/* Jogadores / duplas dinâmicas */
.jogador-row, .dupla-row {
    display: flex;
    gap: .5rem;
    align-items: flex-end;
    margin-bottom: .6rem;
}
.jogador-row input, .dupla-row input { flex: 1; }
.jogador-row select { width: 130px; flex-shrink: 0; }
.btn-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--danger);
    font-size: 1.25rem;
    padding: .4rem .5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    flex-shrink: 0;
}
.btn-remove:hover { background: var(--danger-light); }

/* Loading */
.loading-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-dark);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Preview sorteio */
.sorteio-preview h3     { font-size: 1.1rem; margin-bottom: .75rem; }
.duplas-preview-list    { list-style: none; display: grid; gap: .45rem; }
.duplas-preview-list li {
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: .55rem 1rem;
    font-size: .9rem;
    border-left: 3px solid var(--primary);
}
.e-slash { color: var(--text-muted); margin: 0 .25rem; }
.preview-legend { margin-top: .5rem; font-size: .8rem; color: var(--text-muted); }
.preview-legend .leg { margin-right: .75rem; }

.grupos-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem;
    margin-bottom: .75rem;
}
.grupo-preview-card {
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    border: 1px solid var(--border-dark);
}
.grupo-preview-card h4 { font-size: .95rem; margin-bottom: .5rem; color: var(--primary-dark); }
.grupo-preview-card ul { list-style: none; font-size: .85rem; }
.grupo-preview-card li { padding: .2rem 0; border-bottom: 1px solid var(--border); }
.grupo-preview-card li:last-child { border-bottom: none; }

.preview-info { color: var(--text-muted); font-size: .85rem; margin-top: .5rem; }

.bracket-preview { font-size: .9rem; }
.preview-match {
    padding: .4rem .75rem;
    background: var(--surface);
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    margin-bottom: .4rem;
}
.preview-match.bye { color: var(--text-muted); font-style: italic; }

/* ── Página de Torneio ───────────────────────────────────────────────────────── */
.torneio-header {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}
.torneio-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .75rem;
}
.torneio-title { font-size: 1.75rem; font-weight: 800; margin-bottom: .5rem; }
.torneio-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: .85rem;
    color: var(--text-muted);
}

/* Campeão */
.campeao-banner {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-md);
}
.campeao-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}
.campeao-trophy  { font-size: 3.5rem; }
.campeao-label   { font-size: .85rem; color: #92400e; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.campeao-nome    { font-size: 2rem; font-weight: 800; color: #78350f; }

/* Accordion duplas */
.duplas-accordion {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.duplas-accordion summary {
    padding: .75rem 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: .9rem;
    color: var(--text-muted);
    user-select: none;
    list-style: none;
}
.duplas-accordion summary::-webkit-details-marker { display: none; }
.duplas-accordion summary::before {
    content: '▶';
    display: inline-block;
    font-size: .75rem;
    margin-right: .35rem;
    transition: transform .25s ease;
}
.duplas-accordion[open] summary::before { transform: rotate(90deg); }

.duplas-list-full {
    list-style: none;
    padding: .5rem 1rem 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .35rem;
    border-top: 1px solid var(--border);
    transform-origin: top;
    transition: opacity .3s ease, transform .3s ease;
}

@starting-style {
    .duplas-accordion[open] .duplas-list-full {
        opacity: 0;
        transform: scaleY(.96) translateY(-4px);
    }
}
.duplas-list-full li { font-size: .85rem; }
.dupla-lados { color: var(--text-muted); font-size: .8rem; }

/* Seções */
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--border-dark);
    color: var(--primary-dark);
}
.section-grupos, .section-chaveamento { margin-bottom: 2.5rem; }

/* Grupos */
.grupos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.grupo-section {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.grupo-title {
    background: var(--primary);
    color: #fff;
    padding: .65rem 1rem;
    font-size: 1rem;
    font-weight: 700;
}

/* Tabela de classificação */
.table-wrapper { overflow-x: auto; }
.classificacao-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}
.classificacao-table th,
.classificacao-table td {
    padding: .5rem .6rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}
.classificacao-table th { background: var(--primary-light); font-weight: 700; color: var(--primary-dark); }
.classificacao-table td.dupla-nome { text-align: left; font-weight: 600; min-width: 130px; }
.classificacao-table tr:last-child td { border-bottom: none; }
.classificacao-table tr:hover td { background: var(--bg); }

/* Jogos do grupo */
.grupo-jogos { padding: .75rem 1rem; }
.grupo-jogos h4 { font-size: .85rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .6rem; }

.jogo-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: .5rem;
    overflow: hidden;
    font-size: .875rem;
}
.jogo-row.finalizado { opacity: .8; }

.jogo-teams {
    /*display: flex;*/
    align-items: center;
/*    gap: .5rem;*/
    padding: .55rem .75rem;
/*    flex-wrap: wrap;*/
}
.jogo-teams .team { flex: 1; min-width: 80px; }
.jogo-teams .team.winner { font-weight: 700; color: var(--primary-dark); }
.vs { color: var(--text-light); font-size: .75rem; font-weight: 600; flex-shrink: 0; padding: 5px; }

.jogo-placar {
 /*   display: flex;*/
    align-items: center;
/*    justify-content: center;*/
/*    gap: .4rem;*/
    padding: .3rem .75rem .55rem;
    font-size: .95rem;
}
.score { font-weight: 700; font-size: 1.1rem; width: 1.8rem; text-align: center; color: var(--text-muted); }
.score.score-win { color: var(--primary); }
.score-sep { color: var(--text-light); margin: 0px 7px; }
.btn-edit-score { font-size: .7rem; padding: .15rem .45rem; opacity: 0; transition: opacity .15s; }
.jogo-row:hover .btn-edit-score { opacity: 1; }

.jogo-form-toggle { padding: .35rem .75rem .55rem; }

/* Formulário inline de placar */
.inline-score-form {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: .75rem;
}
.score-input-row {
 /*   display: flex;*/
    align-items: center;
/*    gap: .5rem;*/
/*    flex-wrap: wrap;*/
    margin-bottom: .5rem;
}
.score-input-row label { font-size: .8rem; flex: 1; min-width: 60px; font-weight: 600; margin: 0px 10px; }
.score-input {
    width: 60px !important;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
}
.form-actions { display: flex; gap: .4rem; }

/* ── Bracket (Chaveamento) ───────────────────────────────────────────────────── */
.bracket-wrapper { overflow-x: auto; padding-bottom: .5rem; }
.bracket-hint { font-size: .8rem; color: var(--text-muted); margin-top: .75rem; }

.bracket {
    display: flex;
    gap: 0;
    min-width: max-content;
    padding: .5rem 0 1rem;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.bracket-round-title {
    text-align: center;
    font-size: .78rem;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .4rem 1rem;
    margin-bottom: .5rem;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    margin: 0 .5rem .75rem;
}

.bracket-games {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: 1;
    gap: 12px;
    padding: 0 .5rem;
}

.bracket-game {
    background: var(--surface);
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: box-shadow var(--transition), border-color var(--transition);
    position: relative;
}
.bracket-game.editable { cursor: pointer; }
.bracket-game.editable:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}
.bracket-game.done { border-color: var(--border); opacity: .9; }

.bracket-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border);
    font-size: .85rem;
    min-height: 36px;
}
.bracket-team:last-of-type { border-bottom: none; }
.bracket-team.winner {
    background: var(--primary-light);
    font-weight: 700;
}
.bracket-team.bye { color: var(--text-light); font-style: italic; }
.team-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: .35rem; }
.team-score {
    font-weight: 800;
    font-size: 1rem;
    color: var(--primary);
    min-width: 22px;
    text-align: right;
}
.bracket-team.winner .team-score { color: var(--primary-dark); }

.bracket-form { border-top: 1px solid var(--border); }

.edit-hint {
    text-align: center;
    font-size: .7rem;
    color: var(--primary);
    padding: .25rem .5rem .35rem;
    background: rgba(22,163,74,.05);
    display: none;
}
.bracket-game.editable:hover .edit-hint { display: block; }

/* ── Tabs ────────────────────────────────────────────────────────────────────── */
.tabs {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.tab-bar {
    display: flex;
    background: var(--bg);
    border-bottom: 2px solid var(--border-dark);
}

.tab-btn {
    padding: .7rem 1.4rem;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font);
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.tab-btn:hover  { color: var(--primary); background: var(--primary-light); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--surface); }

.tab-pane          { display: none; padding: 1.25rem; }
.tab-pane.active   { display: block; }

/* Cabeçalho de rodada na aba Jogos */
.rodada-header {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 700;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .45rem 1rem;
    margin: .75rem -1.25rem .5rem;
    border-left: 3px solid var(--primary);
}
.rodada-header:first-child { margin-top: 0; }

/* Badge de grupo na aba Jogos (multi-grupo) */
.jogo-grupo-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    background: var(--primary);
    color: #fff;
    border-radius: 4px;
    padding: .1rem .45rem;
    margin-right: .4rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Action / Info boxes ─────────────────────────────────────────────────────── */
.action-box {
    background: var(--accent-light);
    border: 1.5px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-top: 1rem;
}
.action-box h3 { font-size: 1.05rem; margin-bottom: .4rem; }
.action-box p  { font-size: .9rem; color: var(--text-muted); margin-bottom: .85rem; }

/* Cartões de avanço (1 grupo) */
.advancement-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: .85rem;
    margin-top: .75rem;
}

.advancement-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    padding: 1.1rem 1rem;
    background: var(--surface);
    border: 2px solid var(--border-dark);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    font-family: var(--font);
    width: 100%;
}
.advancement-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: var(--shadow-md);
}
.adv-icon  { font-size: 2rem; }
.adv-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.adv-desc  { font-size: .8rem; color: var(--text-muted); line-height: 1.4; }

.info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    padding: .85rem 1.25rem;
    color: #1e40af;
    font-size: .9rem;
    margin-top: 1rem;
}

/* ── Jogadores ───────────────────────────────────────────────────────────────── */
.jogadores-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.jogador-form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}
.jogador-form-card h2 { font-size: 1.15rem; margin-bottom: 1.25rem; }

.jogadores-list-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.jogadores-table td,
.jogadores-table th { padding: .6rem .75rem; }
.jogadores-table td:last-child { width: 72px; }

.jogadores-actions { display: flex; gap: .35rem; justify-content: flex-end; align-items: center; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-dark);
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    padding: 0;
}
.btn-icon:hover { background: var(--border); color: var(--text); }
.btn-icon-edit:hover  { border-color: var(--primary); color: var(--primary); background: var(--primary-light, #eff6ff); }
.btn-icon-danger:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-light); }

.edit-row td { padding: .5rem .75rem; background: var(--bg); }
.edit-inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.edit-inline-form input[type="tel"] { flex: 1; min-width: 160px; }

/* Jogador selector no wizard */
.jogador-add-row {
    display: flex;
    gap: .5rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.jogador-add-row .typeahead-wrap-outer { flex: 1; min-width: 160px; }
.jogador-add-row select { flex: 0 0 140px; }

.jogadores-selecionados-list { margin-top: .75rem; }

/* Linha de empate na classificação */
tr.empate-pendente td { background: #fffbeb; }
tr.empate-pendente td:first-child::after { content: ' 🎲'; }

/* Caixa de ação de sorteio de empate */
.empate-box {
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-top: .75rem;
}
.empate-box h3 { font-size: 1rem; margin-bottom: .35rem; color: #1e40af; }
.empate-box p  { font-size: .88rem; color: #374151; margin-bottom: .75rem; }

@media (max-width: 720px) {
    .jogadores-layout { grid-template-columns: 1fr; }
}

/* ── Responsividade ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .wizard-steps-bar span { display: none; }
    .step-circle { width: 1.75rem; height: 1.75rem; font-size: .8rem; }
    .radio-cards { grid-template-columns: 1fr; }
    .grupos-grid { grid-template-columns: 1fr; }
    .cards-grid  { grid-template-columns: 1fr; }
    .campeao-nome { font-size: 1.5rem; }
    .score-input-row label { display: none; }
    .torneio-title { font-size: 1.4rem; }
    .bracket-round { min-width: 160px; }
    .login-card { padding: 1.75rem 1.25rem; }
}

@media (max-width: 400px) {
    .campeao-content { flex-direction: column; }
}

/* ── Rankings ────────────────────────────────────────────────────────────────── */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: .6rem;
    cursor: pointer;
    font-weight: 500;
}
.checkbox-label input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ── Rankings: responsividade ────────────────────────────────────────────────── */

/* Lista: metadados inline visíveis só no mobile */
.ranking-meta-mobile {
    display: none;
    font-size: .75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: .15rem;
}

/* Tabela de lista: ações */
.ranking-col-actions {
    text-align: right;
    white-space: nowrap;
}

/* Tabela de detalhe: rótulos completos/curtos */
.col-label-short { display: none; }
.col-label-full  { display: inline; }

@media (max-width: 640px) {
    /* Formulário: título menor e padding compacto */
    .jogador-form-card { padding: 1rem; }
    .jogador-form-card h2 { font-size: 1rem; margin-bottom: .85rem; }

    /* Lista: esconde colunas secundárias, mostra metadados inline */
    .ranking-list-table .ranking-col-count,
    .ranking-list-table .ranking-col-date { display: none; }
    .ranking-meta-mobile { display: block; }

    /* Lista: botões de ação empilhados */
    .ranking-col-actions {
        white-space: normal;
        text-align: right;
    }
    .ranking-col-actions .btn {
        display: block;
        width: 100%;
        text-align: center;
        margin-bottom: .25rem;
    }
    .ranking-col-actions .btn:last-child { margin-bottom: 0; }
    .ranking-col-actions form { display: block !important; }

    /* Detalhe: header empilhado */
    .ranking-detail-header {
        flex-direction: column;
        gap: .75rem;
    }
    .ranking-detail-header .btn { align-self: flex-start; }

    /* Detalhe: células da tabela mais compactas, rótulos abreviados */
    .ranking-detail-table td,
    .ranking-detail-table th { padding: .45rem .3rem; font-size: .82rem; }
    .col-label-full  { display: none; }
    .col-label-short { display: inline; }

    /* Share box: padding reduzido */
    .share-box { padding: .75rem 1rem; }
}

.ranking-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.ranking-detail-header h2 { margin: 0; }
.ranking-detail { width: 100%; }

/* ── Link público ────────────────────────────────────────────────────────────── */
.share-box {
    background: var(--surface, #f8f9fa);
    border: 1px solid var(--border, #e0e0e0);
    border-radius: var(--radius, 8px);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.share-label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .5rem;
    color: var(--text, #333);
}
.share-row {
    display: flex;
    gap: .5rem;
    align-items: center;
}
.share-input {
    flex: 1;
    font-size: .8rem;
    padding: .4rem .6rem;
    border: 1px solid var(--border, #e0e0e0);
    border-radius: var(--radius-sm, 4px);
    background: var(--bg, #fff);
    color: var(--text, #333);
    min-width: 0;
    cursor: text;
}
.share-hint {
    margin: .5rem 0 0;
    font-size: .78rem;
    color: var(--text-muted, #888);
}
@media (max-width: 500px) {
    .share-row { flex-direction: column; align-items: stretch; }
}

/* ── Paginação ───────────────────────────────────────────────────────────────── */
.paginacao {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: 1rem;
    align-items: center;
}
.paginacao-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: .3rem .6rem;
    font-size: .8rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
    transition: background .15s, border-color .15s;
    cursor: pointer;
}
.paginacao-btn:hover:not(.disabled):not(.active) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}
.paginacao-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    cursor: default;
}
.paginacao-btn.disabled {
    opacity: .4;
    cursor: default;
}

/* ── Toast de desfazer ───────────────────────────────────────────────────────── */
.undo-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: .75rem;
    background: #1e1e2e;
    color: #f0f0f0;
    padding: .75rem 1.1rem;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.35);
    font-size: .9rem;
    z-index: 9999;
    white-space: nowrap;
    animation: undo-in .25s ease;
}
.undo-toast-out {
    animation: undo-out .3s ease forwards;
}
@keyframes undo-in {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes undo-out {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to   { opacity: 0; transform: translateX(-50%) translateY(16px); }
}
.undo-toast-msg {
    font-weight: 500;
}
.undo-toast-btn {
    background: #6c63ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: .35rem .8rem;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.undo-toast-btn:hover {
    background: #574fd6;
}
.undo-toast-timer {
    font-size: .8rem;
    color: #aaa;
    min-width: 28px;
}
.undo-toast-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 1rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.undo-toast-close:hover { color: #fff; }
@media (max-width: 480px) {
    .undo-toast { font-size: .8rem; padding: .65rem .9rem; gap: .5rem; }
}

/* ── Regras de pontuação do ranking ────────────────────────────────────────── */
.scoring-rules {
    background: var(--surface);
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.scoring-rules summary {
    padding: .85rem 1.25rem;
    font-weight: 600;
    font-size: .95rem;
    color: var(--primary-dark);
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: .5rem;
    transition: background var(--transition);
}
.scoring-rules summary::-webkit-details-marker { display: none; }
.scoring-rules summary::after {
    content: '▸';
    margin-left: auto;
    font-size: .8rem;
    color: var(--text-muted);
    transition: transform var(--transition);
}
.scoring-rules[open] summary::after { transform: rotate(90deg); }
.scoring-rules summary:hover { background: var(--primary-light); }

.scoring-rules-body {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem 2rem;
}

.scoring-section h3 {
    font-size: .85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: .5rem;
}

.scoring-section ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

.scoring-section li {
    font-size: .9rem;
    color: var(--text);
    padding: .2rem 0;
    border-bottom: 1px solid var(--border);
}
.scoring-section li:last-child { border-bottom: none; }

.scoring-section li strong {
    color: var(--primary-dark);
    min-width: 4rem;
    display: inline-block;
}

.scoring-badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    background: var(--accent-light);
    color: #92400e;
    border-radius: 99px;
    padding: .1rem .5rem;
    vertical-align: middle;
    text-transform: none;
    letter-spacing: 0;
}

.scoring-note {
    grid-column: 1 / -1;
    font-size: .84rem;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: .6rem .85rem;
    margin-top: .25rem;
}

/* ── Typeahead (autocomplete de jogadores) ──────────────────────────────────── */
.typeahead-wrap-outer { flex: 1; min-width: 160px; }

.typeahead {
    position: relative;
    width: 100%;
}

.typeahead-input {
    width: 100%;
    padding: .6rem .85rem;
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-size: .95rem;
    font-family: var(--font);
    background: var(--surface);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.typeahead-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22,163,74,.15);
}
.typeahead-input::placeholder { color: var(--text-light); }

.typeahead-list {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1.5px solid var(--border-dark);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    list-style: none;
    max-height: 220px;
    overflow-y: auto;
    z-index: 200;
    overscroll-behavior: contain;
}

.typeahead-item {
    padding: .65rem .85rem;
    font-size: .93rem;
    cursor: pointer;
    color: var(--text);
    transition: background var(--transition);
    /* Touch target mínimo */
    min-height: 44px;
    display: flex;
    align-items: center;
}
.typeahead-item:hover,
.typeahead-item:focus {
    background: var(--primary-light);
    outline: none;
}
.typeahead-item + .typeahead-item {
    border-top: 1px solid var(--border);
}

/* Dentro da .dupla-row, os dois typeaheads ficam lado a lado */
.dupla-row .typeahead-wrap-outer {
    flex: 1;
    min-width: 130px;
}

/* Hint abaixo do campo quando lista está vazia */
.typeahead-empty {
    padding: .65rem .85rem;
    font-size: .88rem;
    color: var(--text-muted);
    font-style: italic;
}

@media (max-width: 600px) {
    .typeahead-list { max-height: 180px; }
    .typeahead-item { font-size: .9rem; }
}
