body {
    font-family: Arial, sans-serif;
    margin: 24px;
    background: #f7f7f7;
    color: #222;
}

h1 {
    margin-bottom: 10px;
}

h2 {
    margin-top: 36px;
    margin-bottom: 14px;
    font-size: 24px;
}

.hint {
    color: #666;
    margin-bottom: 10px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.login-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.login-form input {
    padding: 8px 10px;
    border: 1px solid #bbb;
    border-radius: 8px;
    font-size: 14px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.login-error,
.error-box {
    background: #fde8e8;
    color: #8a1f1f;
    border: 1px solid #e5a5a5;
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 18px;
}

.schedule-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.schedule-intro {
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.week-section {
    display: flex;
    flex-direction: column;
}

.day {
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 18px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.today {
    border: 4px solid #0a7a33;
    background: #dff7e7;
    box-shadow: 0 0 0 4px rgba(10, 122, 51, 0.18), 0 6px 18px rgba(0, 0, 0, 0.10);
}

.target-day {
    scroll-margin-top: 24px;
}

.day-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.day h3 {
    margin: 0;
    font-size: 22px;
    padding: 8px 12px;
    border-radius: 8px;
}

.today h3 {
    background: #0a7a33;
    color: white;
    font-weight: 700;
}

.today-badge {
    display: inline-block;
    background: #0a7a33;
    color: white;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 999px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}

.schedule-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    margin-top: 4px;
    table-layout: fixed;
    background: white;
}

.schedule-table th,
.schedule-table td {
    border: 1px solid #ccc;
    padding: 10px;
    text-align: center;
    vertical-align: top;
}

.schedule-table th {
    background: #f0f0f0;
    font-size: 14px;
}

.time-col {
    width: 120px;
    font-weight: bold;
    background: #fafafa;
    text-align: left;
    white-space: nowrap;
}

.available {
    background: #ffffff;
}

.unavailable {
    background: #ececec;
    color: #999;
}

.slot-cell {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    min-height: 160px;
}

.slot-header-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.slot-count {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef5f0;
    color: #0a7a33;
    font-weight: bold;
    font-size: 13px;
}

.slot-persons {
    text-align: left;
    min-height: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slot-empty-state {
    font-size: 13px;
    color: #666;
    background: #f7f7f7;
    border: 1px dashed #d3d3d3;
    border-radius: 8px;
    padding: 8px 10px;
}

.person-entry {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.person-name {
    word-break: break-word;
    flex: 1;
    line-height: 1.35;
}

.person-meta {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 3px;
}

.person-delete-form {
    margin: 0;
    flex-shrink: 0;
}

.slot-unavailable-mark {
    font-size: 20px;
    color: #999;
    padding-top: 18px;
    text-align: center;
}

.btn {
    border: 0;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    min-height: 40px;
}

.btn-primary {
    background: #0a7a33;
    color: white;
}

.btn-primary:disabled {
    background: #b8c9bd;
    color: #f5f5f5;
    cursor: not-allowed;
}

.btn-danger {
    background: #b3261e;
    color: white;
    padding: 8px 10px;
    font-size: 12px;
    min-height: 36px;
}

.btn-disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    width: 100%;
}

.slot-full-button {
    margin-top: 2px;
}

.inline-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.booking-form {
    padding-top: 2px;
}

.login-only-box {
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.mini-hint {
    font-size: 12px;
    color: #666;
    text-align: left;
    line-height: 1.45;
}

/* Autocomplete */

.player-autocomplete {
    text-align: left;
}

.selected-players {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    min-height: 10px;
}

.selected-player-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #e9f6ee;
    border: 1px solid #b7dfc4;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 13px;
    max-width: 100%;
    min-height: 36px;
    box-sizing: border-box;
}

.selected-player-chip.self-player {
    background: #dff7e7;
    border-color: #8ccc9f;
    font-weight: bold;
}

.selected-player-chip span {
    word-break: break-word;
}

.selected-player-remove {
    border: 0;
    background: transparent;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.selected-player-remove:hover {
    color: #b3261e;
}

.autocomplete-input-wrap {
    position: relative;
}

.player-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid #bbb;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    min-height: 44px;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d6d6d6;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.10);
    max-height: 220px;
    overflow-y: auto;
    z-index: 30;
    display: none;
}

.autocomplete-dropdown.open {
    display: block;
}

.autocomplete-option {
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    line-height: 1.35;
}

.autocomplete-option:last-child {
    border-bottom: 0;
}

.autocomplete-option:hover,
.autocomplete-option.active {
    background: #f3f8f5;
}

.autocomplete-empty {
    padding: 10px 12px;
    color: #777;
    font-size: 13px;
}

.is-hidden {
    display: none !important;
}

.autocomplete-option.self-option {
    font-weight: bold;
}

.global-booking-hint {
    margin-bottom: 0;
}

@media (max-width: 1100px) {
    body {
        margin: 18px;
    }

    .schedule-table {
        min-width: 760px;
    }

    .day {
        padding: 14px;
    }
}

@media (max-width: 900px) {
    body {
        margin: 16px;
    }

    h2 {
        font-size: 21px;
    }

    .day {
        padding: 12px;
        border-radius: 10px;
    }

    .day h3 {
        font-size: 19px;
        padding: 7px 10px;
    }

    .schedule-table th,
    .schedule-table td {
        padding: 8px;
    }

    .schedule-table {
        min-width: 700px;
    }

    .slot-cell {
        gap: 8px;
        min-height: 150px;
    }

    .person-entry {
        flex-direction: column;
        align-items: stretch;
    }

    .person-delete-form .btn-danger {
        width: 100%;
    }
}

@media (max-width: 640px) {
    body {
        margin: 12px;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        margin-top: 28px;
        margin-bottom: 12px;
        font-size: 20px;
    }

    .top-bar {
        padding: 12px;
    }

    .login-form {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .login-form input,
    .login-form button {
        width: 100%;
        box-sizing: border-box;
        min-height: 44px;
    }

    .user-info {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .schedule-intro {
        padding: 12px;
    }

    .day-header {
        gap: 8px;
    }

    .today-badge {
        font-size: 12px;
    }

    .schedule-table {
        min-width: 640px;
    }

    .schedule-table th {
        font-size: 13px;
    }

    .time-col {
        width: 92px;
        font-size: 13px;
    }

    .slot-count {
        font-size: 12px;
        padding: 4px 8px;
    }

    .slot-cell {
        min-height: 140px;
    }

    .slot-empty-state,
    .person-name,
    .autocomplete-option,
    .mini-hint {
        font-size: 13px;
    }

    .btn,
    .inline-form .btn {
        width: 100%;
    }

    .btn-danger {
        font-size: 13px;
    }

    .selected-players {
        gap: 6px;
    }

    .selected-player-chip {
        width: 100%;
        border-radius: 12px;
        justify-content: space-between;
    }

    .player-search-input {
        font-size: 16px;
    }
}

@media (max-width: 420px) {
    body {
        margin: 10px;
    }

    .schedule-table {
        min-width: 600px;
    }

    .day {
        padding: 10px;
    }

    .day h3 {
        font-size: 17px;
        padding: 6px 8px;
    }

    .schedule-table th,
    .schedule-table td {
        padding: 7px;
    }

    .slot-count {
        min-height: 26px;
    }

    .person-entry {
        padding: 8px;
    }
}