/* ===== IASH Presensi — modern theme (di atas Bootstrap 5) ===== */
:root {
    --brand: #4f46e5;
    --brand-600: #4338ca;
    --brand-50: #eef2ff;
    --navy: #0f172a;
    --ink: #1e293b;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f5f7fb;
    --card: #ffffff;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.06);
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79,70,229;
    --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-color: #1e293b;
    --bs-link-color: #4f46e5;
    --bs-link-hover-color: #4338ca;
}
body { background: var(--bg); font-size: .925rem; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5,h6 { font-weight: 700; letter-spacing: -.02em; color: var(--ink); }

/* Page header */
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-head h4 { margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: .875rem; }

/* Cards */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card); }
.card-header { background: transparent !important; border-bottom: 1px solid var(--line); padding: 1rem 1.25rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.card > .table-responsive:first-child, .card > .table-responsive:last-child { border-radius: var(--radius); }
.card-body.border-bottom { border-color: var(--line) !important; }

/* Tables */
.table { --bs-table-hover-bg: #f8fafc; margin: 0; }
.table > :not(caption) > * > * { padding: .85rem 1rem; border-color: var(--line); }
.table thead th, .table-light th {
    background: #f8fafc !important; color: var(--muted); font-size: .72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table-sm > :not(caption) > * > * { padding: .6rem 1rem; }

/* Buttons */
.btn { border-radius: 10px; font-weight: 600; padding: .5rem 1rem; transition: all .15s; }
.btn-sm { border-radius: 8px; padding: .3rem .65rem; font-size: .8rem; }
.btn-lg { border-radius: 12px; padding: .8rem 1.4rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); box-shadow: 0 4px 12px rgba(79,70,229,.25); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-600); border-color: var(--brand-600); transform: translateY(-1px); }
.btn-light { background: #f1f5f9; border-color: #f1f5f9; }
.btn-secondary { background: #334155; border-color: #334155; }
.btn-outline-primary { color: var(--brand); border-color: #c7d2fe; }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-outline-success, .btn-outline-danger, .btn-outline-dark, .btn-outline-secondary { border-color: var(--line); background: #fff; }
.btn-outline-success { color: #059669; } .btn-outline-success:hover { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.btn-outline-danger { color: #e11d48; } .btn-outline-danger:hover { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.btn-outline-dark { color: #334155; } .btn-outline-dark:hover { background: #f1f5f9; color: #0f172a; border-color: #cbd5e1; }
.btn-success { background: #10b981; border-color: #10b981; box-shadow: 0 4px 12px rgba(16,185,129,.25); }
.btn-danger { background: #f43f5e; border-color: #f43f5e; box-shadow: 0 4px 12px rgba(244,63,94,.25); }
.btn:disabled { box-shadow: none; }

/* Forms */
.form-control, .form-select { border-radius: 10px; border-color: var(--line); padding: .6rem .9rem; background-color: #fff; }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(79,70,229,.12); }
.form-label { font-weight: 600; font-size: .82rem; color: #334155; margin-bottom: .35rem; }
.form-text { font-size: .78rem; color: var(--muted); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.input-icon .form-control { padding-left: 2.6rem; }

/* Select2 */
.select2-container--bootstrap-5 .select2-selection { border-radius: 10px; border-color: var(--line); min-height: calc(1.5em + 1.2rem + 2px); padding: .55rem .9rem; }
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection { border-color: #a5b4fc; box-shadow: 0 0 0 4px rgba(79,70,229,.12); }
.select2-container--bootstrap-5 .select2-dropdown { border-color: var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted { background: var(--brand-50); color: var(--brand-600); }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--selected { background: var(--brand); color: #fff; }

/* Soft badges */
.badge { font-weight: 600; padding: .4em .7em; border-radius: 999px; font-size: .72rem; letter-spacing: .01em; }
.badge.bg-success { background: #dcfce7 !important; color: #15803d !important; }
.badge.bg-danger { background: #ffe4e6 !important; color: #be123c !important; }
.badge.bg-secondary { background: #f1f5f9 !important; color: #475569 !important; }
.badge.bg-warning { background: #fef3c7 !important; color: #b45309 !important; }
.badge.bg-info { background: #e0f2fe !important; color: #0369a1 !important; }
.badge.bg-light { background: #f8fafc !important; color: #64748b !important; border: 1px solid var(--line); }
.badge.bg-primary { background: var(--brand-50) !important; color: var(--brand-600) !important; }

/* Alerts */
.alert { border: 0; border-radius: 12px; padding: .9rem 1.1rem; font-weight: 500; }
.alert-success { background: #ecfdf5; color: #047857; }
.alert-danger { background: #fff1f2; color: #be123c; }
.alert-warning { background: #fffbeb; color: #b45309; }

/* Pagination */
.pagination { gap: 4px; }
.page-link { border-radius: 8px !important; border: 1px solid var(--line); color: #334155; }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); }

/* Avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6); flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; font-size: .7rem; }

/* ===== Top navbar (aplikasi pegawai) ===== */
.topbar { background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line); }
.topbar .navbar-brand { font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.topbar .nav-link { color: var(--muted); font-weight: 600; border-radius: 10px; padding: .5rem .9rem !important; margin: 0 2px; }
.topbar .nav-link:hover { color: var(--ink); background: #f1f5f9; }
.topbar .nav-link.active { color: var(--brand); background: var(--brand-50); }
.dropdown-menu { border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(15,23,42,.1); padding: 6px; }
.dropdown-item { border-radius: 8px; padding: .5rem .75rem; font-weight: 500; }

/* ===== Stat cards ===== */
.stat { display: flex; gap: 14px; align-items: center; }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.stat-label { color: var(--muted); font-size: .78rem; font-weight: 600; }
.stat-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; color: var(--ink); }
.ic-indigo { background: #eef2ff; color: #4f46e5; } .ic-green { background: #ecfdf5; color: #059669; }
.ic-amber { background: #fffbeb; color: #d97706; } .ic-rose { background: #fff1f2; color: #e11d48; }
.ic-sky { background: #f0f9ff; color: #0284c7; } .ic-violet { background: #f5f3ff; color: #7c3aed; }

/* ===== Clock hero (absensi) ===== */
.clock-hero { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%); color: #fff; border: 0; position: relative; overflow: hidden; }
.clock-hero::after { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,.08); right: -80px; top: -90px; }
.clock-hero .time { font-size: 2.8rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.clock-hero .chip { background: rgba(255,255,255,.16); border-radius: 12px; padding: .6rem .9rem; }
.clock-hero .chip small { opacity: .75; display: block; font-size: .72rem; }
.clock-hero .chip b { font-size: 1.15rem; }
.clock-hero .btn { position: relative; z-index: 1; }
.btn-clock-in { background: #fff; color: #4f46e5; border: 0; }
.btn-clock-in:hover { background: #eef2ff; color: #4338ca; }
.btn-clock-out { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.btn-clock-out:hover { background: rgba(255,255,255,.25); color: #fff; }

/* ===== Admin sidebar ===== */
.sidebar { width: 260px; min-height: 100vh; background: var(--navy); position: fixed; inset: 0 auto 0 0; z-index: 1040; transition: left .2s; display: flex; flex-direction: column; }
.sidebar .brand { padding: 20px; display: flex; align-items: center; gap: 10px; }
.sidebar .brand img { height: 34px; background: #fff; border-radius: 8px; padding: 3px 6px; }
.sidebar .brand span { color: #fff; font-weight: 800; letter-spacing: -.02em; }
.sidebar .brand small { color: #94a3b8; display: block; font-size: .72rem; font-weight: 500; }
.sidebar .label { color: #64748b; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 18px 24px 6px; }
.sidebar .nav-link { color: #cbd5e1; margin: 2px 12px; padding: .6rem .9rem; border-radius: 10px; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.sidebar .nav-link i { font-size: 1.05rem; opacity: .85; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.35); }
.sidebar .side-foot { margin-top: auto; padding: 16px; border-top: 1px solid rgba(255,255,255,.06); }
.admin-content { margin-left: 260px; min-height: 100vh; }
.admin-header { background: rgba(255,255,255,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); padding: .8rem 1.5rem; position: sticky; top: 0; z-index: 1020; }
.sidebar-backdrop { display: none; }
@media (max-width: 991px) {
    .sidebar { left: -260px; } .sidebar.show { left: 0; }
    .sidebar.show + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 1035; }
    .admin-content { margin-left: 0; }
}

/* ===== Login ===== */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: linear-gradient(145deg, #0f172a 0%, #312e81 55%, #4f46e5 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::before { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; background: rgba(255,255,255,.06); right: -120px; bottom: -140px; }
.auth-side::after { content: ''; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.05); left: -60px; top: 30%; }
.auth-side h1 { color: #fff; font-size: 2.4rem; font-weight: 800; line-height: 1.15; }
.auth-side .feat { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; position: relative; z-index: 1; }
.auth-side .feat i { background: rgba(255,255,255,.12); border-radius: 10px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: #fff; }
.auth-form .inner { width: 100%; max-width: 380px; }
@media (max-width: 991px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } .auth-form { background: var(--bg); } .auth-form .inner { background: #fff; padding: 28px; border-radius: 20px; box-shadow: var(--shadow); } }

/* Empty state */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty i { font-size: 2rem; display: block; margin-bottom: .5rem; color: #cbd5e1; }

/* ===== Theme toggle ===== */
.theme-toggle { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
    color: var(--ink); display: inline-flex; align-items: center; justify-content: center; transition: all .15s; }
.theme-toggle:hover { background: var(--brand-50); color: var(--brand); }
.theme-toggle .bi-sun { display: none; }
[data-bs-theme="dark"] .theme-toggle .bi-sun { display: inline; }
[data-bs-theme="dark"] .theme-toggle .bi-moon-stars { display: none; }
.theme-float { position: fixed; top: 16px; right: 16px; z-index: 1050; }

/* ===== DARK MODE ===== */
[data-bs-theme="dark"] {
    --bg: #0b1120;
    --card: #111827;
    --line: #1f2937;
    --ink: #e5e7eb;
    --muted: #94a3b8;
    --brand: #6366f1;
    --brand-600: #818cf8;
    --brand-50: rgba(99,102,241,.15);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    --bs-body-bg: #0b1120;
    --bs-body-color: #e5e7eb;
    --bs-secondary-color: #94a3b8;
    --bs-border-color: #1f2937;
    --bs-link-color: #818cf8;
    --bs-link-hover-color: #a5b4fc;
    color-scheme: dark;
}
[data-bs-theme="dark"] body { background: var(--bg); }
[data-bs-theme="dark"] .text-dark { color: var(--ink) !important; }
[data-bs-theme="dark"] .text-muted, [data-bs-theme="dark"] .text-secondary { color: var(--muted) !important; }
[data-bs-theme="dark"] .table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-hover-bg: rgba(255,255,255,.03); --bs-table-hover-color: var(--ink); }
[data-bs-theme="dark"] .table thead th, [data-bs-theme="dark"] .table-light th { background: #0f172a !important; }
[data-bs-theme="dark"] .topbar, [data-bs-theme="dark"] .admin-header { background: rgba(17,24,39,.85); }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { background-color: #0f172a; color: var(--ink); }
[data-bs-theme="dark"] .form-control::placeholder { color: #64748b; }
[data-bs-theme="dark"] .form-label { color: #cbd5e1; }
[data-bs-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-bs-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(1); }
[data-bs-theme="dark"] .btn-light { background: #1f2937; border-color: #1f2937; color: var(--ink); }
[data-bs-theme="dark"] .btn-outline-success, [data-bs-theme="dark"] .btn-outline-danger,
[data-bs-theme="dark"] .btn-outline-dark, [data-bs-theme="dark"] .btn-outline-secondary,
[data-bs-theme="dark"] .btn-outline-primary { background: transparent; border-color: #334155; }
[data-bs-theme="dark"] .btn-outline-dark { color: #cbd5e1; }
[data-bs-theme="dark"] .btn-outline-dark:hover { background: #1f2937; color: #fff; }
[data-bs-theme="dark"] .btn-outline-primary { color: #a5b4fc; }
[data-bs-theme="dark"] .btn-outline-success:hover { background: rgba(16,185,129,.12); color: #34d399; }
[data-bs-theme="dark"] .btn-outline-danger:hover { background: rgba(244,63,94,.12); color: #fb7185; }
[data-bs-theme="dark"] .badge.bg-success { background: rgba(34,197,94,.15) !important; color: #4ade80 !important; }
[data-bs-theme="dark"] .badge.bg-danger { background: rgba(244,63,94,.15) !important; color: #fb7185 !important; }
[data-bs-theme="dark"] .badge.bg-warning { background: rgba(245,158,11,.15) !important; color: #fbbf24 !important; }
[data-bs-theme="dark"] .badge.bg-info { background: rgba(14,165,233,.15) !important; color: #38bdf8 !important; }
[data-bs-theme="dark"] .badge.bg-secondary, [data-bs-theme="dark"] .badge.bg-light { background: #1f2937 !important; color: #94a3b8 !important; border-color: #334155; }
[data-bs-theme="dark"] .badge.bg-primary { color: #a5b4fc !important; }
[data-bs-theme="dark"] .alert-success { background: rgba(16,185,129,.12); color: #34d399; }
[data-bs-theme="dark"] .alert-danger { background: rgba(244,63,94,.12); color: #fb7185; }
[data-bs-theme="dark"] .alert-warning { background: rgba(245,158,11,.12); color: #fbbf24; }
[data-bs-theme="dark"] .page-link { background: var(--card); color: var(--ink); border-color: var(--line); }
[data-bs-theme="dark"] .dropdown-menu { background: var(--card); }
[data-bs-theme="dark"] .ic-indigo, [data-bs-theme="dark"] .ic-green, [data-bs-theme="dark"] .ic-amber,
[data-bs-theme="dark"] .ic-rose, [data-bs-theme="dark"] .ic-sky, [data-bs-theme="dark"] .ic-violet { background: rgba(255,255,255,.05); }
[data-bs-theme="dark"] .auth-form { background: var(--bg); }
[data-bs-theme="dark"] .auth-form .inner { background: transparent; }
@media (max-width: 991px) { [data-bs-theme="dark"] .auth-form .inner { background: var(--card); } }
[data-bs-theme="dark"] [style*="background:#f8fafc"] { background: #0f172a !important; }
[data-bs-theme="dark"] .empty i { color: #334155; }
[data-bs-theme="dark"] .navbar-toggler { color: var(--ink); }
/* Select2 */
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection { background-color: #0f172a; border-color: var(--line); }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { color: var(--ink); }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown { background: var(--card); border-color: var(--line); color: var(--ink); }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field { background: #0f172a; color: var(--ink); border-color: var(--line); }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option[aria-disabled=true] { color: #475569; }
