@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@500;700&family=Manrope:wght@400;500;600;700&display=swap");

:root {
    --bg-top: #8fd3fb;
    --bg-bottom: #b9e8ff;
    --ink: #2f6899;
    --ink-soft: #5f8eb6;
    --line: #b8ddf6;
    --card: rgba(255, 255, 255, 0.96);
    --accent: #61b4ef;
    --accent-dark: #3e98da;
    --navy: #5aa9e4;
    --mint: #dff3ff;
    --sand: #d7efff;
    --rose: #cfe9ff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Manrope", "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.2) 0 2px, transparent 3px),
        radial-gradient(circle at 78% 24%, rgba(255, 255, 255, 0.18) 0 2px, transparent 3px),
        radial-gradient(circle at 34% 72%, rgba(255, 255, 255, 0.2) 0 2px, transparent 3px),
        radial-gradient(circle at 88% 82%, rgba(255, 255, 255, 0.16) 0 2px, transparent 3px),
        linear-gradient(30deg, rgba(72, 157, 223, 0.09) 1px, transparent 1px),
        linear-gradient(150deg, rgba(72, 157, 223, 0.09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(72, 157, 223, 0.07) 1px, transparent 1px),
        linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
    background-size: 180px 180px, 220px 220px, 200px 200px, 240px 240px, 120px 120px, 120px 120px, 80px 80px, auto;
    color: var(--ink);
}

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

.shell {
    max-width: 1560px;
    margin: 0 auto;
    padding: 32px 20px 60px;
    position: relative;
}

.hero {
    display: grid;
    grid-template-columns: 1.35fr 0.95fr;
    gap: 24px;
    align-items: stretch;
    margin-bottom: 28px;
}

.card {
    background: var(--card);
    border: 1px solid rgba(183, 220, 245, 0.82);
    border-radius: 24px;
    box-shadow: 0 18px 36px rgba(73, 139, 188, 0.12);
    backdrop-filter: blur(10px);
}

.hero-copy {
    padding: 34px;
    position: relative;
    overflow: hidden;
}

.hero-copy::after {
    content: "";
    position: absolute;
    right: -40px;
    top: -36px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(97, 180, 239, 0.24), transparent 64%);
    pointer-events: none;
}

.eyebrow {
    display: inline-flex;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

h1, h2, h3 {
    margin: 0 0 14px;
    font-family: "Fraunces", Georgia, serif;
}

h1 {
    font-size: clamp(32px, 5vw, 54px);
    line-height: 1.02;
    margin-top: 18px;
}

.lead {
    font-size: 17px;
    line-height: 1.6;
    color: var(--ink-soft);
    margin-bottom: 20px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 24px 0 20px;
}

.stat-tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(248,252,255,0.99));
    border: 1px solid rgba(191, 223, 244, 0.8);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--ink-soft);
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.pill {
    display: block;
    padding: 10px 14px;
    border-radius: 999px;
    background: #ffffff;
    color: #4f7da5;
    border: 1px solid #d9e9f6;
    font-size: 14px;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

.space-photo {
    margin-top: 20px;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid #d9e9f6;
    box-shadow: 0 10px 24px rgba(84, 149, 194, 0.1);
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4fbff;
}

.space-description {
    margin-top: 18px;
    margin-bottom: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

.space-photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.admin-image-preview img {
    display: block;
    width: 100%;
    height: 260px;
    object-fit: cover;
}

.form-card,
.calendar-card,
.admin-card {
    padding: 28px;
}

.form-card {
    display: flex;
    flex-direction: column;
    max-height: 960px;
    overflow: hidden;
}

#booking-form {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.is-hidden {
    display: none !important;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 6px 0 16px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #d8e8f6;
    background: #ffffff;
    color: #4b779e;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    padding: 0;
    flex: 0 0 auto;
}

.admin-checkbox-row {
    margin-top: -4px;
    margin-bottom: 14px;
}

.multi-day-panel,
.daily-time-row {
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid #d8e8f6;
    background: #fafdff;
}

.daily-time-list {
    display: grid;
    gap: 12px;
}

.daily-time-date {
    margin-bottom: 10px;
    font-weight: 700;
    color: #3d7098;
}

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

.field label {
    font-size: 14px;
    color: #4b779e;
}

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

input,
textarea,
select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 13px 14px;
    border-radius: 14px;
    border: 1px solid #bfdff4;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(97, 180, 239, 0.8);
    box-shadow: 0 0 0 4px rgba(97, 180, 239, 0.16);
}

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 18px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
    box-shadow: 0 12px 24px rgba(76, 156, 214, 0.26);
}

button:hover,
.button:hover {
    transform: translateY(-1px);
}

.button.secondary {
    background: var(--navy);
    box-shadow: 0 12px 24px rgba(67, 136, 189, 0.2);
}

.small-button,
.danger-button {
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
    box-shadow: none;
}

.danger-button {
    background: linear-gradient(180deg, #74bff0, #509fda);
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
}

.flash.success {
    background: #e5f6ff;
    color: #2c6d99;
}

.flash.error {
    background: #edf8ff;
    color: #4c7ca4;
}

.booking-help {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #cfe4f5;
    background: #f7fbff;
    color: #4b78a0;
    line-height: 1.55;
}

.booking-help strong {
    display: block;
    margin-bottom: 8px;
    color: #2f6797;
}

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

.calendar-nav {
    display: flex;
    gap: 10px;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.space-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.space-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    background: #ffffff;
    color: #4f7da5;
    font-size: 14px;
    border: 1px solid #d9e9f6;
}

.space-tab.active {
    background: #5aa9e4;
    color: #fff;
    border-color: #5aa9e4;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: #ffffff;
    font-size: 13px;
    color: var(--ink-soft);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.legend-dot.free {
    background: #caebff;
}

.legend-dot.partial {
    background: #86caf3;
}

.legend-dot.occupied {
    background: #4ca8e8;
}

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

.calendar-weekday,
.calendar-day {
    min-height: 148px;
    padding: 14px;
    border-radius: 18px;
}

.calendar-weekday {
    min-height: auto;
    background: var(--navy);
    color: #fff;
    text-align: center;
    font-size: 13px;
    letter-spacing: 0.04em;
}

.calendar-day {
    display: flex;
    border: 1px solid #d9e9f6;
    background: rgba(255, 255, 255, 0.98);
    flex-direction: column;
    justify-content: flex-start;
    gap: 8px;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
    overflow: hidden;
    width: 100%;
    min-width: 0;
    cursor: pointer;
}

.calendar-day.selected {
    border-color: #5aa9e4;
    box-shadow: 0 0 0 2px rgba(90, 169, 228, 0.2), 0 12px 26px rgba(74, 141, 191, 0.1);
}

.calendar-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(74, 141, 191, 0.1);
}

.calendar-day.muted {
    opacity: 0.38;
}

.calendar-day.partial {
    background: linear-gradient(180deg, #ffffff 0%, #eef8ff 100%);
    border-color: #8ccbf2;
}

.calendar-day.occupied {
    background: linear-gradient(180deg, #f5fbff 0%, #dbf0ff 100%);
    border-color: #68b4ea;
}

.day-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
}

.calendar-day .date {
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.today-badge {
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
    font-size: 11px;
    line-height: 1;
}

.calendar-day .status {
    color: #4d7ca4;
}

.status-main {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.status-event {
    font-size: 12px;
    line-height: 1.35;
    color: #5b85ac;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.calendar-day.free .status-main {
    color: #47739b;
}

.calendar-day.partial .status-main {
    color: #367fb7;
}

.calendar-day.occupied .status-main,
.calendar-day.occupied .status-event,
.calendar-day.occupied .slot-time,
.calendar-day.occupied .slot-name {
    color: #2a74aa;
}

.calendar-day ul,
.bookings-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bookings-list {
    max-height: 620px;
    overflow-y: auto;
    padding-right: 4px;
}

.calendar-day li,
.bookings-list li {
    padding: 10px 11px;
    border-radius: 12px;
    background: #f7fbff;
    font-size: 13px;
    line-height: 1.35;
}

.calendar-day li {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.slot-time {
    font-size: 12px;
    font-weight: 700;
    color: #3d7298;
    overflow-wrap: anywhere;
}

.slot-name {
    font-size: 12px;
    color: #4f7ca4;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.slot-desc,
.slot-person,
.booking-description,
.booking-responsible {
    font-size: 12px;
    line-height: 1.35;
    color: #6588a9;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.booking-item {
    display: grid;
    gap: 4px;
    border-left: 4px solid rgba(97, 180, 239, 0.58);
    background: #ffffff;
}

.booking-date {
    font-weight: 700;
}

.booking-meta {
    color: var(--ink-soft);
    font-size: 13px;
}

.booking-name {
    font-size: 15px;
    line-height: 1.35;
    word-break: break-word;
}

.selected-date-badge {
    display: inline-flex;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 999px;
    background: #ffffff;
    color: #42739b;
    border: 1px solid #d9e9f6;
    font-weight: 700;
}

.admin-image-preview {
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid #d9e9f6;
    background: rgba(255, 255, 255, 0.96);
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1.75fr) minmax(320px, 0.85fr);
    gap: 18px;
}

.muted {
    color: #6b90b3;
}

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

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

.table-wrap {
    max-height: 1180px;
    overflow-y: auto;
    overflow-x: auto;
}

.export-dialog {
    width: min(520px, calc(100vw - 32px));
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 24px;
    background: transparent;
    box-shadow: none;
}

.export-dialog::backdrop {
    background: rgba(54, 96, 135, 0.3);
    backdrop-filter: blur(6px);
}

.export-dialog-body {
    padding: 26px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(183, 220, 245, 0.9);
    box-shadow: 0 24px 40px rgba(73, 139, 188, 0.18);
}

.export-dialog-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 1;
}

.dialog-close-button {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    font-size: 24px;
    line-height: 1;
}

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

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid #d4e8f7;
    text-align: left;
    vertical-align: top;
}

.inline-form {
    display: inline;
}

.small {
    font-size: 13px;
}

@media (max-width: 960px) {
    .hero,
    .layout,
    .grid-two {
        grid-template-columns: 1fr;
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }

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

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

    .calendar-nav {
        width: 100%;
    }

    .calendar-nav .button {
        flex: 1;
    }
}

@media (max-width: 640px) {
    .shell {
        padding: 16px 12px 32px;
    }

    .hero-copy,
    .form-card,
    .calendar-card,
    .admin-card {
        padding: 16px;
    }

    h1 {
        font-size: 34px;
    }

    h2 {
        font-size: 30px;
    }

    .lead,
    .muted {
        font-size: 15px;
        line-height: 1.45;
    }

    .pill-row,
    .legend,
    .action-row,
    .space-switcher {
        gap: 8px;
    }

    .pill,
    .legend-item,
    .space-tab {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        justify-content: flex-start;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .field,
    .checkbox-row,
    .multi-day-panel,
    .daily-time-row,
    .filter-grid {
        min-width: 0;
        max-width: 100%;
    }

    select,
    input,
    button,
    .button {
        max-width: 100%;
    }

    .form-card {
        max-height: none;
        overflow: visible;
    }

    #booking-form {
        overflow: visible;
        padding-right: 0;
    }

    .space-photo img,
    .admin-image-preview img {
        height: 190px;
    }

    .calendar-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .calendar-grid {
        gap: 6px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .calendar-weekday {
        display: none;
    }

    .calendar-day {
        min-height: 118px;
        padding: 12px;
        border-radius: 16px;
    }

    .calendar-day.muted {
        display: none;
    }

    .day-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .calendar-day .date {
        font-size: 22px;
    }

    .today-badge {
        font-size: 10px;
    }

    .status-main {
        font-size: 15px;
    }

    .status-event,
    .slot-time,
    .slot-name,
    .booking-meta,
    .booking-name {
        font-size: 12px;
    }

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

    .bookings-list {
        max-height: 420px;
    }

    .table-wrap table,
    .table-wrap thead,
    .table-wrap tbody,
    .table-wrap tr,
    .table-wrap th,
    .table-wrap td {
        display: block;
        width: 100%;
    }

    .table-wrap thead {
        display: none;
    }

    .table-wrap tr {
        padding: 12px;
        margin-bottom: 12px;
        border: 1px solid #d4e8f7;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.96);
    }

    .table-wrap td {
        padding: 6px 0;
        border: 0;
    }

    .small-button,
    .danger-button,
    .action-row .button,
    .action-row button {
        width: 100%;
    }

    .inline-form {
        display: block;
        margin-top: 8px;
    }
}
