:root {
    --bg: #eef1ed;
    --surface: #ffffff;
    --surface-soft: #f7f8f6;
    --ink: #1b231d;
    --muted: #6d756d;
    --line: #d8ddd6;
    --green-900: #0d2418;
    --green-800: #123322;
    --green-700: #18412b;
    --green-600: #1d5a3d;
    --gold: #caa23a;
    --gold-strong: #d6ae49;
    --danger: #b42318;
    --success: #2f8f57;
    --shadow: 0 20px 42px rgba(17, 31, 21, 0.12);
    --shadow-soft: 0 10px 24px rgba(17, 31, 21, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--bg);
    font-family: "Segoe UI Variable Text", "Aptos", "Segoe UI", system-ui, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

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

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    padding: 0 18px 0 0;
    color: #fff;
    background: linear-gradient(180deg, #121812, #111510);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05);
}

.topbar-spacer {
    width: 246px;
    height: 54px;
    background: linear-gradient(180deg, #111510, #141913);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.icon-button,
.button,
button {
    font: inherit;
}

.icon-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #fff;
    cursor: pointer;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}

.icon-button.ghost {
    color: var(--ink);
    background: #fff;
    border-color: var(--line);
}

.icon-glyph {
    font-size: 18px;
    line-height: 1;
}

.icon-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    background: var(--gold);
    border: 2px solid #111510;
    border-radius: 999px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 14px;
}

.user-caret {
    color: rgba(255, 255, 255, 0.7);
}

.app-frame {
    display: grid;
    grid-template-columns: 246px minmax(0, 1fr);
    min-height: calc(100vh - 54px);
}

.sidebar {
    display: grid;
    align-content: start;
    gap: 18px;
    padding: 18px 14px;
    color: #fff;
    background: linear-gradient(180deg, var(--green-900), var(--green-800));
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.05);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 4px 4px 16px;
    color: #f4e3aa;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #f3d98b;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(243, 217, 139, 0.22);
    border-radius: 10px;
}

.side-nav {
    display: grid;
    gap: 6px;
}

.side-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 0 12px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 14px;
    border: 1px solid transparent;
    border-radius: 10px;
}

.side-nav a:hover,
.side-nav a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(211, 177, 84, 0.38);
}

.sidebar-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px;
    margin-top: auto;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.sidebar-card strong,
.sidebar-card span {
    display: block;
}

.sidebar-card span {
    color: rgba(255, 255, 255, 0.68);
    font-size: 12px;
}

.sidebar-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    color: #f4e3aa;
    font-size: 12px;
    font-weight: 800;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
}

.workspace {
    padding: 18px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin-bottom: 0;
    font-size: 28px;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

h2 {
    margin-bottom: 0;
    font-size: 16px;
    letter-spacing: -0.01em;
}

.muted {
    color: var(--muted);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(180deg, #1e603f, #18472f);
    border: 0;
    border-radius: 10px;
    box-shadow: 0 10px 18px rgba(24, 71, 47, 0.16);
}

.button.gold {
    color: #fff;
    background: linear-gradient(180deg, #d3ad4c, #b68f2b);
    box-shadow: 0 10px 18px rgba(182, 143, 43, 0.18);
}

.button.ghost {
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: none;
}

.button.full {
    width: 100%;
}

.actions,
.players-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.metric-card {
    display: grid;
    gap: 6px;
    padding: 16px;
    color: #fff;
    background: linear-gradient(180deg, #13361f, #0f2c1b);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

.metric-card span {
    color: rgba(255, 255, 255, 0.86);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.metric-card strong {
    font-size: 28px;
    line-height: 1;
    color: #f7eac0;
}

.metric-card small {
    color: rgba(255, 255, 255, 0.74);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.95fr;
    gap: 12px;
}

.grid {
    display: grid;
    gap: 12px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-grid .panel:nth-child(3),
.dashboard-grid .panel:nth-child(4) {
    min-height: 244px;
}

.panel,
.card,
.team-card {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid rgba(216, 221, 214, 0.98);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

.panel {
    padding: 16px;
}

.panel::before,
.card::before,
.team-card::before {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    content: "";
    background: linear-gradient(90deg, var(--gold), var(--green-600));
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.panel-head a {
    color: var(--green-600);
    font-weight: 700;
}

.match-line {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.match-badge {
    display: grid;
    place-items: center;
    width: 62px;
    height: 72px;
    color: #fff;
    background: linear-gradient(180deg, var(--green-600), var(--green-700));
    border-radius: 12px;
}

.match-badge span {
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.82;
}

.match-badge strong {
    font-size: 26px;
    line-height: 1;
}

.match-copy {
    display: grid;
    gap: 4px;
}

.match-copy strong {
    font-size: 18px;
}

.ranking-list,
.activity-list,
.team-slots,
.stat-list,
.check-list {
    display: grid;
    gap: 10px;
}

.ranking-row,
.activity-row,
.team-slot {
    display: grid;
    align-items: center;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(216, 221, 214, 0.9);
}

.week-summary {
    display: grid;
    gap: 4px;
    margin-bottom: 14px;
}

.ranking-row {
    grid-template-columns: auto 1fr auto;
}

.ranking-place {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: #8d6a18;
    font-weight: 800;
    background: rgba(202, 162, 58, 0.12);
    border-radius: 999px;
}

.ranking-info {
    display: grid;
    gap: 2px;
}

.ranking-info span {
    color: var(--muted);
    font-size: 13px;
}

.activity-row {
    grid-template-columns: auto 1fr;
}

.activity-dot {
    width: 10px;
    height: 10px;
    background: var(--green-600);
    border-radius: 999px;
}

.chart-wrap {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 16px;
    align-items: center;
}

.chart {
    width: 160px;
    aspect-ratio: 1;
    border-radius: 50%;
    box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.75);
}

.chart-legend {
    display: grid;
    gap: 8px;
}

.chart-legend div {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.legend-dot.high {
    background: var(--green-600);
}

.legend-dot.medium {
    background: var(--gold);
}

.legend-dot.low {
    background: #b9c3bb;
}

.chart-legend p {
    margin-top: 8px;
    color: var(--muted);
}

.distribution-panel {
    grid-column: 1 / -1;
}

.position-list {
    display: grid;
    gap: 12px;
}

.position-row {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 12px;
    align-items: start;
    padding-top: 12px;
    border-top: 1px solid rgba(216, 221, 214, 0.9);
}

.position-info {
    display: grid;
    gap: 4px;
}

.position-info span {
    color: var(--muted);
    font-size: 13px;
}

.position-names {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.position-names span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    color: var(--ink);
    font-size: 12px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.table-panel {
    padding: 0;
    overflow: auto;
    background: var(--surface);
}

.players-table {
    width: 100%;
    min-width: 1120px;
    border-collapse: collapse;
}

thead th {
    padding: 14px 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid rgba(216, 221, 214, 0.9);
}

td {
    padding: 14px 12px;
    border-bottom: 1px solid rgba(216, 221, 214, 0.82);
    vertical-align: middle;
}

tbody tr:hover {
    background: rgba(24, 65, 43, 0.03);
}

.player-cell {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
}

.player-cell strong {
    display: block;
}

.player-cell span {
    color: var(--muted);
    font-size: 13px;
}

.avatar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    background: linear-gradient(180deg, var(--green-600), var(--green-700));
    border-radius: 999px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 800;
    border-radius: 999px;
}

.status-pill.active {
    color: #0f5e34;
    background: rgba(47, 143, 87, 0.12);
}

.status-pill.inactive {
    color: #7e3d22;
    background: rgba(202, 162, 58, 0.16);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-link {
    color: var(--green-600);
    font-weight: 700;
}

.table-actions button {
    padding: 0;
    color: var(--danger);
    background: transparent;
    border: 0;
}

.players-toolbar {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.searchbar {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

.searchbar input {
    width: 240px;
    min-height: 34px;
    padding: 0 10px;
    border: 0;
    outline: none;
    background: transparent;
    box-shadow: none;
}

.searchbar .icon-button {
    width: 34px;
    height: 34px;
    color: var(--ink);
    border-color: transparent;
}

.searchbar .icon-button.ghost {
    background: var(--surface-soft);
}

.player-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-panel {
    display: grid;
    gap: 14px;
}

.form-grid.single {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.stat-inputs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.check-list label {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(216, 221, 214, 0.9);
}

.check-list input {
    min-height: auto;
    width: 18px;
    height: 18px;
    padding: 0;
}

.stat-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.5fr) repeat(6, minmax(60px, 1fr));
    gap: 8px;
    align-items: end;
    padding-top: 10px;
    border-top: 1px solid rgba(216, 221, 214, 0.9);
}

.stat-row strong {
    align-self: center;
}

.stat-row input {
    min-height: 36px;
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    padding: 10px 12px;
    color: var(--ink);
    font: inherit;
    background: #fff;
    border: 1px solid #cfd6cf;
    border-radius: 10px;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(29, 90, 61, 0.5);
    box-shadow: 0 0 0 4px rgba(29, 90, 61, 0.12);
}

.page-head,
.flash,
.alert {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

.page-head {
    padding: 14px 16px;
    margin-bottom: 12px;
}

.flash,
.alert {
    margin-bottom: 12px;
    padding: 14px 16px;
}

.flash {
    color: #0f5e34;
    background: #deefe1;
}

.alert {
    color: var(--danger);
    background: #fff1f0;
}

.warning {
    color: #7d621f;
    background: #fff6df;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.week-card {
    display: grid;
    gap: 10px;
    padding: 16px;
}

.pill {
    display: inline-flex;
    width: max-content;
    padding: 5px 10px;
    color: #0f5e34;
    font-size: 12px;
    font-weight: 800;
    background: rgba(47, 143, 87, 0.12);
    border-radius: 999px;
}

.card-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.teams-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.team-card {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.team-card strong {
    color: var(--green-600);
    font-size: 18px;
}

.team-slot {
    grid-template-columns: 110px 1fr auto;
}

.team-slot span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.team-slot strong {
    font-size: 14px;
    color: var(--ink);
}

.team-slot b {
    color: var(--muted);
}

.bench-box {
    display: grid;
    gap: 4px;
    padding: 12px;
    background: var(--surface-soft);
    border: 1px dashed var(--line);
    border-radius: 10px;
}

.bench-box span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.pitch-panel {
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

.pitch-head {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
}

.pitch {
    position: relative;
    width: 100%;
    min-height: 480px;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 14%, transparent 14% 28%, rgba(255, 255, 255, 0.04) 28% 42%, transparent 42% 56%, rgba(255, 255, 255, 0.04) 56% 70%, transparent 70% 84%, rgba(255, 255, 255, 0.04) 84% 100%),
        linear-gradient(180deg, #2e7d46, #215f36);
    border: 1px solid #d6e1d6;
    border-radius: 14px;
}

.pitch::before,
.pitch::after {
    position: absolute;
    content: "";
    border: 2px solid rgba(255, 255, 255, 0.7);
}

.pitch::before {
    inset: 22px;
    border-radius: 12px;
}

.pitch::after {
    top: 50%;
    left: 22px;
    right: 22px;
    border-width: 2px 0 0;
}

.pitch-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110px;
    height: 110px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.pitch-line {
    position: absolute;
    left: 22px;
    right: 22px;
    height: 2px;
    background: rgba(255, 255, 255, 0.7);
}

.pitch-mid {
    top: 50%;
}

.pitch-center {
    top: 50%;
    left: 50%;
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.pitch-slot {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    padding: 8px 12px;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    background: rgba(13, 36, 24, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    transform: translate(-50%, -50%);
}

.slot-goal {
    top: 9%;
    left: 50%;
}

.slot-left-back {
    top: 29%;
    left: 24%;
}

.slot-right-back {
    top: 29%;
    left: 76%;
}

.slot-mid {
    top: 50%;
    left: 50%;
}

.slot-striker {
    top: 67%;
    left: 50%;
}

.slot-wing-left {
    top: 67%;
    left: 24%;
}

.slot-wing-right {
    top: 67%;
    left: 76%;
}

tbody tr:last-child td {
    border-bottom: 0;
}

@media (max-width: 1180px) {
    .topbar-spacer {
        width: 214px;
    }

    .app-frame {
        grid-template-columns: 214px minmax(0, 1fr);
    }
}

@media (max-width: 980px) {
    .topbar {
        padding-right: 12px;
    }

    .topbar-spacer {
        width: 0;
        border: 0;
    }

    .app-frame {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        order: 2;
    }

    .workspace {
        order: 1;
    }

    .metrics-grid,
    .dashboard-grid,
    .cards,
    .teams-layout,
    .player-form-grid {
        grid-template-columns: 1fr;
    }

    .chart-wrap {
        grid-template-columns: 1fr;
    }

    .chart {
        margin-inline: auto;
    }

    .table-panel {
        overflow-x: auto;
    }

    .players-table {
        min-width: 980px;
    }
}

@media (max-width: 680px) {
    .workspace {
        padding: 12px;
    }

    .page-head,
    .panel,
    .card,
    .team-card,
    .pitch-panel {
        padding: 14px;
    }

    .page-head,
    .actions,
    .players-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .searchbar {
        width: 100%;
    }

    .searchbar input {
        width: 100%;
        min-width: 0;
    }

    .form-grid.single,
    .stat-inputs {
        grid-template-columns: 1fr;
    }

    .team-slot {
        grid-template-columns: 1fr;
    }

    .pitch {
        min-height: 380px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .button,
    .icon-button,
    input,
    select,
    textarea,
    .panel,
    .card,
    .team-card,
    .metric-card,
    .pitch-slot {
        transition:
            transform 150ms ease,
            box-shadow 150ms ease,
            border-color 150ms ease,
            background-color 150ms ease;
    }

    .button:hover,
    .icon-button:hover {
        transform: translateY(-1px);
    }

    .panel:hover,
    .card:hover,
    .team-card:hover,
    .metric-card:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow);
    }
}

.logout-button {
    min-height: 40px;
}

.guest-body {
    background:
        radial-gradient(circle at top left, rgba(29, 90, 61, 0.18), transparent 36%),
        radial-gradient(circle at bottom right, rgba(202, 162, 58, 0.14), transparent 30%),
        var(--bg);
}

.guest-shell {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(360px, 420px);
    gap: 18px;
    width: min(1100px, 100%);
    align-items: center;
}

.login-brand {
    display: grid;
    gap: 16px;
    align-content: center;
    padding: 24px;
}

.brand-mark-large {
    width: 64px;
    height: 64px;
    font-size: 20px;
}

.login-panel {
    display: grid;
    gap: 14px;
    padding: 22px;
}

.remember-line {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

.remember-line input {
    width: 18px;
    height: 18px;
    min-height: 18px;
    padding: 0;
}

.login-hint {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}
