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

html {
    background-color: #1a1a1a; /* Prevent white background during overscroll */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top)); /* Handle iPhone notch */
    touch-action: manipulation; /* Disable double-tap to zoom on touch devices */
    color: #333;
}

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

/* Main App Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    padding: 12px 20px;
    text-align: center;
    transition: background 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    position: relative; /* allow absolute-centering of the title */
}

.header-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%; /* take full width so we can position controls left/right */
}

.clear-cache-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 20px;
    padding: 0;
    flex-shrink: 0;
    opacity: 0.7;
}

.clear-cache-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    opacity: 1;
}

.clear-cache-btn:active {
    transform: scale(0.95);
}

header h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    position: absolute; /* center without affecting controls */
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none; /* avoid intercepting clicks on nearby controls */
}

/* keep clear cache on the left and push dark mode toggle to the right */
.dark-mode-toggle {
    margin-left: auto;
}

.dark-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.dark-mode-toggle:active {
    transform: scale(0.95);
}

.input-section {
    display: grid;
    grid-template-columns: 1fr auto auto auto auto;
    gap: 4px;
    padding: 4px;
    background: #f5f5f5;
}

.input-section > .input-row {
    display: grid;
    grid-template-columns: subgrid;
    grid-column: 1 / -1;
    align-items: center;
    background: white;
    padding: 5px 8px;
    border-radius: 10px;
}

.input-row-commission .entry-select {
    grid-column: 1 / 5;
}

.row-label {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    padding: 0 8px;
}

body.dark-mode .row-label {
    color: #ccc;
}

.entry-btn, .user-select-btn {
    padding: 8px 12px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.pm-dusk-switch {
    display: flex;
    gap: 4px;
    background: #e0e0e0;
    border-radius: 8px;
    padding: 4px;
}

.switch-btn {
    flex: 1;
    padding: 6px 12px;
    background: transparent;
    color: #666;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.switch-btn.active {
    background: #2196F3;
    color: white;
}

.switch-btn:active {
    transform: scale(0.95);
}

body.dark-mode .pm-dusk-switch {
    background: #404040;
}

body.dark-mode .switch-btn {
    color: #b0b0b0;
}

body.dark-mode .switch-btn.active {
    background: #3498db;
    color: white;
}

.entry-btn:active, .user-select-btn:active {
    transform: scale(0.95);
    background: #1976D2;
}

.entry-select {
    padding: 8px 12px;
    background: white;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.quantity-btn {
    /* make +/- buttons a bit smaller so the quantity value becomes the focal point
       and use muted / desaturated colors so the pill stands out more */
    padding: 6px 10px;
    background: rgba(76, 175, 80, 0.12);
    color: #2e7d32; /* muted green text */
    border: 1px solid rgba(46, 125, 50, 0.12);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    min-width: 36px;
    transition: all 0.18s ease;
}

/* Subtle hover to give affordance without stealing focus from the quantity pill */
.quantity-btn:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 6px 18px rgba(11,87,164,0.06);
}

.quantity-btn:active {
    transform: scale(0.96);
    background: rgba(76, 175, 80, 0.18);
}

.quantity-btn[data-action="remove"] {
    background: rgba(244, 67, 54, 0.12);
    color: #b71c1c; /* muted red text */
    border: 1px solid rgba(183, 28, 28, 0.12);
}

.quantity-btn[data-action="remove"]:active {
    background: rgba(244, 67, 54, 0.18);
}

.quantity {
    /* prominent pill-style number to stand out from the +/- buttons */
    font-size: 16px;
    font-weight: 700;
    width: 60px;
    padding: 6px 0;
    text-align: center;
    color: #0b57a4; /* accent color */
    background: linear-gradient(180deg, #ffffff 0%, #f3f7fb 100%);
    border-radius: 8px;
    border: 1px solid rgba(11,87,164,0.08);
    box-shadow: 0 4px 10px rgba(11,87,164,0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

/* Gentle hover on the pill to indicate it is the primary value (non-intrusive) */
.quantity:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(11,87,164,0.09);
}

.days-section {
    padding: 20px;
}

.days-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.nav-btn {
    padding: 10px 16px;
    background: #FF9800;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:active {
    transform: scale(0.95);
    background: #F57C00;
}

#dateRange {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.grid-container {
    overflow-x: auto;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: white;
}

/* iOS touch scrolling and sticky header fixes */
.grid-container {
    -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
    position: relative; /* ensure sticky children position correctly */
}

.grid-header {
    display: grid;
    background: #2196F3;
    color: white;
    font-weight: 600;
    font-size: 12px;
    position: sticky;
    top: 0; /* for sticky positioning */
    z-index: 10;
}

/* create its own stacking context to avoid subpixel/paint issues on mobile */
.grid-header {
    transform: translateZ(0);
}

/* New inner wrapper to keep header and rows aligned when scrolling */
.grid-inner {
    display: flex;
    flex-direction: column;
    width: 100%; /* ensure it fills the container */
}

/* Ensure the days grid sits below the header inside the same scrolling block */
.days-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.header-cell {
    padding: 8px;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-cell:last-child {
    border-right: none;
}

.day-row {
    display: grid;
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
}

.day-row:hover {
    background: #f5f5f5;
}

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

/* Highlight for the current day */
.day-row.current-day {
    background-color: #e3f2fd; /* Light blue to match theme */
    font-weight: 600; /* Make text slightly bolder */
}

.day-row.current-day:hover {
    background-color: #dbeffc; /* A slightly darker blue on hover */
}


.day-cell {
    padding: 8px;
    text-align: center;
    font-size: 14px;
    border-right: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-cell:last-child {
    border-right: none;
}

/* Shared grid column layout for header and rows */
.grid-header {
    /* Date | Overtime | Commission (Merged) | Mech OT | Total */
    grid-template-columns: 100px 0.6fr 1.6fr 0.6fr 0.6fr;
    align-items: stretch;
}

.day-row {
    grid-template-columns: 100px 0.6fr 1.6fr 0.6fr 0.6fr;
    align-items: stretch;
}

/* --- Mech User Visibility --- */
/* Hide mech elements by default for non-mech users */
body:not(.is-mech-user) .mech-only {
    display: none !important;
}
body:not(.is-mech-user) .grid-header,
body:not(.is-mech-user) .day-row {
    /* Date | Overtime | Commission | Total */
    grid-template-columns: 100px 0.6fr 1.6fr 0.6fr;
}

.day-date {
    font-size: 12px;
    color: #666;
    font-weight: 600; /* Make the date bold */
}

.day-value {
    font-weight: 500;
    color: #333;
}

.edit-btn {
    padding: 6px 10px; /* vertically compact */
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.18s;
    min-width: 56px;
}

.edit-btn:hover {
    background: #1976D2;
}

.edit-btn:active {
    transform: translateY(1px);
}

/* Edit Dialog */
.edit-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.edit-dialog.open {
    display: flex;
}


.edit-dialog-content {
    background: white;
    border-radius: 16px;
    width: 86%;
    max-width: 380px; /* slimmer dialog */
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

.edit-dialog-header {
    padding: 12px 14px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edit-dialog-header h3 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.close-dialog {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-dialog:hover {
    background: #f5f5f5;
}

.edit-dialog-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    align-items: center; /* center everything vertically */
}

.edit-group {
    margin-bottom: 14px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* center group contents */
}

.edit-group label {
    display: block;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
    color: #333;
}

.commission-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
    justify-content: center;
}

.commission-item {
    background: #e0e0e0;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.remove-commission-btn {
    background: #aaa;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    font-weight: bold;
}

.commission-add-controls {
    display: flex;
    gap: 8px;
    width: 100%;
}

.add-commission-btn {
    padding: 0 16px;
}
.edit-controls {
    display: flex;
    flex-direction: column; /* stack PM and DUSK vertically */
    gap: 12px;
    align-items: center; /* center the stacked groups */
}

/* For the new PM/Dusk switch in the edit dialog */
#editPmDuskControls {
    flex-direction: row;
    gap: 16px;
}

.edit-value-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* center label and number-input */
}

.edit-value-group label {
    font-size: 14px;
    color: #666;
}


.number-input {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 6px;
    justify-content: center; /* center buttons and input */
}

.number-input button {
    width: 36px;
    height: 36px;
    border: none;
    background: white;
    color: #333;
    font-size: 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.18s;
}

.number-input button:hover {
    background: #eee;
}

.number-input input {
    width: 56px;
    height: 36px;
    border: none;
    background: white;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
}

.number-input input::-webkit-outer-spin-button,
.number-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.edit-dialog-footer {
    padding: 16px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: center; /* center action buttons */
    gap: 10px;
}

.cancel-btn,
.save-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.cancel-btn {
    background: #f5f5f5;
    color: #666;
}

.cancel-btn:hover {
    background: #eee;
}

.save-btn {
    background: #2196F3;
    color: white;
}

.save-btn:hover {
    background: #1976D2;
}

/* Dark mode styles for edit dialog */
body.dark-mode .edit-dialog-content {
    background: #2a2a2a;
}

body.dark-mode .edit-dialog-header {
    border-bottom-color: #404040;
}

body.dark-mode .edit-dialog-header h3 {
    color: #e0e0e0;
}

body.dark-mode .close-dialog {
    color: #b0b0b0;
}

body.dark-mode .commission-item {
    background: #444;
}

body.dark-mode .remove-commission-btn {
    background: #666;
}

body.dark-mode .entry-select {
    background: #404040;
    color: #e0e0e0;
    border-color: #555;
}


body.dark-mode .close-dialog:hover {
    background: #333;
}

body.dark-mode .edit-group label {
    color: #e0e0e0;
}

body.dark-mode .edit-value-group label {
    color: #b0b0b0;
}

body.dark-mode .number-input {
    background: #333;
}

body.dark-mode .number-input button {
    background: #404040;
    color: #e0e0e0;
}

body.dark-mode .number-input button:hover {
    background: #505050;
}

body.dark-mode .number-input input {
    background: #404040;
    color: #e0e0e0;
}

body.dark-mode .edit-dialog-footer {
    border-top-color: #404040;
}

body.dark-mode .cancel-btn {
    background: #404040;
    color: #e0e0e0;
}

body.dark-mode .cancel-btn:hover {
    background: #505050;
}

body.dark-mode .save-btn:hover {
    background: #1565C0;
}

/* Mobile responsive */
@media (max-width: 600px) {
    body {
        padding: 0;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .container {
        border-radius: 0;
        box-shadow: none !important;
    }

    header {
        padding: 12px;
    }

    .header-content {
        gap: 10px;
    }

    header h1 {
        font-size: 18px;
    }

    .dark-mode-toggle {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .grid-header,
    .day-row {
        grid-template-columns: 50px 0.6fr 1.6fr 0.6fr 0.6fr;
        font-size: 11px;
    }

    .header-cell,
    .day-cell {
        padding: 5px 6px;
        font-size: 11px;
    }

    .nav-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .edit-dialog-content {
        width: 95%;
        max-height: 95vh;
    }

    .edit-dialog-header {
        padding: 15px;
    }

    .edit-dialog-body {
        padding: 15px;
    }

    .edit-controls {
        flex-direction: column;
        gap: 15px;
    }

    .number-input button {
        width: 36px;
        height: 36px;
    }

    .number-input input {
        width: 50px;
        height: 36px;
        font-size: 16px;
    }

    .edit-dialog-footer {
        padding: 15px;
    }

    .cancel-btn,
    .save-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* User Menu Overlay */
.overlay-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.overlay-menu:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.overlay-menu-content {
    background: white;
    border-radius: 16px;
    padding: 20px;
    width: 90%;
    max-width: 300px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.overlay-menu:not(.hidden) .overlay-menu-content {
    transform: scale(1);
}

.overlay-menu-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 22px;
    color: #333;
}

.theme-options {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.theme-btn {
    padding: 10px;
    border: 1px solid #ddd;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-btn.active {
    background: #2196F3;
    color: white;
    border-color: #2196F3;
}

.menu-logout-btn {
    width: 100%;
    padding: 12px;
    background: #e53935;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

body.dark-mode .overlay-menu-content {
    background: #2a2a2a;
    color: #e0e0e0;
}

body.dark-mode .overlay-menu-content h3 {
    color: #e0e0e0;
}

body.dark-mode .theme-btn {
    background: #404040;
    color: #e0e0e0;
    border-color: #555;
}

body.dark-mode .theme-btn.active {
    background: #3498db;
    border-color: #3498db;
}

.total-section {
    padding: 15px 25px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.action-section {
    padding: 20px;
    background: #f5f5f5;
    text-align: center;
}

#periodTotalValue {
    font-size: 24px;
    font-weight: 800;
    color: #2196F3;
    letter-spacing: 0;
}

.send-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    transition: all 0.3s;
}

.send-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Dark Mode Styles */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
}

body.dark-mode .container {
    background: #1e1e1e;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

body.dark-mode header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.date-section {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 8px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    text-align: center;
}

.current-date {
    font-size: 16px;
    font-weight: 600;
    color: #2196F3;
    margin: 0;
    line-height: 1.2;
}

body.dark-mode .date-section {
    background: #252525;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

body.dark-mode .current-date {
    color: #64b5f6;
}

body.dark-mode .input-section {
    background: #252525;
}

body.dark-mode .input-row {
    background: #2a2a2a;
}

body.dark-mode .entry-btn, body.dark-mode .user-select-btn {
    background: #3498db;
}

body.dark-mode .entry-btn:active, body.dark-mode .user-select-btn:active {
    background: #2980b9;
}

body.dark-mode .quantity {
    /* dark mode variant for the quantity pill */
    color: #ffffff; /* use pure white in dark mode per request */
    background: linear-gradient(180deg, #2a2a2a 0%, #232323 100%);
    border: 1px solid rgba(255,255,255,0.04);
    box-shadow: 0 6px 12px rgba(0,0,0,0.6);
}

/* Muted button variants for dark mode */
body.dark-mode .quantity-btn {
    background: rgba(255, 255, 255, 0.03);
    color: rgba(139,195,74,0.95); /* soft green */
    border: 1px solid rgba(255,255,255,0.04);
}

body.dark-mode .quantity-btn:active {
    background: rgba(255, 255, 255, 0.04);
}

body.dark-mode .quantity-btn:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}

body.dark-mode .quantity-btn[data-action="remove"] {
    background: rgba(255, 255, 255, 0.03);
    color: rgba(244,67,54,0.92); /* soft red */
    border: 1px solid rgba(255,255,255,0.04);
}

body.dark-mode .quantity-btn[data-action="remove"]:active {
    background: rgba(255, 255, 255, 0.04);
}

body.dark-mode .days-section {
    background: #1e1e1e;
}

body.dark-mode #dateRange {
    color: #e0e0e0;
}

body.dark-mode .grid-container {
    background: #2a2a2a;
    border: 1px solid #404040;
}

body.dark-mode .grid-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

body.dark-mode .day-row {
    border-bottom: 1px solid #404040;
}

body.dark-mode .day-row:hover {
    background: #333333;
}

/* Highlight for the current day in dark mode */
body.dark-mode .day-row.current-day {
    background-color: #2c3e50; /* A distinct, lighter dark blue */
    font-weight: 600;
}

body.dark-mode .day-row.current-day:hover {
    background-color: #34495e; /* A slightly lighter shade on hover */
}

body.dark-mode .day-cell {
    border-right: 1px solid #404040;
    color: #e0e0e0;
}

body.dark-mode .day-date {
    color: #b0b0b0;
}

body.dark-mode .day-value {
    color: #e0e0e0;
}

body.dark-mode .total-section {
    background: #252525;
    border-top-color: #333;
    color: #aaa;
}

body.dark-mode #periodTotalValue {
    color: #64b5f6;
}

body.dark-mode .action-section {
    background: #252525;
}

/* Admin View Styles */
.is-admin .input-section { display: none !important; }
.is-admin .action-section { display: none !important; }

#admin-section {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

#userButtons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.user-select-btn {
    margin: 5px;
}

.day-row:not(.read-only) {
    cursor: pointer;
}

/* Admin Layout Adjustments - Desktop */
body.is-admin .grid-header,
body.is-admin .day-row {
    /* Date | Overtime | Commission | Mech OT | Total */
    grid-template-columns: 100px 0.6fr 1.6fr 0.6fr 0.6fr;
}

body.is-admin:not(.is-mech-user) .grid-header,
body.is-admin:not(.is-mech-user) .day-row {
    /* Date | Overtime | Commission | Total */
    grid-template-columns: 100px 0.6fr 1.6fr 0.6fr;
}

/* Admin Layout Adjustments - Mobile */
@media (max-width: 600px) {
    body.is-admin .grid-header,
    body.is-admin .day-row {
        grid-template-columns: 40px 0.6fr 1.4fr 0.6fr 0.6fr;
    }

    body.is-admin:not(.is-mech-user) .grid-header,
    body.is-admin:not(.is-mech-user) .day-row {
        grid-template-columns: 40px 0.6fr 1.4fr 0.6fr;
    }
}

/* Mobile grid column override */
@media (max-width: 600px) {
    .grid-header,
    .day-row {
        grid-template-columns: 40px 0.6fr 1.4fr 0.6fr 0.6fr;
    }
}

/* --- Login View Styles (Merged) --- */
#login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh; /* Adjust to fit within body padding */
    width: 100%;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.login-box h1 {
    margin-bottom: 30px;
    color: #333;
    font-weight: 600;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #666;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #2196F3;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.login-btn:hover {
    opacity: 0.9;
}

.login-btn:active {
    transform: scale(0.98);
}

.error-message {
    color: #e53935;
    margin-top: 15px;
    height: 20px;
    font-weight: 500;
}