:root {
    --primary: #15803d;
    --primary-dark: #14532d;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --warn: #d97706;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

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

.container {
    width: 100%;
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 12px;
}

/* Header */
.site-header {
    background: var(--primary);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 56px;
    gap: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 800;
    font-size: 1.05rem;
    text-decoration: none;
}
.brand:hover { text-decoration: none; opacity: .95; }
.brand-logo { height: 32px; width: auto; object-fit: contain; border-radius: 6px; }
.brand-icon { font-size: 1.3rem; }

.nav-pill {
    display: inline-block;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: .84rem;
    font-weight: 600;
}
.nav-pill:hover { background: rgba(255, 255, 255, .28); text-decoration: none; }

.main-content { padding-top: 14px; padding-bottom: 32px; }

/* Cards & Buttons */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.card h2 { margin: 0 0 12px; font-size: 1.1rem; }
.card h3 { margin: 0 0 8px; font-size: 1rem; }

.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.card-header-row h2 { margin: 0; }

.hero-card {
    background: linear-gradient(135deg, var(--primary) 0%, #0f172a 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 18px 16px;
    margin-bottom: 14px;
}
.hero-card h1 { margin: 0 0 4px; font-size: 1.25rem; }
.hero-card p { margin: 0; font-size: .9rem; opacity: .92; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 700;
    font-size: .92rem;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s, transform .05s;
}
.btn:active { transform: scale(.99); }
.btn:hover { text-decoration: none; opacity: .92; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-dark { background: #0f172a; color: #fff; }
.btn-warn { background: #d97706; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-whatsapp { background: #16a34a; color: #fff; }
.btn-outline { background: transparent; border: 1px solid #cbd5e1; color: var(--text); }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 18px; font-size: 1rem; }
.btn-sm { padding: 7px 12px; font-size: .84rem; }
.btn-xs { padding: 4px 8px; font-size: .78rem; border-radius: 6px; }

.input, select.input, textarea.input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    font-size: .95rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
    margin-bottom: 10px;
}
.input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 12px;
    font-weight: 500;
    cursor: pointer;
}
.checkbox-row input { width: 18px; height: 18px; margin: 0; }

/* Lookup */
.lookup-card { margin-bottom: 16px; }
.lookup-form {
    display: flex;
    gap: 8px;
}
.lookup-form .input { margin-bottom: 0; flex: 1; }
.lookup-results { margin-top: 12px; display: grid; gap: 10px; }
.lookup-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    background: #f8fafc;
}
.lookup-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.lookup-item-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Sections & Round Cards */
.section-block { margin-top: 18px; }
.section-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.section-title-row h2 { margin: 0; font-size: 1.08rem; }

.badge {
    background: #e2e8f0;
    color: #1e293b;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 700;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-amber { background: #fef3c7; color: #92400e; }

.rounds-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 680px) {
    .rounds-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
    .rounds-grid { grid-template-columns: repeat(3, 1fr); }
}

.round-card { display: flex; flex-direction: column; gap: 10px; }
.round-open { border-top: 4px solid var(--primary); }
.round-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.round-title { margin: 0; font-size: 1.05rem; }
.round-meta { font-size: .88rem; color: #334155; display: grid; gap: 4px; }
.prize-highlight {
    margin-top: 4px;
    padding: 6px 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    color: #166534;
    font-weight: 700;
}

.status-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
}
.status-aberta { background: #dcfce7; color: #166534; }
.status-andamento { background: #fef3c7; color: #92400e; }
.status-encerrada { background: #e2e8f0; color: #334155; }
.status-cancelada { background: #fee2e2; color: #991b1b; }

.countdown {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: .84rem;
    color: var(--primary-dark);
}

.muted-sm { color: var(--muted); font-size: .82rem; }
.empty-state { text-align: center; color: var(--muted); padding: 20px; }

/* Round Banner */
.breadcrumb-bar { margin-bottom: 10px; }
.back-link { font-weight: 600; font-size: .9rem; }
.round-banner { margin-bottom: 14px; }
.round-banner-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}
.round-banner h1 { margin: 6px 0 0; font-size: 1.25rem; }
.banner-countdown {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 6px 12px;
    text-align: center;
}
.banner-countdown small { display: block; font-size: .72rem; color: #166534; }
.banner-countdown strong { font-size: 1rem; }

.banner-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}
.stat-chip {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 8px 10px;
    text-align: center;
}
.stat-chip span { display: block; font-size: .74rem; color: var(--muted); }
.stat-chip strong { font-size: .92rem; }
.stat-prize { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.round-obs {
    margin-top: 10px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: .86rem;
    color: #334155;
}

/* ULTRA COMPACT MOBILE-FIRST BETTING SCREEN */
.bet-card { padding: 12px; }
.bet-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}
.bet-card-head h2 { margin: 0; font-size: 1.05rem; }

.matches-compact-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.match-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 6px;
    padding: 8px 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fafbfc;
}

.team-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 3px;
    min-width: 0;
}

.team-shield {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    padding: 2px;
    border: 1px solid #e2e8f0;
}
.team-shield-sm {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
}
.team-inline { display: flex; align-items: center; gap: 8px; }

.team-name {
    font-size: .76rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.15;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.score-inputs {
    display: flex;
    align-items: center;
    gap: 5px;
}

.goal-input {
    width: 44px;
    height: 44px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 800;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    padding: 0;
    -moz-appearance: textfield;
}
.goal-input::-webkit-outer-spin-button,
.goal-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.goal-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, .16);
}
.goal-input.input-invalid { border-color: var(--danger); background: #fef2f2; }

.score-x { font-weight: 800; color: var(--muted); font-size: .95rem; }

.score-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 800;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.match-time-mini {
    grid-column: 1 / -1;
    text-align: center;
    font-size: .7rem;
    color: var(--muted);
    margin-top: -2px;
}

.bettor-fields {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.fields-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}
@media (min-width: 600px) {
    .fields-grid { grid-template-columns: 1fr 1fr; }
    .team-shield { width: 40px; height: 40px; }
    .team-name { font-size: .85rem; }
    .goal-input { width: 50px; height: 46px; }
}

/* Tabs, Ranking & Mural */
.tabs-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    margin-bottom: 12px;
    padding-bottom: 2px;
}
.tab-btn {
    border: 1px solid var(--border);
    background: #fff;
    padding: 9px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: .86rem;
    cursor: pointer;
    white-space: nowrap;
    color: #334155;
}
.tab-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.live-dot { color: #16a34a; font-size: .8rem; font-weight: 700; }

.table-wrap { width: 100%; overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
.data-table th, .data-table td {
    padding: 9px 8px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
.data-table th {
    background: #f8fafc;
    color: #475569;
    font-size: .78rem;
    text-transform: uppercase;
}
.data-table th.num, .data-table td.num { text-align: right; }
.data-table tr.top-1 { background: #fefce8; }
.data-table tr.top-2 { background: #f8fafc; }
.data-table tr.top-3 { background: #fff7ed; }

.tie-badge {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    font-size: .68rem;
    padding: 1px 5px;
    border-radius: 4px;
    margin-left: 3px;
}

.mural-search-box { margin-bottom: 10px; }
.mural-list { display: grid; gap: 8px; }
.mural-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fafbfc;
    padding: 10px 12px;
}
.mural-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    list-style: none;
    gap: 8px;
}
.mural-summary::-webkit-details-marker { display: none; }
.mural-main { display: flex; flex-direction: column; }
.mural-sub { font-size: .78rem; color: var(--muted); }
.mural-pts { text-align: right; white-space: nowrap; }
.mural-pts small { display: block; font-size: .74rem; color: var(--muted); }
.mural-palpites {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed #cbd5e1;
    display: grid;
    gap: 5px;
}
.mural-palpite-row {
    display: flex;
    justify-content: space-between;
    font-size: .84rem;
}
.pts-pill { font-size: .75rem; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.pts-3 { background: #dcfce7; color: #166534; }
.pts-2 { background: #dbeafe; color: #1e40af; }
.pts-0 { background: #f1f5f9; color: #64748b; }

/* PIX & Bet Status */
.bet-status-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.bet-code-big { margin: 0; font-size: 1.6rem; letter-spacing: 2px; text-transform: uppercase; }
.bet-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 14px;
    font-size: .88rem;
}

.pix-box {
    text-align: center;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fafbfc;
}
.pix-timer-bar {
    display: inline-block;
    background: #fef3c7;
    color: #92400e;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: .9rem;
    margin-bottom: 12px;
}
.pix-qr-img {
    width: 210px;
    max-width: 100%;
    height: auto;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    padding: 8px;
}
.pix-copy-label { margin-top: 12px; text-align: left; }
.pix-copy-row { display: flex; gap: 8px; }
.pix-copy-row .input { margin-bottom: 0; font-size: .82rem; }
.copy-feedback { color: #15803d; font-weight: 700; font-size: .86rem; margin-top: 6px; }
.pix-waiting-note { font-size: .84rem; color: var(--muted); margin: 12px 0 0; }

.payment-ok-box { text-align: center; }
.payment-ok-box h3 { margin-top: 0; }

.palpites-chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}
.palpite-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .86rem;
}

/* Alerts & Rules */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .9rem; }
.alert-err { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

.rules-card summary { font-weight: 700; cursor: pointer; }
.rules-body { margin-top: 10px; font-size: .9rem; color: #334155; }

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    background: #fff;
    padding: 14px 0;
    font-size: .82rem;
    color: var(--muted);
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; }
.footer-admin-link { color: var(--muted); }

/* ADMIN LAYOUT */
.admin-login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-head { text-align: center; margin-bottom: 16px; }
.login-head h1 { margin: 4px 0 2px; font-size: 1.3rem; }
.login-head p { margin: 0; color: var(--muted); }
.login-back { text-align: center; margin-top: 14px; font-size: .88rem; }

.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 240px;
    background: #0f172a;
    color: #e2e8f0;
    padding: 16px 12px;
    flex-shrink: 0;
}
.sidebar-brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 1rem;
    color: #fff;
    padding: 4px 8px 14px;
    border-bottom: 1px solid #1e293b;
    margin-bottom: 10px;
}
.sidebar-close { display: none; background: transparent; border: 0; color: #fff; font-size: 1.2rem; cursor: pointer; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav a {
    color: #cbd5e1;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
}
.sidebar-nav a:hover { background: #1e293b; color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: var(--primary); color: #fff; }
.sidebar-nav hr { border: 0; border-top: 1px solid #1e293b; width: 100%; margin: 8px 0; }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.btn-menu-mobile {
    display: none;
    background: #0f172a;
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 7px 12px;
    font-weight: 700;
    cursor: pointer;
}
.topbar-title { font-weight: 800; font-size: 1.05rem; }
.topbar-user { font-size: .85rem; color: var(--muted); font-weight: 600; }

.admin-content { padding: 16px; flex: 1; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.kpi-card { display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 1.4rem; color: var(--primary-dark); }

.admin-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 960px) {
    .admin-grid-2 { grid-template-columns: 1fr 1fr; }
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    align-items: end;
}
.filters-grid .input { margin-bottom: 0; }
.filters-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-row .input { margin-bottom: 0; max-width: 340px; }

.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-bottom: 2px; }
.form-actions { display: flex; gap: 8px; align-items: center; }

@media (max-width: 820px) {
    .btn-menu-mobile { display: inline-block; }
    .sidebar-close { display: inline-block; }
    .admin-sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        z-index: 60;
        transition: left .2s ease;
    }
    .admin-sidebar.open { left: 0; }
}
