:root {
    --bg: #0f172a;
    --card: #111827;
    --card-soft: #1f2937;
    --text: #f9fafb;
    --muted: #9ca3af;
    --line: #374151;
    --accent: #22c55e;
    --accent-dark: #16a34a;
    --danger: #ef4444;
    --blue: #38bdf8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: radial-gradient(circle at top, #1e293b, #020617);
    color: var(--text);
}

.page-shell {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 48px;
}

.top-card {
    background: rgba(17, 24, 39, 0.92);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 22px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

.top-card h1 {
    margin: 0;
    font-size: 30px;
}

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

.card {
    background: rgba(17, 24, 39, 0.92);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.card h2 {
    margin-top: 0;
}

.login-wrap {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: min(420px, 100%);
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.login-card h1 {
    margin: 0;
    font-size: 28px;
}

form {
    margin-top: 22px;
}

label {
    display: block;
    margin: 16px 0 8px;
    color: var(--muted);
    font-size: 14px;
}

input,
select {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #020617;
    color: var(--text);
    font-size: 16px;
}

input:focus,
select:focus {
    outline: 2px solid rgba(34, 197, 94, 0.35);
    border-color: var(--accent);
}

button,
.button {
    display: inline-block;
    margin-top: 18px;
    border: 0;
    background: var(--accent);
    color: #052e16;
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    font-size: 15px;
}

button:hover,
.button:hover {
    background: var(--accent-dark);
}

.button.secondary {
    background: var(--card-soft);
    color: var(--text);
    border: 1px solid var(--line);
}

.button.small {
    margin-top: 0;
    padding: 8px 12px;
    font-size: 13px;
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.error-box {
    margin-top: 18px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.55);
    color: #fecaca;
    padding: 12px;
    border-radius: 12px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card {
    background: rgba(17, 24, 39, 0.92);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}

.metric-number {
    font-size: 34px;
    font-weight: 800;
    color: var(--blue);
}

.metric-label {
    margin-top: 6px;
    color: var(--muted);
}

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

.user-pill {
    background: var(--card-soft);
    border: 1px solid var(--line);
    padding: 10px 12px;
    border-radius: 999px;
    color: var(--muted);
}

.module-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 18px;
}

.module-card {
    background: #020617;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
}

.module-card h3 {
    margin: 0 0 8px;
}

.module-card p {
    color: var(--muted);
    min-height: 42px;
}

.badge {
    display: inline-block;
    background: rgba(56, 189, 248, 0.12);
    color: #bae6fd;
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
}

.badge.live {
    background: rgba(34, 197, 94, 0.12);
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.45);
}

.active-module {
    border-color: rgba(34, 197, 94, 0.45);
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px;
    text-align: left;
}

th {
    color: var(--muted);
    font-weight: 600;
}

code {
    background: #020617;
    border: 1px solid var(--line);
    padding: 3px 6px;
    border-radius: 8px;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.section-title-row h2 {
    margin-bottom: 0;
}

.empty-state {
    background: #020617;
    border: 1px dashed var(--line);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.empty-state h3 {
    margin-top: 0;
}

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

.event-select-box {
    margin-top: 26px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 16px;
}

.check-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: #020617;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    margin: 0;
    cursor: pointer;
}

.check-card:hover {
    border-color: rgba(34, 197, 94, 0.65);
}

.check-card input {
    width: auto;
    margin-top: 3px;
}

.check-card strong {
    display: block;
    color: var(--text);
}

.check-card small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.tournament-grid {
    grid-template-columns: repeat(3, 1fr);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.detail-grid > div {
    background: #020617;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
}

.detail-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}

.event-pill-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.event-pill {
    background: #020617;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    align-items: center;
}

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

.event-card-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.event-manage-card {
    background: #020617;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
}

.event-manage-card strong {
    display: block;
    font-size: 18px;
}

.event-manage-card span {
    display: block;
    color: var(--muted);
    margin-top: 6px;
}

.court-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.court-card {
    background: #020617;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
}

.court-card strong {
    display: block;
    font-size: 18px;
}

.court-card span {
    display: block;
    color: var(--muted);
    margin-top: 6px;
}

.entry-slot-card {
    background: #020617;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    margin-top: 18px;
}

.entry-slot-card h3 {
    margin-top: 0;
}

.seed-grid {
    grid-template-columns: 220px;
}

@media (max-width: 900px) {
    .top-card {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .module-list {
        grid-template-columns: 1fr;
    }

    .top-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .section-title-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-grid,
    .checkbox-grid,
    .detail-grid,
    .court-list,
    .event-card-list {
        grid-template-columns: 1fr;
    }

    .tournament-grid {
        grid-template-columns: 1fr;
    }

    .event-manage-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .seed-grid {
        grid-template-columns: 1fr;
    }
}

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