/* ================= HRMS Pro - theme ================= */
:root {
    --brand: #4f46e5;
    --brand-2: #7c3aed;
    --sidebar-w: 260px;
    --topbar-h: 60px;
    --radius: 14px;
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color: #4f46e5;
    --bs-link-color-rgb: 79, 70, 229;
    --bs-body-font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-orange-rgb: 249, 115, 22;
}
[data-bs-theme=light] { --bs-body-bg: #f4f6fb; --card-bg: #fff; --muted-bg: #f8f9fc; }
[data-bs-theme=dark] { --bs-body-bg: #0f1221; --card-bg: #171a2e; --muted-bg: #1d2138; --bs-border-color: #2a2f4a; }

body { font-size: .92rem; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca; --bs-btn-active-bg: #3730a3; }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); }
.progress-bar { background-color: var(--brand); }
.text-bg-orange, .bg-orange { background: #f97316 !important; color: #fff !important; }
.text-orange { color: #f97316 !important; }

/* ---------- layout ---------- */
.app { min-height: 100vh; }
.sidebar {
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
    color: #c7d2fe;
    width: var(--sidebar-w);
}
@media (min-width: 992px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; overflow-y: auto; z-index: 1030; }
    .main { margin-left: var(--sidebar-w); }
}
.sidebar-brand { display: flex; align-items: center; height: var(--topbar-h); padding: 0 1.1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(135deg, #818cf8, #c084fc); color: #fff; font-size: 1.2rem; }
.brand-text { color: #fff; font-size: 1.15rem; letter-spacing: .3px; }
.sidebar-nav { padding: .75rem .65rem 2rem; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav .nav-title { font-size: .68rem; text-transform: uppercase; letter-spacing: 1px; color: #818cf8; padding: 1rem .75rem .35rem; font-weight: 600; }
.sidebar-nav .nav-link { color: #c7d2fe; border-radius: 10px; padding: .55rem .75rem; display: flex; align-items: center; gap: .7rem; font-weight: 500; }
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav .nav-link.active { background: rgba(255,255,255,.14); color: #fff; box-shadow: inset 3px 0 0 #a5b4fc; }

.topbar {
    position: sticky; top: 0; z-index: 1020; height: var(--topbar-h);
    display: flex; align-items: center; gap: .5rem; padding: 0 1rem;
    background: color-mix(in srgb, var(--bs-body-bg) 85%, transparent);
    backdrop-filter: blur(10px); border-bottom: 1px solid var(--bs-border-color);
}
.page-title { font-weight: 600; font-size: 1.05rem; }
.btn-icon { width: 40px; height: 40px; border-radius: 10px; display: inline-grid; place-items: center; border: 0; }
.btn-icon:hover { background: var(--muted-bg); }
.btn-user { border: 0; display: flex; align-items: center; border-radius: 30px; padding: 4px 10px 4px 4px; }
.btn-user:hover { background: var(--muted-bg); }
.content { padding: 1.25rem; max-width: 1500px; }
@media (max-width: 991.98px) { .content { padding: .9rem .8rem 90px; } }

/* ---------- bottom nav (mobile) ---------- */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1040; height: 66px;
    display: flex; justify-content: space-around; align-items: center;
    background: var(--card-bg); border-top: 1px solid var(--bs-border-color);
    padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 20px rgba(0,0,0,.06);
}
.bottom-nav a { flex: 1; text-align: center; color: var(--bs-secondary-color); text-decoration: none; font-size: .68rem; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bottom-nav a i { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--brand); font-weight: 600; }
.bottom-nav .punch-fab { flex: 0 0 auto; width: 58px; height: 58px; margin-top: -30px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff !important; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(79,70,229,.45); border: 4px solid var(--bs-body-bg); }
.bottom-nav .punch-fab i { font-size: 1.6rem; }

/* ---------- cards ---------- */
.card { border: 1px solid var(--bs-border-color); border-radius: var(--radius); background: var(--card-bg); box-shadow: 0 1px 3px rgba(16,24,40,.04); }
.card-header { background: transparent; border-bottom: 1px solid var(--bs-border-color); padding: .85rem 1.1rem; font-weight: 600; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card-body { padding: 1.1rem; }
.stat-card { padding: 1rem 1.1rem; display: flex; flex-direction: row; align-items: center; gap: .9rem; height: 100%; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .78rem; color: var(--bs-secondary-color); font-weight: 500; }
.bg-soft-primary { background: rgba(79,70,229,.12); color: #4f46e5; }
.bg-soft-success { background: rgba(34,197,94,.12); color: #16a34a; }
.bg-soft-danger { background: rgba(239,68,68,.12); color: #dc2626; }
.bg-soft-warning { background: rgba(245,158,11,.14); color: #d97706; }
.bg-soft-info { background: rgba(14,165,233,.12); color: #0284c7; }
.bg-soft-secondary { background: rgba(100,116,139,.12); color: #64748b; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h4 { margin: 0; font-weight: 700; }
.page-head .sub { color: var(--bs-secondary-color); font-size: .85rem; }

/* ---------- tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--bs-secondary-color); font-weight: 600; background: var(--muted-bg); border-bottom: 1px solid var(--bs-border-color); white-space: nowrap; }
.table td, .table th { padding: .65rem .8rem; vertical-align: middle; }
.table-hover tbody tr:hover { --bs-table-hover-bg: var(--muted-bg); }

/* Mobile par table -> cards */
@media (max-width: 767.98px) {
    .table-mobile thead { display: none; }
    .table-mobile, .table-mobile tbody, .table-mobile tr, .table-mobile td { display: block; width: 100%; }
    .table-mobile tr { border: 1px solid var(--bs-border-color); border-radius: 12px; margin-bottom: .65rem; padding: .4rem .2rem; background: var(--card-bg); }
    .table-mobile td { border: 0; padding: .3rem .75rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
    .table-mobile td::before { content: attr(data-label); font-weight: 600; color: var(--bs-secondary-color); font-size: .75rem; text-align: left; }
    .table-mobile td[data-label=""]::before { content: none; }
    .card .table-mobile { padding: .5rem; }
}

/* ---------- misc ---------- */
.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 600; background: linear-gradient(135deg, #818cf8, #c084fc); color: #fff; flex-shrink: 0; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; font-size: .8rem; }
.avatar-lg { width: 84px; height: 84px; font-size: 1.8rem; }
.badge { font-weight: 600; }
.form-label { font-weight: 500; font-size: .82rem; margin-bottom: .3rem; }
.form-control, .form-select { border-radius: 10px; }
.btn { border-radius: 10px; font-weight: 500; }
.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; }
.filter-bar > * { min-width: 140px; }
@media (max-width: 575.98px) { .filter-bar > * { flex: 1 1 45%; min-width: 0; } }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--bs-secondary-color); }
.empty i { font-size: 2.5rem; display: block; margin-bottom: .5rem; opacity: .5; }

/* status pills */
.st { display: inline-block; min-width: 30px; padding: 2px 6px; border-radius: 6px; font-size: .72rem; font-weight: 700; text-align: center; }
.st-P { background: #dcfce7; color: #15803d; } .st-A { background: #fee2e2; color: #b91c1c; }
.st-HD { background: #fef3c7; color: #b45309; } .st-L, .st-HL { background: #e0f2fe; color: #0369a1; }
.st-H { background: #ede9fe; color: #6d28d9; } .st-WO { background: #f1f5f9; color: #64748b; }
.st-MP { background: #ffedd5; color: #c2410c; }
[data-bs-theme=dark] .st { filter: brightness(.85) saturate(1.2); }

/* muster grid */
.muster { font-size: .75rem; }
.muster th, .muster td { padding: .35rem .3rem !important; text-align: center; }
.muster td.name, .muster th.name { text-align: left; position: sticky; left: 0; background: var(--card-bg); z-index: 1; min-width: 160px; }

/* punch screen */
.punch-hero { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-radius: 20px; padding: 1.5rem; text-align: center; position: relative; overflow: hidden; }
.punch-clock { font-size: 2.6rem; font-weight: 700; letter-spacing: 1px; }
.punch-btn { width: 160px; height: 160px; border-radius: 50%; border: 0; font-size: 1.1rem; font-weight: 700; color: var(--brand); background: #fff; box-shadow: 0 0 0 12px rgba(255,255,255,.18), 0 0 0 24px rgba(255,255,255,.08); transition: transform .15s; }
.punch-btn:active { transform: scale(.95); }
.punch-btn i { font-size: 3rem; display: block; }
.punch-btn.out { color: #dc2626; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: .7rem; font-weight: 600; color: var(--bs-secondary-color); }
.cal .day { border-radius: 10px; min-height: 64px; padding: 6px; background: var(--muted-bg); font-size: .72rem; display: flex; flex-direction: column; gap: 2px; }
.cal .day .n { font-weight: 700; font-size: .85rem; }
.cal .day.today { outline: 2px solid var(--brand); }
@media (max-width: 575.98px) { .cal .day { min-height: 48px; padding: 4px; } .cal .day .t { display: none; } }

.list-tile { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px dashed var(--bs-border-color); }
.list-tile:last-child { border-bottom: 0; }

.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: linear-gradient(135deg, #1e1b4b, #4f46e5 60%, #7c3aed); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: center; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 2rem; }
@media (max-width: 991.98px) { .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; } }

@media print {
    .sidebar, .topbar, .bottom-nav, .no-print { display: none !important; }
    .main { margin: 0 !important; } .content { padding: 0 !important; }
    .card { border: 0; box-shadow: none; }
    body { background: #fff !important; }
}
a { text-decoration: none; } a:hover { text-decoration: underline; }
.nav-pills { --bs-nav-pills-link-active-bg: var(--brand); --bs-nav-link-color: var(--bs-body-color); --bs-nav-link-hover-color: var(--brand); }
.nav-pills .nav-link { border-radius: 10px; }
