:root {
    --bg: #f4f1ea;
    --surface: #fffdf8;
    --surface-strong: #ffffff;
    --border: #ded7cb;
    --text: #212121;
    --muted: #6b6a66;
    --accent: #1f6f43;
    --danger: #b44336;
    --shadow: 0 18px 45px rgba(48, 39, 24, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(221, 204, 169, 0.35), transparent 28%),
        linear-gradient(180deg, #f6f2ea 0%, #efe7dc 100%);
    color: var(--text);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

button,
input,
select,
a {
    font: inherit;
}

.hidden {
    display: none !important;
}

.app-shell {
    width: min(1180px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 32px 0 48px;
}

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

.eyebrow,
.month-caption,
.modal-label {
    margin: 0 0 6px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
}

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

h1 {
    font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.calendar-card {
    background: rgba(255, 253, 248, 0.88);
    backdrop-filter: blur(8px);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.calendar-header {
    display: grid;
    grid-template-columns: 56px 1fr 56px;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.month-title-wrap {
    text-align: center;
}

#month-title {
    letter-spacing: 0.08em;
}

.nav-btn,
.icon-btn,
.btn {
    border: 0;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.nav-btn,
.icon-btn {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: var(--surface-strong);
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(33, 33, 33, 0.08);
    font-size: 2rem;
}

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

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

.weekdays {
    margin-bottom: 12px;
}

.weekday {
    padding: 10px 8px;
    text-align: center;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.8rem;
}

.day-cell {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 22px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: left;
}

.day-cell.is-admin {
    cursor: pointer;
}

.day-cell.is-readonly {
    cursor: default;
}

.day-cell.empty-slot {
    visibility: hidden;
}

.day-cell.is-reserved {
    background: linear-gradient(180deg, #2b8a57 0%, #236f47 100%);
    color: #ffffff;
    border-color: transparent;
}

.day-cell.reservation-range::before {
    content: "";
    position: absolute;
    top: 50%;
    height: 18px;
    transform: translateY(-50%);
    background: #72c498;
    z-index: 0;
}

.day-cell.reservation-start::before {
    left: 50%;
    right: -6px;
    border-radius: 999px 0 0 999px;
}

.day-cell.reservation-end::before {
    left: -6px;
    right: 50%;
    border-radius: 0 999px 999px 0;
}

.day-cell.reservation-middle::before {
    left: -6px;
    right: -6px;
    border-radius: 0;
}

.day-cell.reservation-start.reservation-end::before {
    display: none;
}

.day-cell > * {
    position: relative;
    z-index: 1;
}

.day-cell.is-today {
    box-shadow: 0 0 0 2px rgba(31, 111, 67, 0.18);
}

.day-number {
    font-size: 1.05rem;
    font-weight: 700;
}

.day-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    flex: 1;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.guest-name {
    font-weight: 700;
}

.summary-line {
    font-size: 0.85rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-line.muted {
    opacity: 0.82;
}

.phone-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.reservation-following .day-content {
    justify-content: center;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(24, 22, 18, 0.42);
}

.modal {
    width: min(100%, 560px);
    background: var(--surface);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal-small {
    width: min(100%, 420px);
}

.modal-header,
.modal-body {
    padding: 20px 22px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid rgba(33, 33, 33, 0.08);
}

.reservation-summary,
.readonly-card {
    background: #f7f3ec;
    border: 1px solid rgba(33, 33, 33, 0.08);
    border-radius: 18px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.summary-stack,
.form-grid,
.field {
    display: grid;
    gap: 8px;
}

.form-grid {
    gap: 16px;
}

.field label {
    font-weight: 600;
}

.field-label {
    font-weight: 600;
}

.field input,
.field select {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #ffffff;
}

.radio-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.radio-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #ffffff;
    cursor: pointer;
}

.radio-card input {
    margin: 0;
}

.modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 700;
}

.btn-primary {
    background: var(--text);
    color: #ffffff;
}

.btn-secondary {
    background: #ffffff;
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(33, 33, 33, 0.12);
}

.btn-danger {
    background: #f6e2df;
    color: var(--danger);
}

.btn-call {
    background: var(--accent);
    color: #ffffff;
}

.btn-link {
    color: var(--text);
    text-decoration: none;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    max-width: 320px;
    padding: 14px 16px;
    border-radius: 16px;
    color: #ffffff;
    background: rgba(33, 33, 33, 0.92);
    box-shadow: var(--shadow);
    z-index: 20;
}

.admin-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.admin-card {
    width: min(100%, 520px);
}

.admin-form {
    margin-top: 16px;
}

.admin-actions {
    margin-top: 16px;
}

.error-banner {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f6e2df;
    color: var(--danger);
    font-weight: 600;
}

@media (max-width: 860px) {
    .app-shell {
        width: min(100vw - 20px, 100%);
        padding-top: 20px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .calendar-card {
        padding: 16px;
    }

    .weekdays,
    .days-grid {
        gap: 8px;
    }

    .weekday {
        font-size: 0.7rem;
        padding: 8px 2px;
    }

    .day-cell {
        padding: 8px;
        border-radius: 16px;
    }

    .day-cell.reservation-start::before {
        right: -4px;
    }

    .day-cell.reservation-end::before {
        left: -4px;
    }

    .day-cell.reservation-middle::before {
        left: -4px;
        right: -4px;
    }

    .summary-line {
        font-size: 0.76rem;
    }
}

@media (max-width: 560px) {
    .calendar-header {
        grid-template-columns: 48px 1fr 48px;
    }

    .nav-btn,
    .icon-btn {
        width: 48px;
        height: 48px;
        border-radius: 14px;
    }

    .weekday {
        font-size: 0.64rem;
    }

    .day-number {
        font-size: 0.94rem;
    }

    .summary-line.rooms {
        display: none;
    }
}
