:root {
    --day-width: 77px;
    --month-label-height: 40px;
    --room-label-width: 156px;
    --booking-slant: 32px;
    --booking-bar-height: 58px;
    --booking-lane-spacing: 66px;
    --booking-row-pad-top: 6px;
    --booking-min-row-height: 72px;
    --app-width: 1140px;
    --panel-width: 1096px;
    --brand-blue: #3157f4;
    --booking-blue: #38a8cf;
    --booking-green: #39df86;
    --booking-airbnb: #FF5A5F;
    --room-bg: #eaf0f7;
    --weekend-bg: #ffffcc;
    --line-soft: #d5dce6;
    --today-border: #111111;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #ffffff;
    color: #1e2a39;
    line-height: 1.6;
}

.container {
    max-width: var(--app-width);
    margin: 0 auto;
    background-color: white;
    min-height: 100vh;
    position: relative;
    padding-bottom: 2rem;
}

/* Header */
.header {
    height: 100px;
    background: #efefef;
    color: #24313f;
    padding: 0 42px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 1.5rem;
    box-shadow: inset 0 -1px 0 #d9d9d9;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.appbar-group {
    display: flex;
    align-items: center;
    gap: 1.9rem;
    min-width: 190px;
}

.appbar-group-left {
    position: relative;
}

.appbar-group-right {
    justify-content: flex-end;
    gap: 0.65rem;
}

.appbar-icon {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--brand-blue);
    width: 42px;
    height: 42px;
    position: relative;
    cursor: pointer;
}

.appbar-menu span {
    position: absolute;
    left: 2px;
    right: 2px;
    height: 3px;
    background: var(--brand-blue);
    border-radius: 99px;
}

.appbar-menu span:nth-child(1) {
    top: 9px;
}

.appbar-menu span:nth-child(2) {
    top: 20px;
}

.appbar-menu span:nth-child(3) {
    top: 31px;
}

.settings-menu {
    position: absolute;
    top: 54px;
    left: 0;
    width: 252px;
    background: #ffffff;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
    padding: 1rem;
    z-index: 60;
}

.settings-menu h2 {
    margin: 0 0 0.85rem;
    color: #111827;
    font-size: 1.05rem;
    line-height: 1.2;
    font-weight: 600;
}

.settings-row {
    display: grid;
    gap: 0.5rem;
}

.settings-label {
    color: #4b5563;
    font-size: 0.92rem;
    line-height: 1.25;
}

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

.language-option {
    appearance: none;
    min-height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2937;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
}

.language-option:hover,
.language-option:focus {
    border-color: var(--brand-blue);
    outline: none;
}

.language-option.active {
    background: var(--brand-blue);
    border-color: var(--brand-blue);
    color: #ffffff;
}

.appbar-search::before {
    content: "";
    position: absolute;
    width: 27px;
    height: 27px;
    border: 3px solid var(--brand-blue);
    border-radius: 50%;
    left: 0;
    top: 0;
}

.appbar-search::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 3px;
    background: var(--brand-blue);
    border-radius: 99px;
    transform: rotate(48deg);
    left: 25px;
    top: 29px;
}

.app-logo {
    width: 58px;
    height: 58px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2ddc8d 0 32%, #3157f4 32% 100%);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-size: 2.35rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.14);
}

.appbar-globe {
    width: 30px;
    height: 30px;
    border: 2px solid var(--brand-blue);
    border-radius: 50%;
}

.appbar-globe::before,
.appbar-globe::after {
    content: "";
    position: absolute;
    border: 1px solid var(--brand-blue);
    border-radius: 50%;
}

.appbar-globe::before {
    inset: 6px 10px;
}

.appbar-globe::after {
    left: 5px;
    right: 5px;
    top: 13px;
}

.language-label {
    color: #1f4bd9;
    font-size: 1.15rem;
    line-height: 1;
}

.appbar-users {
    width: 48px;
}

.appbar-users span {
    position: absolute;
    bottom: 6px;
    width: 18px;
    height: 19px;
    border: 2px solid #46bdd0;
    border-top: 0;
    border-radius: 0 0 8px 8px;
}

.appbar-users span::before {
    content: "";
    position: absolute;
    width: 11px;
    height: 11px;
    border: 2px solid #46bdd0;
    border-radius: 50%;
    top: -12px;
    left: 1px;
}

.appbar-users span:nth-child(1) {
    left: 2px;
}

.appbar-users span:nth-child(2) {
    left: 15px;
}

.appbar-users span:nth-child(3) {
    left: 28px;
}

.controls {
    display: none;
    gap: 0.5rem;
    align-items: center;
}

/* Room selector */
.room-selector {
    padding: 0.5rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 1rem;
    cursor: pointer;
    min-width: 120px;
}

/* Navigation */
.navigation {
    width: min(var(--panel-width), calc(100% - 48px));
    margin: 0.7rem auto 0;
    padding: 0.35rem 0;
    background: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.nav-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.month-picker {
    padding: 0.35rem 0.55rem;
    border: 1px solid #d8dee8;
    border-radius: 3px;
    font-size: 0.9rem;
    cursor: pointer;
    color: #24313f;
}

.filter-dropdown {
    padding: 0.35rem 0.65rem;
    border: 1px solid #d8dee8;
    border-radius: 3px;
    font-size: 0.9rem;
    cursor: pointer;
    color: #24313f;
}

/* Buttons */
.btn {
    padding: 0.35rem 0.75rem;
    border: none;
    border-radius: 3px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn-primary {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
}

.btn-primary:hover {
    background: white;
}

.btn-primary.active {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: #3157f4;
    color: white;
}

.btn-secondary:hover {
    background: #2446ca;
}

.btn-secondary:active {
    transform: scale(0.98);
}

/* Calendar container */
.calendar-shell {
    width: min(var(--panel-width), calc(100% - 48px));
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #d8d8d8;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.calendar {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    padding: 0;
    background: #ffffff;
}

.calendar-grid {
    display: grid;
    grid-template-columns: auto;
    min-width: 100%;
    position: relative;
}

.hidden {
    display: none !important;
}

.muted {
    color: #6b7280;
}

.booking-bar.selected {
    outline: 2px solid rgba(49, 87, 244, 0.36);
    outline-offset: 0;
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.92),
        0 0 0 2px rgba(49, 87, 244, 0.22);
    z-index: 5;
}

.booking-details {
    padding: 1.5rem;
    background: #f3f4f6;
    display: flex;
    justify-content: center;
}

.booking-details-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.15);
    padding: 1.5rem;
    position: relative;
}

.booking-details-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.booking-details-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.booking-details-chip {
    background: #e8edff;
    color: #4a56a6;
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.booking-details-chip.cancelled {
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #cbd5e1;
}

.booking-details-grid {
    display: grid;
    gap: 0.75rem;
}

.booking-details-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

.booking-detail-label {
    font-weight: 600;
    color: #4a5568;
}

.booking-detail-value {
    color: #1f2933;
    text-align: right;
    font-weight: 500;
}

.booking-details-row-notes {
    align-items: flex-start;
}

.booking-detail-notes {
    text-align: left;
    display: block;
    white-space: pre-line;
    max-width: 100%;
}

.booking-detail-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.booking-detail-link:hover,
.booking-detail-link:focus {
    text-decoration: underline;
}

.booking-details-empty {
    color: #6b7280;
    text-align: center;
    padding: 0.75rem 0;
}

.dashboard-panels {
    width: min(var(--panel-width), calc(100% - 48px));
    margin: 2.1rem auto 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3rem;
}

.dashboard-card {
    min-height: 124px;
    background: #ffffff;
    border: 1px solid #dedede;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    padding: 1.45rem 1.7rem;
}

.dashboard-card h2 {
    margin: 0;
    color: #0f2433;
    font-size: 1.65rem;
    line-height: 1.2;
    font-weight: 400;
}

.dashboard-list {
    display: grid;
    gap: 0.65rem;
    margin-top: 1rem;
}

.dashboard-list-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    color: #162334;
    font-size: 1rem;
    line-height: 1.35;
}

.dashboard-room {
    flex: 0 0 auto;
    font-weight: 600;
}

.dashboard-date {
    min-width: 0;
    text-align: right;
    color: #334155;
    font-weight: 400;
}

.dashboard-empty {
    margin-top: 1rem;
    color: #6b7280;
    font-size: 0.95rem;
}

.floating-add {
    position: fixed;
    right: max(34px, calc((100vw - var(--app-width)) / 2 + 34px));
    bottom: 28px;
    width: 116px;
    height: 116px;
    border: 0;
    border-radius: 50%;
    background: #2fdf86;
    color: #0f2433;
    box-shadow: 0 10px 20px rgba(47, 223, 134, 0.28);
    cursor: pointer;
    display: grid;
    place-items: center;
    z-index: 40;
}

.calendar-plus {
    width: 39px;
    height: 36px;
    border: 3px solid #0f2433;
    border-radius: 3px;
    position: relative;
}

.calendar-plus::before {
    content: "";
    position: absolute;
    left: -3px;
    right: -3px;
    top: 8px;
    border-top: 3px solid #0f2433;
}

.calendar-plus::after {
    content: "+";
    position: absolute;
    left: 0;
    right: 0;
    top: 7px;
    text-align: center;
    font-size: 1.55rem;
    line-height: 1;
    font-weight: 700;
}

.month-labels {
    display: flex;
    position: sticky;
    top: 0;
    background: white;
    z-index: 25;
    border-bottom: 1px solid #e4e7ec;
}

.month-label-spacer {
    width: var(--room-label-width);
    background: var(--room-bg);
    border-right: 1px solid var(--line-soft);
    position: sticky;
    left: 0;
    z-index: 25;
}

.month-label-track {
    position: relative;
    flex: 0 0 auto;
    height: var(--month-label-height);
    background: #ffffff;
}

.month-label {
    position: absolute;
    top: 10px;
    transform: translateX(-50%);
    font-size: 1.05rem;
    font-weight: 500;
    color: #202936;
    white-space: nowrap;
    pointer-events: none;
}

/* Room row */
.room-row {
    display: grid;
    grid-template-columns: var(--room-label-width) max-content;
    min-height: var(--booking-min-row-height);
    border-bottom: 0;
    background: #ffffff;
}

.room-name {
    padding: 0 0.7rem;
    font-size: 1.02rem;
    font-weight: 400;
    background: var(--room-bg);
    border-right: 1px solid var(--line-soft);
    box-shadow:
        inset 0 1px 4px rgba(15, 23, 42, 0.08),
        inset 0 -1px 0 rgba(255, 255, 255, 0.72),
        inset -1px 0 0 rgba(174, 185, 199, 0.55);
    display: flex;
    align-items: center;
    position: sticky;
    left: 0;
    z-index: 10;
    color: #24313f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.room-calendar {
    position: relative;
    min-height: var(--booking-min-row-height);
    background: #ffffff;
    overflow: hidden;
}

.day-bands {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.day-band {
    position: absolute;
    top: 0;
    bottom: 0;
    background: #ffffff;
    border-right: 1px solid rgba(213, 220, 230, 0.42);
}

.day-band.weekday,
.date-cell.weekday {
    background: #ffffff;
}

.day-band.weekend,
.date-cell.weekend {
    background: var(--weekend-bg);
}

.today-column-border {
    position: absolute;
    top: 0;
    bottom: 0;
    box-sizing: border-box;
    border-left: 2px solid var(--today-border);
    border-right: 2px solid var(--today-border);
    pointer-events: none;
    z-index: 4;
}

/* Date header */
.date-header {
    display: flex;
    position: sticky;
    top: var(--month-label-height);
    background: white;
    z-index: 20;
    margin-bottom: 0;
    border-bottom: 1px solid #dce2ea;
}

.date-footer {
    display: flex;
    background: #ffffff;
    border-top: 1px solid #dce2ea;
}

.date-header-spacer,
.date-footer-spacer {
    width: var(--room-label-width);
    background: var(--room-bg);
    border-right: 1px solid var(--line-soft);
    position: sticky;
    left: 0;
}

.date-header-spacer {
    z-index: 21;
}

.date-footer-spacer {
    z-index: 11;
}

.date-cells {
    display: flex;
    flex: 0 0 auto;
}

.date-cell {
    min-width: var(--day-width);
    width: var(--day-width);
    padding: 0.22rem 0.2rem 0.48rem;
    text-align: center;
    font-size: 1rem;
    color: #202936;
}

.date-cell.today {
    color: #1f2937;
    font-weight: 700;
    position: relative;
    z-index: 2;
    border-left: 2px solid var(--today-border);
    border-right: 2px solid var(--today-border);
}

.date-header .date-cell.today {
    border-top: 2px solid var(--today-border);
}

.date-footer .date-cell.today {
    border-bottom: 2px solid var(--today-border);
}

.date-cell.today .day-name {
    color: #4b5563;
}

.date-cell.today .day-number {
    color: #111827;
    font-weight: 800;
}

.date-cell .day-name {
    font-size: 1rem;
    color: #202936;
    display: block;
    font-weight: 500;
    line-height: 1.18;
}

.date-cell .day-number {
    font-size: 0.96rem;
    font-weight: 500;
    display: block;
    line-height: 1.18;
    margin-bottom: 0.5rem;
}

.date-cell-bottom .day-name {
    margin-bottom: 0.5rem;
}

.date-cell-bottom .day-number {
    margin-bottom: 0;
}

.date-cell.weekend .day-name,
.date-cell.weekend .day-number {
    color: #3f51d5;
}

/* Booking bars */
.booking-bar {
    position: absolute;
    height: var(--booking-bar-height);
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: var(--booking-label-pad-start, 14px);
    padding-right: var(--booking-label-pad-end, 14px);
    font-size: 1.04rem;
    color: #0f2433;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    text-align: center;
    box-shadow: none;
    z-index: 2;
    clip-path: polygon(
        var(--cut-start, 0px) 0,
        100% 0,
        calc(100% - var(--cut-end, 0px)) 100%,
        0 100%
    );
}

.booking-label {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.booking-text-tight {
    justify-content: flex-start;
    text-align: left;
}

.booking-text-tight .booking-label {
    width: 100%;
}

.booking-bar:hover {
    filter: brightness(0.97);
}

.booking-bar.airbnb {
    background: var(--booking-airbnb);
}

.booking-bar.direct {
    background: #dde7f1;
    color: #17202c;
    box-shadow: inset 0 0 0 1px #b8c4d2;
}

.booking-bar.booking {
    background: var(--booking-blue);
}

.booking-bar.bookingcom {
    background: var(--booking-blue);
}

.booking-bar.booking-linked {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.booking-bar.cancelled {
    background: repeating-linear-gradient(
        135deg,
        #94a3b8 0,
        #94a3b8 8px,
        #64748b 8px,
        #64748b 16px
    );
    color: #ffffff;
}

.booking-bar.direct:hover {
    box-shadow: inset 0 0 0 1px #b8c4d2;
}

.booking-bar.selected {
    box-shadow:
        inset 0 0 0 2px rgba(255, 255, 255, 0.92),
        0 0 0 2px rgba(49, 87, 244, 0.36);
}

.booking-cut-start {
    --cut-start: var(--booking-slant);
}

.booking-cut-end {
    --cut-end: var(--booking-slant);
}

/* Loading state */
.loading {
    padding: 2rem;
    text-align: center;
    color: #888;
    font-size: 1.1rem;
}

/* Error state */
.error {
    padding: 2rem;
    text-align: center;
    color: #d32f2f;
}

/* Responsive design - Mobile optimization */
@media (max-width: 768px) {
    :root {
        --day-width: 38px;
        --month-label-height: 32px;
        --room-label-width: 92px;
        --booking-slant: 24px;
        --booking-bar-height: 44px;
        --booking-lane-spacing: 50px;
        --booking-row-pad-top: 5px;
        --booking-min-row-height: 54px;
    }
    .month-label-spacer {
        width: var(--room-label-width);
    }
    .header {
        height: 72px;
        padding: 0 18px;
        gap: 0.75rem;
    }

    .appbar-group {
        gap: 0.65rem;
        min-width: 96px;
    }

    .appbar-icon {
        width: 32px;
        height: 32px;
    }

    .appbar-menu span {
        height: 2px;
    }

    .appbar-menu span:nth-child(1) {
        top: 7px;
    }

    .appbar-menu span:nth-child(2) {
        top: 15px;
    }

    .appbar-menu span:nth-child(3) {
        top: 23px;
    }

    .appbar-search::before {
        width: 20px;
        height: 20px;
        border-width: 2px;
    }

    .appbar-search::after {
        width: 14px;
        height: 2px;
        left: 19px;
        top: 22px;
    }

    .appbar-globe {
        width: 26px;
        height: 26px;
    }

    .app-logo {
        width: 44px;
        height: 44px;
        font-size: 1.8rem;
    }

    .language-label {
        font-size: 0.95rem;
    }

    .appbar-users {
        display: none;
    }
    
    .navigation {
        width: min(var(--panel-width), calc(100% - 20px));
        padding: 0.55rem 0;
        flex-direction: column;
        align-items: stretch;
    }
    
    .nav-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .filters {
        width: 100%;
    }
    
    .filter-dropdown,
    .room-selector {
        width: 100%;
    }
    
    .calendar {
        padding: 0;
    }

    .calendar-shell,
    .dashboard-panels {
        width: min(var(--panel-width), calc(100% - 20px));
    }

    .dashboard-panels {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1.25rem;
    }

    .dashboard-card h2 {
        font-size: 1.35rem;
    }

    .dashboard-list-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.15rem;
    }

    .dashboard-date {
        text-align: left;
    }

    .floating-add {
        width: 72px;
        height: 72px;
        right: 18px;
        bottom: 18px;
    }

    .booking-details {
        padding: 1rem;
    }

    .booking-details-card {
        max-width: 100%;
        padding: 1.25rem;
    }

    .booking-details-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .booking-detail-value {
        text-align: left;
        width: 100%;
    }
    
    .room-name {
        padding: 0.45rem 0.5rem;
        font-size: 0.9rem;
    }
    
    .room-row {
        grid-template-columns: var(--room-label-width) max-content;
    }
    
    .date-header-spacer,
    .date-footer-spacer {
        width: var(--room-label-width);
    }
    
    .date-cell {
        padding: 0.4rem;
    }
    
    .booking-bar {
        font-size: 0.82rem;
    }
}

@media (max-width: 480px) {
    :root {
        --day-width: 34px;
        --month-label-height: 30px;
        --room-label-width: 78px;
        --booking-slant: 21px;
        --booking-bar-height: 40px;
        --booking-lane-spacing: 46px;
        --booking-row-pad-top: 4px;
        --booking-min-row-height: 48px;
    }
    .month-label-spacer {
        width: var(--room-label-width);
    }
    .appbar-group {
        min-width: 72px;
    }

    .settings-menu {
        width: min(252px, calc(100vw - 32px));
    }

    .appbar-group-left .appbar-search,
    .appbar-globe,
    .language-label {
        display: none;
    }
    
    .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .room-name {
        font-size: 0.85rem;
    }
    
    .room-row {
        grid-template-columns: var(--room-label-width) max-content;
    }
    
    .date-header-spacer,
    .date-footer-spacer {
        width: var(--room-label-width);
    }
    
    .date-cell {
        padding: 0.3rem;
        font-size: 0.75rem;
    }

    .booking-details-card {
        padding: 1rem;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .booking-bar {
        min-height: var(--booking-bar-height);
    }
}

/* Scrollbar styling */
.calendar::-webkit-scrollbar {
    height: 8px;
}

.calendar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.calendar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.calendar::-webkit-scrollbar-thumb:hover {
    background: #555;
}
