/* Jogadinha de Paiol — tokens extraídos do design */
:root {
    --bg: #F4F1E8;
    --ink: #17211C;
    --green: #1F4D3A;
    --green-dark: #183D2E;
    --card: #FFFDF7;
    --line: #E2DCCB;
    --line-strong: #CFC7B2;
    --soft: #ECE7D8;
    --muted: #6B7069;
    --label: #3A443E;
    --on-green-muted: #C9D3CC;
    --win: #2F7A55;
    --win-dark: #276848;
    --loss: #A33B27;
    --loss-soft: #F8E6DF;
    --gold: #C9A24A;
    --cream-gold: #FBF3DD;
    --cream-gold-line: #E6D29C;
    --font: 'Familjen Grotesk', system-ui, sans-serif;
    --display: 'Big Shoulders Display', 'Familjen Grotesk', system-ui, sans-serif;
    --focus: 0 0 0 3px rgba(31, 77, 58, .15);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); }
h1:focus { outline: none; }
button { font: inherit; }
button:disabled { cursor: default; }

/* ---------- utilitários ---------- */
.grow { flex: 1; }
.col { display: flex; flex-direction: column; }
.min0 { min-width: 0; }
.strong { font-weight: 600; }
.big { font-size: 17px; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.label-color { color: var(--label); }
.center { text-align: center; }
.center-x { justify-content: center; }
.wrap { flex-wrap: wrap; }
.mono { font-family: ui-monospace, Menlo, monospace; color: var(--ink); }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ellipsis-box { min-width: 0; }
.gap-4 { gap: 4px; }
.mb-6 { margin-bottom: 6px; }
.mt-8 { margin-top: 8px; }
.pad-12 { padding: 12px 0; }
.pad-16 { padding: 16px 0; }
.row-4, .row-8, .row-10 { display: flex; align-items: center; }
.row-4 { gap: 4px; }
.row-8 { gap: 8px; }
.row-10 { gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.stack-4 { display: flex; flex-direction: column; gap: 4px; }
.stack-8 { display: flex; flex-direction: column; gap: 8px; }
.stack-10 { display: flex; flex-direction: column; gap: 10px; }

.display {
    font-family: var(--display);
    font-weight: 800;
    line-height: 1;
    margin: 0;
    text-transform: uppercase;
}
.h1 { font-size: clamp(30px, 8vw, 44px); }
.h1-sm { font-size: clamp(28px, 7.5vw, 40px); }
.eyebrow, .section-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.eyebrow { font-size: 13px; font-weight: 600; color: var(--green); letter-spacing: .06em; }

/* ---------- marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand-ball {
    width: 30px; height: 30px; border-radius: 50%; background: var(--ink);
    display: flex; align-items: center; justify-content: center; flex: none;
}
.brand-ball > div {
    width: 14px; height: 14px; border-radius: 50%; background: var(--bg); color: var(--ink);
    font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.brand-sm .brand-ball { width: 28px; height: 28px; }
.brand-sm .brand-ball > div { width: 13px; height: 13px; font-size: 8px; }

/* ---------- avatar ---------- */
.avatar {
    border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; flex: none;
}
.avatar-light { color: var(--green); }
.avatar-ring { border: 2px solid var(--bg); }
.faded { opacity: .6; }

/* ---------- formulários ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--label); }
.input {
    height: 46px; border: 1.5px solid var(--line-strong); border-radius: 10px; padding: 0 14px;
    font: inherit; font-size: 15px; font-weight: 400; background: var(--card); color: var(--ink);
    outline: none; width: 100%;
}
.input:focus { border-color: var(--green); box-shadow: var(--focus); }
.input-white { background: #fff; }
.input-error { border-color: var(--loss); }
.field-error { color: var(--loss); font-weight: 500; }
.alert-error { color: var(--loss); font-size: 14px; background: var(--loss-soft); border-radius: 8px; padding: 10px 12px; }
.info-box { font-size: 14px; color: var(--label); background: var(--soft); border-radius: 10px; padding: 12px 14px; }
.temp-box { font-size: 13px; color: var(--muted); background: var(--soft); border-radius: 8px; padding: 8px 12px; }
.form-col { max-width: 480px; display: flex; flex-direction: column; gap: 16px; }

.btn {
    height: 46px; border-radius: 10px; font-weight: 600; padding: 0 22px; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
    border: none; text-decoration: none;
}
.btn-primary { background: var(--green); color: var(--bg); }
.btn-primary:hover:not(:disabled) { background: var(--green-dark); color: var(--bg); }
.btn-primary:disabled { opacity: .4; }
.btn-outline { border: 1.5px solid var(--line-strong); background: transparent; color: var(--ink); }
.btn-outline:hover { background: var(--soft); color: var(--ink); }
.btn-link { background: transparent; color: var(--green); padding: 0 8px; text-decoration: underline; }
.btn-lg { height: 48px; font-size: 16px; }
.btn-sm { height: 40px; padding: 0 16px; border-radius: 9px; }
.page-head .btn { height: 44px; padding: 0 18px; }
.link-muted { background: none; border: none; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer; }
.link-danger { background: none; border: none; color: var(--loss); font-size: 14px; font-weight: 600; cursor: pointer; }
.back-link { color: var(--green); font-weight: 600; align-self: flex-start; }

/* ---------- login / páginas centralizadas ---------- */
.login-page { min-height: 100vh; display: flex; }
.login-hero {
    flex: 1; background: var(--green); color: var(--bg); padding: 48px 56px;
    display: flex; flex-direction: column; justify-content: space-between;
}
.login-hero-title { font-size: 96px; line-height: .9; max-width: 520px; text-wrap: balance; }
.login-area { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-form { width: 100%; max-width: 360px; }
.login-brand-narrow { display: none; margin-bottom: 12px; }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.narrow-col { width: 100%; max-width: 380px; }
.side-muted { color: var(--on-green-muted); }

.checks { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.check.ok { color: var(--ink); }
.check-icon {
    width: 18px; height: 18px; border-radius: 50%; background: var(--line-strong); color: #fff;
    font-size: 11px; display: flex; align-items: center; justify-content: center; flex: none;
}
.check.ok .check-icon { background: var(--win); }

/* ---------- casca do app ---------- */
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 232px; flex: none; background: var(--green); color: var(--bg); padding: 24px 16px;
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.side-brand { padding: 0 8px 24px; }
.side-item {
    display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px;
    font-weight: 600; color: var(--on-green-muted);
}
.side-item:hover { background: rgba(244, 241, 232, .12); color: var(--bg); }
.side-item.on { background: rgba(244, 241, 232, .16); color: var(--bg); }
.badge { background: var(--gold); color: var(--ink); border-radius: 99px; font-size: 12px; font-weight: 700; padding: 1px 8px; }
.badge-sm { font-size: 11px; padding: 0 6px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 8px; border-top: 1px solid rgba(244, 241, 232, .18); }
.side-logout {
    padding: 6px 10px; border-radius: 8px; cursor: pointer; color: var(--on-green-muted);
    font-size: 14px; background: none; border: none;
}
.side-logout:hover { background: rgba(244, 241, 232, .12); color: var(--bg); }

.app-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: none; align-items: center; gap: 10px; padding: 14px 20px; background: var(--green);
    color: var(--bg); position: sticky; top: 0; z-index: 5;
}
.top-logout { font-size: 14px; color: var(--on-green-muted); cursor: pointer; background: none; border: none; padding: 0; }
.topbar form, .side-user form { display: flex; }

.main {
    flex: 1; width: 100%; max-width: 920px; margin: 0 auto; padding: 40px 40px 64px;
    display: flex; flex-direction: column; gap: 24px;
}
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }

.bottom-nav {
    display: none; position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 5;
}
.bn-item {
    flex: 1; height: 48px; display: flex; align-items: center; justify-content: center; gap: 6px;
    font-weight: 500; color: var(--muted); font-size: 14px; border-top: 3px solid transparent;
}
.bn-item.on { font-weight: 700; color: var(--green); border-top-color: var(--green); }

/* ---------- placares ---------- */
.request-card {
    background: var(--cream-gold); border: 1px solid var(--cream-gold-line); border-radius: 14px;
    padding: 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.request-text { min-width: 180px; gap: 2px; }
.recado { color: var(--label); font-style: italic; }

.score-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.score-card {
    background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px;
    display: flex; flex-direction: column; gap: 14px; color: var(--ink);
    transition: border-color .15s, transform .15s;
}
.score-card:hover { border-color: var(--green); transform: translateY(-2px); color: var(--ink); }
.score-line { display: flex; align-items: baseline; gap: 10px; font-family: var(--display); font-weight: 800; line-height: .9; }
.score-num { font-size: 56px; }
.score-x { font-size: 28px; color: #9AA096; }
.score-status { font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--muted); }
.win { color: var(--win); }
.loss { color: var(--loss); }
.bar { height: 6px; border-radius: 99px; background: #E9C9BF; overflow: hidden; }
.bar > div { height: 100%; background: var(--win); }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.win { background: var(--win); }
.dot.loss { background: var(--loss); }
.card-cta { font-size: 13px; font-weight: 600; color: var(--green); }

.empty-box {
    border: 1.5px dashed var(--line-strong); border-radius: 14px; padding: 36px 20px; text-align: center;
    display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.pending-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line);
    border-radius: 12px; background: var(--card);
}

.scoreboard {
    background: var(--green); color: var(--bg); border-radius: 18px; padding: 28px 20px;
    display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.scoreboard-row { display: flex; align-items: center; justify-content: center; gap: clamp(14px, 5vw, 44px); width: 100%; }
.player { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 70px; }
.big-score {
    display: flex; align-items: center; gap: clamp(8px, 3vw, 20px); font-family: var(--display);
    font-weight: 800; line-height: .85; font-size: clamp(72px, 16vw, 120px);
}
.big-x { font-size: 36px; color: var(--gold); }

.win-buttons { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.btn-win, .btn-loss {
    height: 84px; border-radius: 14px; font-size: 18px; font-weight: 700; cursor: pointer;
    transition: transform .08s;
}
.btn-win { border: none; background: var(--win); color: #fff; }
.btn-win:hover:not(:disabled) { background: var(--win-dark); }
.btn-loss { border: 2px solid var(--loss); background: var(--card); color: var(--loss); }
.btn-loss:hover:not(:disabled) { background: var(--loss-soft); }
.btn-win:active, .btn-loss:active { transform: scale(.98); }
.btn-win:disabled, .btn-loss:disabled { opacity: .7; }

.match-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.res {
    width: 26px; height: 26px; border-radius: 7px; color: #fff; font-weight: 700; font-size: 13px;
    display: flex; align-items: center; justify-content: center; flex: none;
}
.res.win { background: var(--win); }
.res.loss { background: var(--loss); }

.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }

/* ---------- histórico ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    padding: 6px 14px; border-radius: 99px; font-size: 14px; font-weight: 600; cursor: pointer;
    border: 1.5px solid var(--line-strong); background: transparent; color: var(--ink);
}
.chip.on { border-color: var(--green); background: var(--green); color: var(--bg); }
.stats-box {
    display: flex; gap: 28px; align-items: baseline; padding: 16px 20px; background: var(--card);
    border: 1px solid var(--line); border-radius: 14px; flex-wrap: wrap;
}
.stat-num { font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 1; }

/* ---------- usuários ---------- */
.user-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-bottom: 1px solid var(--line);
    border-radius: 8px; color: var(--ink);
}
.user-row:hover { background: var(--soft); color: var(--ink); }
.user-row.inactive { opacity: .55; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; }
.tag-admin { background: var(--green); color: var(--bg); }
.tag-pending { background: var(--cream-gold); color: #7A5A12; }
.tag-inactive { background: var(--line); color: var(--label); }

.toggles { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.toggle-row {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; text-align: left;
    background: none; border: none; color: var(--ink); width: 100%;
}
.toggle-row + .toggle-row { border-top: 1px solid var(--line); }
.toggle-row:disabled { cursor: not-allowed; }
.toggle-text { flex: 1; display: flex; flex-direction: column; }
.switch { width: 44px; height: 26px; border-radius: 99px; background: var(--line-strong); position: relative; flex: none; transition: background .15s; }
.switch > span { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--green); }
.switch.on > span { left: 21px; }

.created { max-width: 460px; margin: 24px auto 0; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.created-check {
    width: 64px; height: 64px; border-radius: 50%; background: var(--win); color: #fff; font-size: 30px;
    display: flex; align-items: center; justify-content: center;
}

/* ---------- modal / toast ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(23, 33, 28, .5); display: flex; align-items: center;
    justify-content: center; z-index: 20; padding: 24px;
}
.sheet {
    width: 100%; max-width: 420px; background: var(--card); border-radius: 18px; padding: 24px;
    display: flex; flex-direction: column; gap: 16px;
}
.vs-row { display: flex; align-items: center; justify-content: center; gap: 16px; }
.vs { font-family: var(--display); font-weight: 800; font-size: 28px; color: var(--gold); }
.sheet-title { font-weight: 700; font-size: 19px; }

.toast {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 30;
    background: var(--ink); color: var(--bg); border-radius: 12px; padding: 12px 16px;
    display: flex; align-items: center; gap: 16px; box-shadow: 0 8px 24px rgba(23, 33, 28, .25);
    max-width: calc(100vw - 32px);
}
.toast-undo { color: var(--gold); font-weight: 700; cursor: pointer; white-space: nowrap; background: none; border: none; padding: 0; }

/* ---------- telas estreitas (< 860px) ---------- */
@media (max-width: 859.98px) {
    .login-hero { display: none; }
    .login-brand-narrow { display: flex; }
    .sidebar { display: none; }
    .topbar { display: flex; }
    .bottom-nav { display: flex; }
    .main { padding: 24px 18px 40px; }
    .app-shell + .toast { bottom: 80px; }
    .modal-backdrop { align-items: flex-end; padding: 0; }
    .sheet { border-radius: 18px 18px 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* ---------- Blazor ---------- */
.blazor-error-boundary { background: var(--loss); padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "Ocorreu um erro."; }
