/* ===== Design Tokens ===== */
:root {
    --color-primary: #4a6cf7;
    --color-primary-hover: #3a5ce5;
    --color-primary-light: #f0f4ff;
    --color-danger: #dc3545;
    --color-danger-hover: #c82333;
    --color-danger-light: #fff0f0;
    --color-success: #28a745;
    --color-success-hover: #218838;
    --color-warning: #ffc107;
    --color-warning-hover: #e0a800;
    --color-secondary: #6c757d;
    --color-secondary-hover: #5a6268;
    --color-info: #17a2b8;
    --color-dark: #1a1a2e;
    --color-dark-alt: #2a2a4e;
    --color-text: #333;
    --color-text-muted: #888;
    --color-text-light: #666;
    --color-bg: #f0f2f5;
    --color-white: #fff;
    --color-border: #ddd;
    --color-border-light: #eee;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 6px rgba(0,0,0,0.05);
    --shadow-lg: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-xl: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-dropdown: 0 8px 30px rgba(0,0,0,0.2);
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --navbar-height: 60px;
    --container-max: 1200px;
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

/* ===== Navigation ===== */
.navbar {
    background: var(--color-dark);
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--navbar-height);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-brand a {
    color: var(--color-white);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links > a {
    color: #ccc;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-links > a:hover {
    color: var(--color-white);
    background: rgba(255,255,255,0.1);
}

/* Dropdown */
.nav-dropdown { position: relative; }

.nav-dropdown-trigger {
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--color-white);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.2s;
}

.nav-dropdown-trigger:hover { background: rgba(255,255,255,0.2); }

.nav-dropdown-arrow { font-size: 0.7rem; opacity: 0.7; }

.nav-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--color-white);
    border-radius: 10px;
    box-shadow: var(--shadow-dropdown);
    min-width: 240px;
    z-index: 100;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    padding: 0.4rem 0;
}

.nav-dropdown.open .nav-dropdown-menu { display: block; }

.nav-dropdown-item {
    display: block;
    padding: 0.65rem 1.2rem;
    color: #000;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.nav-dropdown-item:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
}

.nav-dropdown-title {
    font-weight: 700;
    color: #000;
    font-size: 0.95rem;
    background: #f8f9fa;
    padding: 0.7rem 1.2rem;
}

.nav-dropdown-title:hover {
    background: #eef0f2;
    color: #000;
    border-left-color: transparent;
}

.nav-dropdown-divider {
    border-top: 1px solid #e0e0e0;
    margin: 0.3rem 0.6rem;
}

.nav-dropdown-logout { color: var(--color-danger); }

.nav-dropdown-logout:hover {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-left-color: var(--color-danger);
}

/* ===== Typography ===== */
h2 {
    margin-bottom: 1.5rem;
    color: var(--color-dark);
    font-size: 1.4rem;
}

h3 {
    margin-bottom: 1rem;
    color: var(--color-text);
    font-size: 1.15rem;
}

/* ===== Layout ===== */
.container {
    max-width: var(--container-max);
    margin: 2rem auto;
    padding: 0 1rem;
}

.section-title {
    margin-bottom: 1.5rem;
    color: var(--color-dark);
}

.section-subtitle {
    margin-bottom: 1rem;
    color: var(--color-text);
}

/* ===== Flash Messages ===== */
.flash-messages {
    position: fixed;
    top: 60px;
    right: 16px;
    z-index: 1000;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.auth-wrapper .flash-messages {
    top: 16px;
    right: auto;
    left: 50%;
    transform: translateX(-50%);
}

.flash {
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    position: relative;
    line-height: 1.5;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.flash::before {
    position: absolute;
    left: 0.8rem;
    top: 0.8rem;
    font-size: 1rem;
    font-weight: 700;
}

.flash-info { background: #e8f4fd; color: #0c5460; border: 1px solid #bee5eb; border-left: 4px solid var(--color-info); }
.flash-info::before { content: '\24D8'; }

.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; border-left: 4px solid var(--color-success); }
.flash-success::before { content: '\2713'; }

.flash-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; border-left: 4px solid var(--color-warning); }
.flash-warning::before { content: '\26A0'; }

.flash-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; border-left: 4px solid var(--color-danger); }
.flash-danger::before { content: '\2717'; }

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1.4;
}

.btn-primary { background: var(--color-primary); color: var(--color-white); }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-secondary); color: var(--color-white); }
.btn-secondary:hover { background: var(--color-secondary-hover); }
.btn-success { background: var(--color-success); color: var(--color-white); }
.btn-success:hover { background: var(--color-success-hover); }
.btn-danger { background: var(--color-danger); color: var(--color-white); }
.btn-danger:hover { background: var(--color-danger-hover); }
.btn-warning { background: var(--color-warning); color: var(--color-text); }
.btn-warning:hover { background: var(--color-warning-hover); }
.btn-outline { background: transparent; border: 1px solid var(--color-primary); color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary); color: var(--color-white); }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.6rem; font-size: 1rem; }

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-family: var(--font-family);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74,108,247,0.1);
}

.form-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row input,
.form-row select {
    padding: 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

.form-container {
    background: var(--color-white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.form-container h3 {
    margin-bottom: 1rem;
    color: var(--color-text);
}

/* ===== Auth Forms ===== */
.auth-wrapper {
    min-height: calc(100vh - var(--navbar-height) - 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-container {
    max-width: 400px;
    width: 100%;
    background: var(--color-white);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
}

.auth-container h2 {
    margin-bottom: 1.5rem;
    color: var(--color-dark);
    text-align: center;
    font-size: 1.5rem;
}

.auth-form .form-group { margin-bottom: 1.2rem; }

.auth-form .form-group label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
}

.auth-form .form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form .form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(74,108,247,0.12);
}

.auth-form .btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.auth-link {
    margin-top: 1.2rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.auth-link a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-link a:hover { text-decoration: underline; }

/* ===== Cards ===== */
.dashboard-grid {    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    background: var(--color-white);
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    text-align: center;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.dashboard-card-icon {
    font-size: 2rem;
    margin-bottom: 0.3rem;
    opacity: 0.7;
}

.dashboard-card h3 {
    color: var(--color-text-light);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-dark);
    line-height: 1.2;
}

.dashboard-card .btn { margin-top: 0.5rem; }

/* Locations grid (dashboard & general) */
.locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.8rem;
}

.location-card {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--color-white);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.location-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.loc-card-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(0,0,0,0.1);
}

.loc-card-info {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    gap: 0.1rem;
}

.loc-card-info strong { font-size: 0.95rem; }

/* ===== Tables ===== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.table-wrapper .data-table {
    box-shadow: none;
    margin-bottom: 0;
}
.table-wrapper .data-table td:nth-child(2),
.table-wrapper .data-table th:nth-child(2) {
    text-align: center;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.data-table th {
    background: var(--color-dark);
    color: var(--color-white);
    padding: 0.8rem;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}

.data-table td {
    padding: 0.7rem;
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr.inactive { opacity: 0.5; }

.data-table tr:hover { background: #f8f9fa; }

.data-table .btn-sm {
    white-space: nowrap;
    margin: 0.15rem 0;
}

/* ===== Grid Table (Schedule Editor) ===== */
.grid-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.grid-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 800px;
    font-size: 0.8rem;
}

.grid-table th {
    background: var(--color-dark);
    color: var(--color-white);
    padding: 0.4rem 0.3rem;
    font-weight: 500;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.grid-table th.col-name {
    min-width: 120px;
    text-align: left;
    padding-left: 0.8rem;
    position: sticky;
    left: 0;
    z-index: 20;
}

.grid-table th.col-day { min-width: 52px; width: 52px; }

.grid-table th.col-total {
    min-width: 90px;
    background: var(--color-dark-alt);
}

.grid-table th.weekend { background: #c0392b; }

.day-header {
    font-size: 0.85rem;
    font-weight: 700;
}

.weekday-header {
    font-size: 0.65rem;
    opacity: 0.7;
    font-weight: 400;
}

.grid-table td {
    border: 1px solid #e8e8e8;
    padding: 0.2rem;
    text-align: center;
    vertical-align: middle;
}

.grid-table td.col-name {
    text-align: left;
    padding-left: 0.8rem;
    font-weight: 500;
    font-size: 0.8rem;
    white-space: nowrap;
    position: sticky;
    left: 0;
    background: var(--color-white);
    z-index: 5;
    border-right: 2px solid var(--color-border);
}

.grid-table td.col-total {
    font-weight: 700;
    font-size: 0.75rem;
    background: #f8f9fa;
    color: var(--color-text);
    min-width: 90px;
    white-space: nowrap;
    text-align: right;
    padding-right: 6px;
}

.cell-editable {
    position: relative;
    padding: 0.2rem;
    border-radius: var(--radius-sm);
    --st-color: transparent;
    --loc-color-tint: transparent;
}

.cell-editable.loc-active {
    background: linear-gradient(180deg, var(--loc-color) 0%, var(--loc-color) 30%, var(--st-color) 70%, var(--st-color) 100%);
    box-shadow: inset 0 2px 0 var(--loc-color);
}

.cell-editable:not(.loc-active) { background: var(--st-color); }

td.editable-cell { cursor: pointer; transition: background 0.2s; }

td.editable-cell:hover { background: #e3e8ff; outline: 2px solid var(--color-primary); }

.col-day.kb-selected { outline: 3px solid var(--color-primary); outline-offset: -3px; z-index: 1; position: relative; }

/* Grid selects */
.loc-select {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 0.75rem;
    padding: 0.25rem 0.1rem;
    cursor: pointer;
    text-align: center;
    color: #000;
    font-weight: 400;
    appearance: auto;
    -webkit-appearance: auto;
    border-radius: 3px;
}

.loc-select:focus { outline: 1px solid var(--color-primary); }

.loc-select option { color: var(--color-text); background: var(--color-white); }

.cell-select {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 0.75rem;
    padding: 0.25rem 0.1rem;
    cursor: pointer;
    text-align: center;
    color: #000;
    font-weight: 400;
    appearance: auto;
    -webkit-appearance: auto;
    border-radius: 3px;
    transition: background 0.2s;
}

.cell-select:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
    background: var(--color-white);
}

.cell-hours {
    font-size: 0.55rem;
    font-weight: 700;
    color: #000;
    text-align: center;
    line-height: 1.2;
    min-height: 0.7em;
    cursor: pointer;
}
.cell-hours:hover {
    background: rgba(0,0,0,.06);
    border-radius: 3px;
}

.emp-name-text { font-weight: 600; font-size: 0.8rem; }

.emp-rate { font-size: 0.65rem; color: var(--color-text-muted); margin-left: 2px; }

/* ===== Employee Schedule ===== */
.schedule-cal-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.schedule-cal {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.schedule-cal .grid-table { min-width: auto; }

.schedule-cal-wrapper .schedule-total {
    border-radius: 0;
    margin: 0;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--color-border-light);
}

.schedule-cal-wrapper .legend-bar {
    margin: 0;
    border-radius: 0;
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--color-border-light);
}

.emp-loc-name { font-size: 0.6rem; font-weight: 700; color: #000; line-height: 1.2; }

.emp-shift-name { font-size: 0.65rem; color: #000; }

.schedule-total {
    max-width: 800px;
    margin-top: 0.5rem;
    padding: 0.6rem 1rem;
    background: #f8f9fa;
    border-radius: var(--radius-md);
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
}

.schedule-total strong { font-weight: 700; }

/* ===== Toolbar ===== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.save-status { font-size: 0.85rem; color: var(--color-text-light); }

/* ===== Schedule Header ===== */
.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.schedule-header h2 { margin-bottom: 0; }

.month-nav { display: flex; gap: 0.5rem; }

/* ===== Filter Tabs ===== */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.tab {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-size: 0.9rem;
    color: #555;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    transition: all 0.2s;
}

.tab.active { background: var(--color-primary); color: var(--color-white); border-color: var(--color-primary); }

.tab:hover:not(.active) { background: #f0f0f0; }

/* ===== Filter Form ===== */
.filter-form { margin-bottom: 1.5rem; }

.filter-form select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    background: var(--color-white);
}

/* ===== Legend ===== */
.legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.3rem 0;
}

.legend-row + .legend-row {
    border-top: 1px solid var(--color-border-light);
    margin-top: 0.3rem;
    padding-top: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.legend-color {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.legend-bar {
    margin-top: 1rem;
    padding: 0.6rem 1rem;
    background: var(--color-white);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
}

/* ===== Modal ===== */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 { margin-bottom: 1rem; }

.modal-sm { max-width: 280px; }

.modal-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* ===== Status Badges ===== */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-pending { background: #fff3cd; color: #856404; }
.status-approved { background: #d4edda; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }

/* ===== Calendar (Day Picker) ===== */
.dayoff-layout {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2rem;
    align-items: start;
}

.calendar-panel {
    background: var(--color-white);
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.calendar-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-dark);
}

.calendar-grid {
    border-collapse: collapse;
    width: 100%;
}

.calendar-grid th {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-light);
    border-bottom: 2px solid var(--color-border-light);
}

.calendar-grid td {
    border: 1px solid #f0f0f0;
    padding: 0;
    text-align: center;
    vertical-align: middle;
}

.cal-day {
    width: 48px;
    height: 48px;
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
    border-radius: var(--radius-lg);
}

.cal-day:hover { background: #e3e8ff; }

.cal-day.selected { background: var(--color-primary); color: var(--color-white); box-shadow: 0 2px 8px rgba(74,108,247,0.3); }

.cal-day.selected .cal-num { color: var(--color-white); }

.cal-day.selected .cal-badge { color: var(--color-white); background: rgba(255,255,255,0.25); }

.cal-day.weekend { background: #fafafa; }

.cal-day.is-today .cal-num { font-weight: 800; color: var(--color-primary); mix-blend-mode: difference;
}

.cal-day.selected.is-today .cal-num { color: var(--color-white); }

/* .cal-day.has-request.status-pending { background: #fff3cd; }
.cal-day.has-request.status-approved { background: #d4edda; }
.cal-day.has-request.status-rejected { background: #f8d7da; } */

.cal-day.has-shift {
    background: var(--st-color, #eee);
    box-shadow: inset 0 6px 1px var(--loc-color, transparent);
}

.cal-day.has-shift .cal-num { font-weight: 700; }

.cal-day.has-shift .cal-badge.status-pending { background: #fff3cd; color: #856404; }
.cal-day.has-shift .cal-badge.status-approved { background: #d4edda; color: #155724; }
.cal-day.has-shift .cal-badge.status-rejected { background: #f8d7da; color: #721c24; }

.cal-shift-info {
    position: absolute;
    bottom: 2px;
    left: 2px;
    right: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

.cal-loc-name {
    font-size: 0.4rem;
    font-weight: 700;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.cal-st-name {
    font-size: 0.4rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.cal-vacation {
    font-size: 0.55rem;
    color: #7B42A8;
    font-weight: 600;
}

.cal-dayoff-text {
    font-size: 0.55rem;
    color: #666;
    font-style: italic;
}

.cal-num {
    font-size: 0.9rem;
    font-weight: 500;
    display: block;
    line-height: 48px;
    color: #333;
}

.cal-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.55rem;
    font-weight: 600;
    padding: 0 3px;
    border-radius: 3px;
    line-height: 1.4;
    color: #333;
    background: rgba(126, 126, 126, 0.301);
}

td.empty { background: transparent; }

/* ===== Request Panel ===== */
.request-panel {
    background: var(--color-white);
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.request-panel h3 {
    margin-bottom: 1.5rem;
    color: var(--color-dark);
}

.selected-date-display {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 1rem;
    padding: 0.8rem;
    background: var(--color-primary-light);
    border-radius: var(--radius-lg);
    text-align: center;
}

.request-status-card {
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
}

.request-status-card .status-badge {
    font-size: 1rem;
    padding: 0.4rem 1rem;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.request-status-card p { color: var(--color-text-light); margin-top: 0.5rem; }

/* ===== Import Page ===== */
.import-container { max-width: 600px; }

.import-form {
    background: var(--color-white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
}

.import-info {
    background: var(--color-white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.import-info ul { margin: 0.5rem 0 1rem 1.5rem; }

.import-info li { margin-bottom: 0.3rem; }

.import-info code {
    background: #f0f0f0;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

/* ===== Utilities ===== */
.text-muted { color: var(--color-text-muted); font-size: 0.85rem; }

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-style: italic;
}

.color-dot {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    vertical-align: middle;
    border: 1px solid #ccc;
}

.color-input {
    width: 40px;
    height: 34px;
    padding: 2px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.rate-input {
    width: 70px;
    padding: 0.2rem 0.3rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    text-align: right;
}

.vacation-label {
    color: #7B42A8;
    font-weight: 600;
    font-size: 0.65rem;
}

.dayoff-label { font-size: 0.65rem; color: #999; font-style: italic; }



/* ===== Additional Utilities ===== */
.inline-form { display: inline; }
.d-none { display: none; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.w-auto { width: auto; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .navbar { padding: 0 1rem; }

    .container { margin: 1rem auto; }

    .dashboard-grid { grid-template-columns: 1fr; }

    .dayoff-layout { grid-template-columns: 1fr; }

    .schedule-header { flex-direction: column; align-items: flex-start; }

    .toolbar { flex-direction: column; align-items: stretch; gap: 0.5rem; }

    .toolbar-left, .toolbar-right {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .toolbar .btn-sm { font-size: 0.75rem; padding: 0.3rem 0.5rem; }

    .data-table { font-size: 0.85rem; }
    .data-table th, .data-table td { padding: 0.5rem; }

    .table-wrapper { margin: 0 -1rem; border-radius: 0; }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .form-row input,
    .form-row select {
        width: 100%;
    }

    .auth-wrapper { min-height: calc(100vh - var(--navbar-height) - 2rem); }

    .locations-grid { grid-template-columns: 1fr; }

    .filter-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }

    .calendar-panel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .calendar-grid { min-width: 280px; }

    .cal-day { width: 36px; height: 36px; border-radius: var(--radius-md); }

    .cal-num { line-height: 36px; font-size: 0.8rem; }

    .cal-badge { font-size: 0.45rem; bottom: 1px; right: 1px; }

    .cal-shift-info { bottom: 1px; left: 1px; right: 1px; }
    .cal-loc-name { font-size: 0.35rem; }
    .cal-st-name { font-size: 0.35rem; }
    .cal-vacation { font-size: 0.45rem; }
    .cal-dayoff-text { font-size: 0.45rem; }

    .request-panel { padding: 1.5rem; }

    .schedule-cal-wrapper .schedule-total { flex-direction: column; gap: 0.3rem; }

    .schedule-cal .grid-table td { padding: 0.1rem; }
    .schedule-cal .emp-loc-name { font-size: 0.45rem; }
    .schedule-cal .emp-shift-name { font-size: 0.5rem; }
    .schedule-cal .cell-hours { font-size: 0.45rem; }
    .schedule-cal .day-header { font-size: 0.7rem; }
    .schedule-cal .grid-table th.col-day { min-width: 40px; width: 40px; font-size: 0.6rem; padding: 0.15rem 0.1rem; }
    .schedule-cal .weekday-header { font-size: 0.5rem; }
    .schedule-cal .vacation-label { font-size: 0.45rem; }
    .schedule-cal .dayoff-label { font-size: 0.45rem; }
    .legend-bar { padding: 0.4rem 0.6rem; font-size: 0.7rem; }
    .legend-item { gap: 0.2rem; }
    .legend-color { width: 8px; height: 8px; }
}

@media (max-width: 480px) {
    .navbar { padding: 0 0.5rem; }

    .nav-brand a { font-size: 1rem; }

    .nav-dropdown-trigger { font-size: 0.8rem; padding: 0.4rem 0.6rem; }

    .schedule-cal .grid-table th.col-day { min-width: 36px; width: 36px; }
    .schedule-cal .grid-table td { padding: 0.08rem; }
    .schedule-cal .emp-loc-name { font-size: 0.4rem; }
    .schedule-cal .emp-shift-name { font-size: 0.45rem; }
    .schedule-cal .cell-hours { font-size: 0.4rem; }
    .schedule-cal .day-header { font-size: 0.65rem; }
    .schedule-cal .vacation-label { font-size: 0.4rem; }
    .schedule-cal .dayoff-label { font-size: 0.4rem; }

    .nav-dropdown-menu { min-width: 200px; right: -10px; }

    .dashboard-card { padding: 1.5rem; }

    .stat-number { font-size: 1.5rem; }

    .modal-content { padding: 1.5rem; }

    .request-panel { padding: 1.5rem; }

    .calendar-panel { padding: 1rem; }
}

.payroll-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.payroll-nav { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.payroll-period { font-weight: 600; margin: 0 0.5rem; }
.payroll-table td.cell-hours {
    font-size: inherit;
    font-weight: 700;
    text-align: center;
    min-height: auto;
    cursor: default;
}
.payroll-table th { text-align: center; }

.month-header { font-size: 0.65rem; color: #888; text-transform: uppercase; }

/* ===== Toggle Switch (boolean settings) ===== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc;
    border-radius: 24px;
    transition: background 0.25s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--color-success);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}
.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px var(--color-primary-light);
}
