* { box-sizing: border-box; }

/* ── Custom scrollbar (overlay, minimal, transparent) ── */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(31,111,185,0.25) transparent;
}
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
    background: transparent;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(31,111,185,0.22);
    border-radius: 999px;
    transition: background .2s;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(31,111,185,0.45);
}
::-webkit-scrollbar-corner {
    background: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(circle at 15% 20%, #eef3f8 0%, transparent 35%),
        radial-gradient(circle at 85% 80%, #edf2f7 0%, transparent 30%),
        var(--ui-bg-page);
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}
.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(32, 57, 84, 0.12);
    padding: 24px;
}
.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}
.auth-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: linear-gradient(180deg, #2e79d7, #245ea8);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: 0.4px;
}
.auth-card h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #223446;
}
.auth-subtitle {
    margin: 2px 0 0 0;
    color: var(--ui-text-soft);
    font-size: 13px;
}
.auth-nav { display: flex; gap: 8px; margin-bottom: 14px; }
.auth-nav a {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid var(--ui-border);
    color: #3d4e62;
    font-size: 13px;
    transition: all .18s ease;
}
.auth-nav a:hover { border-color: var(--ui-border-strong); background: #f8fbff; }
.auth-nav a.is-active {
    background: var(--ui-primary-50);
    border-color: var(--ui-primary-300);
    color: #1f4f85;
}
.auth-form { display: grid; gap: 10px; }
.form-title {
    margin: 0 0 4px 0;
    font-size: 18px;
    color: #27384a;
}
.auth-form label { font-size: 12px; font-weight: 700; color: #526376; letter-spacing: .2px; }
.auth-form button { margin-top: 6px; }

.environment-choice-page { min-height: 100vh; padding: 32px; display: grid; place-items: center; }
.environment-choice-card { width: min(1060px, 100%); background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 16px; padding: 26px; box-shadow: 0 18px 48px rgba(27, 53, 82, .14); }
.environment-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.environment-card { display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--ui-border); border-radius: 12px; padding: 20px; background: #f8fbff; }
.environment-card h2, .environment-card p { margin: 0; }
.environment-card p { color: var(--ui-text-soft); line-height: 1.45; flex: 1; }
.environment-card-assistance { grid-column: 1 / -1; }
.environment-card select { width: 100%; }
.environment-logout { margin-top: 18px; text-align: right; }
.environment-badge { display: inline-flex; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.environment-badge-master { background: #ede9fe; color: #5b21b6; }
.environment-badge-structure { background: #dcfce7; color: #166534; }
.environment-badge-assistance { background: #fef3c7; color: #92400e; }
.assistance-structure-switcher { align-items: stretch !important; }
.assistance-structure-switcher form { display: grid; gap: 7px; width: 100%; }
.assistance-structure-switcher label { color: #dbeafe; font-size: 11px; font-weight: 700; }
.assistance-structure-switcher select { width: 100%; min-width: 0; padding: 7px; border-radius: 6px; border: 1px solid rgba(255,255,255,.35); }
.app-shell {
    display: flex;
    min-height: 100vh;
    --simplystayflow-sidebar-width: 260px;
}
.sidebar {
    width: 260px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(180deg, var(--ui-blue-800), var(--ui-blue-900));
    color: #fff;
    padding: 16px 12px;
    height: 100vh;
    overflow: auto;
    overflow: overlay;
}
.sidebar h2 { font-size: 18px; margin: 0; }
.sidebar-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.environment-test-label {
    display: inline-flex;
    align-items: center;
    border: 1px solid #fecaca;
    border-radius: 999px;
    padding: 4px 9px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 11px;
    line-height: 1.2;
    font-weight: 800;
    cursor: help;
}
.environment-test-label[hidden] { display: none !important; }
.sidebar .menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}
.sidebar .sidebar-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    font-weight: 700;
    padding: 10px 11px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease;
}
/* Le voci-link (es. Anagrafiche, Configurazione) devono avere la stessa altezza dei pulsanti dei gruppi. */
.sidebar a.sidebar-item {
    box-sizing: border-box;
    min-height: 40px;
    font-size: 13.3333px;
    line-height: normal;
    text-decoration: none;
}
.sidebar button.sidebar-item {
    box-sizing: border-box;
    min-height: 40px;
    line-height: normal;
}
.sidebar .sidebar-item:hover,
.sidebar .sidebar-item.is-active {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.36);
}
.sidebar .menu-group {
    margin-top: 4px;
}
.sidebar .menu-toggle {
    justify-content: space-between;
}
.sidebar .menu-toggle::after {
    content: "▸";
    font-size: 12px;
    transition: transform .16s ease;
}
.sidebar .submenu {
    margin-top: 6px;
    padding-left: 8px;
    display: none;
    list-style: none;
}
.sidebar .menu-group.is-open .submenu {
    display: block;
}
/* ── nested sub-groups inside submenu ── */
.sidebar .sub-group > .sub-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
}
.sidebar .sub-group > .sub-toggle::after {
    content: "▸";
    font-size: 11px;
    transition: transform .16s ease;
}
.sidebar .sub-group.is-open > .sub-toggle::after {
    transform: rotate(90deg);
}
.sidebar .sub-submenu {
    list-style: none;
    margin: 6px 0 0 0;
    padding: 0;
    display: none;
}
.sidebar .sub-group.is-open > .sub-submenu {
    display: block;
}
.sidebar .sub-submenu li {
    padding: 6px 10px 6px 12px;
    border-radius: 5px;
    margin-bottom: 4px;
    background: rgba(255,255,255,0.05);
    font-size: 13px;
}
.sidebar .sub-submenu li:hover {
    background: rgba(255,255,255,0.14);
}
.sidebar .submenu li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.08);
    margin-bottom: 6px;
    font-size: 14px;
}
.sidebar .submenu li.is-active { background: rgba(255,255,255,0.2); }
.sidebar .submenu form { margin: 0; }
.sidebar .submenu button { width: 100%; }
.sidebar-link,
.submenu-link {
    display: block;
    width: 100%;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
}
.sidebar .submenu li:hover {
    background: rgba(255,255,255,0.16);
}
.sidebar-spacer {
    flex: 1;
}
.sidebar-link:hover,
.submenu-link:hover {
    color: #e7f1ff;
}

.open-windows {
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 10px;
}
.open-windows h3 {
    margin: 0 0 8px;
    color: #d8e7fa;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.open-windows-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}
.open-window-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 7px;
    background: rgba(255,255,255,0.08);
    padding: 6px 8px;
}
.open-window-item button {
    width: auto;
    padding: 4px 7px;
    border-radius: 5px;
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.28);
}
.open-window-item .window-name {
    font-size: 12px;
    font-weight: 700;
    color: #f1f7ff;
    cursor: pointer;
}

.workspace {
    flex: 1;
    min-width: 0;
    position: relative;
    padding: 0;
    background: linear-gradient(180deg, #f4f8fd, #eef4fb);
}

.workspace-empty {
    height: 100vh;
    border: 1px dashed #b9cce2;
    border-radius: 11px;
    background: rgba(255,255,255,0.54);
}

.app-window {
    height: 100vh;
    border: 1px solid #b5c8df;
    border-radius: 0;
    background: #ffffff;
    overflow: hidden;
    display: none;
    box-shadow: 0 14px 30px rgba(26, 53, 83, 0.12);
}

.app-window.is-active {
    display: flex;
    flex-direction: column;
}

.window-titlebar {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px 0 12px;
    border-bottom: 1px solid #c8d8ea;
    background: linear-gradient(180deg, var(--ui-blue-200), var(--ui-blue-100));
}

.window-title {
    font-weight: 800;
    color: #23415f;
}

.window-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.window-control {
    width: 30px;
    height: 24px;
    min-height: 24px;
    padding: 0;
    font-size: 14px;
    line-height: 1;
}

.window-content {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overflow: overlay;
}

.window-empty {
    background: linear-gradient(180deg, #fbfdff, #f4f9ff);
}

.app-modal-root {
    position: fixed;
    inset: 0;
    z-index: 80;
    pointer-events: none;
}

.app-modal-blocker {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.app-modal-blocker.is-active {
    pointer-events: none;
}

.app-modal-blocker-panel {
    position: fixed;
    display: none;
    background: rgba(239, 245, 252, 0.42);
    backdrop-filter: blur(1px);
    cursor: not-allowed;
    pointer-events: auto;
}

.app-modal-stack {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.app-modal {
    position: fixed;
    top: 72px;
    left: 50%;
    width: min(1100px, calc(100vw - 180px));
    height: min(82vh, 860px);
    transform: translateX(-50%);
    border: 1px solid #b5c8df;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 28px 60px rgba(25, 49, 75, 0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.app-modal.app-modal--quote {
    top: 0;
    right: 0;
    left: var(--simplystayflow-sidebar-width, 260px);
    width: calc(100vw - var(--simplystayflow-sidebar-width, 260px));
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    max-width: none;
    border-radius: 0;
    transform: none;
}

.app-modal.app-modal--quote > .app-modal-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.app-modal.app-modal--quote .app-modal-frame {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.app-modal.is-hidden-parent {
    display: none;
}

.app-modal.is-child-overlay-active {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}
.app-modal.is-child-overlay-active > .app-modal-titlebar {
    display: none;
}
.app-modal.is-child-overlay-active > .app-modal-body {
    background: transparent;
}
.app-modal.is-child-overlay-active .app-modal-frame {
    background: transparent;
}

.app-modal.is-maximized {
    border-radius: 10px;
}

.app-modal.is-minimized {
    width: auto;
    min-width: 220px;
    max-width: 420px;
    height: 44px;
    min-height: 44px;
    overflow: visible;
    box-shadow: 0 16px 28px rgba(25, 49, 75, 0.18);
}

.app-modal.is-minimized .app-modal-body {
    display: none;
}

.app-modal-titlebar {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 10px 0 12px;
    border-bottom: 1px solid #c8d8ea;
    background: linear-gradient(180deg, var(--ui-blue-200), var(--ui-blue-100));
}

.app-modal.is-minimized .app-modal-titlebar {
    border-bottom: 0;
    cursor: move;
}

.app-modal-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
    color: #23415f;
}

.app-modal-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.app-modal-body {
    flex: 1;
    min-height: 0;
    background: #f8fbff;
}

.app-modal-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #ffffff;
}

.app-modal-loading {
    position: absolute;
    inset: 44px 0 0 0;
    display: grid;
    place-items: center;
    background: rgba(248, 251, 255, 0.9);
    color: #2a4f70;
    font-size: 13px;
    font-weight: 700;
}

.app-modal.is-ready .app-modal-loading {
    display: none;
}

.planning-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.planning-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-bottom: 1px solid #d2dfed;
    background: #f8fbff;
}

.planning-toolbar label {
    font-size: 12px;
    font-weight: 700;
    color: #48627f;
}

.planning-toolbar input[type="date"] {
    width: auto;
    min-width: 170px;
}

.planning-options-anchor {
    margin-left: auto;
    position: relative;
    display: inline-flex;
    align-items: center;
}

.planning-chat-label {
    display: inline-block;
    margin-right: 6px;
}

.planning-chat-badge {
    display: inline-flex;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #d04d4d;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.planning-chat-badge[hidden] {
    display: none;
}

.planning-toast-top {
    position: fixed;
    z-index: 180;
    top: 16px;
    left: 50%;
    transform: translate(-50%, -20px);
    opacity: 0;
    pointer-events: none;
    max-width: min(760px, calc(100vw - 24px));
    padding: 9px 14px;
    border-radius: 999px;
    border: 1px solid #0f3d66;
    background: #134c7f;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 14px 24px rgba(20, 50, 80, 0.3);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.planning-toast-top.is-visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

#planningOptionsToggle.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.planning-options-menu {
    min-width: 500px;
    max-width: min(680px, calc(100vw - 24px));
    max-height: min(70vh, 420px);
    overflow: auto;
}

.planning-options-menu-header {
    font-size: 12px;
    font-weight: 800;
    color: #335978;
    margin-bottom: 6px;
    padding: 4px 6px 6px;
    border-bottom: 1px solid #d3e0ee;
}

.planning-option-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid #d7e1ee;
    border-radius: 8px;
    padding: 6px 8px;
    background: #f3f8ff;
    margin-bottom: 6px;
}

.planning-option-menu-item.due {
    border-color: #e3bd66;
    background: #fff6df;
}

.planning-option-menu-item.expired {
    border-color: #d07d7d;
    background: #ffecec;
}

.planning-option-menu-item.pending {
    border-color: #7fa8d6;
    background: #eaf3ff;
}

.planning-option-menu-text {
    font-size: 12px;
    font-weight: 700;
    color: #2f4e69;
}

.planning-option-menu-item.due .planning-option-menu-text {
    color: #5c4417;
}

.planning-option-menu-item.expired .planning-option-menu-text {
    color: #7b2e2e;
}

.planning-option-menu-item.pending .planning-option-menu-text {
    color: #214f7d;
}

.planning-option-menu-actions {
    display: inline-flex;
    gap: 6px;
    flex-shrink: 0;
}

.planning-date-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #d4e4f3;
    transition: .2s;
    border-radius: 999px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background-color: #fff;
    transition: .2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #1f6fb9;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.planning-date-wrap input[type="date"] {
    width: auto;
    min-width: 170px;
    min-height: 33px;
    padding: 7px 10px;
    border: 1px solid var(--ui-border);
    border-radius: 6px;
    background: #f7f9fc;
    color: #2d4560;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.planning-date-wrap input[type="date"]:focus {
    border-color: var(--ui-primary-500);
    box-shadow: 0 0 0 3px rgba(69, 127, 198, 0.18);
}

.planning-frame {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: scroll;
    padding: 0;
    background: #f2f7fd;
}

/* Scrollbar personalizzate sempre visibili (verticale a destra, orizzontale in basso). */
.planning-frame::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.planning-frame::-webkit-scrollbar-track {
    background: #e3edf8;
}

.planning-frame::-webkit-scrollbar-thumb {
    background: #8fb0d3;
    border: 3px solid #e3edf8;
    border-radius: 8px;
}

.planning-frame::-webkit-scrollbar-thumb:hover {
    background: #6f97c2;
}

.planning-frame::-webkit-scrollbar-corner {
    background: #e3edf8;
}

@supports not selector(::-webkit-scrollbar) {
    .planning-frame {
        scrollbar-color: #8fb0d3 #e3edf8;
    }
}

.planning-grid {
    --room-col-width: 170px;
    --planning-day-width: 44px;
    --planning-row-height: 44px;
    min-width: max-content;
    border: 1px solid #c5d7eb;
    border-radius: 10px;
    overflow: clip;
    background: #ffffff;
}

.app-modal.app-modal--configuration {
    left: 0;
    width: 100vw;
    z-index: 3;
}

.planning-grid > .planning-row:nth-child(1),
.planning-grid > .planning-row:nth-child(2) {
    position: sticky;
    z-index: 30;
    background: #ffffff;
    isolation: isolate;
}

.planning-grid > .planning-row:nth-child(1) { top: 0; }
.planning-grid > .planning-row:nth-child(2) { top: 32px; }

.planning-grid > .planning-row:nth-child(1) .planning-stub,
.planning-grid > .planning-row:nth-child(2) .planning-stub {
    z-index: 40;
}

.planning-grid > .planning-row:nth-child(1) .planning-month-cell,
.planning-grid > .planning-row:nth-child(2) .planning-day-cell {
    position: relative;
    z-index: 30;
}

.planning-row {
    position: relative;
    display: grid;
    border-bottom: 1px solid #d6e3f0;
}

.planning-row:last-child {
    border-bottom: 0;
}

.planning-row[data-room-id] {
    height: var(--planning-row-height);
}

.planning-cell,
.planning-room-head,
.planning-month-cell,
.planning-day-cell,
.planning-stub {
    border-right: 1px solid #dbe7f3;
}

.planning-row > :last-child {
    border-right: 0;
}

.planning-stub,
.planning-room-head {
    position: sticky;
    left: 0;
    z-index: 20;
    background: #f4f8fe;
    overflow: hidden;
    isolation: isolate;
}

.planning-stub {
    min-height: 32px;
}

.planning-month-cell {
    min-height: 32px;
    display: flex;
    align-items: center;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 800;
    color: #224562;
    text-transform: uppercase;
}

.planning-month-cell.month-even {
    background: #e7f0fd;
}

.planning-month-cell.month-odd {
    background: #d7e6fb;
}

.planning-day-cell {
    min-height: 36px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #2c4963;
    background: #f8fbff;
}

.planning-day-cell.weekend {
    background: #eef4ff;
}

.planning-day-cell.is-today {
    background: #d4e7ff;
    color: #1d3f5f;
}

/* Evidenziazione incrociata: intestazione del giorno e della camera sotto il puntatore. */
.planning-day-cell.is-crosshair,
/* Colonna camere: sfondo dalla tipologia (Configurazione > Generale > Colonna camere) e informazioni in ordine di priorita'. */
.planning-room-head.has-type-color {
    background: var(--room-type-bg);
}
.planning-room-head.has-type-color .planning-room-name,
.planning-room-head.has-type-color .planning-room-meta {
    color: var(--room-type-fg, #244663);
}
.planning-room-infos {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    justify-content: flex-end;
    gap: 0 6px;
    min-width: 0;
    overflow: hidden;
    line-height: 14px;
    text-align: right;
}

.planning-room-head.has-type-color.is-crosshair .planning-room-name,
.planning-room-head.has-type-color.is-crosshair .planning-room-meta {
    color: #12304d;
}
.planning-room-head.is-crosshair {
    background: #bcd8fa;
    color: #12304d;
    box-shadow: inset 0 0 0 1px #6fa3dc;
}

.planning-room-head {
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 0 8px;
    font-size: 12px;
}

.planning-room-name {
    font-weight: 800;
    color: #244663;
}

.planning-room-meta {
    font-weight: 600;
    color: #58738e;
}

.planning-cell {
    min-height: 0;
    background: #ffffff;
}

.planning-cell.weekend {
    background: #f6f9ff;
}

.planning-cell.is-today {
    background: #e8f2ff;
}

.planning-cell.drop-target {
    position: relative;
}

.planning-cell.drop-target::after {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 4px;
    border: 1px dashed transparent;
    pointer-events: none;
}

.planning-cell.drop-target:hover::after {
    border-color: #8eb5e1;
    background: rgba(148, 188, 234, 0.08);
}

.planning-cell.drop-target.is-create-start::after {
    border-color: #2a6eb6;
    border-width: 2px;
    background: rgba(42, 110, 182, 0.16);
}

.planning-cell.drop-target.is-create-range::after {
    border-color: #5a9ad8;
    background: rgba(90, 154, 216, 0.14);
}

.planning-overlay {
    position: sticky;
    left: 10px;
    top: 10px;
    z-index: 18;
    width: fit-content;
    max-width: calc(100% - 20px);
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #1d3f5f;
    border: 1px solid #9bbde1;
    background: #eaf3ff;
    box-shadow: 0 8px 20px rgba(34, 69, 98, 0.16);
}

.planning-overlay.is-error {
    color: #7b2e2e;
    border-color: #d89a9a;
    background: #ffeaea;
}

.planning-booking-label {
    --booking-tip-size: 12px;
    position: absolute;
    z-index: 7;
    top: calc((100% / var(--lane-count, 1)) * var(--lane-index, 0) + 1px);
    height: calc((100% / var(--lane-count, 1)) - 2px);
    min-height: 16px;
    padding: 0;
    border: 1px solid var(--booking-border, #dbe7f3);
    border-right: 1px solid var(--booking-border, #dbe7f3);
    border-radius: 4px 0 0 4px;
    background: var(--booking-bg, #dbe7f3);
    box-sizing: border-box;
    overflow: visible;
    user-select: none;
    cursor: default;
    clip-path: polygon(
        0 0,
        calc(100% - var(--booking-tip-size)) 0,
        100% 50%,
        calc(100% - var(--booking-tip-size)) 100%,
        0 100%
    );
}

.planning-booking-label::after {
    content: none;
}

/* Etichette Prenotazioni (Configurazione): bordo superiore/inferiore configurabile (spessore fisso di sistema).
   Le regole di stato (opzione, hover) definite dopo hanno la precedenza. */
.planning-booking-label {
    --label-inner-shadow: 0 0 0 0 transparent;
    box-shadow: var(--label-inner-shadow);
}

.planning-booking-label.has-bt {
    border-top: var(--bt-width, 2px) var(--bt-style, solid) var(--bt-color, var(--booking-border, #dbe7f3));
}

.planning-booking-label.has-bb {
    border-bottom: var(--bb-width, 2px) var(--bb-style, solid) var(--bb-color, var(--booking-border, #dbe7f3));
}

/* Ombra esterna: elemento affiancato sotto l'etichetta, perché il ritaglio a freccia taglierebbe l'ombra. */
.planning-booking-shadow {
    position: absolute;
    z-index: 6;
    top: calc((100% / var(--lane-count, 1)) * var(--lane-index, 0) + 1px);
    height: calc((100% / var(--lane-count, 1)) - 2px);
    pointer-events: none;
}

.planning-booking-shadow > span {
    display: block;
    width: 100%;
    height: 100%;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%);
}

.planning-booking-label.no-footer .planning-booking-main {
    height: 100%;
}

.planning-booking-label.is-clipped-end::after {
    display: none;
}

.planning-booking-label.is-clipped-end {
    border-right: 1px solid var(--booking-border, #dbe7f3);
    border-radius: 4px;
    clip-path: none;
}

.planning-booking-label.is-linked-hover {
    box-shadow: 0 0 0 2px rgba(42, 95, 150, 0.35);
}

.planning-booking-label.is-split-group {
    border-left: 3px solid var(--split-group-color, #5c7085);
    box-shadow: var(--label-inner-shadow, 0 0 0 0 transparent), inset 0 0 0 1px rgba(24, 52, 80, 0.22);
}

.planning-booking-label.is-split-linked-hover {
    box-shadow: 0 0 0 2px rgba(194, 127, 29, 0.5), inset 0 0 0 1px rgba(24, 52, 80, 0.22);
}

.planning-booking-label.is-resize-hover {
    border-color: #3f78b7;
}

.planning-booking-label.is-option {
    border-color: #c98a2c;
    border-style: solid;
    border-width: 2px;
}

.planning-booking-label.is-option .planning-booking-main {
    background: rgba(246, 104, 104, 0.2);
}

.planning-booking-label.is-option-due,
.planning-booking-label.is-option-expired {
    animation: planning-option-border-blink 1s steps(2, end) infinite;
}

.planning-booking-label.is-option-due {
    border-color: #d9822b;
    --option-blink-color: rgba(217, 130, 43, 0.68);
}

.planning-booking-label.is-option-expired {
    border-color: #c24141;
    --option-blink-color: rgba(194, 65, 65, 0.72);
}

@keyframes planning-option-border-blink {
    0% {
        box-shadow: 0 0 0 0 rgba(196, 74, 16, 0.25);
    }
    50% {
        box-shadow: 0 0 0 2px var(--option-blink-color, rgba(196, 74, 16, 0.62));
    }
    100% {
        box-shadow: 0 0 0 0 rgba(196, 74, 16, 0.25);
    }
}

.planning-booking-main {
    position: absolute;
    top: 0;
    left: 0;
    right: calc(var(--booking-tip-size) + 2px);
    height: 70%;
    padding: 0 18px 0 6px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(9px, calc(var(--planning-row-height, 44px) * 0.25 / var(--lane-count, 1)), 14px);
    font-weight: 800;
    color: #1d3347;
    transition: background-color 0.16s ease;
    z-index: 1;
    cursor: default;
}

.planning-booking-main-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.planning-booking-split-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 14px;
    margin-right: 5px;
    padding: 0 5px;
    border-radius: 7px;
    border: 1px solid var(--split-group-color, #5c7085);
    background: #ffffff;
    color: #19334a;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.2px;
    line-height: 1;
}

.planning-booking-main.is-linked-hover,
.planning-booking-label.is-linked-hover .planning-booking-main,
.planning-booking-main:hover {
    background: rgba(255, 255, 255, 0.36);
}

.planning-booking-footer {
    position: absolute;
    left: 0;
    right: calc(var(--booking-tip-size) + 2px);
    bottom: 0;
    height: 30%;
    overflow: hidden;
    z-index: 1;
}

.planning-booking-checkin {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 3px;
    width: var(--checkin-progress, 0%);
    background: var(--checkin-color, #2f80ed);
    opacity: 0.75;
}

.planning-booking-markers {
    position: absolute;
    inset: 0 2px 0 2px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.planning-booking-corner {
    position: absolute;
    top: 2px;
    right: calc(var(--booking-tip-size) + 4px);
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 2px;
}

.pm-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.pm-center {
    margin-inline: auto;
}

.pm-right {
    margin-left: auto;
}

.planning-booking-marker.shape-circle {
    border-radius: 50%;
}

.planning-booking-marker.shape-triangle {
    border: 0;
    border-radius: 0;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.planning-booking-marker {
    flex: 0 0 auto;
    width: var(--marker-size, 8px);
    height: var(--marker-size, 8px);
    border-radius: 1px;
    border: 1px solid rgba(23, 42, 58, 0.25);
    background: var(--marker-color, #9ca9b7);
    box-sizing: border-box;
}

/* Camera Allotment assegnata ma non ancora convertita in Prenotazione (SS11): nessun nuovo colore
   di stato sulla cella, solo un contorno tratteggiato neutro e un marker/badge discreto in alto a
   sinistra con tooltip "Allotment: <nome>". Il click apre la scheda Allotment (SS11.2). */
.planning-allotment-block {
    position: absolute;
    z-index: 6;
    top: 1px;
    height: calc(100% - 2px);
    min-height: 16px;
    box-sizing: border-box;
    border: 1px dashed #9ca9b7;
    border-radius: 4px;
    background: rgba(156, 169, 183, 0.10);
    cursor: pointer;
}

.planning-allotment-block:hover {
    background: rgba(156, 169, 183, 0.22);
    border-color: #6d7d8c;
}

.planning-allotment-marker {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1px solid rgba(23, 42, 58, 0.25);
    background: #9ca9b7;
    box-sizing: border-box;
}

.planning-booking-resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 7px;
    z-index: 2;
}

.planning-booking-resize-handle.left {
    left: 0;
    cursor: ew-resize;
}

.planning-booking-resize-handle.right {
    right: 0;
    width: calc(var(--booking-tip-size, 12px) + 4px);
    cursor: ew-resize;
}

/* ═══════════════════════════════════════════════════════
   Custom Datepicker – Modifica Periodo (v1)
   REGOLA: usare sempre queste classi per i picker di data
   nei dialog modali. Non usare stili inline sui bottoni giorno.
   ═══════════════════════════════════════════════════════ */
.custom-datepicker-panel {
    background: #fff;
    border: 1px solid #d6e0ea;
    border-radius: 8px;
    padding: 8px;
    display: block;
}

.custom-picker-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.custom-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.custom-picker-dayname {
    font-size: 11px;
    text-align: center;
    color: #5f6b7a;
    font-weight: 700;
    padding: 2px 0;
}

.custom-picker-day {
    height: 30px;
    border: 1px solid #d6e0ea;
    background: #fff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    padding: 0;
    color: #2f3e4e;
}

.custom-picker-day:hover:not(:disabled) {
    background: #eef3f8;
}

.custom-picker-day.selected {
    background: #2f66b3;
    color: #fff;
    border-color: #2f66b3;
    font-weight: 700;
}

.custom-picker-day.outside-month {
    opacity: 0.4;
}

.custom-picker-day.disabled {
    background: #f4f6f8;
    color: #9aa4b2;
    border-color: #e2e7ee;
    cursor: not-allowed;
}

.custom-picker-day.disabled-occupied {
    background: #ffe8e8;
    border-color: #f1b4b4;
    color: #a14c4c;
    cursor: not-allowed;
}

.picker-legend {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-top: 10px;
    font-size: 12px;
    color: #5f6b7a;
}

.picker-legend .swatch {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid transparent;
    display: inline-block;
    margin-right: 4px;
    vertical-align: middle;
}

.picker-legend .swatch.occupied {
    background: #ffe8e8;
    border-color: #f1b4b4;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.confirm-btn {
    border: 1px solid #c3cfdd;
    border-radius: 8px;
    background: #ffffff;
    color: #2d435a;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.confirm-btn.primary {
    border-color: #1e6ab0;
    background: linear-gradient(180deg, #3e89d7, #256db3);
    color: #ffffff;
}

.confirm-btn.secondary {
    border-color: #cad6e3;
    background: #eef4fa;
    color: #2f4a64;
}

.planning-context-menu {
    position: fixed;
    z-index: 90;
    min-width: 220px;
    padding: 6px;
    border-radius: 8px;
    border: 1px solid #bdd2e8;
    background: #f8fbff;
    box-shadow: 0 14px 30px rgba(18, 43, 69, 0.24);
}

.planning-context-item {
    width: 100%;
    text-align: left;
    border: 0;
    border-radius: 6px;
    padding: 7px 8px;
    font-size: 12px;
    font-weight: 700;
    color: #2a4f70;
    background: #ebf3fe;
}

.planning-booking-drag-preview {
    position: absolute;
    z-index: 55;
    min-height: 30px;
    max-height: 50px;
    padding: 6px 8px;
    border-radius: 7px;
    border: 1px solid #77a2cf;
    background: rgba(171, 208, 239, 0.94);
    color: #173654;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    pointer-events: none;
    box-shadow: 0 14px 26px rgba(29, 57, 82, 0.24);
}

.planning-booking-drop-preview {
    position: absolute;
    z-index: 48;
    pointer-events: none;
    border: 2px dashed #3577b7;
    border-radius: 8px;
    background: rgba(110, 165, 216, 0.16);
    box-sizing: border-box;
}

body.is-planning-dragging,
body.is-planning-dragging * {
    cursor: grabbing !important;
}

.app-tooltip {
    position: fixed;
    z-index: 9999;
    max-width: 300px;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    white-space: pre-line;
    pointer-events: none;
    box-shadow: 0 10px 22px rgba(17, 38, 61, 0.2);
}

.app-tooltip--operativo {
    background: linear-gradient(180deg, #2b6fc7, #255ea9);
    border-color: #214f89;
    color: #ffffff;
}

.app-tooltip--informativo {
    background: #eaf3ff;
    border-color: #93bbf2;
    color: #224562;
}

@media (max-width: 720px) {
    .auth-page { padding: 16px; }
    .auth-card { padding: 18px; }
    .auth-nav { flex-wrap: wrap; }
    .environment-choice-page { padding: 16px; }
    .environment-choice-grid { grid-template-columns: 1fr; }
    .environment-card-assistance { grid-column: auto; }
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; min-width: 100%; }
    .app-shell { --simplystayflow-sidebar-width: 0px; }
    .app-modal.app-modal--quote {
        left: 0;
        width: 100vw;
        max-width: 100vw;
    }
    .workspace,
    .app-window,
    .workspace-empty { height: auto; min-height: 60vh; }
}
