:root {
    --sidebar-width: 270px;
    --primary: #5b4cdb;
    --primary-dark: #4538b8;
    --primary-light: #ede9fe;
    --accent: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --sidebar-bg: #1e1b4b;
    --body-bg: #f3f4f8;
    --card-shadow: 0 4px 24px rgba(30, 27, 75, 0.08);
    --radius: 14px;
}

* { box-sizing: border-box; }

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--body-bg);
    min-height: 100%;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #1f2937;
    margin: 0;
}

/* App shell: sidebar + header stay fixed; only main content scrolls */
body.app-shell {
    height: 100%;
    overflow: hidden;
}

body.app-shell #wrapper {
    display: flex;
    height: 100dvh;
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

#wrapper { min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    max-height: 100dvh;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #312e81 100%) !important;
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    border-right: none;
    z-index: 1051;
}

/* Scrollable menu area — flex child must have min-height:0 to scroll on iOS/PWA */
.sidebar-nav {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scroll-padding-bottom: 0.75rem;
    padding-bottom: 0.25rem;
}

.sidebar-nav .nav {
    flex-shrink: 0;
    padding-bottom: 0.5rem;
}

.sidebar-brand {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: relative;
}

.sidebar-close-btn {
    position: absolute;
    top: 0.85rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}

@media (max-width: 991.98px) {
    .sidebar-close-btn { display: inline-flex; }
}

.sidebar-brand .logo-icon {
    width: 40px; height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-brand-logo {
    height: 38px;
    width: auto;
    max-width: 130px;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
    background: #fff;
    padding: 3px 8px;
}

.speech-input-group .speech-mic-btn {
    flex-shrink: 0;
    min-width: 42px;
}

.speech-input-group .speech-mic-btn.btn-danger {
    animation: speech-pulse 1s ease infinite;
}

@keyframes speech-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.35); }
    50% { box-shadow: 0 0 0 6px rgba(220, 53, 69, 0); }
}

.login-brand-logo {
    height: 72px;
    width: auto;
    max-width: min(320px, 90vw);
    object-fit: contain;
    display: block;
    margin-left: auto;
    margin-right: auto;
    border-radius: 10px;
}

.sidebar .nav-link {
    border-radius: 10px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.75) !important;
    margin: 2px 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: all 0.15s;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: rgba(91, 76, 219, 0.35);
    color: #fff !important;
}

.sidebar .nav-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.4);
    padding: 0.75rem 1.25rem 0.25rem;
    margin-top: 0.15rem;
}

.sidebar-profile {
    margin: 0.75rem;
    padding: 0.85rem 1rem;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius);
    flex-shrink: 0;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.sidebar-profile-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.sidebar-profile-meta {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    line-height: 1.25;
}

.sidebar-profile-name {
    font-weight: 600;
    color: #fff;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-profile-email {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-profile-role {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.72rem;
    text-transform: capitalize;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Top header */
.app-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.85rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.app-header .greeting { font-size: 1.1rem; font-weight: 600; }
.app-header .search-box {
    max-width: 280px;
    border-radius: 999px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    padding: 0.4rem 1rem;
}

/* YesR AI — header + results */
.yesr-ai-header-search {
    flex: 1 1 220px;
    max-width: 420px;
    min-width: 180px;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    padding: 0.28rem 0.4rem 0.28rem 0.75rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 45%, #f8fafc 100%);
    border: 1px solid #bbf7d0;
}
.yesr-ai-header-icon { color: #16a34a; font-size: 0.95rem; flex-shrink: 0; }
.yesr-ai-header-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    font-size: 0.875rem;
    color: #14532d;
}
.yesr-ai-header-input::placeholder { color: #86efac; }
.yesr-ai-header-btn {
    border: 0;
    background: #16a34a;
    color: #fff;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.yesr-ai-header-btn:hover { background: #15803d; color: #fff; }

.yesr-ai-page { max-width: 960px; margin: 0 auto; }
.yesr-ai-hero {
    padding: 1.25rem 1.35rem 1.5rem;
    border-radius: 1rem;
    background: linear-gradient(145deg, #052e16 0%, #14532d 42%, #166534 100%);
    color: #ecfdf5;
    margin-bottom: 1.25rem;
    box-shadow: 0 12px 40px rgba(20, 83, 45, 0.22);
}
.yesr-ai-brand {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}
.yesr-ai-tagline { opacity: 0.88; margin: 0.4rem 0 1rem; font-size: 0.95rem; max-width: 36rem; }
.yesr-ai-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.yesr-ai-input {
    flex: 1 1 240px;
    border: 0;
    border-radius: 0.65rem;
    padding: 0.7rem 1rem;
    font-size: 1rem;
}
.yesr-ai-submit {
    border: 0;
    border-radius: 0.65rem;
    padding: 0.7rem 1.15rem;
    background: #86efac;
    color: #052e16;
    font-weight: 600;
}
.yesr-ai-submit:hover { background: #bbf7d0; color: #052e16; }
.yesr-ai-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.85rem; }
.yesr-ai-chip {
    font-size: 0.78rem;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    color: #ecfdf5;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.18);
}
.yesr-ai-chip:hover { background: rgba(255,255,255,0.22); color: #fff; }

.yesr-ai-answer { padding: 1rem 1.15rem; }
.yesr-ai-answer-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #16a34a;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.yesr-ai-source {
    margin-left: auto;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: #94a3b8;
    font-size: 0.72rem;
}
.yesr-ai-answer-text { white-space: pre-wrap; line-height: 1.55; color: #1e293b; }

.yesr-ai-emp { padding: 0.9rem 1rem; }
.yesr-ai-emp-links { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.yesr-ai-period {
    margin-left: 0.5rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: #64748b;
    font-size: 0.72rem;
}
.yesr-ai-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.35rem;
    margin-top: 0.75rem;
    padding: 0.55rem 0.4rem;
    border-radius: 0.55rem;
    background: #f0fdf4;
    border: 1px solid #dcfce7;
}
.yesr-ai-stat { text-align: center; min-width: 0; }
.yesr-ai-stat-v {
    display: block;
    font-weight: 700;
    font-size: 0.95rem;
    color: #14532d;
    line-height: 1.2;
}
.yesr-ai-stat-l {
    display: block;
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
@media (max-width: 576px) {
    .yesr-ai-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.yesr-ai-link-card {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.85rem 0.95rem;
    border-radius: 0.75rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: inherit;
    height: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.yesr-ai-link-card:hover {
    border-color: #86efac;
    box-shadow: 0 4px 16px rgba(22, 163, 74, 0.1);
    color: inherit;
}
.yesr-ai-link-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.55rem;
    background: #f0fdf4;
    color: #16a34a;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.yesr-ai-link-title { display: block; font-weight: 600; font-size: 0.92rem; }
.yesr-ai-link-desc { display: block; font-size: 0.78rem; color: #64748b; margin-top: 0.1rem; }
.yesr-ai-link-cat {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #16a34a;
}

#page-content {
    min-width: 0;
    min-height: 0;
    background: var(--body-bg);
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: hidden;
}

body.app-shell #page-content {
    height: 100%;
}

.main-content {
    padding: 1.5rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Cards */
.sc-card {
    background: #fff;
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}

.filter-bar {
    border-left: 4px solid var(--primary, #5b4cdb);
}

.report-card h5 {
    font-weight: 600;
}

.report-hub .report-card {
    transition: box-shadow 0.15s, transform 0.15s;
}

.report-hub .report-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(91, 76, 219, 0.12);
}

.field-visit-mobile .kpi-card {
    min-height: 5.5rem;
}

.emp-edit-tabs .nav-link {
    font-weight: 500;
    font-size: 0.9rem;
}

.portal-section-label {
    letter-spacing: 0.06em;
}

.stat-card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
    background: #fff;
    transition: transform 0.15s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card .stat-trend {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.stat-card.purple .stat-value { color: var(--primary); }
.stat-card.green .stat-value { color: var(--accent); }
.stat-card.red .stat-value { color: var(--danger); }
.stat-card.amber .stat-value { color: var(--warning); }

/* Attendance badges */
.badge-present { background: #d1fae5; color: #065f46; }
.badge-late { background: #fef3c7; color: #92400e; }
.badge-absent { background: #fee2e2; color: #991b1b; }
.badge-leave { background: #dbeafe; color: #1e40af; }
.badge-holiday { background: #e0e7ff; color: #3730a3; }

/* Matrix attendance register — scrollable grid with sticky header, employee cols, totals */
.matrix-register-wrap {
    overflow: auto;
    max-height: calc(100vh - 14rem);
    border: 1px solid #e5e7eb;
    border-radius: 0.35rem;
    -webkit-overflow-scrolling: touch;
}
.matrix-register-full .matrix-register-wrap { max-height: calc(100vh - 12rem); }
body.matrix-page-fullscreen {
    height: 100vh;
    overflow: hidden;
}
body.matrix-page-fullscreen #wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}
body.matrix-page-fullscreen #sidebar,
body.matrix-page-fullscreen .app-header { display: none !important; }
body.matrix-page-fullscreen .main-content {
    padding: 0.5rem 0.75rem;
    max-width: 100%;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
body.matrix-page-fullscreen .matrix-register-full {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
body.matrix-page-fullscreen .matrix-register-wrap {
    flex: 1;
    max-height: none !important;
    overflow: auto !important;
}
.matrix-register {
    border-collapse: separate;
    border-spacing: 0;
}
.matrix-register th, .matrix-register td { white-space: nowrap; font-size: 0.75rem; padding: 0.25rem 0.35rem; }
.matrix-register thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #f1f5f9;
    box-shadow: 0 1px 0 #cbd5e1;
}
.matrix-register tfoot td {
    position: sticky;
    bottom: 0;
    z-index: 4;
    background: #e2e8f0;
    box-shadow: 0 -1px 0 #94a3b8;
    font-weight: 800;
}
.matrix-to-pay {
    color: #1d4ed8;
    white-space: nowrap;
}
.matrix-net-pay {
    color: #047857;
    white-space: nowrap;
}
.matrix-summary-col, .matrix-payout-col { min-width: 2.5rem; background: #f8f9fa; font-weight: 600; }
.matrix-sticky-col { position: sticky; background: #fff; z-index: 2; }
.matrix-sticky-1 { left: 0; min-width: 2rem; }
.matrix-sticky-2 { left: 2rem; min-width: 3rem; }
.matrix-sticky-3 { left: 5rem; min-width: 10rem; box-shadow: 4px 0 6px -4px rgba(0,0,0,.15); }
.matrix-register thead .matrix-sticky-col { z-index: 6; background: #f1f5f9; }
.matrix-register tfoot .matrix-sticky-col { z-index: 6; background: #e2e8f0; }
.matrix-register tbody .matrix-sticky-col { background: #fff; }
.matrix-totals-row td { vertical-align: middle; }
.matrix-totals-label { font-size: 0.72rem; letter-spacing: 0.02em; text-transform: uppercase; color: #0f172a; }
.matrix-day-total {
    font-size: 0.62rem;
    font-weight: 800;
    color: #1d4ed8;
    line-height: 1.15;
}
.matrix-present { background: #a7f3d0; color: #047857; font-weight: 800; }
.matrix-absent { background: #fecaca; color: #b91c1c; font-weight: 800; }
.matrix-half { background: #fde68a; color: #b45309; font-weight: 800; }
.matrix-leave { background: #bfdbfe; color: #1d4ed8; font-weight: 800; }
.matrix-weekoff { background: #d1d5db; color: #1f2937; font-weight: 800; }
.matrix-holiday { background: #ddd6fe; color: #6d28d9; font-weight: 800; }
.matrix-wfh { background: #a5f3fc; color: #0f766e; font-weight: 800; }
.matrix-compoff { background: #fed7aa; color: #c2410c; font-weight: 800; }
.matrix-lop { background: #fbcfe8; color: #be185d; font-weight: 800; }
.matrix-empty { background: #f3f4f6; color: #6b7280; font-weight: 700; }

/* Payout matrix day codes */
.matrix-payout-payday { background: #bbf7d0; color: #15803d; font-weight: 800; }
.matrix-payout-extra { background: #99f6e4; color: #0f766e; font-weight: 800; }
.matrix-payout-lop { background: #fecaca; color: #dc2626; font-weight: 800; }
.matrix-payout-half { background: #fef08a; color: #ca8a04; font-weight: 800; }
.matrix-payout-leave { background: #bae6fd; color: #0369a1; font-weight: 800; }
.matrix-payout-ot { background: #c4b5fd; color: #6d28d9; font-weight: 800; }
.matrix-payout-weekoff { background: #e5e7eb; color: #374151; font-weight: 800; }
.matrix-payout-holiday { background: #e9d5ff; color: #7e22ce; font-weight: 800; }

.matrix-legend-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.7rem;
    border-radius: 0.45rem;
    font-size: 0.8rem;
    border: 2px solid rgba(0,0,0,.12);
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.matrix-legend-badge .legend-code {
    font-weight: 900;
    font-size: 0.9rem;
    min-width: 2rem;
    text-align: center;
    letter-spacing: 0.05em;
    line-height: 1.1;
}
.matrix-legend-badge .legend-label {
    font-weight: 800;
    color: inherit;
    line-height: 1.2;
    text-shadow: 0 1px 0 rgba(255,255,255,.35);
}
.matrix-day-code {
    display: block;
    font-weight: 900;
    letter-spacing: 0.02em;
    line-height: 1.1;
}
.matrix-day-pay {
    display: block;
    font-size: 0.58rem;
    font-weight: 700;
    line-height: 1;
    opacity: 0.92;
    color: #15803d;
}
.matrix-day-extra {
    display: block;
    font-size: 0.55rem;
    color: #0f766e;
    font-weight: 700;
    line-height: 1;
}
.matrix-day-late {
    display: block;
    font-size: 0.55rem;
    color: #b45309;
    font-weight: 600;
    line-height: 1;
}
.matrix-day-ot {
    display: block;
    font-size: 0.55rem;
    color: #6d28d9;
    font-weight: 600;
    line-height: 1;
}
.matrix-day-lop {
    display: block;
    font-size: 0.55rem;
    color: #dc2626;
    font-weight: 600;
    line-height: 1;
}
.matrix-day-net {
    display: block;
    font-size: 0.58rem;
    color: #1d4ed8;
    font-weight: 800;
    line-height: 1.05;
    margin-top: 0.05rem;
}
.matrix-register.payout-mode .matrix-day-col { min-width: 2.75rem; }
.matrix-day-ok {
    display: block;
    color: #15803d;
    font-weight: 800;
    font-size: 0.72rem;
}
.matrix-day-approve {
    font-size: 0.55rem !important;
    text-decoration: underline;
    color: #1d4ed8 !important;
    line-height: 1.1;
}
.matrix-day-verified {
    box-shadow: inset 0 0 0 2px rgba(21, 128, 61, 0.35);
}
.matrix-day-pending {
    box-shadow: inset 0 0 0 2px rgba(180, 83, 9, 0.3);
}
.matrix-day-payout { line-height: 1.15; }
.matrix-net-pay { color: #0f766e; }
.matrix-verified-col { font-size: 0.75rem; }
.matrix-pay-status {
    font-weight: 800;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.matrix-pay-status-paid { color: #15803d; }
.matrix-pay-status-pending { color: #b45309; }
.matrix-pay-status-hold { color: #dc2626; }
.matrix-emp-link { color: inherit; text-decoration: none; display: block; }
.matrix-emp-link:hover { color: var(--primary, #5b4cdb); text-decoration: underline; }
.matrix-day-link {
    display: block;
    color: inherit;
    text-decoration: none;
    border-radius: 2px;
}
.matrix-day-link:hover { outline: 2px solid rgba(91, 76, 219, 0.45); outline-offset: -1px; }
.matrix-row-hover:hover .matrix-sticky-col { background: #f8fafc; }

/* Manual entry time pickers */
.time-picker {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: nowrap;
}
.time-picker .tp-h,
.time-picker .tp-m { width: 3.2rem; min-width: 3.2rem; padding-left: 0.25rem; padding-right: 0.25rem; }
.time-picker .tp-ap { width: 3.5rem; min-width: 3.5rem; padding-left: 0.2rem; padding-right: 0.2rem; }
.time-picker .tp-sep { font-weight: 600; line-height: 1; }

.status-badge {
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Tabs */
.sc-tabs { border-bottom: 2px solid #e5e7eb; margin-bottom: 1.5rem; }
.sc-tabs .nav-link {
    border: none;
    color: #6b7280;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 0;
}
.sc-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

/* Tables */
.table-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.25rem;
    overflow-x: auto;
    overflow-y: visible;
}

.table-card .table { margin-bottom: 0; }
.table-card thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    font-weight: 600;
    border-bottom-width: 1px;
    background: #f9fafb;
}

.emp-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* Employee portal grid */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 1rem;
    max-width: 480px;
    margin: 0 auto;
}

.portal-tile {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.25rem 0.75rem;
    text-align: center;
    text-decoration: none;
    color: #374151;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
}

.portal-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(91,76,219,0.15);
    color: var(--primary);
}

.portal-tile .tile-icon {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.portal-tile .tile-label { font-size: 0.8rem; font-weight: 500; }

.portal-tile .badge-count {
    position: absolute;
    top: 8px; right: 8px;
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
}

/* Punch card */
.punch-card {
    max-width: 420px;
    margin: 0 auto;
    text-align: center;
    padding: 2rem;
}

.punch-clock {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.btn-punch-in {
    background: var(--accent);
    border: none;
    color: #fff;
    padding: 0.85rem 2rem;
    border-radius: 12px;
    font-weight: 600;
}

.btn-punch-out {
    background: var(--warning);
    border: none;
    color: #fff;
    padding: 0.85rem 2rem;
    border-radius: 12px;
    font-weight: 600;
}

.punch-card-v2 {
    max-width: 520px;
    padding: 1.5rem 1.75rem 1.25rem;
}

.punch-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 8px 24px rgba(91, 76, 219, 0.35);
}

.punch-video {
    max-height: 320px;
    object-fit: cover;
    min-height: 240px;
    transform: scaleX(-1);
}

.punch-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.btn-punch-break {
    background: #0ea5e9;
    border: none;
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-weight: 600;
}

.btn-punch-break-out {
    background: #6366f1;
    border: none;
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-weight: 600;
}

.punch-location-footer {
    border-top: 1px solid #e9ecef;
    padding-top: .75rem;
    text-align: center;
}

.kiosk-gps-badge {
    display: inline-block;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: .15rem .45rem;
    border-radius: 999px;
}

.kiosk-gps-badge.on {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.kiosk-gps-badge.off {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.punch-status-line {
    font-weight: 500;
}

/* Employee punch — device mode */
.punch-device-page {
    --punch-primary: #0d6efd;
    --punch-accent: #16a34a;
    --punch-bg: #0b1220;
    --punch-text: #f8fafc;
}
.punch-device-page .main-content {
    padding-top: 0.5rem;
}

.punch-device-shell {
    min-height: calc(100dvh - 120px);
}

.punch-device-card {
    position: relative;
}

.punch-device-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    gap: 0.35rem;
}

.punch-device-badge {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    font-weight: 600;
    flex: 1;
}

.punch-logo {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--punch-primary) 18%, transparent);
    color: var(--punch-primary);
    font-size: 1.4rem;
}

.punch-clock {
    color: var(--punch-primary);
    font-weight: 800;
}

.face-verify-hint,
.punch-selfie-hint,
.punch-capture-hint {
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
    background: color-mix(in srgb, var(--punch-primary) 12%, #fff);
    color: #334155;
}

.btn-punch-in {
    background: linear-gradient(135deg, var(--punch-accent), color-mix(in srgb, var(--punch-accent) 70%, #000)) !important;
    border: none !important;
    color: #fff !important;
}

.btn-punch-out {
    background: linear-gradient(135deg, #ef4444, #b91c1c) !important;
    border: none !important;
    color: #fff !important;
}

.punch-fullscreen-btn {
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    border-radius: 10px;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.punch-pwa-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    background: linear-gradient(90deg, #1d4ed8, #0d6efd);
    color: #fff;
    padding: 0.55rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
}

.punch-pwa-banner[hidden] { display: none !important; }

.punch-pwa-install-btn {
    margin-left: auto;
    border: none;
    background: #fff;
    color: #0d6efd;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

.punch-pwa-dismiss {
    border: none;
    background: transparent;
    color: #fff;
    opacity: 0.85;
}

.punch-offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1190;
    background: linear-gradient(90deg, #b45309, #f59e0b);
    color: #fff;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

.punch-offline-banner[hidden] { display: none !important; }

.punch-offline-sync-btn {
    margin-left: auto;
    border: none;
    background: #fff;
    color: #b45309;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.75rem;
}

body.punch-fullscreen-active {
    background: radial-gradient(circle at top, color-mix(in srgb, var(--punch-bg, #1e293b) 80%, #334155) 0%, var(--punch-bg, #0b1220) 55%);
    overflow: hidden;
}

body.punch-fullscreen-active #wrapper {
    height: 100dvh;
    overflow: hidden;
}

body.punch-fullscreen-active .app-header {
    display: none !important;
}

body.punch-fullscreen-active .main-content {
    padding: 0.5rem !important;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
    min-height: 0;
    height: 100dvh;
}

body.punch-fullscreen-active .punch-device-shell {
    min-height: 0;
    height: 100%;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.punch-fullscreen-active .punch-device-shell > .row {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    overflow: hidden;
}

body.punch-fullscreen-active .punch-device-shell > .row > [class*="col-"] {
    height: 100%;
    display: flex;
    flex-direction: column;
}

body.punch-fullscreen-active .punch-device-card {
    background: var(--punch-bg, #121a2b);
    color: var(--punch-text, #f8fafc);
    border: none;
    box-shadow: 0 20px 50px rgba(0,0,0,.45);
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.85rem 1rem 1rem;
}

body.punch-fullscreen-active .punch-video,
body.punch-fullscreen-active .face-capture-stage .punch-camera-wrap {
    max-height: min(28vh, 220px);
    object-fit: cover;
}

body.punch-fullscreen-active .punch-clock {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    margin-bottom: 0.35rem !important;
}

body.punch-fullscreen-active .punch-actions-grid {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: linear-gradient(180deg, transparent, #121a2b 28%);
    padding-top: 0.5rem;
    margin-bottom: 0.35rem !important;
}

body.punch-fullscreen-active .punch-device-card .text-muted {
    color: #94a3b8 !important;
}

body.punch-fullscreen-active .punch-device-card .text-success {
    color: #4ade80 !important;
}

body.punch-fullscreen-active .punch-clock {
    color: #f8fafc;
}

body.punch-fullscreen-active .punch-location-footer {
    border-top-color: #334155;
}

body.punch-fullscreen-active .punch-fullscreen-btn {
    background: rgba(30, 41, 59, 0.8);
    border-color: #334155;
    color: #94a3b8;
}

body.punch-fullscreen-active .punch-device-badge {
    color: #94a3b8;
}

body.punch-fullscreen-active .btn-punch-in {
    background: linear-gradient(135deg, var(--punch-accent, #22c55e), color-mix(in srgb, var(--punch-accent, #15803d) 80%, #000));
}

body.punch-fullscreen-active .btn-punch-out {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

@media (max-height: 700px) {
    .punch-device-card .punch-brand { display: none; }
    .punch-clock { font-size: 1.75rem !important; }
    .face-capture-stage .punch-camera-wrap { max-height: 180px; }
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #5b4cdb 50%, #818cf8 100%);
}

.login-card {
    border: none;
    border-radius: 1.25rem;
    box-shadow: 0 2rem 4rem rgba(0,0,0,0.25);
    max-width: 440px;
    width: 100%;
    background: #fff;
}

.login-card .btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    border-radius: 10px;
    padding: 0.65rem;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.chart-card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    background: #fff;
    padding: 1.25rem;
}

.donut-legend { list-style: none; padding: 0; margin: 0; }
.donut-legend li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}
.donut-legend .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* KPI cards */
.kpi-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--card-shadow);
    height: 100%;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.kpi-purple .kpi-icon { background: #ede9fe; color: var(--primary); }
.kpi-green .kpi-icon { background: #d1fae5; color: var(--accent); }
.kpi-amber .kpi-icon { background: #fef3c7; color: var(--warning); }
.kpi-blue .kpi-icon { background: #dbeafe; color: #2563eb; }

.kpi-label { font-size: 0.8rem; color: #6b7280; font-weight: 500; }
.kpi-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.kpi-sub { font-size: 0.75rem; color: #9ca3af; margin-top: 0.15rem; }

/* Employee attendance cards */
.emp-attendance-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 1.15rem;
    height: 100%;
    transition: transform 0.15s, box-shadow 0.15s;
}

.emp-attendance-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(30, 27, 75, 0.12);
}

.emp-photo {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ede9fe;
    flex-shrink: 0;
}

.emp-photo-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ede9fe;
}

.emp-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid #f3f4f6;
}

.emp-kpi-row-5 {
    grid-template-columns: repeat(5, 1fr);
}

.emp-kpi { text-align: center; }
.emp-kpi-label { display: block; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.04em; color: #9ca3af; }
.emp-kpi-val { display: block; font-size: 0.85rem; font-weight: 600; }

/* Attendance card v2 + done-mode badges */
.emp-attendance-card-v2 {
    border: 1px solid #eef0f4;
    border-radius: 14px;
    padding: 1rem 1.05rem 0.9rem;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfd 100%);
    position: relative;
    overflow: hidden;
}
.emp-attendance-card-v2::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #cbd5e1;
}
.emp-attendance-card-v2.status-present::before { background: #10b981; }
.emp-attendance-card-v2.status-late::before,
.emp-attendance-card-v2.is-late::before { background: #f59e0b; }
.emp-attendance-card-v2.status-absent::before { background: #ef4444; }
.emp-attendance-card-v2.status-leave::before { background: #6366f1; }
.emp-attendance-card-v2.status-halfday::before { background: #8b5cf6; }

.emp-card-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.55rem;
    border-top: 1px dashed #e5e7eb;
}

.attn-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.28rem 0.5rem;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.attn-mode-badge i { font-size: 0.72rem; }
.attn-mode-badge.mode-face {
    background: #ede9fe;
    color: #5b21b6;
    border-color: #ddd6fe;
}
.attn-mode-badge.mode-selfie {
    background: #e0f2fe;
    color: #075985;
    border-color: #bae6fd;
}
.attn-mode-badge.mode-device {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}
.attn-mode-badge.mode-hardware {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}
.attn-mode-badge.mode-manual {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fed7aa;
}
.attn-mode-badge.mode-excel,
.attn-mode-badge.mode-api,
.attn-mode-badge.mode-other {
    background: #f8fafc;
    color: #475569;
    border-color: #e2e8f0;
}

@media (max-width: 575.98px) {
    .emp-kpi-row-5 {
        grid-template-columns: repeat(3, 1fr);
    }
}

.min-w-0 { min-width: 0; }

/* Manual entry */
.manual-entry-form .form-label { font-size: 0.85rem; }
.manual-preview { background: #f9fafb; border: 1px solid #e5e7eb; }

/* Sidebar layout modes */
#wrapper.sidebar-collapsed { --sidebar-width: 0px; }
#wrapper.sidebar-collapsed .sidebar { width: 0; padding: 0; overflow: hidden; border: none; }
#wrapper.sidebar-collapsed .sidebar-brand,
#wrapper.sidebar-collapsed .sidebar-nav,
#wrapper.sidebar-collapsed .sidebar-profile { opacity: 0; pointer-events: none; }

#wrapper.fullscreen-mode .sidebar,
#wrapper.fullscreen-mode .sidebar-backdrop { display: none !important; }
#wrapper.fullscreen-mode #page-content { width: 100%; }
#wrapper.fullscreen-mode .main-content { padding: 1rem; }
#wrapper.fullscreen-mode .app-header { display: none !important; }
#wrapper.fullscreen-mode .yesr-fs-bar { display: flex; }
#wrapper.fullscreen-mode .yesr-module-subnav { top: 0; position: sticky; }

/* Module top submenu + fullscreen Home/Exit */
.yesr-fs-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    background: #0f172a;
    color: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 45;
}
.yesr-fs-home,
.yesr-fs-exit {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid rgba(248, 250, 252, 0.35);
    background: transparent;
    color: #f8fafc;
    border-radius: 0.55rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.yesr-fs-home:hover,
.yesr-fs-exit:hover {
    background: rgba(248, 250, 252, 0.1);
    color: #fff;
}
.yesr-fs-title {
    font-weight: 700;
    font-size: 0.9rem;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.yesr-module-subnav {
    position: sticky;
    top: 0;
    z-index: 35;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.45rem 1rem 0.55rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}
.yesr-module-subnav-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}
.yesr-module-subnav-label i {
    color: #0d9488;
    margin-right: 0.2rem;
}
.yesr-module-subnav-scroll {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.15rem;
    scrollbar-width: none;
}
.yesr-module-subnav-scroll::-webkit-scrollbar { display: none; }
.yesr-module-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    border: 1px solid #ccfbf1;
    background: #f0fdfa;
    color: #134e4a;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.yesr-module-chip i {
    font-size: 0.9rem;
    color: #0d9488;
}
.yesr-module-chip:hover {
    background: #ccfbf1;
    color: #115e59;
}
.yesr-module-chip.active {
    background: #0d9488;
    color: #ecfdf5;
    border-color: #0d9488;
}
.yesr-module-chip.active i { color: #ecfdf5; }

#wrapper.fullscreen-mode .yesr-module-subnav {
    top: 0;
}

/* Lock background scroll when mobile menu or manual entry overlay is open */
body.sidebar-open {
    overflow: hidden;
}

body.sidebar-open #page-content,
body.manual-entry-open .main-content {
    overflow: hidden;
}

/* Keep sidebar menu scrollable on touch devices (do NOT use touch-action:none on body) */
body.sidebar-open .sidebar,
body.sidebar-open .sidebar-nav {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

body.manual-entry-open {
    overflow: hidden;
}

body.manual-entry-open #manualMobileEntry,
body.manual-entry-open .manual-mobile-entry-body {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1040;
}

.header-icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

/* Attendance calendar */
.emp-photo-lg {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ede9fe;
}

.emp-photo-face {
    object-fit: cover;
    background: #f3f4f6;
}

.dash-day-photo-wrap {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.dash-day-photo-wrap-sm {
    width: 48px;
    height: 48px;
}

.dash-day-photo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ede9fe;
    display: block;
}

.dash-day-photo-sm {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ede9fe;
    display: block;
}

.dash-day-punch-thumb {
    position: absolute;
    right: -4px;
    bottom: -2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.dash-day-punch-thumb-sm {
    position: absolute;
    right: -3px;
    bottom: -2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

.dash-day-list[hidden],
.dash-day-cards[hidden] {
    display: none !important;
}

.emp-face-badge,
.emp-face-badge-sm,
.emp-face-badge-lg {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: 2px solid #fff;
    line-height: 1;
}

.emp-face-badge {
    right: -2px;
    bottom: -2px;
    width: 20px;
    height: 20px;
    font-size: 0.65rem;
}

.emp-face-badge-sm {
    right: -4px;
    bottom: -4px;
    width: 16px;
    height: 16px;
    font-size: 0.55rem;
}

.emp-face-badge-lg {
    right: 0;
    bottom: 0;
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
}

.emp-day-face-photo {
    width: 100%;
    max-width: 180px;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    margin: 0 auto;
}

.attn-punch-photo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    display: block;
}

.attn-punch-photo-sm {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

.attn-punch-photo-box {
    min-width: 120px;
}

.leave-day-card {
    border-left: 3px solid var(--sc-primary, #5b4cdb);
}

.payroll-steps .payroll-step {
    min-width: 100px;
    padding: 0.75rem;
    border-radius: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    text-align: center;
}
.payroll-steps .payroll-step.active {
    background: #eef2ff;
    border-color: #5b4cdb;
}
.payroll-steps .payroll-step.done {
    background: #ecfdf5;
    border-color: #059669;
}
.payroll-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}
.payroll-step.active .payroll-step-num { background: #5b4cdb; color: #fff; }
.payroll-step.done .payroll-step-num { background: #059669; color: #fff; }

/* Management dashboard month calendar */
.dash-month-weekdays,
.dash-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.dash-month-weekday {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6b7280;
    padding: 0.25rem;
}

.dash-month-cell {
    display: block;
    min-height: 78px;
    border-radius: 10px;
    padding: 0.4rem 0.45rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}

.dash-month-cell:hover:not(.empty):not(.future) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(30, 27, 75, 0.1);
    border-color: #c4b5fd;
}

.dash-month-cell.empty {
    background: transparent;
    border-color: transparent;
    pointer-events: none;
}

.dash-month-cell.today {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(91, 76, 219, 0.15);
}

.dash-month-cell.weekend { background: #fafafa; }
.dash-month-cell.future { opacity: 0.55; }

.dash-month-cell.high { background: #ecfdf5; border-color: #a7f3d0; }
.dash-month-cell.mid { background: #fffbeb; border-color: #fde68a; }
.dash-month-cell.low { background: #fef2f2; border-color: #fecaca; }

.dash-month-day {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.15rem;
}

.dash-month-stat {
    font-size: 0.62rem;
    line-height: 1.35;
}

.dash-month-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 999px;
    margin-top: 0.35rem;
    overflow: hidden;
}

.dash-month-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #10b981, #5b4cdb);
    border-radius: 999px;
}

.dash-month-legend {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    margin-right: 0.35rem;
    vertical-align: middle;
}

.dash-month-legend.high { background: #a7f3d0; }
.dash-month-legend.mid { background: #fde68a; }
.dash-month-legend.low { background: #fecaca; }

.att-cal-cell-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s, box-shadow 0.12s;
}

.att-cal-cell-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(30, 27, 75, 0.08);
}

.att-cal-cell-link.st-present:hover { border-color: #6ee7b7; }
.att-cal-cell-link.st-late:hover { border-color: #fcd34d; }
.att-cal-cell-link.st-absent:hover { border-color: #fca5a5; }

.emp-contact-actions {
    display: inline-flex;
    gap: 0.35rem;
}

.emp-contact-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.emp-contact-sm .emp-contact-btn {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
}

.emp-edit-photo {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ede9fe;
    background: #f3f4f6;
}

.face-bulk-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ede9fe;
    flex-shrink: 0;
    background: #f3f4f6;
}

.face-bulk-queue-photo {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    flex-shrink: 0;
    background: #f3f4f6;
}

.face-bulk-queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    cursor: pointer;
    transition: background 0.12s;
}

.face-bulk-queue-item:hover { background: #f9fafb; }
.face-bulk-queue-item.active { background: #eff6ff; border-left: 3px solid var(--primary); }
.face-bulk-queue-item.is-done { opacity: 0.92; }

.att-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.att-cal-header div {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #6b7280;
    padding: 0.35rem;
}

.att-cal-cell {
    min-height: 72px;
    border-radius: 10px;
    padding: 0.35rem 0.4rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    font-size: 0.7rem;
}

.att-cal-cell.other-month { opacity: 0.35; }
.att-cal-cell.out-range { opacity: 0.5; }

.att-cal-day-num { font-weight: 700; font-size: 0.8rem; display: block; }
.att-cal-hours { display: block; font-weight: 600; color: var(--primary); margin-top: 0.15rem; }
.att-cal-times { display: block; color: #6b7280; font-size: 0.65rem; }
.att-cal-status { display: block; margin-top: 0.2rem; font-size: 0.65rem; }

.att-cal-cell.st-present { background: #ecfdf5; border-color: #a7f3d0; }
.att-cal-cell.st-late { background: #fffbeb; border-color: #fde68a; }
.att-cal-cell.st-absent { background: #fef2f2; border-color: #fecaca; }
.att-cal-cell.st-leave { background: #eff6ff; border-color: #bfdbfe; }
.att-cal-cell.st-off { background: #f3f4f6; border-color: #e5e7eb; }
.att-cal-cell.st-half { background: #fef3c7; border-color: #fcd34d; }

.att-cal-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.att-cal-week-cell {
    border-radius: var(--radius);
    padding: 0.75rem;
    background: #fff;
    box-shadow: var(--card-shadow);
    text-align: center;
    min-height: 120px;
}

.att-cal-week-cell.st-present { border-top: 3px solid var(--accent); }
.att-cal-week-cell.st-late { border-top: 3px solid var(--warning); }
.att-cal-week-cell.st-absent { border-top: 3px solid var(--danger); }
.att-cal-week-cell.st-leave { border-top: 3px solid #3b82f6; }
.att-cal-week-cell.st-off { border-top: 3px solid #9ca3af; }

.att-cal-week-head { font-weight: 700; margin-bottom: 0.35rem; }

.att-cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    color: #6b7280;
}

.att-cal-legend .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.35rem;
    vertical-align: middle;
}

.att-cal-legend .dot.present { background: #10b981; }
.att-cal-legend .dot.late { background: #f59e0b; }
.att-cal-legend .dot.absent { background: #ef4444; }
.att-cal-legend .dot.leave { background: #3b82f6; }
.att-cal-legend .dot.off { background: #9ca3af; }

/* Payout flow */
.payout-shell {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: calc(100dvh - 7rem);
    padding-bottom: 5.25rem;
}
.payout-shell.payout-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: var(--body-bg);
    padding: 0.65rem 0.85rem 5.5rem;
    overflow: hidden;
    min-height: 100dvh;
    height: 100dvh;
}

/* Modal must sit above fullscreen payout shell (1040) and backdrop */
body:has(.payout-shell.payout-fullscreen) .modal-backdrop { z-index: 1065; }
body:has(.payout-shell.payout-fullscreen) .modal { z-index: 1070; }

.payout-toolbar { flex: 0 0 auto; }
.payout-fs-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.payout-shell.payout-fullscreen .payout-fs-btn {
    position: sticky;
    top: 0;
    z-index: 5;
}

.payout-summary-strip {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.65rem;
    padding: 0.45rem 0.65rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    box-shadow: var(--card-shadow);
}
.payout-sum-item {
    display: flex;
    flex-direction: column;
    min-width: 3.5rem;
    line-height: 1.15;
}
.payout-sum-item span {
    font-size: 0.58rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #94a3b8;
    font-weight: 600;
}
.payout-sum-item strong {
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
}
.payout-sum-final {
    padding: 0.15rem 0.45rem;
    border-radius: 0.4rem;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}
.payout-sum-final strong { color: #047857; font-size: 1rem; }
.payout-details-toggle {
    margin-left: auto;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.payout-details-panel {
    flex: 0 0 auto;
    max-height: 32vh;
    overflow: auto;
}

.payout-stat {
    background: #fff;
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
    box-shadow: var(--card-shadow);
    font-size: 0.8rem;
}
.payout-stat span { display: block; color: #6b7280; font-size: 0.68rem; text-transform: uppercase; }
.payout-stat strong { font-size: 0.95rem; }

.payout-grid-wrap {
    flex: 1 1 auto;
    min-height: 12rem;
    max-height: none;
    overflow: auto;
    display: flex;
    flex-direction: column;
}
.payout-shell:not(.payout-fullscreen) .payout-grid-wrap {
    max-height: calc(100dvh - 18rem);
}
.payout-fullscreen .payout-grid-wrap {
    flex: 1 1 auto;
    min-height: 0;
}
.payout-grid-wrap .table-responsive {
    flex: 1 1 auto;
    overflow: auto;
    min-height: 0;
}

/* Bottom action menu */
.payout-bottom-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem calc(0.45rem + env(safe-area-inset-bottom, 0));
    background: rgba(15, 23, 42, 0.97);
    color: #f8fafc;
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(8px);
}
.platform-shell #wrapper:not(.fullscreen-mode) .payout-bottom-dock {
    left: var(--sidebar-width, 0px);
}
.payout-dock-nav,
.payout-dock-actions {
    display: flex;
    align-items: stretch;
    gap: 0.25rem;
}
.payout-dock-pay {
    flex: 1 1 auto;
    min-width: 5.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0 0.5rem;
    border-left: 1px solid rgba(148, 163, 184, 0.35);
    border-right: 1px solid rgba(148, 163, 184, 0.35);
}
.payout-dock-pay span {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
    line-height: 1.1;
}
.payout-dock-pay strong {
    font-size: 1.05rem;
    font-weight: 800;
    color: #6ee7b7;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.payout-dock-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.05rem;
    min-width: 3.4rem;
    padding: 0.35rem 0.5rem;
    border: 0;
    border-radius: 0.55rem;
    background: rgba(255,255,255,0.08);
    color: #f1f5f9;
    text-decoration: none;
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1.1;
    cursor: pointer;
}
.payout-dock-btn i { font-size: 1.05rem; line-height: 1; }
.payout-dock-btn:hover { background: rgba(255,255,255,0.16); color: #fff; }
.payout-dock-btn.disabled,
.payout-dock-btn:disabled {
    opacity: 0.4;
    pointer-events: none;
}
.payout-dock-confirm { background: rgba(16, 185, 129, 0.22); color: #a7f3d0; }
.payout-dock-confirm-next { background: rgba(16, 185, 129, 0.4); color: #d1fae5; min-width: 4rem; }
.payout-dock-save { background: rgba(59, 130, 246, 0.28); color: #bfdbfe; }
.payout-dock-save-next { background: rgba(59, 130, 246, 0.45); color: #dbeafe; min-width: 3.75rem; }
.payout-bottom-dock .dropdown-menu { font-size: 0.85rem; }

/* Month list sticky footer */
.payout-month-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.96);
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.1);
}
.payout-month-footer .payout-month-progress {
    font-size: 0.85rem;
    color: #64748b;
}
.payout-month-footer .payout-month-progress strong { color: #0f172a; }
.payout-page-toolbar .dropdown-menu { min-width: 12rem; }

@media (max-width: 767.98px) {
    .payout-fs-label { display: none; }
    .payout-sum-item:nth-child(n+6):not(.payout-sum-final) { display: none; }
    .payout-dock-btn { min-width: 2.85rem; padding: 0.3rem 0.28rem; }
    .payout-dock-btn span { font-size: 0.56rem; }
    .payout-dock-pay strong { font-size: 0.95rem; }
}

.payout-grid { font-size: 0.78rem; }
.payout-grid thead th {
    position: sticky;
    top: 0;
    background: #f9fafb;
    z-index: 2;
    white-space: nowrap;
}
.payout-grid .payout-inp { min-width: 64px; max-width: 80px; padding: 0.2rem 0.35rem; }
.payout-grid .payout-time-in,
.payout-grid .payout-time-out { min-width: 88px; max-width: 96px; padding: 0.2rem 0.35rem; }
.payout-mode-toggle .btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.payout-grid tr.row-frozen { opacity: 0.65; }
.payout-grid tr.row-verified { background: #f0fdf4; }
.payout-grid tr.row-editing { background: #fff7ed; }
.payout-grid tr.row-clickable { cursor: pointer; }
.payout-grid tr.row-clickable:hover { background: #eff6ff; }
.payout-grid .btn-edit-day { min-width: 32px; }
.payout-grid tr.row-editing td { border-top: 1px solid #fed7aa; }
.payout-grid tr.row-extra { background: #f0fdfa; }
.payout-grid tr.row-extra td:first-child { box-shadow: inset 3px 0 0 #0f766e; }

.payout-policy-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
    border: 1px solid #e2e8f0;
}
.payout-stat-final {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 0.5rem;
}
.payout-stat-final strong { color: #047857; font-size: 1.1rem; }

/* Manual attendance grid */
.manual-page {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 8rem);
}

.manual-grid-wrap {
    max-height: calc(100dvh - 260px);
    overflow: auto;
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 14rem;
}

.manual-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.manual-kpi {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    padding: 0.85rem 1rem;
    border: 1px solid transparent;
}

.manual-kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
    margin-bottom: 0.15rem;
}

.manual-kpi-value {
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.manual-kpi-ok .manual-kpi-value { color: #047857; }
.manual-kpi-warn .manual-kpi-value { color: #b45309; }

.manual-kpi-progress {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.manual-progress-track {
    height: 8px;
    background: #e5e7eb;
    border-radius: 999px;
    overflow: hidden;
}

.manual-progress-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.manual-toolbar .manual-date-nav {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    align-items: center;
}

.manual-toolbar .manual-date-nav input[type="date"] {
    width: auto;
    min-width: 9.5rem;
    flex: 1 1 auto;
}

.manual-empty {
    border: 1px dashed #d1d5db;
}

.manual-grid-wrap .table-responsive {
    flex: 1 1 auto;
    overflow: auto;
    min-height: 0;
}

.manual-grid {
    font-size: 0.82rem;
}

.manual-grid thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
    padding: 0.65rem 0.5rem;
    box-shadow: 0 1px 0 #e2e8f0;
}

.manual-grid tbody td {
    padding: 0.55rem 0.5rem;
    vertical-align: middle;
    border-color: #f1f5f9;
}

.manual-grid .manual-col-emp { min-width: 11.5rem; max-width: 16rem; }
.manual-grid .manual-col-shift { min-width: 7.5rem; }
.manual-grid .manual-col-time { min-width: 8.5rem; }
.manual-grid .manual-col-status { min-width: 6.5rem; }
.manual-grid .manual-col-act { width: 3rem; }

.manual-grid input[type="time"],
.manual-grid input.manual-in,
.manual-grid input.manual-out { min-width: 72px; max-width: 88px; padding: 0.2rem 0.35rem; }
.manual-grid select.manual-status,
.manual-grid select.manual-shift { min-width: 100px; font-size: 0.78rem; }

.manual-grid tr.row-frozen { opacity: 0.72; }
.manual-grid tr.row-dirty {
    background: #fffbeb !important;
    box-shadow: inset 3px 0 0 #f59e0b;
}
.manual-grid tr.row-marked:not(.row-dirty) {
    background: #f8fffb;
}
.manual-grid tr.manual-row:hover {
    background: #f8fafc;
}
.manual-grid tr.row-dirty:hover {
    background: #fef3c7 !important;
}

.manual-frozen-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: #b45309;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    padding: 0.05rem 0.4rem;
    margin-top: 0.15rem;
}

.btn-save-row {
    min-width: 2rem;
    padding: 0.2rem 0.45rem;
}

.tabular-nums { font-variant-numeric: tabular-nums; }

.manual-grid-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.65rem 0.85rem;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.manual-grid .time-picker .form-select {
    font-size: 0.75rem;
}

@media (max-width: 991.98px) {
    .manual-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .manual-grid-wrap { max-height: none; }
}

@media (max-width: 575.98px) {
    .manual-kpi-row { grid-template-columns: 1fr 1fr; }
    .manual-kpi-progress { grid-column: 1 / -1; }
}
