:root {
    --bg: #f6f1e8;
    --panel: rgba(255, 250, 243, 0.92);
    --panel-strong: #fffaf2;
    --ink: #1f2933;
    --muted: #5d6a72;
    --line: rgba(31, 41, 51, 0.12);
    --accent: #0f766e;
    --accent-strong: #115e59;
    --accent-soft: #d9f2ee;
    --danger: #b42318;
    --success: #0f766e;
    --shadow: 0 20px 50px rgba(60, 49, 32, 0.12);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "Segoe UI", "Trebuchet MS", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.10), transparent 28%),
        radial-gradient(circle at bottom right, rgba(201, 138, 45, 0.15), transparent 24%),
        linear-gradient(135deg, #f8f3e9 0%, #f2ebe1 48%, #efe7dc 100%);
}

.login-page {
    display: grid;
    place-items: center;
    padding: 2rem;
}

.dashboard-page {
    padding: 1.25rem 0 2rem;
}

.login-shell,
.app-shell {
    width: min(1380px, calc(100% - 2rem));
    margin: 0 auto;
}

.login-shell {
    width: min(520px, 100%);
    min-height: calc(100vh - 4rem);
    display: grid;
    place-items: center;
}

.login-links {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

.login-panel,
.panel,
.topbar,
.panel-nested,
.modal-panel {
    background: var(--panel);
    backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.login-panel {
    width: min(520px, 100%);
    padding: 2rem;
}

.panel,
.panel-nested,
.modal-panel {
    padding: 1.25rem;
}

.eyebrow,
.panel-label {
    margin: 0 0 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    color: var(--muted);
}

h1,
h2,
h3,
h4,
p {
    margin-top: 0;
}

.lead,
.topbar-meta,
.section-meta,
.sidebar-user span,
.side-nav-link small {
    color: var(--muted);
}

.settings-summary {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: var(--accent-soft);
}

.stack-form {
    display: grid;
    gap: 1rem;
}

.stack-form-compact {
    gap: 0.85rem;
}

.compact-form {
    margin-bottom: 1rem;
}

.stack-form label {
    display: grid;
    gap: 0.45rem;
}

.stack-form span {
    font-size: 0.92rem;
    font-weight: 600;
}

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

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(31, 41, 51, 0.14);
    border-radius: 14px;
    padding: 0.8rem 0.95rem;
    background: rgba(255, 255, 255, 0.82);
    color: var(--ink);
}

textarea {
    resize: vertical;
}

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

.checkbox-row {
    display: flex;
    justify-content: flex-start;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.checkbox-label input {
    width: auto;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.checkbox-inline input {
    width: auto;
}

.checkbox-card {
    padding: 0.95rem 1rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
}

.primary-button,
.secondary-button,
.ghost-button {
    border: 0;
    border-radius: 999px;
    padding: 0.85rem 1.25rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.primary-button {
    background: linear-gradient(135deg, var(--accent) 0%, #0b5c56 100%);
    color: white;
}

.secondary-button,
.ghost-button,
.icon-button {
    background: white;
    color: var(--ink);
    border: 1px solid var(--line);
}

.icon-button {
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 1.5rem;
    line-height: 1;
}

.calendar-toolbar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.flash-strip {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.flash {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid transparent;
}

.flash-success {
    background: rgba(15, 118, 110, 0.12);
    border-color: rgba(15, 118, 110, 0.18);
    color: var(--success);
}

.flash-error {
    background: rgba(180, 35, 24, 0.08);
    border-color: rgba(180, 35, 24, 0.14);
    color: var(--danger);
}

.workspace-layout {
    display: grid;
    gap: 1rem;
    grid-template-columns: 300px minmax(0, 1fr);
    align-items: start;
}

.workspace-main {
    display: grid;
    gap: 1rem;
}

.workspace-sidebar {
    position: sticky;
    top: 1rem;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-height: calc(100vh - 2.5rem);
}

.sidebar-brand,
.sidebar-user {
    display: grid;
    gap: 0.2rem;
    padding: 1rem;
    border-radius: 18px;
    background: var(--panel-strong);
}

.sidebar-brand strong {
    font-size: 1.4rem;
}

.sidebar-user-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.sidebar-user-button {
    border: 0;
    text-align: left;
    cursor: pointer;
}

.sidebar-logout-form {
    display: flex;
    align-items: center;
}

.sidebar-logout-button {
    white-space: nowrap;
}

.side-nav {
    display: grid;
    gap: 0.75rem;
    margin-bottom: auto;
}

.side-nav-link {
    display: grid;
    gap: 0.2rem;
    padding: 1rem;
    border-radius: 18px;
    text-decoration: none;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid transparent;
}

.side-nav-link.is-active {
    background: linear-gradient(180deg, rgba(217, 242, 238, 0.82), rgba(255, 255, 255, 0.94));
    border-color: rgba(15, 118, 110, 0.18);
}

.side-footer {
    display: grid;
    gap: 0.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.section-header,
.panel-header,
.section-header-schedule {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
    margin-bottom: 1rem;
}

.section-actions,
.calendar-toolbar,
.modal-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.settings-layout,
.clients-layout {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
    align-items: start;
}

.schedule-settings-card {
    display: grid;
    gap: 0.85rem;
    padding: 1rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.58);
}

.schedule-settings-card.is-muted {
    opacity: 0.72;
}

.schedule-settings-header {
    margin-bottom: 0;
}

.schedule-settings-grid {
    display: grid;
    gap: 0.45rem;
}

.schedule-settings-row {
    display: grid;
    grid-template-columns: minmax(140px, 1.2fr) 88px minmax(110px, 1fr) minmax(110px, 1fr);
    gap: 0.6rem;
    align-items: center;
    padding: 0.7rem 0.75rem;
    border-radius: 14px;
    background: rgba(255, 250, 243, 0.82);
    border: 1px solid rgba(31, 41, 51, 0.08);
}

.schedule-settings-row-head {
    background: transparent;
    border-style: dashed;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.schedule-settings-day {
    text-transform: capitalize;
}

.schedule-settings-check {
    justify-self: start;
}

.out-of-office-list {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
}

.out-of-office-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--line);
}

.out-of-office-item .section-meta {
    margin-bottom: 0;
}

.empty-state {
    color: var(--muted);
    padding: 0.9rem 0;
}

.schedule-filter-form {
    display: flex;
    align-items: end;
}

.schedule-filter-form label {
    display: grid;
    gap: 0.35rem;
    min-width: 220px;
}

.schedule-filter-form span {
    font-size: 0.88rem;
    font-weight: 600;
}

.schedule-shell {
    display: grid;
    --schedule-col-gap: 0.3rem;
    --schedule-row-gap: 0.08rem;
    --schedule-scrollbar-width: 0px;
    gap: 0.3rem;
}

.schedule-shell-week {
    --schedule-col-gap: 0.25rem;
    --schedule-row-gap: 0.08rem;
}

.schedule-shell-day {
    --schedule-col-gap: 0.25rem;
    --schedule-row-gap: 0.04rem;
}

.schedule-head,
.schedule-grid {
    display: grid;
    grid-template-columns: 72px repeat(var(--day-columns), minmax(0, 1fr));
    column-gap: var(--schedule-col-gap);
}

.schedule-head {
    padding-right: var(--schedule-scrollbar-width);
}

.schedule-grid {
    grid-auto-rows: var(--schedule-slot-height, 14px);
    row-gap: var(--schedule-row-gap);
}

.schedule-scroll {
    max-height: calc(100vh - 13.5rem);
    overflow: auto;
}

.schedule-corner,
.schedule-day-head,
.time-lane,
.schedule-cell {
    border-radius: 14px;
    border: 1px solid var(--line);
}

.schedule-corner,
.schedule-day-head {
    padding: 0.85rem 0.75rem;
    background: var(--panel-strong);
}

.schedule-day-head {
    display: grid;
    gap: 0.2rem;
}

.schedule-day-name {
    text-transform: capitalize;
    color: var(--muted);
}

.time-lane {
    display: flex;
    align-items: center;
    padding: 0.05rem 0.35rem;
    background: rgba(255, 255, 255, 0.64);
    color: var(--muted);
    font-weight: 700;
    height: 100%;
    min-height: 0;
    font-size: 0.64rem;
    line-height: 1;
}

.schedule-cell {
    position: relative;
    height: 100%;
    min-height: 0;
    padding: 0.04rem;
    background: rgba(255, 255, 255, 0.74);
    overflow: hidden;
}

.schedule-hitbox {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.schedule-cell:hover {
    border-color: rgba(15, 118, 110, 0.2);
    background: rgba(217, 242, 238, 0.35);
}

.schedule-cell-booked {
    background: rgba(217, 242, 238, 0.65);
    border-color: rgba(15, 118, 110, 0.28);
}

.schedule-cell-blocked {
    background: rgba(180, 35, 24, 0.12);
    border-color: rgba(180, 35, 24, 0.24);
}

.schedule-cell-unavailable {
    background: rgba(93, 106, 114, 0.3);
    border-color: rgba(93, 106, 114, 0.4);
}

.schedule-cell-unavailable:hover {
    border-color: rgba(93, 106, 114, 0.4);
    background: rgba(93, 106, 114, 0.3);
}

.schedule-cell-unavailable .schedule-booking {
    background: linear-gradient(180deg, rgba(31, 41, 51, 0.24), rgba(255, 255, 255, 0.92));
    border-color: rgba(31, 41, 51, 0.22);
}

.schedule-cell-blocked:hover {
    border-color: rgba(180, 35, 24, 0.24);
    background: rgba(180, 35, 24, 0.12);
}

.schedule-bookings {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.04rem;
    height: 100%;
    overflow: hidden;
}

.schedule-booking {
    display: grid;
    gap: 0.04rem;
    padding: 0.08rem 0.18rem;
    border-radius: 6px;
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.18), rgba(255, 255, 255, 0.96));
    border: 1px solid rgba(15, 118, 110, 0.22);
    cursor: pointer;
}

.schedule-booking-blocked {
    min-height: 100%;
    background: linear-gradient(180deg, rgba(180, 35, 24, 0.28), rgba(255, 237, 235, 0.98));
    border-color: rgba(180, 35, 24, 0.34);
    cursor: not-allowed;
}


.schedule-booking span {
    color: var(--muted);
    font-size: 0.62rem;
    line-height: 1;
}

.schedule-booking-summary {
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.booking-details-list {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.booking-details-list div {
    display: grid;
    gap: 0.2rem;
}

.booking-details-list span {
    color: var(--muted);
}

.danger-button {
    background: linear-gradient(135deg, #b42318 0%, #8f1d14 100%);
}

.data-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.75rem;
}

.data-list li {
    display: grid;
    gap: 0.2rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--line);
}

.data-list .client-search-item {
    display: none;
}

.data-list .client-search-item.is-visible {
    display: grid;
}

.client-result-button {
    display: grid;
    gap: 0.2rem;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    color: inherit;
}

.client-result-button:hover strong {
    color: var(--accent-strong);
}

.client-search-field {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
}

.client-search-field span {
    font-size: 0.92rem;
    font-weight: 600;
}

.list-helper {
    margin-bottom: 0.9rem;
    color: var(--muted);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.42);
    padding: 1.5rem;
    display: none;
    place-items: center;
    z-index: 30;
}

.modal-backdrop.is-open {
    display: grid;
}

.modal-panel {
    width: min(720px, 100%);
    max-height: calc(100vh - 3rem);
    overflow: auto;
}

.modal-panel-booking {
    width: min(860px, 100%);
}

.public-calendar-shell {
    width: min(1440px, calc(100% - 2rem));
}

.public-calendar-panel h1 {
    margin-bottom: 0.35rem;
}

.public-calendar-index-panel {
    display: grid;
    gap: 1rem;
}

.public-calendar-url-box {
    padding: 1rem 1.1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
}

.public-calendar-url-box strong {
    display: block;
    margin-bottom: 0.35rem;
}

.public-calendar-url-box p {
    margin-bottom: 0;
    color: var(--muted);
    font-weight: 600;
}

.public-calendar-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 0.45rem;
    border-radius: 999px;
    vertical-align: -2px;
    border: 1px solid var(--line);
}

.legend-swatch-free {
    background: rgba(255, 255, 255, 0.9);
}

.legend-swatch-booked {
    background: rgba(180, 35, 24, 0.32);
    border-color: rgba(180, 35, 24, 0.34);
}

.legend-swatch-unavailable {
    background: rgba(93, 106, 114, 0.3);
    border-color: rgba(93, 106, 114, 0.4);
}

.public-schedule-scroll {
    max-height: none;
}

.public-schedule-cell {
    min-height: var(--schedule-slot-height, 21px);
}

.public-schedule-booking {
    min-height: 100%;
}

.form-row-selection {
    align-items: end;
}

.modal-panel-compact {
    width: min(520px, 100%);
}

@media (max-width: 1180px) {
    .workspace-layout {
        grid-template-columns: 1fr;
    }

    .workspace-sidebar {
        position: static;
    }

    .side-panel {
        min-height: auto;
    }
}

@media (max-width: 860px) {
    .form-row,
    .form-row-selection,
    .settings-layout,
    .clients-layout,
    .section-header,
    .panel-header,
    .section-header-schedule,
    .topbar,
    .modal-actions,
    .calendar-toolbar,
    .section-actions {
        grid-template-columns: 1fr;
        display: grid;
    }

    .sidebar-user-row {
        grid-template-columns: 1fr;
    }

    .schedule-filter-form {
        width: 100%;
    }

    .schedule-filter-form label {
        min-width: 0;
    }

    .schedule-grid {
        grid-template-columns: 64px repeat(var(--day-columns), minmax(0, 1fr));
    }

    .schedule-settings-row {
        grid-template-columns: 1fr 88px 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .dashboard-page,
    .login-page {
        padding-inline: 0;
    }

    .app-shell,
    .login-shell {
        width: min(100%, calc(100% - 1rem));
    }

    .schedule-head,
    .schedule-grid {
        gap: 0.45rem;
    }

    .schedule-cell,
    .time-lane {
        min-height: var(--schedule-slot-height, 36px);
    }

    .modal-backdrop {
        padding: 0.75rem;
    }

    .schedule-settings-row,
    .schedule-settings-row-head,
    .out-of-office-item {
        grid-template-columns: 1fr;
        display: grid;
    }
}