/* ═══════════════════════════════════════════════════════════════════
   HRMS – Modern Design System
   Premium dark sidebar + light content, glassmorphism, gradients
   ═══════════════════════════════════════════════════════════════════ */

/* ── CSS Variables / Design Tokens ───────────────────────────────── */
:root {
    /* Primary palette – Indigo / Violet */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    /* Neutral */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Accent colors */
    --green-50: #f0fdf4;
    --green-100: #dcfce7;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --green-700: #15803d;
    --green-800: #166534;
    --red-50: #fef2f2;
    --red-100: #fee2e2;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --red-800: #991b1b;
    --yellow-50: #fffbeb;
    --yellow-100: #fef3c7;
    --yellow-500: #eab308;
    --yellow-800: #854d0e;
    --orange-50: #fff7ed;
    --orange-500: #f97316;
    --orange-600: #ea580c;
    --purple-50: #faf5ff;
    --purple-500: #a855f7;
    --purple-600: #9333ea;
    --blue-50: #eff6ff;
    --blue-100: #dbeafe;
    --blue-500: #3b82f6;
    --blue-800: #1e40af;
    --cyan-500: #06b6d4;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--primary-600), var(--primary-500), #7c3aed);
    --gradient-sidebar: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    --gradient-login: linear-gradient(135deg, #0f172a 0%, #1e1b4b 40%, #312e81 70%, #4c1d95 100%);
    --gradient-green: linear-gradient(135deg, #059669, #10b981);
    --gradient-orange: linear-gradient(135deg, #ea580c, #f97316);
    --gradient-purple: linear-gradient(135deg, #7c3aed, #a855f7);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .07), 0 2px 4px -2px rgba(0, 0, 0, .05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, .08), 0 4px 6px -4px rgba(0, 0, 0, .05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .05);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, .25);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(.4, 0, .2, 1);
    --transition-normal: 250ms cubic-bezier(.4, 0, .2, 1);
    --transition-slow: 350ms cubic-bezier(.4, 0, .2, 1);

    /* Sidebar width */
    --sidebar-width: 300px;
}

/* ── Reset & Base ────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    height: 100%;
    line-height: 1.6;
    color: var(--gray-800);
    background: var(--gray-50);
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
}

input,
select,
textarea,
button {
    font-family: inherit;
    font-size: inherit;
}

/* ── Animations ──────────────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .6;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fadeIn {
    animation: fadeIn .4s ease-out both;
}

.animate-slideUp {
    animation: slideUp .4s ease-out both;
}

.animate-scaleIn {
    animation: scaleIn .3s ease-out both;
}

/* Staggered delays */
.delay-1 {
    animation-delay: .05s;
}

.delay-2 {
    animation-delay: .1s;
}

.delay-3 {
    animation-delay: .15s;
}

.delay-4 {
    animation-delay: .2s;
}

.delay-5 {
    animation-delay: .25s;
}

/* ══════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--gradient-login);
    position: relative;
    overflow: hidden;
}

/* Decorative static shapes */
.login-page::before,
.login-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: .06;
    pointer-events: none;
}

.login-page::before {
    width: 500px;
    height: 500px;
    background: var(--primary-400);
    top: -150px;
    right: -100px;
}

.login-page::after {
    width: 350px;
    height: 350px;
    background: #7c3aed;
    bottom: -100px;
    left: -80px;
}

.login-box {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .15);
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .1);
    animation: slideUp .5s ease-out;
    color: #fff;
}

.login-box h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 .25rem;
    background: linear-gradient(135deg, #fff, var(--primary-200));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -.02em;
}

.login-subtitle {
    margin: 0 0 2rem;
    color: rgba(255, 255, 255, .55);
    font-size: .9rem;
    font-weight: 400;
}

.login-box .error {
    background: rgba(239, 68, 68, .15);
    border: 1px solid rgba(239, 68, 68, .3);
    padding: .75rem 1rem;
    border-radius: var(--radius-md);
    color: #fca5a5;
    margin-bottom: 1.25rem;
    font-size: .875rem;
    animation: slideDown .3s ease-out;
}

.login-box label {
    display: block;
    margin-bottom: .4rem;
    font-size: .85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .7);
    letter-spacing: .02em;
}

.login-box input[type="email"],
.login-box input[type="password"],
.login-box input[type="text"] {
    width: 100%;
    padding: .75rem 1rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(255, 255, 255, .15);
    border-radius: var(--radius-md);
    font-size: .95rem;
    background: rgba(255, 255, 255, .06);
    color: #fff;
    outline: none;
    transition: all var(--transition-normal);
}

.login-box input[type="email"]:focus,
.login-box input[type="password"]:focus,
.login-box input[type="text"]:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .25);
    background: rgba(255, 255, 255, .1);
}

.login-box input::placeholder {
    color: rgba(255, 255, 255, .3);
}

.login-box button[type="submit"] {
    width: 100%;
    padding: .8rem 1.5rem;
    background: var(--gradient-primary);
    background-size: 200% auto;
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 15px rgba(99, 102, 241, .35);
}

.login-box button[type="submit"]:hover {
    background-position: right center;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, .45);
}

.login-box button[type="submit"]:active {
    transform: translateY(0);
}

/* ══════════════════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════════════════ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar — Glass White ───────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    overflow-y: auto;
    border-right: 1px solid rgba(99, 102, 241, 0.10);
    box-shadow: 2px 0 24px rgba(99, 102, 241, 0.07);
}

.sidebar-brand {
    padding: 1.5rem 1.5rem;
    border-bottom: 1px solid rgba(99, 102, 241, 0.10);
    display: flex;
    align-items: center;
    gap: .75rem;
    overflow: hidden;
}

.sidebar-brand-logo {
    width: auto;
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
    padding: 0;
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, .3);
    flex-shrink: 0;
}

.sidebar-brand-text h1 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: .01em;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
}

.sidebar-brand-text p {
    font-size: .62rem;
    color: var(--gray-500);
    font-weight: 500;
    letter-spacing: .02em;
    margin-top: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: .75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-section-label {
    padding: .75rem .75rem .4rem;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--gray-400);
    margin-top: .5rem;
}

.sidebar-divider {
    height: 1px;
    background: rgba(99, 102, 241, 0.10);
    margin: .5rem .75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .85rem;
    border-radius: var(--radius-md);
    font-size: .875rem;
    font-weight: 600;
    color: var(--gray-500);
    transition: all var(--transition-normal);
    position: relative;
}

.sidebar-link:hover {
    color: var(--primary-700);
    background: rgba(99, 102, 241, 0.07);
}

.sidebar-link.active {
    color: var(--primary-700);
    background: rgba(99, 102, 241, 0.12);
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.18);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary-500);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.sidebar-link-signout {
    color: var(--gray-500);
}
.sidebar-link-signout:hover {
    color: var(--red-600, #dc2626);
    background: rgba(239, 68, 68, 0.08);
}
.sidebar-link-signout:hover .sidebar-link-icon {
    stroke: var(--red-600, #dc2626);
}

.sidebar-link-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: .6;
    color: var(--gray-500);
}

.sidebar-link:hover .sidebar-link-icon {
    opacity: 1;
    color: var(--primary-600);
}

.sidebar-link.active .sidebar-link-icon {
    opacity: 1;
    color: var(--primary-600);
}

/* ── Main Content Area ───────────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex: 1;
}

.header-context {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.1;
    letter-spacing: -0.01em;
}

.header-subtitle {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-weight: 500;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: 1rem;
}

.header-search {
    position: relative;
    max-width: 400px;
    flex: 1;
}

.header-search-icon {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--gray-400);
    pointer-events: none;
}

.header-search input {
    width: 100%;
    padding: .55rem .75rem .55rem 2.5rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: .85rem;
    color: var(--gray-800);
    background: var(--gray-50);
    outline: none;
    transition: all var(--transition-normal);
}

.header-search input::placeholder {
    color: var(--gray-400);
}

.header-search input:focus {
    border-color: var(--primary-300);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .1);
    background: #fff;
}

.header-right {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--gray-500);
    transition: all var(--transition-fast);
    position: relative;
}

.header-icon-btn:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.header-icon-btn svg {
    width: 20px;
    height: 20px;
}

.header-icon-btn .notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 7px;
    height: 7px;
    background: var(--red-500);
    border-radius: 50%;
    border: 2px solid var(--gray-50);
}

/* Profile dropdown */
.profile-dropdown {
    position: relative;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .35rem .6rem .35rem .35rem;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.profile-trigger:hover {
    background: var(--gray-100);
}

.profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.profile-info {
    text-align: left;
}

.profile-name {
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.2;
}

.profile-email {
    font-size: .7rem;
    color: var(--gray-500);
    line-height: 1.2;
}

.profile-chevron {
    width: 16px;
    height: 16px;
    color: var(--gray-400);
    transition: transform var(--transition-fast);
}

.profile-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    width: 200px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all var(--transition-fast);
    z-index: 50;
    overflow: hidden;
}

.profile-dropdown:hover .profile-menu,
.profile-dropdown:focus-within .profile-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-menu a,
.profile-menu button {
    display: block;
    width: 100%;
    padding: .6rem 1rem;
    font-size: .85rem;
    color: var(--gray-700);
    text-align: left;
    border: none;
    background: none;
    transition: background var(--transition-fast);
}

.profile-menu a:hover,
.profile-menu button:hover {
    background: var(--gray-50);
}

.profile-menu .menu-divider {
    height: 1px;
    background: var(--gray-100);
    margin: .25rem 0;
}

.profile-menu .menu-danger {
    color: var(--red-600);
}

.profile-menu .menu-danger:hover {
    background: var(--red-50);
}

/* ── Page Content ────────────────────────────────────────────────── */
.page-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.75rem 2rem;
    background: var(--gray-50);
    overflow-y: auto;
    animation: fadeIn .3s ease-out;
}

.page-container {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── Page Header ─────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
}

.page-header-left h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: -.02em;
    line-height: 1.3;
}

.page-header-left p {
    font-size: .875rem;
    color: var(--gray-500);
    margin-top: .2rem;
}

.page-header-actions {
    display: flex;
    gap: .6rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .6rem 1.15rem;
    border-radius: var(--radius-md);
    font-size: .85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    line-height: normal;
    white-space: nowrap;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--gradient-primary);
    background-size: 200% auto;
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, .3);
}

.btn-primary:hover {
    background-position: right center;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, .4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: var(--gradient-green);
    background-size: 200% auto;
    color: #fff;
    box-shadow: 0 2px 8px rgba(22, 163, 74, .25);
}

.btn-success:hover {
    background-position: right center;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(22, 163, 74, .35);
}

.btn-secondary {
    background: #fff;
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    padding: .5rem .75rem;
}

.btn-ghost:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.btn-danger {
    background: var(--red-600);
    color: #fff;
}

.btn-danger:hover {
    background: var(--red-500);
    transform: translateY(-1px);
}

.btn-sm {
    padding: .4rem .75rem;
    font-size: .8rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-600);
    font-weight: 600;
    font-size: .85rem;
    padding: .25rem .5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-link:hover {
    color: var(--primary-700);
    background: var(--primary-50);
}

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    /* overflow: visible so .table-wrapper inside can scroll horizontally.
       Use .card-clipped on cards that specifically need overflow:hidden (e.g. stat cards). */
    overflow: visible;
    transition: box-shadow var(--transition-normal);
}

/* Use on cards that need clipping (decorative elements, etc.) */
.card-clipped {
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
}

.card-body {
    padding: 1.5rem;
}

/* ── Stat Cards ──────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all var(--transition-normal);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card.green::before {
    background: var(--gradient-green);
}

.stat-card.purple::before {
    background: var(--gradient-purple);
}

.stat-card.orange::before {
    background: var(--gradient-orange);
}

.stat-card.primary::before {
    background: var(--gradient-primary);
}

.stat-card.red::before {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.stat-card-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.stat-label {
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
    margin-top: .4rem;
    letter-spacing: -.02em;
}

.stat-sub {
    font-size: .75rem;
    color: var(--gray-400);
    margin-top: .2rem;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
}

.stat-icon.green {
    background: var(--green-50);
    color: var(--green-600);
}

.stat-icon.purple {
    background: var(--purple-50);
    color: var(--purple-600);
}

.stat-icon.orange {
    background: var(--orange-50);
    color: var(--orange-600);
}

.stat-icon.primary {
    background: var(--primary-50);
    color: var(--primary-600);
}

.stat-icon.red {
    background: #fee2e2;
    color: #dc2626;
}

/* ── Tables ──────────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: .75rem 1.25rem;
    text-align: left;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.data-table th.text-right {
    text-align: right;
}

.data-table td {
    padding: .85rem 1.25rem;
    font-size: .875rem;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table .cell-primary {
    font-weight: 600;
    color: var(--gray-900);
}

.data-table .cell-mono {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: .8rem;
    color: var(--gray-600);
    background: var(--gray-50);
    padding: .15rem .5rem;
    border-radius: var(--radius-sm);
}

.data-table .cell-muted {
    color: var(--gray-400);
}

.data-table .cell-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    justify-content: flex-end;
}

.data-table .empty-row td {
    padding: 3rem 1.25rem;
    text-align: center;
    color: var(--gray-400);
    font-size: .9rem;
}

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .65rem;
    border-radius: var(--radius-full);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .02em;
    white-space: nowrap;
}

.badge-success {
    background: var(--green-50);
    color: var(--green-700);
    border: 1px solid var(--green-100);
}

.badge-warning {
    background: var(--yellow-50);
    color: var(--yellow-800);
    border: 1px solid var(--yellow-100);
}

.badge-info {
    background: var(--blue-50);
    color: var(--blue-800);
    border: 1px solid var(--blue-100);
}

.badge-danger {
    background: var(--red-50);
    color: var(--red-800);
    border: 1px solid var(--red-100);
}

.badge-neutral {
    background: var(--gray-100);
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* ── Forms ────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.15rem;
}

.form-label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: .35rem;
    letter-spacing: .01em;
}

.form-label .required {
    color: var(--red-500);
    margin-left: .15rem;
}

.form-hint {
    font-size: .72rem;
    color: var(--gray-400);
    margin-top: .25rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: .6rem .85rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: .875rem;
    color: var(--gray-800);
    background: #fff;
    outline: none;
    transition: all var(--transition-normal);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--gray-400);
}

.form-input[readonly] {
    background: var(--gray-50);
    color: var(--gray-500);
    border-color: var(--gray-200);
    cursor: not-allowed;
}

.form-checkbox-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: .25rem 0;
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .85rem;
    color: var(--gray-700);
    cursor: pointer;
}

.form-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-600);
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: .75rem;
    margin-top: 1.5rem;
}

.form-actions .btn {
    flex: 1;
    justify-content: center;
}

.form-actions .btn-secondary {
    flex: none;
}

/* ── Collapsible Sections ────────────────────────────────────────── */
.collapsible {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
}

.collapsible-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    font-size: .85rem;
    font-weight: 600;
    color: var(--gray-700);
    background: var(--gray-50);
    border: none;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.collapsible-trigger:hover {
    background: var(--gray-100);
}

.collapsible-trigger svg {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-normal);
    color: var(--gray-400);
}

.collapsible-trigger svg.rotate-180 {
    transform: rotate(180deg);
}

.collapsible-body {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.collapsible-body.hidden {
    display: none;
}

/* ── Modals ──────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-overlay.hidden {
    display: none;
}

.modal-container {
    background: #fff;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp .3s ease-out;
}

.modal-container.wide {
    max-width: 720px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 1.5rem;
}

/* ── Alert / Error boxes ─────────────────────────────────────────── */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius-md);
    font-size: .85rem;
    margin-bottom: 1rem;
    animation: slideDown .3s ease-out;
}

.alert.hidden {
    display: none;
}

.alert-error {
    background: var(--red-50);
    border: 1px solid var(--red-100);
    color: var(--red-800);
}

.alert-success {
    background: var(--green-50);
    border: 1px solid var(--green-100);
    color: var(--green-800);
}

.alert-warning {
    background: var(--yellow-50);
    border: 1px solid var(--yellow-100);
    color: var(--yellow-800);
}

.alert ul {
    padding-left: 1.25rem;
    margin-top: .25rem;
}

.alert li {
    margin-bottom: .15rem;
}

/* ── Chart Placeholder ───────────────────────────────────────────── */
.chart-placeholder {
    height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    border: 2px dashed var(--gray-200);
    border-radius: var(--radius-md);
    color: var(--gray-400);
    gap: .5rem;
}

.chart-placeholder svg {
    width: 40px;
    height: 40px;
    opacity: .5;
}

.chart-placeholder p {
    font-size: .85rem;
}

.chart-placeholder .sub {
    font-size: .75rem;
    color: var(--gray-300);
}

/* ── Grid Layouts ────────────────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

/* ── Comparison Cards (similar names modal) ──────────────────────── */
.comparison-card {
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.comparison-card.new-entry {
    background: var(--primary-50);
    border-color: var(--primary-200);
}

.comparison-card.existing {
    background: var(--gray-50);
}

.comparison-card h3 {
    font-size: .9rem;
    font-weight: 700;
    margin-bottom: .5rem;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .35rem .75rem;
    font-size: .8rem;
    color: var(--gray-600);
}

.similarity-badge {
    font-size: .7rem;
    padding: .15rem .5rem;
    background: var(--yellow-100);
    color: var(--yellow-800);
    border-radius: var(--radius-full);
    font-weight: 600;
}

/* ── Filter Bar ──────────────────────────────────────────────────── */
.filter-bar {
    margin-bottom: 1.25rem;
}

.filter-bar label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: .4rem;
}

.filter-bar select {
    padding: .5rem .85rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: .85rem;
    color: var(--gray-700);
    background: #fff;
    outline: none;
    min-width: 220px;
    transition: all var(--transition-normal);
}

.filter-bar select:focus {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

/* ── Back Link ───────────────────────────────────────────────────── */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .85rem;
    color: var(--gray-500);
    font-weight: 600;
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--gray-800);
}

/* ── Misc Utilities ──────────────────────────────────────────────── */
.text-sm {
    font-size: .85rem;
}

.text-xs {
    font-size: .75rem;
}

.text-muted {
    color: var(--gray-500);
}

.text-danger {
    color: var(--red-600);
}

.font-medium {
    font-weight: 600;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.font-mono {
    font-family: 'SF Mono', 'Cascadia Code', monospace;
}

.mt-1 {
    margin-top: .25rem;
}

.mt-2 {
    margin-top: .5rem;
}

.mb-2 {
    margin-bottom: .5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.gap-3 {
    gap: .75rem;
}

.gap-4 {
    gap: 1rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.inline-form {
    display: inline;
    margin: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.hidden {
    display: none !important;
}

.uppercase {
    text-transform: uppercase;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
    }

    .profile-info {
        display: none;
    }

    .modal-container {
        margin: 1rem;
    }
}

@media (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ══════════════════════════════════════════════════════════════════
   ATTENDANCE PAGE
   ══════════════════════════════════════════════════════════════════ */

/* Toolbar */
.att-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
}

.att-legend {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.att-legend-item {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
    font-weight: 500;
    color: var(--gray-600);
}

.att-cell-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 24px;
    border-radius: 4px;
    font-size: .7rem;
    font-weight: 700;
    color: #fff;
}

.att-cell-preview.present {
    background: var(--green-600);
}

.att-cell-preview.absent {
    background: var(--red-500);
}

.att-cell-preview.halfday {
    background: var(--orange-500);
}

.att-cell-preview.overtime {
    background: var(--purple-500);
}

.att-actions {
    display: flex;
    gap: .6rem;
    align-items: center;
    flex-wrap: wrap;
}

.att-save-status {
    font-size: .8rem;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
    transition: all var(--transition-normal);
}

.att-save-status.saving {
    color: var(--yellow-800);
}

.att-save-status.saved {
    color: var(--green-600);
}

.att-save-status.error {
    color: var(--red-600);
}

.att-month-display {
    display: flex;
    gap: .4rem;
    align-items: center;
}

/* Grid wrapper — horizontal scroll */
.att-grid-wrapper {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

/* Table */
.att-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
}

.att-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.att-table th {
    padding: .5rem .35rem;
    background: var(--gray-800);
    color: #fff;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    border: 1px solid var(--gray-700);
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.att-th-id {
    min-width: 60px;
    position: sticky;
    left: 0;
    z-index: 10;
    background: var(--gray-800) !important;
}

.att-th-name {
    min-width: 130px;
    position: sticky;
    left: 60px;
    z-index: 10;
    background: var(--gray-800) !important;
    text-align: left;
    padding-left: .6rem !important;
}

.att-th-desg {
    min-width: 100px;
    position: sticky;
    left: 190px;
    z-index: 10;
    background: var(--gray-800) !important;
}

.att-th-wage {
    min-width: 60px;
    position: sticky;
    left: 290px;
    z-index: 10;
    background: var(--gray-800) !important;
}

.att-th-day {
    min-width: 32px;
    max-width: 32px;
}

.att-th-summary {
    min-width: 60px;
    background: var(--gray-900) !important;
}

.att-sunday {
    background: #4a1942 !important;
}

/* Body cells */
.att-table td {
    padding: .3rem .25rem;
    text-align: center;
    border: 1px solid var(--gray-200);
    white-space: nowrap;
    vertical-align: middle;
}

.att-td-id {
    position: sticky;
    left: 0;
    z-index: 3;
    background: #fff;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    font-size: .72rem;
    color: var(--gray-600);
}

.att-td-name {
    position: sticky;
    left: 60px;
    z-index: 3;
    background: #fff;
    text-align: left;
    padding-left: .6rem !important;
    font-weight: 600;
    color: var(--gray-800);
}

.att-td-desg {
    position: sticky;
    left: 190px;
    z-index: 3;
    background: #fff;
    color: var(--gray-500);
    font-size: .72rem;
}

.att-td-wage {
    position: sticky;
    left: 290px;
    z-index: 3;
    background: #fff;
    font-weight: 600;
}

.att-row-alt .att-td-id,
.att-row-alt .att-td-name,
.att-row-alt .att-td-desg,
.att-row-alt .att-td-wage {
    background: var(--gray-50);
}

.att-row-alt td {
    background: var(--gray-50);
}

/* Day cells — clickable */
.att-cell {
    cursor: pointer;
    min-width: 32px;
    max-width: 32px;
    height: 28px;
    font-weight: 700;
    font-size: .72rem;
    transition: all 80ms ease;
    user-select: none;
}

.att-cell:hover {
    outline: 2px solid var(--primary-400);
    outline-offset: -2px;
    z-index: 1;
    position: relative;
}

.att-cell.present {
    background: var(--green-100);
    color: var(--green-800);
}

.att-cell.absent {
    background: var(--red-100);
    color: var(--red-800);
}

.att-cell.halfday {
    background: var(--orange-50);
    color: #c2410c;
}

.att-cell.overtime {
    background: var(--purple-50);
    color: #7e22ce;
}

.att-cell.att-face::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    background: var(--cyan-500);
    border-radius: 50%;
    margin: -2px auto 0;
}

/* Summary columns */
.att-td-summary {
    font-weight: 600;
    font-size: .75rem;
    background: var(--gray-50) !important;
}

.att-td-total {
    color: var(--primary-700);
    font-weight: 700;
}

.att-td-gross {
    color: var(--green-700);
}

.att-td-adv {
    color: var(--red-600);
}

.att-td-net {
    color: var(--primary-800);
    font-weight: 700;
}

.att-td-mode {
    font-size: .68rem;
    color: var(--gray-500);
    text-transform: uppercase;
}

/* Totals row */
.att-totals-row td {
    background: var(--gray-100) !important;
    font-weight: 700;
    border-top: 2px solid var(--gray-400);
    font-size: .8rem;
}

.att-totals-label {
    text-align: right !important;
    padding-right: 1rem !important;
    font-size: .85rem;
    color: var(--gray-700);
}

.att-loading {
    text-align: center;
    padding: 2rem !important;
    color: var(--gray-400);
    font-size: .9rem;
}

/* ── Footer ──────────────────────────────────────────────────────── */
.app-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 0 1rem;
    margin-top: auto;
    border-top: 1px solid var(--gray-200);
    font-size: 0.85rem;
    color: var(--gray-500);
    width: 100%;
}

.app-footer a {
    color: var(--primary-600);
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.app-footer a:hover {
    color: var(--primary-800);
    text-decoration: underline;
}

@media (max-width: 640px) {
    .app-footer {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}

/* ── Pagination ─────────────────────────────────────────────────── */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: #fff;
    border-top: 1px solid var(--gray-100);
}

.pagination-stats {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 500;
}

.pagination-stats b {
    color: var(--gray-900);
    font-weight: 700;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    background: #fff;
    color: var(--gray-700);
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition-normal);
    user-select: none;
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--primary-600);
}

.pagination-btn.active {
    background: var(--primary-600);
    color: #fff;
    border-color: var(--primary-600);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--gray-50);
}

.pagination-btn svg {
    width: 18px;
    height: 18px;
}

.pagination-ellipsis {
    color: var(--gray-400);
    font-weight: 700;
    margin: 0 0.25rem;
    font-size: 0.8rem;
}

@media (max-width: 640px) {
    .pagination-container {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}