@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* Color & Design System Tokens */
:root {
    --font-family: 'Outfit', sans-serif;
    --primary: #0d9488;          /* Vibrant clinical teal */
    --primary-hover: #0f766e;
    --primary-light: #ccfbf1;
    --primary-dark: #115e59;
    --bg-main: #f8fafc;          /* Cool slate white */
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-sidebar: #0f172a;       /* Deep slate navy */
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent: #3b82f6;           /* Electric blue */
    --warning: #f59e0b;          /* Warm amber */
    --danger: #ef4444;           /* Coral red */
    --success: #10b981;          /* Emerald green */
    --glass-blur: blur(12px);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
    --radius: 16px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --print-zoom: 0.8;
}

[data-theme="dark"] {
    --bg-main: #0b0f19;          /* Deep dark slate */
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-sidebar: #020617;       /* Total dark black */
    --sidebar-text: #64748b;
    --sidebar-active: #2dd4bf;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --primary-light: rgba(13, 148, 136, 0.2);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

/* Global Reset & Body */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    transition: var(--transition);
    min-height: 100vh;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Main Layout Architecture */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    color: var(--sidebar-text);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
    padding: 2.5rem;
    overflow-y: auto;
    max-height: 100vh;
}

/* Sidebar Styling */
.brand-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.brand-title span {
    color: var(--primary);
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 500;
    transition: var(--transition);
}

.nav-item-link:hover, .nav-item-link.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--sidebar-active);
}

.nav-item-link.active {
    border-left: 4px solid var(--primary);
    background-color: rgba(13, 148, 136, 0.1);
}

/* Profile / Role Banner Control */
.user-profile-widget {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: auto;
}

/* Developer Switcher bar styling */
.dev-banner {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

/* Cards & Glassmorphism widgets */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -5px rgba(0,0,0,0.08);
}

/* Typography elements */
h1, h2, h3, h4, h5 {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.text-muted-custom {
    color: var(--text-muted);
}

/* Modern Pill Badges */
.badge-pill {
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.badge-admin { background-color: rgba(59, 130, 246, 0.15); color: #2563eb; }
.badge-clinician { background-color: rgba(13, 148, 136, 0.15); color: #0f766e; }
.badge-receptionist { background-color: rgba(168, 85, 247, 0.15); color: #7c3aed; }
.badge-support { background-color: rgba(100, 116, 139, 0.15); color: #475569; }

.badge-morning { background-color: #fef3c7; color: #d97706; }
.badge-afternoon { background-color: #e0f2fe; color: #0284c7; }
.badge-fullday { background-color: #dcfce7; color: #15803d; }

.badge-approved { background-color: rgba(16, 185, 129, 0.15); color: #059669; }
.badge-pending { background-color: rgba(245, 158, 11, 0.15); color: #d97706; }
.badge-rejected { background-color: rgba(239, 68, 68, 0.15); color: #dc2626; }

/* Interactive Schedule Matrix Grid */
.rota-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--bg-card);
    box-shadow: var(--shadow);
}

.rota-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.rota-table th {
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.rota-table th:first-child {
    text-align: left;
    background-color: var(--primary-dark);
}

.rota-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    min-width: 170px;
}

.rota-table td:first-child {
    font-weight: 600;
    background-color: rgba(248, 250, 252, 0.5);
    min-width: 150px;
    border-right: 2px solid var(--border);
}

[data-theme="dark"] .rota-table td:first-child {
    background-color: rgba(15, 23, 42, 0.3);
}

/* Grid Cell Interactive Components */
.rota-cell {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
}

.shift-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem;
    font-size: 0.85rem;
    transition: var(--transition);
    position: relative;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.shift-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.shift-card[draggable="true"] {
    cursor: grab;
}
.shift-card[draggable="true"]:active {
    cursor: grabbing;
}

/* Drag-over styling for target drop-zones */
.rota-table td.drag-over {
    background-color: rgba(20, 184, 166, 0.08) !important;
    outline: 2px dashed var(--primary) !important;
    outline-offset: -2px;
}

.shift-card.drag-over {
    border-color: var(--primary) !important;
    background-color: rgba(20, 184, 166, 0.05) !important;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.15) !important;
    transform: scale(1.02);
}

/* Drag validity highlights */
.rota-table td.drag-over.drag-valid {
    background-color: rgba(16, 185, 129, 0.08) !important;
    outline: 2px dashed var(--success) !important;
}
.rota-table td.drag-over.drag-invalid {
    background-color: rgba(239, 68, 68, 0.08) !important;
    outline: 2px dashed var(--danger) !important;
}

.shift-card.drag-over.drag-valid {
    border-color: var(--success) !important;
    background-color: rgba(16, 185, 129, 0.05) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15) !important;
}
.shift-card.drag-over.drag-invalid {
    border-color: var(--danger) !important;
    background-color: rgba(239, 68, 68, 0.05) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15) !important;
}

/* Tiny spinner for loading validation state */
.spinner-tiny {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(15, 118, 110, 0.2);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin-tiny 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin-tiny {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.shift-dentist {
    font-weight: 600;
    color: var(--text-main);
}

.shift-nurse {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Warnings and conflicts tags */
.conflict-badge {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.warning-badge {
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--warning);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Custom modern Buttons */
.btn-modern {
    font-family: var(--font-family);
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-modern-primary {
    background-color: var(--primary);
    color: white;
}

.btn-modern-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-modern-secondary {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn-modern-secondary:hover {
    background-color: var(--border);
    transform: translateY(-1px);
}

.btn-modern-danger {
    background-color: var(--danger);
    color: white;
}

.btn-modern-danger:hover {
    background-color: #dc2626;
}

/* Modals & Backdrop */
.modal-backdrop-custom {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.modal-content-custom {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Styling Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label-custom {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.4rem;
    display: block;
}

.form-input-custom {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background-color: var(--bg-card);
    color: var(--text-main);
    font-family: var(--font-family);
    transition: var(--transition);
}

.form-input-custom:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.form-select-modern,
.form-input-modern {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-card);
    color: var(--text-main);
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
}

.form-select-modern {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.25rem;
}

.form-select-modern optgroup {
    font-weight: 700;
    color: var(--primary-dark);
    background-color: #f8fafc;
}

.form-select-modern option {
    font-weight: 400;
    color: var(--text-main);
    background-color: #ffffff;
    padding: 0.35rem;
}

.form-input-modern:focus,
.form-select-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.form-input-modern:hover,
.form-select-modern:hover {
    border-color: #94a3b8;
}

/* Grid Layout Utilities */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Drag Validation Bar Style */
.drag-validation-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    width: 90%;
    max-width: 550px;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 50px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* Print Scale Controls */
.print-scale-group {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    vertical-align: middle;
    flex-direction: column-reverse;
}

.print-scale-select {
    width: auto;
    height: 38px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

.print-scale-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* Print Stylesheet */
@media print {
    /* Set page dimension to A4 landscape */
    @page {
        size: A4 landscape;
        margin: 0.8cm;
    }
    
    body {
        zoom: var(--print-zoom, 0.8) !important;
        background: #ffffff !important;
        color: #000000 !important;
        font-family: sans-serif;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Hide UI navigation, sidebar, actions, theme controls */
    .sidebar, 
    .dev-banner, 
    .btn, 
    .btn-modern,
    .no-print,
    .role-banner,
    .filter-section,
    .modal-backdrop-custom {
        display: none !important;
    }

    /* Maximize content area */
    .app-container {
        display: block !important;
    }

    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        max-height: none !important;
    }

    .glass-card {
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        border-radius: 0 !important;
        overflow: visible !important;
    }

    /* Rota matrix table formatted for print */
    .rota-container {
        border: none !important;
        overflow: visible !important;
        box-shadow: none !important;
    }

    .rota-table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .rota-table th {
        background-color: #0f766e !important;
        color: #ffffff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border: 1px solid #94a3b8 !important;
        padding: 8px !important;
        font-size: 10pt !important;
    }

    .rota-table th:first-child {
        background-color: #0f766e !important;
    }

    .rota-table td {
        border: 1px solid #cbd5e1 !important;
        padding: 6px !important;
        font-size: 8pt !important;
        color: #0f172a !important;
        background: #ffffff !important;
        min-width: auto !important;
    }

    .rota-table td:first-child {
        font-weight: bold !important;
        background-color: #f8fafc !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border-right: 1px solid #cbd5e1 !important;
    }

    .shift-card {
        border: 1px solid #94a3b8 !important;
        box-shadow: none !important;
        margin-bottom: 4px !important;
        padding: 4px !important;
        background: #ffffff !important;
    }

    .shift-dentist {
        font-weight: bold !important;
    }

    /* Suppress warnings in print */
    .conflict-badge, .warning-badge {
        border: 1px solid #000000 !important;
        color: #000000 !important;
        background: transparent !important;
        font-size: 7pt !important;
    }
}

/* Sidebar Minimization styles */
@media (min-width: 1025px) {
    .sidebar.sidebar-collapsed {
        width: 85px !important;
        padding: 2rem 0.75rem !important;
    }

    .sidebar.sidebar-collapsed .brand-row {
        flex-direction: column !important;
        gap: 1rem !important;
        justify-content: center !important;
        margin-bottom: 1.5rem !important;
    }

    .sidebar.sidebar-collapsed .brand-title {
        justify-content: center;
    }

    .sidebar.sidebar-collapsed .nav-item-link {
        justify-content: center;
        padding: 0.85rem 0;
        gap: 0;
    }

    .sidebar.sidebar-collapsed .nav-item-link .nav-text {
        display: none;
    }

    .sidebar.sidebar-collapsed .user-profile-widget {
        padding: 0.5rem 0 !important;
        background-color: transparent !important;
        border: none !important;
        text-align: center;
        margin-bottom: 0 !important;
    }

    .sidebar.sidebar-collapsed .nav-text {
        display: none !important;
    }

    .sidebar.sidebar-collapsed .user-profile-widget button {
        width: 45px !important;
        height: 45px !important;
        min-width: 0 !important;
        border-radius: 50% !important;
        justify-content: center;
        padding: 0 !important;
        font-size: 1.2rem !important;
        gap: 0 !important;
        margin: 0 auto !important;
    }
}

/* --- Holiday Monthly Calendar View Styles --- */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.calendar-toggle-group {
    display: flex;
    background: rgba(15, 23, 42, 0.05);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid var(--border);
}

[data-theme="dark"] .calendar-toggle-group {
    background: rgba(255, 255, 255, 0.05);
}

.calendar-toggle-btn {
    border: none;
    background: transparent;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.calendar-toggle-btn.active {
    background: var(--primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: var(--shadow);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-lg);
}

.calendar-header-cell {
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
    text-align: center;
    padding: 0.75rem 0.5rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.calendar-day-cell {
    min-height: 120px;
    padding: 0.5rem;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    background: transparent;
    transition: var(--transition);
}

.calendar-day-cell:nth-child(7n) {
    border-right: none;
}

.calendar-day-cell.other-month {
    opacity: 0.45;
    background: rgba(15, 23, 42, 0.02);
}

[data-theme="dark"] .calendar-day-cell.other-month {
    background: rgba(255, 255, 255, 0.02);
}

.calendar-day-cell.today {
    background: rgba(13, 148, 136, 0.05);
}

.calendar-day-number {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    align-self: flex-end;
}

.calendar-day-cell.today .calendar-day-number {
    color: var(--primary);
    background: var(--primary-light);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ─── Bank Holiday Calendar Cells ───────────────────────────────────────── */
.calendar-day-cell.calendar-bank-holiday-day {
    background: linear-gradient(160deg, rgba(245, 158, 11, 0.12), rgba(251, 191, 36, 0.06)) !important;
    border-top: 2px solid rgba(245, 158, 11, 0.5);
}

[data-theme="dark"] .calendar-day-cell.calendar-bank-holiday-day {
    background: linear-gradient(160deg, rgba(245, 158, 11, 0.18), rgba(251, 191, 36, 0.09)) !important;
    border-top-color: rgba(245, 158, 11, 0.65);
}

.calendar-bank-holiday-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: #92400e;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    box-sizing: border-box;
}

[data-theme="dark"] .calendar-bank-holiday-badge {
    color: #fde68a;
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.45);
}

/* ── Practice Closure Day calendar styles (indigo/purple) ──────────────── */
.calendar-day-cell.calendar-closure-day {
    background: linear-gradient(160deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.06)) !important;
    border-top: 2px solid rgba(99, 102, 241, 0.5);
}

[data-theme="dark"] .calendar-day-cell.calendar-closure-day {
    background: linear-gradient(160deg, rgba(99, 102, 241, 0.18), rgba(139, 92, 246, 0.09)) !important;
    border-top-color: rgba(99, 102, 241, 0.65);
}

.calendar-closure-badge {
    font-size: 0.7rem;
    font-weight: 700;
    color: #4338ca;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    box-sizing: border-box;
}

[data-theme="dark"] .calendar-closure-badge {
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

/* ── Closure day matrix/rota cell tint (indigo) ────────────────────────── */
.closure-day-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.08)) !important;
    border-top: 2px solid rgba(99, 102, 241, 0.5) !important;
}

.closure-day-row {
    background: rgba(99, 102, 241, 0.04) !important;
}

.closure-day-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    color: #4338ca;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 3px;
    padding: 0.1rem 0.35rem;
    margin-top: 0.15rem;
    white-space: nowrap;
}

[data-theme="dark"] .closure-day-badge {
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.4);
}

.calendar-leave-badge-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
    max-height: 90px;
    padding-right: 2px;
    width: 100%;
}

/* Custom Scrollbar for badge container */
.calendar-leave-badge-container::-webkit-scrollbar {
    width: 4px;
}
.calendar-leave-badge-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.calendar-leave-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.4rem;
    border-radius: 6px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid transparent;
}

.calendar-leave-badge.approved {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: var(--success);
}

.calendar-leave-badge.pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-color: var(--warning);
}

/* Responsive styles for calendar */
@media (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: 1fr;
    }
    .calendar-header-cell {
        display: none;
    }
    .calendar-day-cell {
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem;
    }
    .calendar-day-number {
        align-self: center;
        font-size: 1rem;
    }
    .calendar-leave-badge-container {
        flex-direction: row;
        flex-wrap: wrap;
        max-height: none;
        overflow-y: visible;
        width: 80%;
        justify-content: flex-end;
    }
}

/* Print utility classes */
.print-only {
    display: none !important;
}

@media print {
    .print-only {
        display: block !important;
    }
}

/* Styling for temporarily unavailable surgeries */
.rota-table td.surgery-unavailable-cell,
.preview-table td.surgery-unavailable-cell {
    background-color: rgba(245, 158, 11, 0.04) !important;
    background-image: repeating-linear-gradient(45deg, rgba(245, 158, 11, 0.03) 0px, rgba(245, 158, 11, 0.03) 10px, transparent 10px, transparent 20px) !important;
}

/* Affected shifts grid layout - 3 columns */
.affected-shifts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 768px) {
    .affected-shifts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 1200px) {
    .affected-shifts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Rota issues panel classes */
.rota-issues-panel {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.rota-issues-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.rota-issues-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rota-issues-badge {
    background-color: var(--danger);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
}

.rota-issues-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

@media (min-width: 992px) {
    .rota-issues-list {
        grid-template-columns: 1fr 1fr;
    }
}

.rota-issue-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    transition: var(--transition);
}

[data-theme="dark"] .rota-issue-item {
    background: rgba(15, 23, 42, 0.2);
}

.rota-issue-item.clickable {
    cursor: pointer;
}

.rota-issue-item.clickable:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.rota-issue-item-error {
    border-left: 4px solid var(--danger);
}

.rota-issue-item-warning {
    border-left: 4px solid var(--warning);
}

.rota-issue-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.rota-issue-content {
    flex-grow: 1;
}

.rota-issue-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Custom Toggle Switch for Daily Consolidation */
.switch-container {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    user-select: none;
}

.switch-input {
    display: none;
}

.switch-slider {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background-color: var(--border);
    border-radius: 24px;
    transition: var(--transition);
}

.switch-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.switch-input:checked + .switch-slider {
    background-color: var(--primary);
}

.switch-input:checked + .switch-slider::before {
    transform: translateX(20px);
}

/* Consolidated Staff Card styles */
.combined-card {
    background: linear-gradient(145deg, var(--bg-card), rgba(255, 255, 255, 0.9));
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 0.85rem;
    font-size: 0.85rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -2px rgba(0, 0, 0, 0.02);
    transition: var(--transition);
    cursor: default;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

[data-theme="dark"] .combined-card {
    background: linear-gradient(145deg, var(--bg-card), rgba(30, 41, 59, 0.9));
    border-left: 4px solid var(--primary);
}

.combined-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

/* Staff Matrix Context Menu & Token Classes */
.context-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    background: transparent;
}

.context-menu-popup {
    position: fixed;
    z-index: 9999;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border, #cbd5e1);
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    min-width: 230px;
    max-width: 320px;
    padding: 0.6rem;
    font-family: inherit;
}

.context-menu-header {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.35rem;
}

.context-menu-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
}

.context-menu-subtitle {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}

.context-menu-remove-btn {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    color: var(--danger);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}

.context-menu-divider {
    border-bottom: 1px solid var(--border);
    margin: 0.35rem 0;
}

.context-menu-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
}

.context-menu-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.context-menu-empty-msg {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.4rem 0.6rem;
}

.context-menu-item-btn {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    color: var(--text-main);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    transition: background 0.15s ease;
}

.context-menu-item-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.context-menu-hours-left {
    font-size: 0.65rem;
    color: var(--success);
    font-weight: 600;
}

.context-menu-agency-btn {
    width: 100%;
    text-align: left;
    background: rgba(245, 158, 11, 0.1);
    border: 1px dashed #d97706;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    color: #d97706;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
}

.context-menu-agency-btn:hover {
    background: rgba(245, 158, 11, 0.2);
}

.context-menu-field-btn {
    width: 100%;
    text-align: left;
    background: rgba(16, 185, 129, 0.1);
    border: 1px dashed #059669;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    color: #059669;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 700;
}

.context-menu-field-btn:hover {
    background: rgba(16, 185, 129, 0.2);
}

/* Sidebar Zero Hours Filter Box */
.sidebar-filter-box {
    margin-bottom: 1rem;
    padding: 0.5rem 0.65rem;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.sidebar-filter-label {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    user-select: none;
}

.sidebar-filter-checkbox {
    cursor: pointer;
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}

/* Inline Booking Badge & Checkbox */
.slot-booking-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 700;
}

.slot-booking-badge-booked {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 4px;
    padding: 0.05rem 0.3rem;
}

.slot-booking-badge-unbooked {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    padding: 0.05rem 0.3rem;
}

/* Leave Decision History Table Scroll */
.leave-history-table-container {
    overflow-x: auto;
    max-height: 520px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.leave-history-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.leave-history-th-sticky {
    background-color: var(--primary);
    position: sticky;
    top: 0;
    z-index: 10;
    cursor: pointer;
    user-select: none;
}

/* Admin Database Management Facility */
.db-manage-glass-card {
    padding: 2rem;
    max-width: 850px;
    margin-bottom: 2rem;
}

.db-manage-header {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.db-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.db-action-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
    background: var(--bg-card);
}

.db-action-card-title {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 700;
}

.db-action-card-title-danger {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--danger);
    font-weight: 700;
}

.db-server-backups-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.db-server-backups-container {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
    margin-bottom: 2rem;
}

/* ==========================================================================
   PWA & Responsive Mobile Enhancements (< 768px Viewports)
   ========================================================================== */

.mobile-header {
    display: none;
    height: 60px;
    background-color: var(--bg-sidebar);
    color: #ffffff;
    padding: 0 1.25rem;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1001;
    border-bottom: 1px solid var(--border);
}

.mobile-hamburger-btn {
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.mobile-hamburger-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.mobile-brand-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
}

.mobile-brand-title span {
    color: var(--primary);
}

.mobile-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1002;
}

/* Screen Scoping: Mobile & Tablet Off-Canvas Drawer (< 1025px) */
@media (max-width: 1024px) {
    .desktop-only-action {
        display: none !important;
    }

    .app-container {
        flex-direction: column;
    }

    .mobile-header {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        bottom: 0;
        width: 280px;
        z-index: 1003;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.mobile-drawer-open {
        transform: translateX(280px);
    }

    .main-content {
        padding: 1.25rem 1rem;
        max-height: none;
        overflow-y: visible;
    }

    .dev-banner {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }

    .dev-banner-right-group {
        display: flex !important;
        align-items: center !important;
        gap: 1rem !important;
        margin-left: auto !important;
    }

    /* Make touch targets at least 44px for accessibility */
    .btn-modern, button, input[type="button"], input[type="submit"] {
        min-height: 44px;
    }

    /* Table responsive overflow wrappers */
    .table-responsive-mobile {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Page Title Bar layout on mobile */
    .page-title-bar {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .action-buttons-group {
        flex-wrap: wrap !important;
        width: 100% !important;
    }

    /* Dashboard mobile list layouts */
    .dashboard-holidays-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .dashboard-holidays-4wks-day-grid {
        grid-template-columns: 1fr !important;
        gap: 0.4rem !important;
    }

    .dashboard-compliance-grid {
        grid-template-columns: 1fr !important;
    }

    /* Mobile tab wrapping */
    .compliance-tab-nav {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
}

/* ==========================================================================
   Global Reusable Utility Components (Subnav, Headers, Tables, Pickers)
   ========================================================================== */

/* Subnavigation Tabs */
.subnav-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.subnav-tab-btn {
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.subnav-tab-btn:hover {
    color: var(--primary);
}

.subnav-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Page Header Bar */
.page-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.page-header-subtitle {
    margin: 0.25rem 0 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Week / Date Navigation Box */
.week-picker-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.week-picker-label {
    font-weight: 600;
    font-size: 0.85rem;
}

.week-picker-display {
    font-weight: 700;
    font-size: 0.85rem;
    min-width: 150px;
    text-align: center;
}

.week-picker-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    margin: 0;
}

/* Modern Data Table */
.data-table-wrapper {
    padding: 0;
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.data-table-modern {
    width: 100%;
    border-collapse: collapse;
}

.data-table-modern th {
    background-color: var(--primary);
    color: #ffffff;
    text-align: left;
    padding: 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    user-select: none;
    white-space: nowrap;
}

.data-table-modern th.sortable {
    cursor: pointer;
}

.data-table-modern td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.data-table-modern tr:hover td {
    background-color: rgba(13, 148, 136, 0.04);
}

/* Centered Notice & Loading Box */
.notice-box {
    text-align: center;
    padding: 2.5rem;
    border-radius: var(--radius);
}

.loading-box {
    text-align: center;
    padding: 2.5rem;
    font-weight: 600;
    color: var(--primary);
}

.empty-state-card {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
