:root {
    --sidebar-width: 276px;
    --sidebar-bg: #111827;
    --body-bg: #f3f4f6;
    --border: #e5e7eb;
    --muted: #6b7280;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--body-bg);
    color: #111827;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 1rem;
    line-height: 1.55;
}

button,
input,
select,
textarea {
    font-size: 1rem;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1040;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    background: var(--sidebar-bg);
    box-shadow: 8px 0 24px rgba(17, 24, 39, 0.12);
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 88px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo,
.sidebar-logo-placeholder {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: 14px;
}

.sidebar-logo {
    object-fit: contain;
    background: white;
    padding: 4px;
}

.sidebar-logo-placeholder {
    display: grid;
    place-items: center;
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    font-size: 25px;
}

.sidebar-brand-title {
    max-width: 170px;
    overflow: hidden;
    color: white;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-brand-subtitle,
.sidebar-footer .small {
    color: #9ca3af;
    font-size: 0.82rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 18px 14px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    margin-bottom: 5px;
    padding: 11px 14px;
    border-radius: 10px;
    color: #d1d5db;
    font-weight: 500;
    text-decoration: none;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: white;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-link.active {
    background: #2563eb;
}

.sidebar-link i {
    width: 22px;
    font-size: 1.1rem;
    text-align: center;
}

.sidebar-section-label {
    margin: 22px 14px 8px;
    color: #6b7280;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-footer {
    padding: 18px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1035;
    display: none;
    background: rgba(17, 24, 39, 0.55);
}

.main-content {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 80px;
    padding: 14px 26px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
}

.topbar-title {
    margin: 0;
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    font-weight: 750;
}

.topbar-date {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.88rem;
}

.content-wrapper {
    width: 100%;
    max-width: 1720px;
    margin: 0 auto;
    padding: 24px 26px 40px;
}

.card {
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 5px 20px rgba(17, 24, 39, 0.045);
}

.card-header,
.card-footer {
    border-color: var(--border);
    background: white;
}

.card-header,
.card-body,
.card-footer {
    padding: 18px 20px;
}

.card-title {
    font-size: 1.08rem;
    font-weight: 700;
}

.form-label {
    font-weight: 600;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 44px;
    border-color: #d1d5db;
    border-radius: 9px;
}

.form-control:focus,
.form-select:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}

.btn {
    min-height: 42px;
    border-radius: 9px;
    font-weight: 600;
}

.btn-sm {
    min-height: 34px;
}

.table {
    font-size: 0.94rem;
}

.table > :not(caption) > * > * {
    padding: 13px 14px;
    border-bottom-color: #edf0f3;
}

.table thead th {
    background: #f9fafb;
    color: #4b5563;
    font-size: 0.78rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    white-space: nowrap;
}

code {
    color: #1d4ed8;
}

.status-badge {
    padding: 0.48em 0.7em;
    font-size: 0.76rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 112px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: white;
}

.stat-icon {
    display: grid;
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    place-items: center;
    border-radius: 14px;
    font-size: 1.35rem;
}

.stat-value {
    font-size: clamp(1.35rem, 2.4vw, 1.8rem);
    font-weight: 800;
}

.stat-label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.stat-card-primary .stat-icon {
    background: #dbeafe;
    color: #2563eb;
}
.stat-card-success .stat-icon {
    background: #dcfce7;
    color: #16a34a;
}
.stat-card-info .stat-icon {
    background: #cffafe;
    color: #0891b2;
}
.stat-card-secondary .stat-icon {
    background: #e5e7eb;
    color: #4b5563;
}
.stat-card-warning .stat-icon {
    background: #fef3c7;
    color: #d97706;
}
.stat-card-danger .stat-icon {
    background: #fee2e2;
    color: #dc2626;
}
.stat-card-dark .stat-icon {
    background: #d1d5db;
    color: #111827;
}
.stat-card-purple .stat-icon {
    background: #ede9fe;
    color: #7c3aed;
}

.chart-container {
    position: relative;
    min-height: 360px;
}

.employee-avatar,
.employee-avatar-placeholder {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 50%;
}

.employee-avatar {
    object-fit: cover;
}

.employee-avatar-placeholder,
.employee-profile-placeholder {
    display: grid;
    place-items: center;
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 800;
}

.employee-photo-preview {
    width: 100%;
    max-width: 280px;
    max-height: 320px;
    border-radius: 12px;
    object-fit: cover;
}

.employee-photo-empty {
    display: grid;
    min-height: 230px;
    place-items: center;
    align-content: center;
    gap: 10px;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    color: #9ca3af;
}

.employee-photo-empty i {
    font-size: 3rem;
}

.employee-profile {
    display: flex;
    align-items: flex-start;
    gap: 22px;
}

.employee-profile-photo,
.employee-profile-placeholder {
    width: 130px;
    height: 130px;
    flex: 0 0 130px;
    border-radius: 18px;
}

.employee-profile-photo {
    object-fit: cover;
}

.employee-profile-placeholder {
    font-size: 3rem;
}

.qr-preview {
    width: min(100%, 300px);
    aspect-ratio: 1;
    object-fit: contain;
}

.settings-logo-preview {
    max-width: 180px;
    max-height: 90px;
    border: 1px solid var(--border);
    border-radius: 10px;
    object-fit: contain;
    padding: 5px;
}

.scanner-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.7fr);
    gap: 24px;
}

.scanner-status {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 10px;
    background: #f3f4f6;
    color: #4b5563;
    font-weight: 600;
    text-align: center;
}

.scanner-help-list li {
    margin-bottom: 12px;
}

.scanner-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    visibility: hidden;
    place-items: center;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.scanner-overlay.show {
    visibility: visible;
    opacity: 1;
}

.scanner-overlay-checkin {
    background: rgba(22, 163, 74, 0.93);
}

.scanner-overlay-checkout {
    background: rgba(37, 99, 235, 0.93);
}

.scanner-overlay-warning {
    background: rgba(234, 88, 12, 0.93);
}

.scanner-overlay-neutral {
    background: rgba(75, 85, 99, 0.93);
}

.scanner-overlay-error {
    background: rgba(220, 38, 38, 0.93);
}

.scanner-overlay-content {
    max-width: 720px;
    color: white;
    text-align: center;
}

.scanner-overlay-icon {
    font-size: clamp(4rem, 12vw, 8rem);
}

.scanner-overlay-message {
    margin-top: 20px;
    font-size: clamp(1.4rem, 4vw, 2.4rem);
    font-weight: 800;
}

.metric-number {
    font-size: 1.05rem;
    font-weight: 800;
}

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.25), transparent 34%),
        radial-gradient(circle at 90% 90%, rgba(124, 58, 237, 0.22), transparent 34%),
        #111827;
}

.login-card {
    width: 100%;
    max-width: 470px;
    padding: 34px;
    border-radius: 20px;
    background: white;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.3);
}

.login-brand {
    margin-bottom: 28px;
    text-align: center;
}

.login-brand h1 {
    margin: 14px 0 5px;
    font-size: 1.55rem;
    font-weight: 800;
}

.login-brand p,
.login-footer {
    color: var(--muted);
}

.login-logo,
.login-logo-placeholder {
    width: 78px;
    height: 78px;
    margin: 0 auto;
    border-radius: 20px;
}

.login-logo {
    object-fit: contain;
}

.login-logo-placeholder {
    display: grid;
    place-items: center;
    background: #dbeafe;
    color: #2563eb;
    font-size: 2.3rem;
}

.login-footer {
    margin-top: 24px;
    font-size: 0.82rem;
    text-align: center;
}

.pagination {
    margin-bottom: 0;
}

@media (max-width: 1199.98px) {
    .scanner-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

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

    .topbar {
        min-height: 72px;
        padding: 12px 16px;
    }

    .content-wrapper {
        padding: 18px 16px 32px;
    }
}

@media (max-width: 767.98px) {
    .card-header,
    .card-body,
    .card-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .employee-profile {
        flex-direction: column;
    }

    .employee-profile-photo,
    .employee-profile-placeholder {
        width: 108px;
        height: 108px;
        flex-basis: 108px;
    }

    .login-card {
        padding: 26px 20px;
    }
}

@media (max-width: 575.98px) {
    .topbar-date {
        display: none;
    }

    .stat-card {
        min-height: 104px;
        padding: 14px;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        flex-basis: 44px;
    }

    .chart-container {
        min-height: 290px;
    }
}


.attendance-selfie-thumbnail {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
}

.attendance-selfie-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: #475569;
    font-size: 0.72rem;
    text-decoration: none;
}

.attendance-selfie-link:hover {
    color: #2563eb;
}

.attendance-selfie-link:hover .attendance-selfie-thumbnail {
    border-color: #2563eb;
}
