:root {
    /* ZKTeco-inspired color palette - Light Green and Grey */
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --primary-light: #81C784;
    --accent-color: #66BB6A;

    --grey-dark: #424242;
    --grey-medium: #757575;
    --grey-light: #BDBDBD;
    --grey-lighter: #E0E0E0;
    --grey-lightest: #F5F5F5;

    --white: #FFFFFF;
    --black: #212121;

    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #F44336;
    --info: #2196F3;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    --border-radius: 8px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--grey-lightest);
    color: var(--grey-dark);
    line-height: 1.6;
}

/* ============ SIDEBAR LAYOUT ============ */

:root {
    --sidebar-width: 240px;
    --topbar-height: 54px;
}

body.has-sidebar {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, var(--primary-dark) 0%, #1B5E20 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 500;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Brand / Logo area */
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--white);
}

.sidebar-logo img {
    height: 32px;
    width: auto;
}

.sidebar-logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    display: none;
    /* hidden on desktop */
    transition: var(--transition);
}

.sidebar-close-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* User Info */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Nav links */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.45);
    padding: 0.75rem 1rem 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.92rem;
    border-radius: 0;
    transition: background 0.2s ease, color 0.2s ease;
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-left-color: rgba(255, 255, 255, 0.5);
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.18);
    color: var(--white);
    font-weight: 600;
    border-left-color: var(--white);
}

.sidebar-link-icon {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

/* Logout */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 0.6rem 0.75rem;
    border-radius: var(--border-radius);
    font-size: 0.92rem;
    transition: var(--transition);
}

.sidebar-logout:hover {
    background: rgba(244, 67, 54, 0.25);
    color: #ff8a80;
}

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 499;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
}

/* Main wrapper shifts right of sidebar on desktop */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* Slim top bar (mobile burger + title) */
.topbar {
    display: none;
    height: var(--topbar-height);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 400;
    flex-shrink: 0;
}

.topbar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 4px;
}

.topbar-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--white);
    border-radius: 2px;
    transition: var(--transition);
}

.topbar-title {
    color: var(--white);
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Container */
.container {
    flex: 1;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    width: 100%;
}


/* Page Title */
.page-title {
    font-size: 2rem;
    color: var(--grey-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--grey-dark);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--grey-lighter);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, var(--white) 0%, var(--grey-lightest) 100%);
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-card.warning {
    border-left-color: var(--warning);
}

.stat-card.info {
    border-left-color: var(--info);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--grey-medium);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--grey-dark);
    margin: 0.5rem 0;
}

.stat-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    opacity: 0.3;
    float: right;
}

/* Action Cards */
.action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.action-card {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.action-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
}

.action-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.action-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--grey-dark);
    margin-bottom: 0.5rem;
}

.action-description {
    color: var(--grey-medium);
    font-size: 0.9rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--grey-dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--grey-lighter);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--grey-medium);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: var(--grey-dark);
}

.btn-success {
    background-color: var(--success);
    color: var(--white);
}

.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--white);
}

.table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--grey-lighter);
}

.table tbody tr:hover {
    background-color: var(--grey-lightest);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Status badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.badge-success {
    background-color: #C8E6C9;
    color: #2E7D32;
}

.badge-warning {
    background-color: #FFF9C4;
    color: #F57F17;
}

.badge-danger {
    background-color: #FFCDD2;
    color: #C62828;
}

.badge-info {
    background-color: #BBDEFB;
    color: #1565C0;
}

/* Flash Messages */
.flash-messages {
    padding: 1rem 2rem 0;
}

.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-success {
    background-color: #C8E6C9;
    color: #2E7D32;
    border-left: 4px solid var(--success);
}

.alert-error {
    background-color: #FFCDD2;
    color: #C62828;
    border-left: 4px solid var(--danger);
}

.alert-warning {
    background-color: #FFF9C4;
    color: #F57F17;
    border-left: 4px solid var(--warning);
}

.alert-info {
    background-color: #BBDEFB;
    color: #1565C0;
    border-left: 4px solid var(--info);
}

/* Loading Spinner */
.spinner {
    border: 4px solid var(--grey-lighter);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Footer */
.footer {
    background-color: var(--grey-dark);
    color: var(--white);
    text-align: center;
    padding: 1.25rem 0;
    margin-top: 0;
    flex-shrink: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-links {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
}

.footer-link {
    color: var(--grey-light);
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--primary-light);
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.login-card {
    background: var(--white);
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-title {
    font-size: 2rem;
    color: var(--grey-dark);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--grey-medium);
}

/* ============ RESPONSIVE - SIDEBAR ============ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
    }

    .sidebar-close-btn {
        display: block;
    }

    .main-wrapper {
        margin-left: 0;
    }

    .topbar {
        display: flex;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .dashboard-grid,
    .action-cards {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .table-container {
        font-size: 0.875rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.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;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.p-1 {
    padding: 0.5rem;
}

.p-2 {
    padding: 1rem;
}

.p-3 {
    padding: 1.5rem;
}

/* Shift Management Layout */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.form-grid {
    display: grid;
    gap: 1rem;
}


.developer-credit {
    color: var(--grey-light);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}