:root {
    --bg-color: #f8fafc;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.05);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --accent-primary: #2563eb;
    --accent-hover: #1d4ed8;
    --danger: #ef4444;
    --success: #10b981;
    --timeline-grid: rgba(0, 0, 0, 0.12);
    
    --bed-height: 32px;
    --day-width: 48px;
    
    --room-width: 70px;
    --bed-width: 70px;
    
    --font-main: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

.screen {
    display: none;
    height: 100vh;
    width: 100vw;
}

.screen.active {
    display: flex;
}

/* LOGIN SCREEN */
#login-screen {
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 1rem;
}

.login-box {
    background: var(--glass-bg);
    padding: 3rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 400px;
    text-align: center;
    margin: auto; /* Fix for flexbox centering cutoff */
}

.login-box h1 { margin-bottom: 0.5rem; font-weight: 600; color: #0f172a;}
.login-box h2 { font-size: 1.2rem; color: var(--text-secondary); margin-bottom: 2rem; font-weight: 400;}

.input-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.input-group-check {
    margin-bottom: 1.5rem;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
}
.input-group-check label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.input-group input, .select-modern, .input-search {
    width: 100%;
    padding: 0.8rem 1rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-main);
    outline: none;
    transition: all 0.2s;
}

.input-group input:focus, .select-modern:focus, .input-search:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.btn-primary, .btn-secondary, .btn-danger {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: var(--font-main);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
    width: auto;
}
.btn-secondary:hover { background: rgba(0,0,0,0.1); }

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    width: auto;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); }

.error-msg {
    color: var(--danger);
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.2rem;
}

/* COOKIE BANNER */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    max-width: 480px;
    padding: 1.5rem;
    border-radius: 12px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    border: 1px solid var(--glass-border);
}
.cookie-content p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}
.cookie-content p:last-child {
    margin-bottom: 0;
}
.cookie-actions {
    display: flex;
    gap: 0.5rem;
}
.cookie-actions button {
    flex: 1;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

@media screen and (max-width: 550px) {
    .cookie-banner {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
    }
    .cookie-actions {
        flex-direction: column;
    }
}

/* APP SCREEN */
#app-screen {
    flex-direction: column;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    height: 70px;
    border-radius: 0 0 16px 16px;
    margin-bottom: 1rem;
}

.app-header h1 { font-size: 1.5rem; color: #0f172a;}
.role-badge {
    background: #e2e8f0;
    color: var(--text-primary);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-left: 1rem;
    font-weight: 500;
}

.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    padding: 0 1rem 1rem 1rem;
    gap: 1rem;
}

/* SIDEBAR */
.sidebar {
    width: 250px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 { font-size: 0.95rem; margin-bottom: 0; }

.guest-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.guest-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 0.8rem;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.2s;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.guest-card:active { cursor: grabbing; }
.guest-card:hover { background: #f8fafc; transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.05); }

.guest-card.dragging {
    opacity: 0.5;
}

.g-name { font-weight: 500; font-size: 0.95rem; color: var(--text-primary); }
.g-meta { font-size: 0.8rem; color: var(--text-secondary); display: flex; justify-content: space-between; margin-top: 0.3rem;}

/* TIMELINE */
.timeline-container {
    flex: 1;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: auto;
    position: relative;
    background: #ffffff;
}

.timeline-header {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--glass-border);
}

.th-room {
    width: calc(var(--room-width) + var(--bed-width));
    min-width: calc(var(--room-width) + var(--bed-width));
    padding: 0.6rem 1rem;
    font-weight: 600;
    position: sticky;
    left: 0;
    z-index: 11;
    background: rgba(255, 255, 255, 0.95);
    border-right: 1px solid var(--glass-border);
}

.th-day {
    width: var(--day-width);
    min-width: var(--day-width);
    text-align: center;
    padding: 0.4rem 0;
    font-size: 0.72rem;
    border-right: 1px solid var(--timeline-grid);
    display: flex;
    flex-direction: column;
    color: var(--text-secondary);
}
.th-day .d-num { font-weight: 600; font-size: 0.9rem; color: var(--text-primary); }
.th-day .d-weekday { font-weight: 600; font-size: 0.65rem; color: var(--text-secondary); text-transform: capitalize; margin-top: 1px; }
.th-day.weekend-day { background: rgba(251, 191, 36, 0.08); }
.th-day.weekend-day .d-weekday { color: #d97706; }

.th-day.today-highlight {
    background: #ffedd5 !important;
    border-bottom: 3px solid #f97316;
    color: #ea580c !important;
}
.th-day.today-highlight .d-num {
    color: #ea580c !important;
}

.timeline-body {
    display: flex;
    flex-direction: column;
}

.room-group {
    display: flex;
    border-bottom: 1px solid var(--timeline-grid);
    background: #ffffff;
}

.room-column {
    width: var(--room-width);
    min-width: var(--room-width);
    background: #f8fafc;
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.2rem;
    font-weight: 600;
    color: var(--accent-primary);
    position: sticky;
    left: 0;
    z-index: 9;
    font-size: 0.8rem;
    text-align: center;
}

.beds-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.bed-row {
    display: flex;
    min-height: var(--bed-height);
    flex: 1;
    border-bottom: 1px solid var(--timeline-grid);
}

.bed-row:last-child {
    border-bottom: none;
}

.bed-title {
    width: var(--bed-width);
    min-width: var(--bed-width);
    background: #ffffff;
    border-right: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2px;
    padding: 0.2rem 0.4rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    position: sticky;
    left: var(--room-width);
    z-index: 9;
    box-shadow: 2px 0 5px rgba(0,0,0,0.01);
}

.btn-add-bed {
    background: none; border: none; color: var(--success); cursor: pointer; font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center;
}

.btn-del-bed {
    background: none; border: none; color: var(--danger); cursor: pointer; opacity: 0; transition: opacity 0.2s;
    font-size: 0.85rem; display: flex; align-items: center; justify-content: center;
}
.bed-title:hover .btn-del-bed { opacity: 1; }

.timeline-grid-row {
    display: flex;
    flex: 1;
    position: relative;
}

.td-cell {
    width: var(--day-width);
    min-width: var(--day-width);
    border-right: 1px solid var(--timeline-grid);
    height: 100%;
}
.td-cell.drag-over {
    background: rgba(37, 99, 235, 0.1);
}

/* STAY BLOCK */
.stay-block {
    position: absolute;
    height: calc(var(--bed-height) - 6px);
    top: 3px;
    border-radius: 4px;
    padding: 0 0.4rem;
    font-size: 0.72rem;
    color: white;
    display: flex;
    align-items: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.1s;
    user-select: none;
    z-index: 2;
}

.stay-block:hover {
    transform: scale(1.02);
    z-index: 3;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* FULL ROOM unified stay block */
.timeline-grid-row {
    overflow: visible;
}
.bed-row {
    overflow: visible;
}
.stay-block-fullroom {
    z-index: 4;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.stay-block-bloqueo {
    background: repeating-linear-gradient(
        45deg,
        #fcd34d,
        #fcd34d 10px,
        #f59e0b 10px,
        #f59e0b 20px
    ) !important;
    color: #451a03 !important;
    font-weight: bold;
    border: 1px solid #d97706 !important;
    opacity: 0.95;
    z-index: 3;
}

/* TOAST */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--accent-primary);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: var(--text-primary);
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    animation: slideIn 0.3s forwards;
    display: flex;
    flex-direction: column;
}
.toast.warning { border-left-color: #f59e0b; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Modals and Group Card enhancements */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    width: 95%;
    max-width: 480px;
    padding: 2rem;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0,0,0,0.05);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.group-modal-content {
    max-width: 680px;
}

.modal-content h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 1.5rem;
}

.modal-actions button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
}

.input-row {
    display: flex;
    gap: 12px;
}
.input-row .input-group {
    flex: 1;
}

.input-pax-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 0.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(15px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* SIDEBAR GROUP CARDS */
.sidebar-group-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.group-propuesta {
    border: 2px dashed #f59e0b;
    background-color: #fffbeb;
}

.group-rechazado {
    border: 2px solid #ef4444;
    background-color: #fef2f2;
}

.sidebar-group-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.04);
}

.group-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.group-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.group-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.group-btn-edit {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.7rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
    white-space: nowrap;
}

.group-btn-edit:hover {
    background: #f1f5f9;
    color: var(--accent-primary);
}

.group-card-dates {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.group-pax-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.4rem;
}

/* DRAGGABLE TYPE ITEMS */
.draggable-type-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: grab;
    user-select: none;
    transition: background 0.2s, border-color 0.2s;
}

.draggable-type-row:hover {
    background: #f1f5f9;
    border-color: var(--accent-primary);
}

.draggable-type-row.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.draggable-type-badge {
    background: #e2e8f0;
    color: var(--text-secondary);
    padding: 1px 5px;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 500;
}

/* ROOM TITLE FLEXBOX */
.room-title {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.btn-toggle-visibility {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 2px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.btn-toggle-visibility:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--accent-primary);
}

.btn-toggle-visibility.hidden-room {
    color: var(--danger) !important;
}

/* Utilities */
.hidden { display: none !important; }

/* Chat-style Notes layout */
.chat-bubble {
    border-radius: 12px;
    padding: 0.8rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

/* School bubble: Warm Orange Accent */
.school-bubble {
    background-color: #fffaf0;
    border-left: 4px solid #ea580c; /* Orange */
}

/* Admin bubble: Sleek Blue Accent */
.admin-bubble {
    background-color: #f0f7ff;
    border-left: 4px solid #2563eb; /* Blue */
}

.bubble-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 500;
}

.school-bubble .bubble-title {
    color: #ea580c;
}

.admin-bubble .bubble-title {
    color: #2563eb;
}

.bubble-time {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 400;
}

.notes-textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.4;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #ffffff;
    color: var(--text-primary);
}

.notes-textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* When a textarea is read-only / disabled for another role */
.notes-textarea:read-only {
    background-color: rgba(0, 0, 0, 0.02) !important;
    border-color: #e2e8f0 !important;
    color: #64748b !important;
    cursor: not-allowed;
    box-shadow: none !important;
}

/* Sidebar Notification Badge */
.group-notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    border-radius: 9999px;
    padding: 2px 6px;
    gap: 3px;
    margin-left: 6px;
    align-self: center;
    animation: pulseBadge 2s infinite;
}

.group-notification-badge.school-unread {
    background-color: #ffedd5;
    color: #ea580c;
    border: 1px solid #fed7aa;
}

.group-notification-badge.admin-unread {
    background-color: #dbeafe;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

@keyframes pulseBadge {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Iframe Overrides */
body.in-iframe #toast-container {
    top: 20px;
    bottom: auto;
}
body.in-iframe .app-header h1,
body.in-iframe .app-header .role-badge,
body.in-iframe #btn-logout {
    display: none !important;
}
body.in-iframe .app-header {
    background: transparent;
    box-shadow: none;
    min-height: auto;
    padding: 0.5rem;
    justify-content: space-between !important;
}
body.in-iframe .main-layout {
    padding: 0 !important;
    height: 100vh !important;
    gap: 0 !important;
}
body.in-iframe .sidebar, 
body.in-iframe .timeline-container {
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
}

/* PDF EXPORT MODE OVERRIDES */
body.pdf-export-mode .timeline-container {
    overflow: visible !important;
    width: max-content !important;
    height: max-content !important;
    max-width: none !important;
    max-height: none !important;
}
body.pdf-export-mode .app-header,
body.pdf-export-mode .sidebar,
body.pdf-export-mode #btn-mobile-sidebar-toggle,
body.pdf-export-mode .mobile-actions-row,
body.pdf-export-mode .zoom-controls,
body.pdf-export-mode #btn-add-room {
    display: none !important;
}
body.pdf-export-mode {
    background: white !important;
}
body.pdf-export-mode .main-layout {
    display: block !important;
}
body.pdf-export-mode .timeline-header {
    position: relative !important;
}
body.pdf-export-mode .th-room, 
body.pdf-export-mode .room-column,
body.pdf-export-mode .bed-title {
    position: relative !important;
}
body.pdf-export-mode .stay-block {
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
}

/* Bed Name Customization Styles */
.bed-name-input {
    border: 1px solid transparent;
    background: transparent;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    width: 100%;
    max-width: calc(var(--bed-width) - 18px);
    padding: 1px 2px;
    margin: 0;
    outline: none;
    text-overflow: ellipsis;
    transition: all 0.15s ease;
}

.bed-name-input:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    border-radius: 4px;
}

.bed-name-input:focus {
    background: #ffffff;
    border-color: var(--accent-primary);
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.bed-name-static {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    max-width: calc(var(--bed-width) - 18px);
}

/* ======================================
   OVERBOOKING WARNINGS CHECKBOX (Header)
   ====================================== */
.overbooking-check-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    margin-right: 0.5rem;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    transition: background 0.2s;
}
.overbooking-check-label:hover {
    background: rgba(0,0,0,0.04);
}
.overbooking-check-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--accent-primary);
    width: 15px;
    height: 15px;
}

/* ======================================
   CONFIRM MODAL (Overbooking Warning)
   ====================================== */
.confirm-modal-content {
    max-width: 420px;
    text-align: center;
}
.confirm-modal-content h2 {
    text-align: center;
}
.confirm-modal-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}
.confirm-modal-msg {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
}
.confirm-modal-check-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: background 0.2s;
}
.confirm-modal-check-label:hover {
    background: #f1f5f9;
}
.confirm-modal-check-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: #f59e0b;
    width: 14px;
    height: 14px;
}
.confirm-modal-content .modal-actions {
    justify-content: center;
}

/* ======================================
   UNDO BUTTON IN TOAST
   ====================================== */
.toast-content-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.toast-content-row span {
    flex: 1;
}
.btn-undo {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(37, 99, 235, 0.2);
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-family: var(--font-main);
    font-weight: 600;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-undo:hover {
    background: rgba(37, 99, 235, 0.2);
    border-color: var(--accent-primary);
}

/* Hide overbooking label for school accounts */
body.role-school .overbooking-check-label {
    display: none !important;
}

/* ======================================
   FULL ROOM CHECKBOX (Stay Modal)
   ====================================== */
.stay-fullroom-check {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    transition: background 0.2s;
}
.stay-fullroom-check:has(input:checked) {
    background: #dcfce7;
    border-color: #86efac;
}
.fullroom-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}
.fullroom-check-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: #16a34a;
    width: 16px;
    height: 16px;
}
.fullroom-hint {
    font-size: 0.75rem;
    color: #64748b;
    padding-left: 24px;
}

/* ======================================
   DRAG ROOM INDICATOR
   ====================================== */
.drag-room-indicator {
    position: fixed;
    pointer-events: none; /* So it doesn't block drop events */
    background: rgba(15, 23, 42, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 9999;
    transform: translate(15px, 15px); /* Offset from cursor */
    white-space: nowrap;
}

/* ======================================
   MOBILE RESPONSIVENESS & TOUCH DRAG
   ====================================== */
/* Touch action none is necessary for polyfill to work well on elements we want to drag */
.guest-card, .stay-block {
    touch-action: none;
}

/* Orientation Warning */
#orientation-warning {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #f8fafc;
    z-index: 100000;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

#btn-mobile-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9000;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border-radius: 50px;
    padding: 0.8rem 1.2rem;
    font-size: 0.95rem;
}

/* Portrait rule: Force landscape (REMOVED) */
/* We no longer force landscape, but we keep the mobile adjustments for both */

/* Mobile / Tablet adjustments (Both Portrait and Landscape) */
@media screen and (max-width: 1024px) {
    .app-header {
        padding: 0.5rem 1rem;
        height: auto;
        min-height: 60px;
        gap: 0.5rem;
        flex-wrap: wrap; /* Allow wrapping on narrow portrait screens */
    }
    .app-header h1 { font-size: 1rem; }
    .role-badge { font-size: 0.7rem; margin-left: 0.5rem; }
    
    .login-box {
        padding: 1.5rem;
    }
    
    .header-center { display: flex; align-items: center; justify-content: center; flex: 1; }
    .header-center select { max-width: 150px; font-size: 0.85rem; padding: 0.4rem; }
    
    .header-right { gap: 0.5rem; }
    #btn-export-pdf, #btn-logout { padding: 0.4rem; font-size: 0.8rem; }
    .overbooking-check-label { font-size: 0.75rem; white-space: nowrap; }

    /* Hide sidebar by default and turn it into a drawer */
    .sidebar {
        position: fixed;
        left: -320px; /* Hidden off-screen */
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 9500;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 5px 0 20px rgba(0,0,0,0.2);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 0 16px 16px 0;
        width: 300px;
    }
    
    .sidebar.mobile-open {
        left: 0;
    }

    #btn-mobile-sidebar-toggle {
        display: block;
    }

    /* Small adjustments to timeline to make it fit better */
    .timeline-container {
        border-radius: 8px;
    }
    .th-room {
        font-size: 0.85rem;
        padding: 0.4rem 0.5rem;
    }
}

/* ======================================
   ONBOARDING MODAL
   ====================================== */
.onboarding-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10001;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    animation: fadeIn 0.3s ease-out;
}

.onboarding-overlay.active {
    display: flex;
}

.onboarding-content {
    background: #ffffff;
    border-radius: 20px;
    padding: 2.5rem;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    border: 1px solid rgba(0,0,0,0.06);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.onboarding-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.onboarding-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.onboarding-step:last-of-type {
    border-bottom: none;
}

.onboarding-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 12px;
}

.onboarding-step strong {
    font-size: 0.95rem;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.3rem;
}

.onboarding-step p {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

.onboarding-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.onboarding-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
    cursor: pointer;
    user-select: none;
}

.onboarding-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
}

@media screen and (max-width: 1024px) {
    .onboarding-content {
        padding: 1.5rem;
        max-height: 85vh;
    }
    .onboarding-content h2 {
        font-size: 1.2rem;
    }
}


/* MOBILE TIMELINE UX IMPROVEMENTS */
@media screen and (max-width: 768px) {
    /* 1. Make rows much taller to be touchable */
    :root {
        --bed-height: 50px;
        --day-width: 60px;
        --room-width: 80px;
    }
    
    /* 2. Disable sticky columns on mobile so they don't cover the calendar when scrolling */
    .timeline-header, .th-room, .room-column, .bed-title {
        position: relative !important;
        z-index: 1 !important;
    }
    
    /* 3. Keep room column borders clean when not sticky */
    .th-room {
        background: #f8fafc;
    }
    
    /* 5. Modals full screen on mobile */
    .modal-content {
        max-width: 100%;
        height: 100%;
        border-radius: 0;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
    }
    #group-form, #stay-form, #block-form {
        flex: 1;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    .modal-actions {
        margin-top: auto;
        padding-top: 1rem;
        border-top: 1px solid #e2e8f0;
    }
    
    /* Button targets minimum 44px */
    .btn-primary, .btn-secondary, .btn-danger, input, select {
        min-height: 44px;
    }
}

/* FURTHER MOBILE UX REFINEMENTS */
@media screen and (max-width: 768px) {
    :root {
        --bed-height: 44px; /* Slightly smaller for mobile */
        --day-width: 50px; /* Narrower to fit more days */
        --room-width: 60px; /* Narrower room column */
    }

    /* Force bed-title column width to not grow huge */
    .bed-title {
        max-width: 90px !important;
        min-width: 90px !important;
        width: 90px !important;
    }

    .bed-name-static {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.65rem;
    }

    /* Smaller fonts for dates to prevent wrapping chaos */
    .th-day .d-num {
        font-size: 0.75rem;
    }
    .th-day .d-weekday {
        font-size: 0.55rem;
    }

    /* Smaller fonts for rooms */
    .room-column span {
        font-size: 0.7rem;
    }

    /* Floating Action Button (FAB) Positioning */
    #btn-mobile-sidebar-toggle {
        left: auto;
        right: 20px;
        bottom: 20px;
        padding: 0.8rem 1.2rem;
        border-radius: 50px;
        font-size: 0.85rem;
        box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
}

/* Fix vertical overflow in stay blocks */
.stay-block, .stay-block-fullroom {
    box-sizing: border-box;
    padding: 0 0.2rem;
}

/* ZOOM CONTROLS & MOBILE ACTIONS ROW */
.mobile-actions-row {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 95;
    background: #f8fafc;
    border-bottom: 1px solid var(--glass-border);
}
@media screen and (max-width: 768px) {
    .mobile-actions-row {
        display: flex;
    }
    #btn-mobile-sidebar-toggle {
        position: static;
        box-shadow: none;
        border-radius: 8px;
        padding: 0.6rem 1rem;
    }
}

/* --- COMPACT LAYOUT & COLLAPSIBLE SIDEBAR --- */

/* Global flex definitions for header sections */
.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

/* Sidebar transition & collapsed state */
.sidebar {
    transition: width 0.25s ease, min-width 0.25s ease, opacity 0.15s ease, padding 0.25s ease;
    min-width: 250px;
}

.sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    border: none !important;
    pointer-events: none;
    overflow: hidden;
    flex-basis: 0 !important;
}

/* Compact header for all desktop viewports */
.app-header {
    height: 54px !important;
    padding: 0.4rem 1.2rem !important;
    margin-bottom: 0.5rem !important;
    display: flex;
    justify-content: space-between !important;
    align-items: center;
}

.header-left {
    display: flex !important;
    align-items: center !important;
    gap: 1.5rem !important;
    flex: 1 !important;
    min-width: 0 !important;
}

.header-controls {
    display: flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
}

.app-header img {
    height: 32px !important;
}

.app-header h1 {
    font-size: 1.1rem !important;
}

.app-header .role-badge {
    font-size: 0.7rem !important;
    padding: 0.15rem 0.5rem !important;
}

.header-right {
    display: flex !important;
    align-items: center !important;
    gap: 0.6rem !important;
    flex-wrap: nowrap !important;
}

.header-right .overbooking-check-label {
    font-size: 0.75rem !important;
    white-space: nowrap;
}

/* Premium Header Buttons styling */
.header-right button {
    font-size: 0.8rem !important;
    padding: 0.45rem 0.85rem !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

#btn-global-rooming {
    background-color: #2563eb !important;
    color: white !important;
    border: 1px solid #2563eb !important;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2) !important;
}
#btn-global-rooming:hover {
    background-color: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3) !important;
    transform: translateY(-1px);
}

#btn-export-pdf, 
#btn-refresh-planning {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
}
#btn-export-pdf:hover, 
#btn-refresh-planning:hover {
    background-color: #e2e8f0 !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

#btn-logout {
    background-color: #ef4444 !important;
    color: white !important;
    border: 1px solid #ef4444 !important;
}
#btn-logout:hover {
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
    transform: translateY(-1px);
}

/* Modern Select Dropdown */
#group-filter {
    width: 160px !important;
    max-width: 160px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background-color: white !important;
    padding: 0.35rem 1.8rem 0.35rem 0.6rem !important;
    font-size: 0.8rem !important;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#group-filter:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
    outline: none !important;
}

/* Sidebar body compact */
.sidebar-body {
    padding: 0.6rem !important;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-body button,
.sidebar-body .btn-primary,
.sidebar-body .btn-secondary {
    font-size: 0.75rem !important;
    padding: 0.3rem !important;
}

.sidebar-body .input-search {
    font-size: 0.8rem !important;
    padding: 0.4rem 0.6rem !important;
}

/* Iframe mode overrides */
body.in-iframe .app-header {
    height: 54px !important;
    padding: 0.4rem 1.2rem !important;
    background: transparent !important;
    box-shadow: none !important;
    justify-content: space-between !important;
}

/* Kitchen Planner Styles */
.kitchen-table th {
    background-color: #f1f5f9;
    color: var(--text-primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}
.kitchen-table td {
    padding: 10px 12px;
    vertical-align: middle;
}
.kitchen-table tr:hover {
    background-color: rgba(0,0,0,0.015);
}

.meal-input-group {
    display: inline-flex;
    justify-content: center;
    gap: 4px;
    background: rgba(0,0,0,0.02);
    padding: 3px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.04);
}

.meal-input-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2px 4px;
    border-radius: 4px;
}

.meal-input-item span {
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.meal-input-item input {
    width: 38px;
    text-align: center;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 2px;
    font-size: 0.8rem;
    font-weight: 600;
    background: white;
}

.meal-input-item input:focus {
    border-color: var(--accent-primary);
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Kitchen Printing Styles */
@media print {
    html, body {
        overflow: visible !important;
        height: auto !important;
        min-height: 0 !important;
    }
    body * {
        visibility: hidden !important;
    }
    #kitchen-modal, #kitchen-modal *,
    #group-summary-modal, #group-summary-modal * {
        visibility: visible !important;
    }
    #kitchen-modal {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        background: white !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
    .kitchen-table {
        border-collapse: collapse !important;
        width: 100% !important;
        margin-top: 1rem !important;
    }
    .kitchen-table th, .kitchen-table td {
        border: 1px solid #cbd5e1 !important;
        padding: 8px !important;
        color: #000 !important;
        background: transparent !important;
    }
    .kitchen-table input[type="number"] {
        border: none !important;
        background: transparent !important;
        font-weight: bold !important;
        width: auto !important;
        pointer-events: none !important;
        color: #000 !important;
        -moz-appearance: textfield;
    }
    .kitchen-table input[type="number"]::-webkit-outer-spin-button,
    .kitchen-table input[type="number"]::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    .kitchen-table textarea {
        border: none !important;
        background: transparent !important;
        resize: none !important;
        color: #000 !important;
        padding: 0 !important;
        height: auto !important;
        font-weight: 500 !important;
    }
    .kitchen-summary-card {
        border: 1px solid #cbd5e1 !important;
        background: transparent !important;
        box-shadow: none !important;
        border-left-width: 4px !important;
    }
    #kitchen-modal button,
    #kitchen-modal .modal-actions,
    .kitchen-date-controls,
    #kitchen-modal h2 + button,
    .kitchen-tabs,
    .kitchen-range-controls {
        display: none !important;
    }
    .kitchen-summary-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }
    /* Weekly Mural Print Adjustments */
    #kitchen-weekly-mural-area {
        display: block !important;
        width: 100% !important;
    }
    .weekly-allergy-row, .mural-day-row {
        box-shadow: none !important;
        transform: none !important;
        border: 2px solid #000 !important;
        background: transparent !important;
    }
    .mural-pill {
        border: 1.5px solid #000 !important;
        box-shadow: none !important;
        transform: none !important;
        background: white !important;
        color: #000 !important;
    }
    .mural-pill.picnic {
        background: #d1d5db !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .mural-page-break {
        page-break-after: always !important;
        display: block !important;
        height: 0 !important;
    }
}

/* Mural Weekly Interactive Styles */
.mural-day-row {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.mural-day-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
}
.mural-pill {
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: default;
}
.mural-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.weekly-allergy-row {
    transition: transform 0.2s ease;
}
.weekly-allergy-row:hover {
    transform: translateX(4px);
}

