/*
==============================================
    BASE & LAYOUT
==============================================
*/
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/*
==============================================
    LOGIN PAGE
==============================================
*/
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-form {
    background: #fff;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-form h2 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.login-form p {
    margin-bottom: 2rem;
    color: #7f8c8d;
}

/*
==============================================
    BUTTONS
==============================================
*/
.btn {
    display: inline-block;
    background-color: #3498db;
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
    width: 100%;
    box-sizing: border-box;
}

.btn:hover {
    background-color: #2980b9;
}

.btn.active {
    background-color: #2c3e50;
    font-weight: bold;
}

.btn-secondary {
    background-color: #95a5a6;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.8rem;
    width: auto;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/*
==============================================
    FORMS
==============================================
*/
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 1rem;
}

.form-group-inline {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-group-inline .form-group {
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.form-group-inline .form-group:last-child {
    flex-grow: 0;
    min-width: 150px;
}

.form-group-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
}

.form-group-checkbox input {
    width: auto;
}

.form-group-checkbox label {
    margin-bottom: 0;
    font-weight: normal;
}

/*
==============================================
    DASHBOARD & CARDS
==============================================
*/
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-header h1 {
    margin: 0;
    width: 100%;
    text-align: center;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    justify-content: center;
}

.header-info .btn {
    width: auto;
}

.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.card {
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.full-width-card {
    grid-column: 1 / -1;
}

/*
==============================================
    MESSAGES & NOTIFICATIONS
==============================================
*/
.message.error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    padding: 1rem;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.message.warning {
    background-color: #fff3cd;
    color: #856404;
    padding: 1rem;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/*
==============================================
    TABS & NAVIGATION
==============================================
*/
.tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 2rem;
    border-bottom: none;
}

.tab-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin-bottom: 10px;
}

.tab-row .btn {
    flex: 1 1 23%;
}

.tab-content {
    display: none;
}

.employee-tabs {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 10px;
}

.employee-tabs .btn {
    width: auto;
    flex-grow: 0;
}

/*
==============================================
    CALENDAR & TIMESHEET
==============================================
*/
.calendar-controls {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.week-navigator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.week-navigator .btn {
    width: auto;
    padding: 8px 12px;
}

.calendar-grid, .monthly-calendar-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 1rem;
}

.monthly-calendar-grid {
    gap: 5px; /* Tighter gap for monthly view */
}

.calendar-day {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fdfdfd;
    display: flex;
    flex-direction: column;
}

.monthly-calendar-grid .calendar-day {
    min-height: 100px; /* Shorter height for monthly view */
}

.day-header {
    background: #f9f9f9;
    padding: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
    text-align: center;
    font-size: 0.9rem;
}

.day-header strong {
    display: block;
}

.day-content {
    padding: 0.5rem;
    flex-grow: 1;
    min-height: 60px;
    text-align: center;
}

.day-footer {
    background: #f9f9f9;
    padding: 0.5rem;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    font-weight: 600;
}

.monthly-calendar-grid .day-header-static {
    text-align: center;
    font-weight: 700;
    padding: 0.5rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 5px;
}

.monthly-calendar-grid .calendar-day.padding-day {
    background-color: #f8f9fa;
    opacity: 0.7;
}
.monthly-calendar-grid .calendar-day.padding-day .day-content,
.monthly-calendar-grid .calendar-day.padding-day .day-footer {
    visibility: hidden;
}

.no-entry.add-entry-link {
    color: #3498db;
    text-align: center;
    font-style: normal;
    font-size: 0.9rem;
    margin-top: 1rem;
    cursor: pointer;
    font-weight: 500;
}
.no-entry.add-entry-link:hover {
    text-decoration: underline;
}

.time-entry {
    font-size: 0.85rem;
    background: #eaf5fc;
    border-radius: 4px;
    padding: 4px 6px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    transition: background-color 0.2s;
}
.time-entry:hover {
    background-color: #d4eaf7;
}

.monthly-calendar-grid .time-entry {
    font-size: 0.75rem; /* Smaller font for entries to fit */
    padding: 2px 4px;
    justify-content: center;
}

.scheduled-time {
    font-size: 0.8rem;
    color: #7f8c8d;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 2px 6px;
    margin-bottom: 6px;
    text-align: center;
}

.week-total {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.5rem;
}
.week-total strong {
    color: #2c3e50;
}

/* Alternating Day Styles */
.calendar-grid .calendar-day:nth-of-type(even):not(.annual_leave):not(.sick_leave):not(.closed):not(.bank-holiday):not(.maternity):not(.paternity):not(.bereavement),
.monthly-calendar-grid .calendar-day:nth-of-type(even):not(.annual_leave):not(.sick_leave):not(.closed):not(.bank-holiday):not(.maternity):not(.paternity):not(.bereavement) {
    background-color: #f8f9fa;
}
.calendar-grid .calendar-day:nth-of-type(even):not(.annual_leave):not(.sick_leave):not(.closed):not(.bank-holiday):not(.maternity):not(.paternity):not(.bereavement) .day-header,
.monthly-calendar-grid .calendar-day:nth-of-type(even):not(.annual_leave):not(.sick_leave):not(.closed):not(.bank-holiday):not(.maternity):not(.paternity):not(.bereavement) .day-header,
.calendar-grid .calendar-day:nth-of-type(even):not(.annual_leave):not(.sick_leave):not(.closed):not(.bank-holiday):not(.maternity):not(.paternity):not(.bereavement) .day-footer,
.monthly-calendar-grid .calendar-day:nth-of-type(even):not(.annual_leave):not(.sick_leave):not(.closed):not(.bank-holiday):not(.maternity):not(.paternity):not(.bereavement) .day-footer {
    background-color: #e9ecef;
}

/*
==============================================
    LEAVE/CLOSURE/STAFFING THEMES
==============================================
*/
.calendar-day.annual_leave .day-content, .calendar-day.sick_leave .day-content, .calendar-day.closed .day-content, .calendar-day.bank-holiday .day-content, .calendar-day.maternity .day-content, .calendar-day.paternity .day-content, .calendar-day.bereavement .day-content { display: flex; justify-content: center; align-items: center; font-weight: 600; text-transform: capitalize; }
.calendar-day.sick_leave { background-color: #fdeded; border-color: #d32f2f; }
.calendar-day.sick_leave .day-header, .calendar-day.sick_leave .day-footer { background-color: #f8d7da; border-color: #d32f2f; color: #721c24; }
.calendar-day.sick_leave .day-content { color: #721c24; }
.calendar-day.annual_leave { background-color: #e0f2f1; border-color: #00796b; }
.calendar-day.annual_leave .day-header, .calendar-day.annual_leave .day-footer { background-color: #b2dfdb; border-color: #00796b; color: #004d40; }
.calendar-day.annual_leave .day-content { color: #004d40; }
.calendar-day.bank-holiday { background-color: #e8f5e9; border-color: #388e3c; }
.calendar-day.bank-holiday .day-header, .calendar-day.bank-holiday .day-footer { background-color: #c8e6c9; border-color: #388e3c; color: #1b5e20; }
.calendar-day.bank-holiday .day-content { color: #1b5e20; }
.calendar-day.maternity { background-color: #f3e5f5; border-color: #6a1b9a; }
.calendar-day.maternity .day-header, .calendar-day.maternity .day-footer { background-color: #e1bee7; border-color: #6a1b9a; color: #4a148c; }
.calendar-day.maternity .day-content { color: #4a148c; }
.calendar-day.paternity { background-color: #e8eaf6; border-color: #303f9f; }
.calendar-day.paternity .day-header, .calendar-day.paternity .day-footer { background-color: #c5cae9; border-color: #303f9f; color: #1a237e; }
.calendar-day.paternity .day-content { color: #1a237e; }
.calendar-day.bereavement { background-color: #efebe9; border-color: #4e342e; }
.calendar-day.bereavement .day-header, .calendar-day.bereavement .day-footer { background-color: #d7ccc8; border-color: #4e342e; color: #3e2723; }
.calendar-day.bereavement .day-content { color: #3e2723; }
.calendar-day.closed { background-color: #f5f5f5; border-color: #757575; }
.calendar-day.closed .day-header, .calendar-day.closed .day-footer { background-color: #e0e0e0; border-color: #757575; color: #424242; }
.calendar-day.closed .day-content { color: #424242; }

/* Staffing Issue Calendar Styling */
.staffing-status-text { font-weight: bold; font-size: 0.9em; display: block; }
.calendar-day.understaffed, .calendar-day.warning { background-color: #ffebee !important; border-color: #ef9a9a !important; }
.calendar-day.overstaffed { background-color: #fff8e1 !important; border-color: #ffcc80 !important; }
.calendar-day.optimal { background-color: #e8f5e9 !important; border-color: #a5d6a7 !important; }
.calendar-day.understaffed .day-content, .calendar-day.warning .day-content, .calendar-day.overstaffed .day-content, .calendar-day.optimal .day-content { justify-content: center; align-items: center; }

/*
==============================================
    TABLES
==============================================
*/
.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9em;
    min-width: 400px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}
.styled-table thead tr {
    background-color: #3498db;
    color: #ffffff;
    text-align: left;
}
.styled-table th, .styled-table td {
    padding: 12px 15px;
}
.styled-table tbody tr {
    border-bottom: 1px solid #dddddd;
}
.styled-table tbody tr:nth-of-type(even) {
    background-color: #f3f3f3;
}
.styled-table tbody tr:last-of-type {
    border-bottom: 2px solid #3498db;
}

.pay-cycle-table th, .pay-cycle-table td {
    padding: 12px 10px;
    font-size: 0.9em;
    white-space: normal;
    text-align: right;
    vertical-align: middle;
    min-width: 90px;
}
.pay-cycle-table th:first-child, .pay-cycle-table td:first-child {
    text-align: left;
}

/*
==============================================
    STATUS & SKILL BADGES
==============================================
*/
.status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}
.status-pending { background-color: #f39c12; }
.status-approved { background-color: #2ecc71; }
.status-rejected { background-color: #e74c3c; }
.status-grey { background-color: #95a5a6; }
.status-danger { background-color: #e74c3c; }

.skill-badge-container {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.skill-badge {
    background-color: #e0e0e0;
    color: #333;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

/*
==============================================
    MODALS
==============================================
*/
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}
.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 1.5rem;
    border: 1px solid #888;
    width: 90%;
    border-radius: 12px;
    position: relative;
    max-width: 500px;
}
.modal-content.large {
    max-width: 1100px;
}
.staffing-modal .modal-content, #coverageReportModal .modal-content {
    max-width: 800px;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
}
.close-button:hover, .close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.modal-actions {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.modal-actions .btn {
    width: 100%;
}

#calendar-container .flatpickr-calendar {
    box-shadow: none;
    border: none;
    width: 100% !important;
    max-width: none !important;
}

/* Policy Modal */
/* Updated Policy Modal for Abbey Services */
#policyModal .modal-content {
    width: 95%;
    max-width: 600px;
    height: auto;           /* CHANGED: Removes the forced 80vh height */
    max-height: 90vh;      /* Prevents it from going off-screen on tiny phones */
    display: flex;
    flex-direction: column;
    margin: 5% auto;       /* Moves it higher up the screen */
    padding: 2rem;
}

#policyModal form {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}
#policyModal #policyContent {
    flex-grow: 0;           /* CHANGED: Box won't expand to fill space */
    overflow-y: auto;
    max-height: 400px;      /* Keeps a scrollbar if the text is very long */
    padding: 15px;
    margin: 15px 0;
    border: 1px solid #e0e0e0;
    background-color: #f9f9f9;
    line-height: 1.6;
    text-align: left;
}

/* Availability Modals */
.availability-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin-top: 1rem; }
.availability-day { border: 1px solid #e0e0e0; border-radius: 8px; padding: 10px; background-color: #f9f9f9; display: flex; flex-direction: column; min-height: 120px; }
.availability-day h4 { margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid #ddd; font-size: 0.9em; font-weight: 600; text-align: center; color: #333; }
.availability-slot { background-color: #e7f3ff; border: 1px solid #b3d7ff; color: #004085; border-radius: 15px; padding: 5px 12px; margin-bottom: 8px; font-size: 0.85em; font-weight: 500; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background-color 0.2s, box-shadow 0.2s; }
.availability-slot:hover { background-color: #d1e7ff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.delete-slot { font-family: Arial, sans-serif; font-size: 1.4em; font-weight: bold; color: #999; cursor: pointer; padding-left: 8px; line-height: 1; }
.delete-slot:hover { color: #e53935; }
.availability-day .btn { margin-top: auto; }

/*
==============================================
    MISC & COMPONENT-SPECIFIC
==============================================
*/
/* Leave Balance Card */
.leave-balance-card { display: flex; justify-content: space-around; text-align: center; padding: 1rem 0; }
.leave-balance-card div { display: flex; flex-direction: column; }
.leave-balance-card span { font-size: 0.9rem; color: #7f8c8d; margin-bottom: 0.25rem; }
.leave-balance-card strong { font-size: 1.8rem; font-weight: 600; color: #2c3e50; }
.leave-balance-card strong.remaining { color: #2ecc71; }
.negative-balance { color: #e74c3c !important; }

/* Settings Toggle Switch */
.setting-with-toggle { display: flex; align-items: center; flex-wrap: wrap; gap: 15px; margin-bottom: 0.5rem; }
.setting-with-toggle .setting-label { font-weight: 600; color: #555; flex-grow: 1; }
.toggle-switch { position: relative; display: inline-block; width: 60px; height: 34px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch label { position: absolute; cursor: pointer; top: 0; left: 0; width: 60px; height: 34px; background-color: #ccc; transition: .4s; border-radius: 34px; }
.toggle-switch label:before { position: absolute; content: ""; height: 26px; width: 26px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
.toggle-switch input:checked+label { background-color: #2ecc71; }
.toggle-switch input:checked+label:before { transform: translateX(26px); }
.setting-warning { display: block; width: 100%; margin-top: 0.25rem; color: #c0392b; font-size: 0.9em; font-style: italic; flex-basis: 100%; }

/* Admin Timesheet View */
#timesheets-content .employee-timesheet-section { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid #e9ecef; }
#timesheets-content .employee-timesheet-section:last-of-type { border-bottom: none; }
#timesheets-content .employee-name-grid-cell { background-color: #eaf5fc; border: 1px solid #aed6f1; }
#timesheets-content .employee-name-grid-cell .day-header { background-color: #d4eaf7; border-bottom: 1px solid #aed6f1; color: #2980b9; }
#timesheets-content .employee-name-grid-cell .day-content.name-content { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; text-align: center; padding: 0.5rem; color: #2c3e50; }
#timesheets-content .employee-name-grid-cell .day-footer { background-color: #d4eaf7; border-top: 1px solid #aed6f1; }
#timesheets-content .employee-totals-footer { display: flex; flex-direction: column; justify-content: center; align-items: center; font-size: 0.8rem; font-weight: 600; color: #2c3e50; padding: 2px; }

/* Employee Timesheet View Controls */
.main-timesheet-controls { display: flex; justify-content: space-between; align-items: center; flex-direction: row; flex-wrap: wrap; }
.main-timesheet-controls .clock-in-form { width: auto; }
.main-timesheet-controls .clock-in-form .btn { width: auto; }
.main-timesheet-controls .view-switcher-tabs { margin-bottom: 0; }

/* Rota Management */
.rota-controls-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid #e0e0e0; }
.rota-controls-header .employee-selector-form { flex: 1 1 50%; margin-bottom: 0; }
.rota-controls-header .rota-view-tabs { flex: 1 1 auto; justify-content: flex-end; margin-bottom: 0; }
.recurring-rota-actions { display: flex; flex-direction: column; align-items: center; gap: 1rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #e0e0e0; }
.warning-icon { background: none; border: 1px solid currentColor; color: inherit; border-radius: 50%; width: 22px; height: 22px; padding: 0; line-height: 20px; cursor: pointer; font-weight: bold; }

/*
==============================================
    RESPONSIVE DESIGN
==============================================
*/

/* Tablet & Desktop */
@media (min-width: 768px) {
    .dashboard-content { display: grid; grid-template-columns: 1fr 2fr; align-items: start; gap: 1.5rem; }
    .dashboard-header h1 { width: auto; text-align: left; }
    .header-info { width: auto; }
    .calendar-grid, .monthly-calendar-grid { grid-template-columns: repeat(7, 1fr); }
    .calendar-controls { flex-direction: row; }
    .week-total { flex-direction: row; text-align: right; justify-content: flex-end; }
    .modal-actions { flex-direction: row; justify-content: space-between; }
    .modal-actions .btn { width: 48%; }
    .table-responsive { overflow-x: auto; }
    .full-width-card .styled-table { display: table; }

    .recurring-rota-actions { flex-direction: row; justify-content: center; gap: 2rem; }
}

/* Admin Timesheet Grid - Large Desktop */
@media (min-width: 1400px) {
    #timesheets-content .calendar-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

/* Admin Timesheet Grid - Medium Desktop/Large Tablet */
@media (min-width: 768px) and (max-width: 1399px) {
    #timesheets-content .calendar-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 991px) {
    .container { 
        padding: 0 1rem; 
        margin: 1rem auto; 
    }
    
    /* 1. Force Header elements to stay on one line */
    .dashboard-header { 
        flex-direction: row !important; 
        justify-content: space-between !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        text-align: left !important;
        padding-bottom: 1rem;
    }

    /* Target the H1 inside the header to be smaller and inline */
    .dashboard-header h1 {
        width: auto !important;
        font-size: 1.2rem !important;
        margin: 0 !important;
    }

    /* 2. Force Welcome + Admin + Logout onto one line */
    .header-info { 
        flex-direction: row !important; 
        justify-content: flex-end !important;
        gap: 5px !important; 
        width: auto !important;
        flex-wrap: nowrap !important;
        font-size: 0.8rem; /* Smaller text to ensure fit */
    }

    /* Shrink header buttons slightly to save space */
    .header-info .btn {
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
        min-width: unset !important;
        white-space: nowrap !important;
    }

    /* 3. Main Tabs: Wrap into rows as requested */
    .tabs.employee-tabs {
        display: flex !important;
        flex-wrap: wrap !important; /* Jump to new line */
        gap: 10px !important;
        margin-bottom: 1.5rem !important;
        justify-content: center !important;
        overflow-x: visible !important;
    }

    /* Tab Button Sizing */
    .tabs.employee-tabs .btn { 
        flex: 1 1 calc(50% - 15px) !important; 
        width: auto !important;     
        min-width: 140px !important; 
        padding: 12px 5px !important;
        text-align: center !important;
        white-space: normal !important; 
        font-size: 0.9rem !important;
    }

    /* 4. Calendar Overrides remains 1-column */
    #timesheets-content .calendar-grid, 
    .monthly-calendar-grid { 
        grid-template-columns: 1fr !important; 
    }
    .monthly-calendar-grid .day-header-static { 
        display: none !important; 
    }
}
/*
==============================================
    COMPONENT OVERRIDES & FIXES
==============================================
*/

/* Fix for view-switcher buttons */
.view-switcher-tabs .btn,
.rota-view-tabs .btn {
    width: auto;          /* Overrides the default 100% width */
    flex-grow: 0;         /* Prevents buttons from stretching */
    font-size: 0.9rem;    /* NEW: Makes the text smaller */
    padding: 8px 15px;    /* NEW: Reduces the space inside the button */
}

/*
==============================================
    Date Picker Modal Fix
==============================================
*/

/* 1. Resize the modal box to fit the calendar neatly */
#datePickerModal .modal-content {
    max-width: 310px;
    width: auto;
}

/* 2. Ensure the calendar is centered within the wrapper */
.flatpickr-wrapper {
    display: flex;
    justify-content: center;
}

/* 3. Center the 'Confirm' button underneath the calendar */
#datePickerModal .modal-actions {
    justify-content: center;
}

/*
==============================================
    Schedule Editor Modal
==============================================
*/
#scheduleModal .modal-content {
    max-width: 1100px;
}

.schedule-editor-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 15px;
    margin-bottom: 1.5rem;
}

.schedule-editor-day {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background-color: #f9f9f9;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.schedule-editor-day h4 {
    margin: 0 0 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
    font-size: 1em;
    font-weight: 600;
    color: #333;
}

.schedule-editor-day .time-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.schedule-editor-day .form-group {
    margin-bottom: 0;
}

.schedule-editor-day .form-group label {
    font-size: 0.85em;
    margin-bottom: 4px;
}

/*
==============================================
    RESPONSIVE DESIGN (Additions)
==============================================
*/


/* Add this to styles.css */
.suggestion-item {
    border-top: 1px solid #eee;
    padding-top: 1rem;
    margin-top: 1rem;
}

.suggestion-reasons ul {
    list-style-type: none;
    padding: 0;
    margin: 0.5rem 0;
    font-size: 0.9em;
    color: #555;
}

.suggestion-reasons li {
    padding-left: 20px;
    position: relative;
    margin-bottom: 0.25rem;
}

.suggestion-reasons li::before {
    position: absolute;
    left: 0;
    top: 0;
    font-weight: bold;
}

/* Add this to styles.css */
.suggestion-warnings ul {
    list-style-type: none;
    padding: 0;
    margin: 0.5rem 0;
    font-size: 0.9em;
    color: #c0392b; /* Red color for warnings */
}

.suggestion-warnings li {
    padding-left: 20px;
    position: relative;
    margin-bottom: 0.25rem;
}

.suggestion-warnings li::before {
    position: absolute;
    left: 0;
    top: 0px;
}

/* Add this to styles.css */
.diagnostic-report {
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
}

.diagnostic-report h4 {
    margin-top: 0;
    color: #d46b08;
}

.diagnostic-report ul {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 1rem;
}

.diagnostic-report li {
    padding: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.diagnostic-report li:last-child {
    border-bottom: none;
}

/* Add this to styles.css */
.draft-shift {
    background-color: #e6f7ff !important;
    border: 1px dashed #91d5ff !important;
    color: #096dd9 !important;
}

.publish-controls-bar {
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: 4px;
    padding: 0.75rem;
    margin: 1rem 0;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

/* Add these styles to styles.css */
.rota-preview-container {
    padding-bottom: 2rem;
}

.employee-key {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding: 0.5rem;
}

.key-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-swatch {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

.rota-preview-container .rota-shift {
    border-radius: 4px;
    padding: 0.4rem;
    margin-bottom: 0.5rem;
    color: #333;
    font-size: 0.9em;
    border: 1px solid rgba(0,0,0,0.1);
}

.rota-preview-container .rota-shift strong {
    font-weight: 600;
}

/*
==============================================
    NEW: Timesheet Control Bar
==============================================
*/
.timesheet-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.status-indicator {
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
}

.status-clocked_out {
    color: #7f8c8d;
    background-color: #e9ecef;
}
.status-clocked_in {
    color: #1b5e20;
    background-color: #c8e6c9;
}
.status-on_break {
    color: #856404;
    background-color: #fff3cd;
}

.button-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.button-group form {
    margin: 0;
}

.button-group .btn {
    width: auto; /* Ensure buttons are not full-width */
}

/* Dropdown Button Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle::after {
    content: ' ▼';
    font-size: 0.7em;
    margin-left: 5px;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background-color: #f1f1f1;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    right: 0; /* Align to the right of the button */
}

.dropdown-menu button {
    color: black;
    background: none;
    border: none;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    width: 100%;
    text-align: left;
    cursor: pointer;
}

.dropdown-menu button:hover {
    background-color: #2ecc71
}

.dropdown.show .dropdown-menu {
	
    display: block;
}

.editable-break {
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.editable-break:hover {
    background-color: #e9ecef;
}

.break-entry {
    display: flex;
    flex-direction: column;  /* Stack items vertically */
    align-items: stretch;     /* Make items fill the available width */
    gap: 5px;                 /* Adjust space between text and button */
    margin-top: 5px;          /* Add a little space above the break entry */
}

.btn-success {
    background-color: #2ecc71; /* A standard green color */
}

.btn-success:hover {
    background-color: #27ae60; /* A slightly darker green for hover */
}

.break-entry-clickable {
    font-size: 0.85rem;
    background: #e8eaf6; /* A light indigo/purple color */
    border-radius: 4px;
    padding: 4px 6px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    transition: background-color 0.2s;
}

.break-entry-clickable:hover {
    background-color: #c5cae9; /* A slightly darker version for hover */
}

.break-entry-display {
    font-size: 0.85rem;
    background: #e8eaf6; /* A light indigo/purple color */
    border-radius: 4px;
    padding: 4px 6px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

/*
==============================================
    NEW: Main Navigation Bar (Updated Style)
==============================================
*/
.main-nav {
    margin-bottom: 2rem; /* Keep the margin */
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 10px; /* Add a gap between buttons */
}

.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    padding: 12px 20px;
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    /* --- Style to match .btn --- */
    background-color: #3498db;
    color: #fff;
}

.nav-link:hover {
    background-color: #2980b9; /* Darker blue on hover */
    color: #fff;
}

.nav-link.active {
    background-color: #2c3e50; /* Dark color to match active tabs */
    font-weight: bold;
}

/* Dropdown Menu Styles */
.nav-item.has-dropdown:hover .dropdown-menu-nav {
    display: block;
}

.dropdown-menu-nav {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    /* margin-top: 5px; */ /* REMOVED: This line was causing the gap */
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 8px 8px; /* UPDATED: Only round the bottom corners */
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    list-style: none;
    padding: 5px 0;
    min-width: 200px;
    z-index: 100;
    overflow: hidden; 
}

.dropdown-menu-nav li a {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    color: #333;
    white-space: nowrap;
}

.dropdown-menu-nav li a:hover {
    background-color: #f8f9fa;
    color: #2980b9;
}

/* ==============================================
    MOBILE-FRIENDLY NAV & GRID FIXES
==============================================
*/



/* 2. Responsive 'My Balance' Grid Fix */
.leave-balance-grid {
    display: grid;
    /* Automatically switches between 1, 2, or 4 columns based on screen width */
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

/* 3. Table Container for Touch Swiping */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

/* PWA App-Like Behaviors */
@media all and (display-mode: standalone) {
    body {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        user-select: none; /* Prevents text highlighting when tapping buttons */
    }
    .container {
        padding-top: env(safe-area-inset-top); /* Supports iPhone "Notch" area */
    }
}