:root {
    --bg-main: #f5f5f8;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --border-color: #ddd;
    --text-main: #222;
    --accent: #ff9800;
    --accent-dark: #f57c00;
    --planned-bg: rgba(255, 193, 7, 0.18);
    --played-bg: rgba(76, 175, 80, 0.2);
    --blocked-bg: rgba(158, 158, 158, 0.25);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
}

/* ссылки и кнопки */

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

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-header);
    padding: 10px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--accent-dark);
}

.topbar nav a {
    margin-left: 12px;
    padding: 6px 10px;
    border-radius: 6px;
}

.topbar nav a:hover {
    background: rgba(0,0,0,0.04);
}

.container {
    padding: 16px;
}

/* login */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f9ff, #e4f1ff);
}

.login-card {
    background: var(--bg-card);
    padding: 24px 28px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,.12);
    width: 320px;
}

.login-card .logo {
    text-align: center;
    margin-bottom: 16px;
}

.login-card label {
    display: block;
    font-size: 14px;
    margin-bottom: 10px;
}

.login-card input {
    width: 100%;
    padding: 8px;
    margin-top: 4px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-main);
}

.login-card button {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

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

/* alerts */

.alert {
    background: #ffebee;
    color: #b71c1c;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid #ffcdd2;
}

/* buttons */

.btn {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #fff;
    cursor: pointer;
    font-size: 14px;
}

.btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn.primary:hover {
    background: var(--accent-dark);
}

.btn.danger {
    border-color: #f44336;
    color: #f44336;
    background: #fff5f5;
}

.btn.danger:hover {
    background: #ffebee;
}

.small-btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* calendar */

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.calendar-nav .btn {
    margin-left: 4px;
}

.calendar {
    overflow-x: auto;
}

.calendar-grid {
    display: grid;
    grid-template-columns: 80px repeat(7, minmax(120px, 1fr));
    gap: 4px;
    min-width: 100%;
}

.calendar-column {
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.calendar-column-header {
    text-align: center;
    padding: 6px;
    font-size: 14px;
    background: #f1f3f7;
    border-bottom: 1px solid var(--border-color);
}

.calendar-times {
    position: sticky;
    left: 0;
    z-index: 2;
}

.time-slot-label {
    padding: 6px 4px;
    font-size: 12px;
    border-bottom: 1px solid #eee;
    background: #fafbff;
}

/* слоты */

.slot {
    display: block;
    padding: 6px 4px;
    border-bottom: 1px solid #f1f1f1;
    font-size: 12px;
    cursor: pointer;
}

.slot.free {
    background: #ffffff;
}

.slot.free:hover {
    background: #fff3e0;
}

/* брони — любые, и запланированные, и отыгранные — оранжевые */
.slot.booked.planned,
.slot.booked.played {
    background: #ffb74d;   /* мягкий оранжевый */
    color: #000000;
}

/* закрытый слот — тёмно-серый с белым текстом */
.slot.blocked {
    background: #424242;
    color: #ffffff;
}

.slot-time {
    font-weight: 600;
}

.slot-title {
    margin-top: 2px;
}

.slot-client,
.slot-age,
.slot-prepayment {
    margin-top: 2px;
    opacity: 0.9;
}

/* форма брони */

.booking-form-section {
    margin-top: 24px;
    background: var(--bg-card);
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.booking-form-section h2 {
    margin-top: 0;
}

.booking-form .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
}

.booking-form label {
    font-size: 13px;
    flex: 1 1 180px;
}

.booking-form input,
.booking-form select,
.booking-form textarea {
    width: 100%;
    margin-top: 4px;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-main);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

/* список броней */

.summary {
    margin-bottom: 12px;
}

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

.list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.list-table th,
.list-table td {
    border-bottom: 1px solid #eee;
    padding: 6px 4px;
}

.list-table th {
    background: #f1f3f7;
}

.row-played {
    background: var(--played-bg);
}

.row-planned {
    background: var(--planned-bg);
}

/* справочник */

.directory-section {
    margin-top: 20px;
    background: var(--bg-card);
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.directory-section h2 {
    margin-top: 0;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.inline-form input[type="text"] {
    flex: 1 1 220px;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.directory-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.directory-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f1f1f1;
}

.directory-list li:last-child {
    border-bottom: none;
}

/* адаптив */

@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .topbar nav a {
        margin-left: 0;
        margin-right: 6px;
    }

    .calendar-grid {
        grid-template-columns: 60px repeat(7, minmax(120px, 1fr));
    }

    .booking-form .form-row {
        flex-direction: column;
    }

    .calendar-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .table-wrapper {
        margin-top: 10px;
    }
}
