:root {
    --bg: #050510;
    --card: rgba(8, 16, 32, 0.88);
    --ink: #d6fbff;
    --muted: #7eb8c9;
    --line: rgba(125, 249, 255, 0.28);
    --brand: #5ac8fa;
    --brand-2: #081018;
    --ok: #00e6a8;
    --warn: #ffd166;
    --bad: #ff5a7a;
    --neon: #7df9ff;
    --shadow: 0 0 18px rgba(90, 200, 250, 0.22);
    --radius: 16px;
    --font: "Rajdhani", "Segoe UI", system-ui, sans-serif;
    --font-display: "Orbitron", "Rajdhani", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.45;
}

.binary-rain {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.app,
.login-wrap {
    position: relative;
    z-index: 1;
}

a { color: var(--neon); }

.app { min-height: 100dvh; }

.topbar {
    background: rgba(5, 8, 18, 0.92);
    color: var(--neon);
    padding: 14px 16px 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 0 24px rgba(90, 200, 250, 0.12);
}

.topbar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: 0.04em;
    text-shadow: 0 0 10px rgba(125, 249, 255, 0.45);
}

.topbar-user {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.who-role {
    display: inline-flex;
    align-items: center;
    max-width: 160px;
    padding: 3px 8px;
    border-radius: 999px;
    font-family: var(--font-display);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-user .btn-ghost {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 0.62rem;
}

.who-role.is-gerente {
    color: #041018;
    background: var(--neon);
    box-shadow: 0 0 10px rgba(125, 249, 255, 0.4);
}

.who-role.is-atendente {
    color: var(--neon);
    background: rgba(90, 200, 250, 0.12);
    border: 1px solid var(--line);
}

.nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--neon);
    text-decoration: none;
    padding: 10px 8px;
    border-radius: 999px;
    background: rgba(90, 200, 250, 0.08);
    border: 1px solid transparent;
    font-family: var(--font-display);
    font-size: 0.68rem;
    letter-spacing: 0.03em;
    min-width: 0;
}

.nav-link.is-active,
.nav-link:hover {
    background: rgba(90, 200, 250, 0.22);
    border-color: var(--line);
    box-shadow: 0 0 12px rgba(125, 249, 255, 0.25);
}

.main {
    width: min(1100px, calc(100% - 24px));
    margin: 16px auto 32px;
}

.flash {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
}

.flash-ok { background: rgba(0, 230, 168, 0.16); color: var(--ok); }
.flash-err { background: rgba(255, 90, 122, 0.16); color: var(--bad); }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    backdrop-filter: blur(8px);
}

.card + .card { margin-top: 14px; }

h1, h2 {
    margin: 0 0 12px;
    font-family: var(--font-display);
    font-size: 1.15rem;
    letter-spacing: 0.04em;
    color: var(--neon);
}

.muted { color: var(--muted); }

.stack { display: grid; gap: 12px; }

.grid {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 600;
    font-size: 0.92rem;
}

input, select, textarea {
    width: 100%;
    min-height: 46px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font: inherit;
    color: var(--ink);
    background: rgba(5, 10, 22, 0.9);
}

input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--neon);
    box-shadow: 0 0 10px rgba(125, 249, 255, 0.25);
}

textarea { min-height: 90px; resize: vertical; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 10px 16px;
    border: 0;
    border-radius: 12px;
    background: var(--brand);
    color: #041018;
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 0 14px rgba(90, 200, 250, 0.28);
}

.btn-ghost {
    background: transparent;
    color: var(--neon);
    border: 1px solid rgba(125, 249, 255, 0.4);
    box-shadow: none;
}

.btn-line {
    background: rgba(5, 10, 22, 0.9);
    color: var(--neon);
    border: 1px solid var(--line);
    box-shadow: none;
}

.btn-ok { background: var(--ok); color: #041018; }
.btn-warn { background: var(--warn); color: #041018; }
.btn-bad { background: var(--bad); color: #fff; }

.btn.full {
    width: 100%;
}

.grid-2 > .btn.full {
    grid-column: 1 / -1;
}

.actions {
    display: grid;
    gap: 8px;
}

.period {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.period-link {
    min-height: 40px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--neon);
    background: rgba(5, 10, 22, 0.9);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.period-link.is-active {
    background: var(--brand);
    color: #041018;
    border-color: var(--brand);
    box-shadow: 0 0 12px rgba(90, 200, 250, 0.35);
}

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.pager .btn {
    min-width: 46px;
}

.pager [aria-disabled="true"] {
    opacity: 0.4;
    pointer-events: none;
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stats-3 { grid-template-columns: 1fr; }

.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
}

.stat b { display: block; font-family: var(--font-display); font-size: 1.4rem; color: var(--neon); }

.fields {
    display: grid;
    gap: 8px;
}

.field {
    background: rgba(10, 18, 36, 0.9);
    border: 1px solid rgba(125, 249, 255, 0.12);
    border-radius: 12px;
    padding: 10px 12px;
}

.field span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.list { display: grid; gap: 10px; }

.item {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
}

.item-side {
    display: grid;
    gap: 8px;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(90, 200, 250, 0.16);
    color: var(--neon);
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-ok { background: rgba(0, 230, 168, 0.16); color: var(--ok); }
.badge-off { background: rgba(255, 90, 122, 0.16); color: var(--bad); }
.badge-wait { background: rgba(255, 209, 102, 0.16); color: var(--warn); }

.progress-wrap { display: grid; gap: 6px; }
.progress-wrap[hidden] { display: none !important; }
.progress-track {
    height: 10px;
    background: rgba(125, 249, 255, 0.12);
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    display: block;
    height: 100%;
    width: 0;
    background: var(--neon);
    box-shadow: var(--shadow);
}
.progress-label { margin: 0; font-size: 0.9rem; }

.login-wrap {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.login-card {
    width: min(420px, 100%);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 24px 18px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.auth-brand {
    color: var(--neon);
    font-family: var(--font-display);
    margin-bottom: 8px;
    text-shadow: 0 0 10px rgba(125, 249, 255, 0.4);
}

.brand-logo {
    display: block;
    max-height: 40px;
    width: auto;
    object-fit: contain;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.card-head h1,
.card-head h2 { margin: 0; }

.rank-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.rank-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--card);
}

.rank-id {
    display: grid;
    justify-items: center;
    gap: 6px;
    min-width: 72px;
}

.rank-id strong {
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--ink);
    text-align: center;
    white-space: nowrap;
}

.rank-pos {
    min-width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(90, 200, 250, 0.16);
    color: var(--neon);
    font-family: var(--font-display);
    font-weight: 800;
}

.rank-item.is-1 {
    border-color: rgba(246, 201, 80, 0.55);
    background: linear-gradient(90deg, rgba(246, 231, 178, 0.12), var(--card) 55%);
    box-shadow: 0 0 18px rgba(246, 201, 80, 0.16);
}
.rank-item.is-2 {
    border-color: rgba(180, 190, 205, 0.4);
    background: linear-gradient(90deg, rgba(180, 190, 205, 0.08), var(--card) 55%);
}
.rank-item.is-3 {
    border-color: rgba(201, 138, 90, 0.4);
    background: linear-gradient(90deg, rgba(243, 215, 196, 0.08), var(--card) 55%);
}

.rank-item.is-1 .rank-pos { background: #f6e7b2; color: #7a5b00; }
.rank-item.is-2 .rank-pos { background: #3a4250; color: #d7dee8; }
.rank-item.is-3 .rank-pos { background: #f3d7c4; color: #7a3e16; }
.rank-item.is-me {
    border-color: var(--neon);
    box-shadow: 0 0 14px rgba(125, 249, 255, 0.28);
}

.rank-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.rank-who {
    flex: 1;
    min-width: 0;
    display: grid;
    justify-items: center;
}

.rank-stat-label {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
}

.rank-stats {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.rank-stat {
    display: grid;
    min-width: 62px;
    padding: 4px 8px 6px;
    border-radius: 10px;
    background: rgba(10, 18, 36, 0.9);
    border: 1px solid rgba(125, 249, 255, 0.16);
    text-align: center;
}

.rank-stat small {
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.rank-stat b {
    font-family: var(--font-display);
    font-size: 1.15rem;
    line-height: 1.1;
    color: var(--neon);
}

.rank-item.is-1 .rank-stat.is-day {
    border-color: rgba(246, 201, 80, 0.45);
}
.rank-item.is-1 .rank-stat.is-day b { color: #f6e7b2; }

.rank-money {
    flex: 0 0 auto;
    font-family: var(--font-display);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ok);
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(0, 230, 168, 0.25);
}

.item.item-config {
    grid-template-columns: 1fr;
    align-items: stretch;
}

.btn-tiny {
    min-height: 32px;
    padding: 4px 10px;
    font-size: 0.62rem;
}

.team-grid {
    display: grid;
    gap: 12px;
}

.team-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card);
}

.team-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.team-head strong {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--neon);
}

.team-head-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.team-head .who-role {
    max-width: 140px;
}

.earn-box {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(10, 18, 36, 0.9);
}

.earn-label {
    margin: 0;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.earn-amount {
    margin: 0 0 4px;
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--ok);
    text-shadow: 0 0 10px rgba(0, 230, 168, 0.28);
}

.earn-row,
.earn-edit,
.earn-del,
.earn-add {
    display: flex;
    align-items: center;
    gap: 8px;
}

.earn-edit {
    flex: 1;
    min-width: 0;
}

.earn-edit input {
    flex: 1;
    width: auto;
    min-width: 0;
    min-height: 40px;
}

.earn-row .btn-tiny {
    flex: 0 0 auto;
    min-height: 40px;
}

.earn-add {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: stretch;
}

.earn-add .btn {
    min-height: 46px;
}

.team-pass {
    text-align: center;
}

.team-pass summary {
    cursor: pointer;
    list-style: none;
    display: block;
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--neon);
}

.team-pass summary::-webkit-details-marker { display: none; }

.team-pass[open] summary {
    margin-bottom: 10px;
}

.modal {
    width: min(640px, calc(100% - 24px));
    max-height: min(85dvh, 720px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 18px;
    background: #081018;
    color: var(--ink);
    box-shadow: var(--shadow);
}

.modal::backdrop { background: rgba(5, 5, 16, 0.72); }

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.modal-head h2 { margin: 0; font-size: 1.2rem; }

.modal-foot { margin: 16px 0 0; }

@media (min-width: 768px) {
    .topbar { padding: 16px 24px 0; }
    .nav {
        display: flex;
        flex-wrap: wrap;
    }
    .nav-link {
        font-size: 0.78rem;
        padding: 8px 12px;
        letter-spacing: 0.04em;
    }
    .main { margin-top: 24px; }
    .grid-2, .fields { grid-template-columns: 1fr 1fr; }
    .stats { grid-template-columns: repeat(4, 1fr); }
    .stats-3 { grid-template-columns: repeat(3, 1fr); }
    .actions { grid-template-columns: repeat(3, 1fr); }
    .item {
        grid-template-columns: 1fr auto;
        align-items: center;
    }
    .item-config { grid-template-columns: 1fr; }
    .item.item-config { grid-template-columns: 1fr; }
    .team-grid { grid-template-columns: 1fr 1fr; }
    .desktop-table { display: table; width: 100%; border-collapse: collapse; }
    .desktop-table th, .desktop-table td {
        text-align: left;
        padding: 10px 8px;
        border-bottom: 1px solid var(--line);
        vertical-align: top;
    }
    .mobile-only { display: none; }
}

@media (max-width: 767px) {
    .desktop-only { display: none; }
    .btn.full, .actions .btn { width: 100%; }
    .earn-add { grid-template-columns: 1fr; }
}
