:root {
    --tennis-forest: #4edea3;
    --tennis-forest-deep: #0e1321;
    --tennis-ink: #dee2f6;
    --tennis-muted: #bbcabf;
    --tennis-line: rgba(60, 74, 66, 0.42);
    --tennis-surface: #1a1f2e;
    --tennis-error: #ffb4ab;
    --surface-lowest: #090e1c;
    --surface-low: #161b2a;
    --surface: #1a1f2e;
    --surface-high: #252a39;
    --surface-highest: #303444;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: "Plus Jakarta Sans", Arial, sans-serif;
    background: #0e1321;
    color: var(--tennis-ink);
}

body {
    min-height: 100vh;
}

a, .btn-link {
    color: var(--tennis-forest);
}

h1, h2, h3 {
    margin-top: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1:focus {
    outline: none;
}

.btn-primary {
    color: #f6fbf7;
    background-color: var(--tennis-forest);
    border-color: var(--tennis-forest);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.48);
    color: #f6fbf7;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.12rem white, 0 0 0 0.28rem rgba(24, 81, 63, 0.24);
}

.eyebrow {
    margin: 0 0 0.4rem;
    color: var(--tennis-muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.muted {
    color: var(--tennis-muted);
    line-height: 1.6;
}

.auth-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
}

.auth-card,
.dashboard-panel {
    border: 1px solid var(--tennis-line);
    border-radius: 8px;
    background: var(--tennis-surface);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.16);
}

.auth-card {
    max-width: 560px;
    margin: 0 auto;
    padding: 2rem;
}

.form-stack {
    display: grid;
    gap: 1rem;
}

.form-label {
    display: inline-block;
    margin-bottom: 0.35rem;
    font-size: 0.92rem;
    font-weight: 700;
}

.form-control {
    border-radius: 8px;
    border-color: rgba(60, 74, 66, 0.72);
    padding: 0.85rem 1rem;
    background: #161b2a;
    color: #dee2f6;
}

.form-control:disabled {
    background: #252a39;
    color: rgba(222, 226, 246, 0.54);
}

.auth-submit {
    width: 100%;
    margin-top: 1.25rem;
    padding: 0.9rem 1rem;
    font-weight: 700;
}

.error-message {
    margin: 1rem 0 0;
    color: var(--tennis-error);
    font-weight: 700;
}

.dashboard-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-panel {
    padding: 1.5rem;
}

.dashboard-hero {
    grid-column: 1 / -1;
}

.resource-setup-grid {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.manage-courts-layout {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 2fr 1fr;
}

.booking-layout {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: 2fr 1fr;
}

.resource-section {
    display: grid;
    gap: 1.25rem;
    align-content: start;
}

.resource-section-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.entity-list {
    display: grid;
    gap: 0.75rem;
}

.entity-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--tennis-line);
    border-radius: 8px;
    background: #161b2a;
}

.entity-row.selected {
    border-color: rgba(24, 81, 63, 0.42);
    box-shadow: inset 0 0 0 1px rgba(24, 81, 63, 0.12);
}

.entity-primary {
    display: grid;
    gap: 0.15rem;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    color: inherit;
    flex: 1;
}

.entity-primary span,
.entity-summary span {
    color: var(--tennis-muted);
}

.entity-summary {
    display: grid;
    gap: 0.15rem;
}

.court-editor {
    border: 1px solid var(--tennis-line);
    border-radius: 8px;
    background: #161b2a;
}

.court-editor summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    cursor: pointer;
}

.court-editor summary::marker {
    color: var(--tennis-muted);
}

.court-editor-body {
    padding: 0 1rem 1rem;
}

.entity-actions,
.editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.editor-card {
    display: grid;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--tennis-line);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
}

.day-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.day-chip {
    min-width: 3.3rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid rgba(24, 81, 63, 0.24);
    border-radius: 999px;
    background: #fff;
    color: var(--tennis-forest);
    font-weight: 700;
}

.day-chip.active {
    background: var(--tennis-forest);
    border-color: var(--tennis-forest);
    color: #f6fbf7;
}

.time-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-list {
    display: grid;
    gap: 1rem;
    margin: 0;
}

.detail-list div {
    padding-top: 0.9rem;
    border-top: 1px solid var(--tennis-line);
}

.detail-list div:first-child {
    padding-top: 0;
    border-top: 0;
}

.detail-list dt {
    margin-bottom: 0.25rem;
    color: var(--tennis-muted);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-list dd {
    margin: 0;
    word-break: break-word;
}

#blazor-error-ui {
    color-scheme: light only;
    background: #fff5cd;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--tennis-forest);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

code {
    color: #7f1c3e;
}

.booking-canvas {
    max-width: 1200px;
    min-height: calc(100vh - 80px);
    margin: 0 auto;
    padding: 2.5rem;
    color: #dee2f6;
}

.booking-header,
.availability-header,
.section-heading,
.booking-summary,
.schedule-heading,
.booking-row,
.row-actions {
    display: flex;
    align-items: center;
}

.booking-header {
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.booking-title {
    font-weight: 900;
}

.booking-flow,
.slot-list,
.resource-choice-list,
.schedule-list {
    display: grid;
    gap: 1rem;
}

.booking-flow {
    gap: 3rem;
}

.booking-panel,
.date-stepper,
.availability-slot,
.booking-summary,
.help-fab {
    border: 1px solid rgba(60, 74, 66, 0.32);
    background: #1a1f2e;
    color: #dee2f6;
}

.booking-panel {
    padding: 2rem;
    border-radius: 8px;
}

.booking-eyebrow {
    color: #bbcabf;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.date-stepper {
    display: grid;
    grid-template-columns: auto minmax(150px, 1fr) auto;
    align-items: center;
    gap: 0.25rem;
    min-width: 350px;
    padding: 0.5rem;
    border-radius: 8px;
}

.date-stepper-copy {
    text-align: center;
}

.date-stepper-label {
    color: #dee2f6;
    font-weight: 900;
}

.native-date-input {
    grid-column: 1 / -1;
    width: 100%;
    border: 1px solid rgba(60, 74, 66, 0.54);
    border-radius: 6px;
    padding: 0.45rem 0.65rem;
    background: #161b2a;
    color: #dee2f6;
}

.option-grid {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

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

.duration-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.option-button {
    min-height: 52px;
    border-radius: 8px;
    background: #303444;
    font-weight: 900;
}

.section-heading {
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.section-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 8px;
    background: rgba(78, 222, 163, 0.12);
    color: #4edea3;
}

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

.player-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 92px;
    padding: 1.25rem;
    border-radius: 8px;
    background: #161b2a;
}

.player-card.host {
    border: 1px solid rgba(78, 222, 163, 0.42);
}

.player-card.invite {
    border: 1px dashed rgba(187, 202, 191, 0.32);
    background: #090e1c;
}

.host-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    border-radius: 4px;
    padding: 0.12rem 0.45rem;
    background: rgba(78, 222, 163, 0.12);
    color: #4edea3;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.availability-section {
    display: grid;
    gap: 1rem;
}

.availability-header {
    justify-content: space-between;
    gap: 1rem;
}

.range-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 999px;
    background: #161b2a;
}

.range-label {
    color: #bbcabf;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.range-times {
    display: flex;
    gap: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(60, 74, 66, 0.5);
}

.range-times label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
}

.range-times span {
    color: #bbcabf;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.range-times input {
    width: 82px;
    border: 0;
    background: transparent;
    color: #dee2f6;
}

.center-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    min-height: 120px;
}

.availability-slot {
    overflow: hidden;
    border-radius: 8px;
}

.availability-slot.expanded {
    border-color: rgba(78, 222, 163, 0.42);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.08);
}

.slot-summary {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 1.5rem;
    padding: 1.5rem;
    border: 0;
    background: rgba(37, 42, 57, 0.54);
    color: #dee2f6;
    text-align: left;
}

.slot-time {
    width: 72px;
    color: #4edea3;
    font-size: 1.3rem;
    font-weight: 900;
}

.slot-divider {
    width: 1px;
    height: 32px;
    background: rgba(60, 74, 66, 0.5);
}

.slot-count {
    flex: 1;
    font-weight: 800;
}

.resource-choice-list {
    padding: 0.5rem 1.5rem 1.5rem;
}

.resource-choice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(60, 74, 66, 0.22);
    border-radius: 8px;
    background: #161b2a;
}

.resource-choice.selected {
    border-color: rgba(78, 222, 163, 0.62);
    background: rgba(78, 222, 163, 0.08);
}

.booking-summary {
    justify-content: space-between;
    gap: 2rem;
    padding: 2rem;
    border-color: rgba(78, 222, 163, 0.34);
    border-radius: 8px;
    background: linear-gradient(90deg, #252a39, #1a1f2e);
}

.summary-label {
    color: #4edea3;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.summary-price-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.summary-price {
    font-weight: 900;
}

.staff-tools,
.schedule-panel {
    margin-top: 2rem;
}

.staff-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding-top: 1rem;
}

.schedule-heading {
    justify-content: space-between;
}

.schedule-filters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.booking-row {
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid rgba(60, 74, 66, 0.28);
    border-radius: 8px;
    background: #161b2a;
}

.row-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.help-fab {
    position: fixed;
    right: 2rem;
    bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    background: rgba(37, 42, 57, 0.82);
    backdrop-filter: blur(20px);
}

.help-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 8px;
    background: rgba(78, 222, 163, 0.16);
    color: #4edea3;
}

.help-title {
    color: #dee2f6;
    font-weight: 900;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

@media (max-width: 860px) {
    .auth-card {
        padding: 1.5rem;
    }

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

    .resource-setup-grid,
    .manage-courts-layout,
    .booking-layout,
    .time-grid,
    .player-grid,
    .schedule-filters,
    .staff-form {
        grid-template-columns: 1fr;
    }

    .resource-section-header,
    .entity-row,
    .booking-header,
    .availability-header,
    .booking-summary,
    .booking-row {
        flex-direction: column;
        align-items: stretch;
    }

    .booking-canvas {
        padding: 1.25rem;
    }

    .date-stepper {
        min-width: 0;
    }

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

    .range-filter,
    .range-times {
        align-items: stretch;
        flex-direction: column;
        border-left: 0;
        border-radius: 8px;
    }

    .help-fab {
        display: none;
    }
}
