/*
 * Rinjani UI — tema mobile-first (kompak, 1 layar, PWA).
 *
 * Dimuat SETELAH css/app.css. Semua aturan di-scope ke `body.rj` supaya
 * spesifisitasnya menang atas utility Tailwind CDN yang disuntik belakangan,
 * tanpa perlu !important di mana-mana. View lama TIDAK perlu diubah satu per
 * satu: input, tombol, kartu, tabel, dan filter otomatis ikut tampil baru.
 */

:root {
    --rj-navy: #0a2540;
    --rj-navy-2: #0c3a5c;
    --rj-navy-3: #0b4f7a;
    --rj-brand: #0b6e99;
    --rj-brand-2: #1a8bb5;
    --rj-brand-50: #eaf5fa;
    --rj-brand-100: #d3eaf3;
    --rj-gold: #e3a82b;
    --rj-ink: #0f1d2e;
    --rj-muted: #64748b;
    --rj-line: #e2e8f0;
    --rj-bg: #f2f5f9;
    --rj-ok: #0f9d6b;
    --rj-bad: #d6455d;
    --rj-r: 12px;
    --rj-appbar-h: 50px;
    --rj-bnav-h: 58px;
    --rj-safe-b: env(safe-area-inset-bottom, 0px);
    --rj-safe-t: env(safe-area-inset-top, 0px);
    --rj-shadow: 0 1px 2px rgba(10, 37, 64, .05), 0 8px 20px -12px rgba(10, 37, 64, .22);
}

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }

body.rj {
    background: var(--rj-bg);
    color: var(--rj-ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
    font-variant-numeric: tabular-nums;
}

body.rj * { -webkit-tap-highlight-color: transparent; }

/* ------------------------------------------------------------------ */
/* Shell                                                              */
/* ------------------------------------------------------------------ */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
    width: 250px; flex-shrink: 0;
    background: linear-gradient(190deg, var(--rj-navy) 0%, var(--rj-navy-2) 58%, var(--rj-navy-3) 100%);
    color: #cfe0ec;
    position: fixed; top: 0; left: 0; bottom: 0;
    overflow-y: auto; overflow-x: hidden;
    z-index: 40;
    transition: width .18s ease, transform .22s cubic-bezier(.3, .8, .3, 1);
    overscroll-behavior: contain;
}
.sidebar::-webkit-scrollbar { width: 0; }
.sidebar-collapse-btn {
    position: absolute; top: 1.1rem; right: -.7rem;
    width: 1.5rem; height: 1.5rem; border-radius: 999px;
    background: #fff; border: 1px solid var(--rj-line);
    box-shadow: 0 2px 6px rgba(15, 23, 42, .15);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--rj-brand); z-index: 41;
}
.sidebar-collapse-btn svg { width: .85rem; height: .85rem; transition: transform .18s ease; }

.sidebar-brand { display: flex; align-items: center; gap: .65rem; padding: 1.15rem 1.15rem .9rem; }
.sidebar-brand-mark {
    width: 2.1rem; height: 2.1rem; border-radius: .65rem;
    background: linear-gradient(135deg, #f1c455, #e3a82b);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; color: var(--rj-navy); font-size: .95rem;
    box-shadow: 0 6px 14px -6px rgba(227, 168, 43, .8);
}
.sidebar-brand-text { font-weight: 700; color: #fff; font-size: 1.02rem; line-height: 1.1; letter-spacing: -.01em; }
.sidebar-brand-sub { font-size: .7rem; color: #7eb8d4; margin-top: .1rem; }

.sidebar-user, .sidebar-foot { display: none; }

.sidebar-section {
    font-size: .65rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: #6fa6c2; padding: .95rem 1.15rem .35rem;
}
.sidebar-link, .sidebar-group-toggle {
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem 1.15rem; margin: 1px .5rem; width: calc(100% - 1rem);
    color: #c3d8e6; font-size: .86rem; font-weight: 500;
    border: none; background: none; border-radius: .6rem;
    cursor: pointer; text-align: left; position: relative;
}
.sidebar-link:hover, .sidebar-group-toggle:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar-link.active, .sidebar-group-toggle.has-active {
    background: linear-gradient(90deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, .05));
    color: #fff;
}
.sidebar-link.active::before {
    content: ""; position: absolute; left: -.5rem; top: 22%; bottom: 22%;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--rj-gold);
}
.sidebar-link svg, .sidebar-group-toggle svg { flex-shrink: 0; width: 1.1rem; height: 1.1rem; opacity: .92; }
.sidebar-link span, .sidebar-group-toggle span { flex: 1; }
.sidebar-chevron { width: .85rem !important; height: .85rem !important; transition: transform .15s ease; opacity: .7 !important; }
.sidebar-group-toggle.open .sidebar-chevron { transform: rotate(90deg); }
.sidebar-group { overflow: hidden; }
.depth-1.sidebar-link, .depth-1.sidebar-group-toggle { padding-left: 2.2rem; font-size: .83rem; }
.depth-2.sidebar-link, .depth-2.sidebar-group-toggle { padding-left: 3rem; font-size: .81rem; }

.sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 70;
    background: rgba(8, 20, 36, .55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}

html.sidebar-collapsed .sidebar { width: 72px; }
html.sidebar-collapsed .sidebar-brand { padding: 1.15rem 0 .9rem; justify-content: center; }
html.sidebar-collapsed .sidebar-brand-text,
html.sidebar-collapsed .sidebar-brand-sub,
html.sidebar-collapsed .sidebar-section,
html.sidebar-collapsed .sidebar-link span,
html.sidebar-collapsed .sidebar-group-toggle span,
html.sidebar-collapsed .sidebar-chevron,
html.sidebar-collapsed .sidebar-group { display: none !important; }
html.sidebar-collapsed .sidebar-link,
html.sidebar-collapsed .sidebar-group-toggle { justify-content: center; padding: .65rem 0; }
html.sidebar-collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
html.sidebar-collapsed .app-main { margin-left: 72px; }

.app-main { flex: 1; margin-left: 250px; min-width: 0; }

/* Topbar desktop */
.topbar {
    position: sticky; top: 0; z-index: 20;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--rj-line);
    display: flex; align-items: center; justify-content: flex-end;
    padding: .6rem 1.5rem;
}
.topbar-user { display: flex; align-items: center; gap: .7rem; }
.topbar-user-avatar, .sidebar-user-avatar {
    width: 2rem; height: 2rem; border-radius: 999px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--rj-brand), var(--rj-brand-2));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem;
}
.topbar-user-name { font-size: .85rem; font-weight: 600; color: #1e293b; }
.topbar-logout { background: none; border: none; color: #94a3b8; font-size: .78rem; cursor: pointer; }
.topbar-logout:hover { color: var(--rj-bad); }

.app-content { padding: 1.4rem 1.5rem 2rem; max-width: 1400px; }

/* App bar mobile + bottom nav: tersembunyi di desktop */
.rj-appbar, .rj-bnav { display: none; }

/* ------------------------------------------------------------------ */
/* Komponen global (berlaku desktop & HP)                             */
/* ------------------------------------------------------------------ */
body.rj h1.text-xl, body.rj h1.text-2xl { font-size: 1.2rem; font-weight: 700; letter-spacing: -.015em; color: var(--rj-ink); }
body.rj h2 { letter-spacing: -.01em; }

/* Kartu */
body.rj .bg-white.border.rounded-xl,
body.rj .bg-white.border.rounded-lg,
body.rj .absensi-card {
    border-color: var(--rj-line);
    border-radius: var(--rj-r);
    box-shadow: var(--rj-shadow);
}

/* Input / select / textarea */
body.rj input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=hidden]):not([type=submit]):not([type=button]):not([type=color]),
body.rj select,
body.rj textarea {
    height: 40px;
    padding: 0 .75rem;
    font-size: 14px;
    color: var(--rj-ink);
    background-color: #fbfcfe;
    border: 1px solid #d3dce8;
    border-radius: 10px;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
    max-width: 100%;
}
body.rj textarea { height: auto; min-height: 72px; padding: .6rem .75rem; line-height: 1.4; }
body.rj select {
    -webkit-appearance: none; appearance: none;
    padding-right: 2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .65rem center; background-size: 16px;
}
body.rj input:focus, body.rj select:focus, body.rj textarea:focus {
    outline: none; background-color: #fff;
    border-color: var(--rj-brand);
    box-shadow: 0 0 0 3px rgba(11, 110, 153, .16);
}
body.rj input::placeholder, body.rj textarea::placeholder { color: #9aa8ba; }
body.rj input[type=checkbox], body.rj input[type=radio] { accent-color: var(--rj-brand); width: 17px; height: 17px; }
body.rj input[disabled], body.rj select[disabled] { background-color: #eef2f7; color: #8a99ad; }

/* Label */
body.rj label.text-xs, body.rj .text-xs.font-medium.text-slate-500 {
    font-size: 11.5px; font-weight: 600; color: #5a6b80; letter-spacing: .01em;
}

/* Tombol — tiap varian punya karakter sendiri, tetap ringan */
body.rj :is(button, a, input[type=submit]).bg-primary,
body.rj :is(button, a).bg-slate-900,
body.rj :is(button, a).bg-red-500,
body.rj :is(button, a).bg-red-600,
body.rj :is(button, a).bg-emerald-600,
body.rj :is(button, a).bg-emerald-500,
body.rj :is(button, a).rj-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 40px; padding: 0 1.05rem; border: none; border-radius: 10px;
    font-weight: 600; font-size: 13.5px; line-height: 1; letter-spacing: .005em;
    color: #fff; cursor: pointer; white-space: nowrap;
    transition: transform .08s ease, box-shadow .15s ease, filter .15s ease;
}
body.rj :is(button, a, input[type=submit]).bg-primary,
body.rj .rj-btn-primary {
    background: linear-gradient(135deg, var(--rj-brand) 0%, var(--rj-brand-2) 100%);
    box-shadow: 0 8px 16px -8px rgba(11, 110, 153, .75), inset 0 1px 0 rgba(255, 255, 255, .22);
}
body.rj :is(button, a).bg-slate-900, body.rj .rj-btn-dark {
    background: linear-gradient(135deg, var(--rj-navy) 0%, var(--rj-navy-3) 100%);
    box-shadow: 0 8px 16px -8px rgba(10, 37, 64, .8), inset 0 1px 0 rgba(255, 255, 255, .14);
}
body.rj :is(button, a).bg-red-500, body.rj :is(button, a).bg-red-600, body.rj .rj-btn-danger {
    background: linear-gradient(135deg, #d6455d, #e8657a);
    box-shadow: 0 8px 16px -8px rgba(214, 69, 93, .75), inset 0 1px 0 rgba(255, 255, 255, .2);
}
body.rj :is(button, a).bg-emerald-600, body.rj :is(button, a).bg-emerald-500, body.rj .rj-btn-success {
    background: linear-gradient(135deg, #0b8f62, #17b684);
    box-shadow: 0 8px 16px -8px rgba(15, 157, 107, .75), inset 0 1px 0 rgba(255, 255, 255, .2);
}
body.rj .rj-btn-soft {
    background: var(--rj-brand-50); color: var(--rj-brand); box-shadow: none; border: 1px solid var(--rj-brand-100);
}
body.rj :is(button, a).bg-primary:hover, body.rj :is(button, a).bg-slate-900:hover { filter: brightness(1.06); }
body.rj :is(button, a, input[type=submit]):active { transform: scale(.975); }
body.rj :is(button, a).bg-primary:disabled, body.rj button:disabled.rj-btn { opacity: .5; box-shadow: none; }

/* Tombol sekunder (outline) */
body.rj :is(a, button).border.border-slate-300.rounded-lg:not(.bg-primary) {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 40px; padding: 0 1rem; border-radius: 10px;
    background: #fff; color: #334155; font-weight: 600; font-size: 13.5px;
    border-color: #d3dce8; box-shadow: 0 1px 2px rgba(10, 37, 64, .05);
}
body.rj :is(a, button).border.border-slate-300.rounded-lg:not(.bg-primary):hover { background: var(--rj-brand-50); border-color: var(--rj-brand-100); color: var(--rj-brand); }

/* Pesan / alert */
body.rj .bg-red-50.border, body.rj .bg-emerald-50.border, body.rj .bg-amber-50.border {
    border-radius: 10px; padding: .6rem .8rem; font-size: 13px;
}

/* Badge */
body.rj .rounded-full.text-xs { font-weight: 600; letter-spacing: .01em; }

/* Tabel */
body.rj table { width: 100%; }
body.rj thead tr { background: #f1f5f9; }
body.rj th { font-size: 11px; letter-spacing: .05em; color: #5a6b80; padding: .6rem .8rem; white-space: nowrap; }
body.rj td { padding: .6rem .8rem; vertical-align: middle; }
body.rj tbody tr + tr td { border-top: 1px solid #eef2f7; }
body.rj tbody tr:hover td { background: #fafcfe; }
body.rj .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }

.rj-tscroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; border-radius: inherit; }
.rj-tscroll::-webkit-scrollbar { height: 6px; }
.rj-tscroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 6px; }

/* Stat card dashboard */
body.rj .stat-card { border-radius: 14px; }
body.rj .stat-card-indigo { background: linear-gradient(135deg, var(--rj-navy-3), var(--rj-brand-2)); }
body.rj .nav-card { border-radius: 14px; border-color: var(--rj-line); box-shadow: var(--rj-shadow); }
body.rj .nav-card:hover { border-color: var(--rj-brand-100); box-shadow: 0 12px 24px -12px rgba(11, 110, 153, .4); }

/* Absensi: samakan aksen biru lama dengan warna brand */
body.rj .absensi-lokasi-card { border-color: var(--rj-line); border-radius: 12px; }
body.rj .absensi-lokasi-card:hover { border-color: var(--rj-brand-100); }
body.rj .absensi-lokasi-ganti { color: var(--rj-brand); }
body.rj .absensi-aktivitas-chip:has(.absensi-aktivitas-input:checked) {
    border-color: var(--rj-brand); background: var(--rj-brand-50); color: var(--rj-brand);
}
body.rj .absensi-btn { border-radius: 12px; min-height: 46px; font-size: .92rem; letter-spacing: .01em; }
body.rj .absensi-btn-masuk { background: linear-gradient(135deg, #0b8f62, #17b684); box-shadow: 0 10px 18px -10px rgba(15, 157, 107, .85); }
body.rj .absensi-btn-keluar { background: linear-gradient(135deg, #d6455d, #ea6a7f); box-shadow: 0 10px 18px -10px rgba(214, 69, 93, .85); }
body.rj .absensi-btn-masuk:disabled, body.rj .absensi-btn-keluar:disabled { box-shadow: none; background: #e3e9f0; color: #94a3b8; }
body.rj .absensi-btn-outline { background: #fff; color: #334155; border: 1px solid #d3dce8; box-shadow: none; }

/* ------------------------------------------------------------------ */
/* Progress bar navigasi, toast, banner                               */
/* ------------------------------------------------------------------ */
.rj-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100;
    background: linear-gradient(90deg, var(--rj-gold), #f6d98a);
    box-shadow: 0 0 8px rgba(227, 168, 43, .7);
    opacity: 0; transition: width .4s ease, opacity .25s ease; pointer-events: none;
}
.rj-progress.on { opacity: 1; width: 78%; }

.rj-offline {
    position: fixed; left: 0; right: 0; top: 0; z-index: 90;
    padding: calc(var(--rj-safe-t) + 6px) 12px 6px; text-align: center;
    background: #f1c455; color: #4a3200; font-size: 12px; font-weight: 600;
    transform: translateY(-110%); transition: transform .25s ease;
}
.rj-offline.on { transform: translateY(0); }

.rj-toast {
    position: fixed; left: 12px; right: 12px; z-index: 95;
    bottom: calc(var(--rj-bnav-h) + var(--rj-safe-b) + 12px);
    max-width: 420px; margin: 0 auto;
    background: var(--rj-navy); color: #fff; border-radius: 14px;
    padding: .7rem .8rem .7rem 1rem; font-size: 13px;
    display: flex; align-items: center; gap: .75rem;
    box-shadow: 0 16px 30px -10px rgba(10, 37, 64, .6);
    transform: translateY(20px); opacity: 0; pointer-events: none;
    transition: transform .25s ease, opacity .25s ease;
}
.rj-toast.on { transform: none; opacity: 1; pointer-events: auto; }
.rj-toast span { flex: 1; }
.rj-toast button {
    border: none; border-radius: 8px; padding: .45rem .8rem; font-weight: 700; font-size: 12.5px;
    background: var(--rj-gold); color: var(--rj-navy); cursor: pointer;
}
.rj-toast button.ghost { background: transparent; color: #9fbdd1; padding: .45rem .5rem; }

.rj-install {
    position: fixed; left: 12px; right: 12px; z-index: 44;
    bottom: calc(var(--rj-bnav-h) + var(--rj-safe-b) + 10px);
    max-width: 440px; margin: 0 auto;
    background: #fff; border: 1px solid var(--rj-line); border-radius: 16px;
    padding: .75rem .8rem; display: none; align-items: center; gap: .7rem;
    box-shadow: 0 18px 34px -14px rgba(10, 37, 64, .45);
}
.rj-install.on { display: flex; animation: rjUp .3s ease; }
.rj-install img { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.rj-install-txt { flex: 1; min-width: 0; }
.rj-install-txt b { display: block; font-size: 13.5px; color: var(--rj-ink); }
.rj-install-txt small { display: block; font-size: 11.5px; color: var(--rj-muted); line-height: 1.3; margin-top: 1px; }
.rj-install .go {
    border: none; border-radius: 10px; padding: .55rem .9rem; font-weight: 700; font-size: 12.5px; color: #fff; cursor: pointer;
    background: linear-gradient(135deg, var(--rj-brand), var(--rj-brand-2));
}
.rj-install .x { border: none; background: none; color: #94a3b8; font-size: 18px; padding: .2rem .35rem; cursor: pointer; }
@keyframes rjUp { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Halaman masuk halus */
.app-content { animation: rjFade .18s ease; }
@keyframes rjFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ */
/* HP / tablet kecil (≤ 900px): app bar + bottom nav + drawer          */
/* ------------------------------------------------------------------ */
@media (max-width: 900px) {
    .topbar { display: none; }
    .app-main { margin-left: 0; }
    html.sidebar-collapsed .app-main { margin-left: 0; }
    .sidebar-collapse-btn { display: none; }

    /* Drawer */
    .sidebar {
        width: min(84vw, 310px);
        transform: translateX(-102%);
        z-index: 71;
        padding-top: var(--rj-safe-t);
        box-shadow: none;
        visibility: hidden;
        transition: transform .22s cubic-bezier(.3, .8, .3, 1), visibility 0s linear .22s, box-shadow .22s ease;
    }
    html.sidebar-collapsed .sidebar { width: min(84vw, 310px); }
    html.sidebar-collapsed .sidebar-brand-text, html.sidebar-collapsed .sidebar-brand-sub,
    html.sidebar-collapsed .sidebar-section, html.sidebar-collapsed .sidebar-link span,
    html.sidebar-collapsed .sidebar-group-toggle span, html.sidebar-collapsed .sidebar-chevron { display: revert !important; }
    html.sidebar-collapsed .sidebar-group { display: revert !important; }
    html.sidebar-collapsed .sidebar-link, html.sidebar-collapsed .sidebar-group-toggle { justify-content: flex-start; padding: .55rem 1.15rem; }
    html.sidebar-collapsed .sidebar-brand { padding: 1.15rem 1.15rem .9rem; justify-content: flex-start; }

    .sidebar.is-open {
        transform: translateX(0); visibility: visible; box-shadow: 18px 0 40px -12px rgba(0, 0, 0, .5);
        transition: transform .22s cubic-bezier(.3, .8, .3, 1), visibility 0s, box-shadow .22s ease;
    }
    .sidebar-backdrop.is-open { display: block; animation: rjFade .2s ease; }
    .sidebar-link, .sidebar-group-toggle { min-height: 42px; }

    .sidebar-user {
        display: flex; align-items: center; gap: .7rem;
        margin: 0 .75rem .35rem; padding: .7rem .75rem;
        background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .1); border-radius: 14px;
    }
    .sidebar-user-avatar { width: 2.3rem; height: 2.3rem; background: linear-gradient(135deg, #f1c455, #e3a82b); color: var(--rj-navy); }
    .sidebar-user-name { color: #fff; font-weight: 700; font-size: .88rem; line-height: 1.15; }
    .sidebar-user-role { color: #8db6cc; font-size: .7rem; }
    .sidebar-foot {
        display: grid; grid-template-columns: 1fr 1fr; gap: .45rem;
        position: sticky; bottom: 0; margin: .6rem 0 0; padding: .9rem .75rem calc(.65rem + var(--rj-safe-b));
        background: linear-gradient(0deg, var(--rj-navy-3) 72%, rgba(11, 79, 122, 0));
    }
    .sidebar-foot > form { margin: 0; display: contents; }
    .sidebar-foot a, .sidebar-foot button {
        display: flex; align-items: center; justify-content: center; gap: .45rem; width: 100%;
        min-height: 42px; border-radius: 12px; font-weight: 600; font-size: .82rem; cursor: pointer; text-decoration: none;
        border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .08); color: #e1eef6;
    }
    .sidebar-foot button[type=submit] { background: rgba(214, 69, 93, .22); border-color: rgba(214, 69, 93, .5); color: #ffd3da; }
    .sidebar-foot [data-rj-install] { grid-column: 1 / -1; background: linear-gradient(135deg, #f6d27a, #e3a82b); border: none; color: var(--rj-navy); font-weight: 700; }
    .sidebar-foot [hidden] { display: none !important; }

    /* App bar */
    .rj-appbar {
        display: flex; align-items: center; gap: .55rem;
        position: sticky; top: 0; z-index: 40;
        height: calc(var(--rj-appbar-h) + var(--rj-safe-t)); padding: var(--rj-safe-t) .5rem 0 .6rem;
        background: linear-gradient(100deg, var(--rj-navy) 0%, var(--rj-navy-2) 100%);
        color: #fff; box-shadow: 0 6px 18px -10px rgba(10, 37, 64, .7);
    }
    .rj-ab-btn {
        width: 38px; height: 38px; border-radius: 12px; border: none; background: rgba(255, 255, 255, .09);
        color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer;
    }
    .rj-ab-btn:active { background: rgba(255, 255, 255, .2); }
    .rj-ab-btn svg { width: 20px; height: 20px; }
    .rj-ab-mark {
        width: 34px; height: 34px; border-radius: 11px; flex-shrink: 0;
        background: linear-gradient(135deg, #f1c455, #e3a82b); color: var(--rj-navy);
        display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .95rem;
    }
    .rj-ab-title { flex: 1; min-width: 0; line-height: 1.15; }
    .rj-ab-title b { display: block; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .rj-ab-title small { display: block; font-size: 10.5px; color: #8db6cc; font-weight: 500; letter-spacing: .03em; }

    /* Konten */
    .app-content {
        padding: .7rem .65rem calc(var(--rj-bnav-h) + var(--rj-safe-b) + 18px);
        max-width: 100%;
    }
    .app-content .max-w-md, .app-content .max-w-lg, .app-content .max-w-xl, .app-content .max-w-2xl { max-width: 100%; }
    body.rj .rj-dup-h1 { display: none; }
    body.rj .mb-5 { margin-bottom: .7rem; }
    body.rj .mb-6 { margin-bottom: .8rem; }
    body.rj .mb-4 { margin-bottom: .65rem; }
    body.rj .p-5 { padding: .85rem; }
    body.rj .p-4 { padding: .75rem; }
    body.rj .gap-4 { gap: .6rem; }
    body.rj .gap-6 { gap: .8rem; }
    body.rj .space-y-4 > * + * { margin-top: .65rem; }
    body.rj .text-2xl { font-size: 1.25rem; line-height: 1.5rem; }
    body.rj .absensi-card { padding: .85rem; margin-bottom: .65rem; }

    /* Form yang punya baris filter -> grid 2 kolom supaya 1 layar */
    body.rj .app-content form > .flex.flex-wrap,
    body.rj .app-content form .flex.flex-wrap.items-end {
        display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem .55rem; align-items: end;
    }
    body.rj .app-content form > .flex.flex-wrap > *,
    body.rj .app-content form .flex.flex-wrap.items-end > * { min-width: 0 !important; width: auto; }
    body.rj .app-content form > .flex.flex-wrap > :is(button, a),
    body.rj .app-content form .flex.flex-wrap.items-end > :is(button, a),
    body.rj .app-content form .flex.flex-wrap > .flex-1,
    body.rj .app-content form .flex.flex-wrap > [class*="min-w-[2"],
    body.rj .app-content form .flex.flex-wrap > [class*="min-w-[3"] { grid-column: 1 / -1; }
    body.rj .app-content form .flex.flex-wrap.items-end > :is(button, a) { width: 100%; }
    body.rj [class*="min-w-["] { min-width: 0 !important; }
    body.rj .flex-col > :is(input, select) { width: 100%; }

    /* Kartu KPI 2 kolom, rapat */
    body.rj .grid.grid-cols-1.sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.rj .grid.grid-cols-1 > .bg-white.p-4 .text-2xl,
    body.rj .stat-value { font-size: 1.05rem; line-height: 1.3; word-break: break-word; }
    body.rj .stat-card { padding: .8rem .9rem; }

    /* Tabel lebih kecil */
    body.rj table { font-size: 12.5px; }
    body.rj th { padding: .5rem .6rem; font-size: 10.5px; }
    body.rj td { padding: .5rem .6rem; white-space: nowrap; }
    body.rj td:first-child { white-space: normal; min-width: 9rem; }

    /* Modal / bottom sheet */
    body.rj [class*="max-h-[80vh]"], body.rj [class*="max-h-[85vh]"] { max-height: 86dvh !important; }
    body.rj .absensi-modal-sheet { max-height: 86dvh; padding-bottom: calc(1.1rem + var(--rj-safe-b)); }

    /* Absensi: 1 layar */
    body.rj .absensi-lokasi-opsi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; margin-bottom: .6rem; }
    body.rj .absensi-lokasi-card { flex-direction: column; text-align: center; gap: .3rem; padding: .6rem .3rem; }
    body.rj .absensi-lokasi-icon { width: 2.1rem; height: 2.1rem; font-size: 1.15rem; }
    body.rj .absensi-lokasi-teks { align-items: center; }
    body.rj .absensi-lokasi-judul { font-size: .74rem; line-height: 1.2; }
    body.rj .absensi-lokasi-sub { display: none; }
    body.rj .absensi-foto-placeholder { padding: 1.1rem .8rem; font-size: .78rem; }
    body.rj .absensi-cam-wrap { aspect-ratio: 4 / 3; max-height: 40dvh; width: 100%; }
    body.rj .absensi-photo-preview { aspect-ratio: 4 / 3; max-height: 40dvh; max-width: none; margin-top: 0; }
    body.rj #form-masuk button[type=submit], body.rj #form-keluar button[type=submit] {
        position: sticky; bottom: calc(var(--rj-bnav-h) + var(--rj-safe-b) + 8px); z-index: 5;
    }

    /* Bottom navigation */
    .rj-bnav {
        display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: stretch;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
        height: calc(var(--rj-bnav-h) + var(--rj-safe-b)); padding: 4px 6px var(--rj-safe-b);
        background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid var(--rj-line);
        box-shadow: 0 -10px 26px -18px rgba(10, 37, 64, .5);
        transition: transform .2s ease;
    }
    html.rj-kb .rj-bnav { transform: translateY(110%); }
    .rj-bn {
        position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
        background: none; border: none; color: #7a8aa0; font-size: 10.5px; font-weight: 600; cursor: pointer;
        border-radius: 12px; min-width: 0; padding: 0 2px;
    }
    .rj-bn svg { width: 22px; height: 22px; stroke-width: 1.8; transition: transform .15s ease; }
    .rj-bn span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .rj-bn.on { color: var(--rj-brand); }
    .rj-bn.on svg { transform: translateY(-1px); }
    .rj-bn.on::before {
        content: ""; position: absolute; top: -4px; left: 50%; width: 24px; height: 3px; margin-left: -12px;
        border-radius: 0 0 4px 4px; background: linear-gradient(90deg, var(--rj-gold), #f1c455);
    }
    .rj-bn:active svg { transform: scale(.88); }
    .rj-toast, .rj-install { bottom: calc(var(--rj-bnav-h) + var(--rj-safe-b) + 10px); }
}

/* iOS Safari zoom otomatis kalau font input < 16px -> naikkan khusus iOS */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 900px) {
        body.rj input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),
        body.rj select, body.rj textarea { font-size: 16px; }
    }
}

/* Layar sangat sempit (≤ 360px) */
@media (max-width: 360px) {
    .app-content { padding-left: .5rem; padding-right: .5rem; }
    .rj-bn { font-size: 10px; }
    body.rj .grid.grid-cols-1.sm\:grid-cols-2 { grid-template-columns: 1fr; }
}

/* Mode standalone (sudah dipasang sebagai app): tanpa efek tap-highlight/seleksi liar */
@media (display-mode: standalone) {
    body.rj { user-select: none; -webkit-user-select: none; }
    body.rj :is(input, textarea, [contenteditable]) { user-select: text; -webkit-user-select: text; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

@media print {
    .sidebar, .topbar, .rj-appbar, .rj-bnav, .rj-install, .rj-toast, .rj-offline, .rj-progress { display: none !important; }
    .app-main { margin-left: 0 !important; }
}

/* ------------------------------------------------------------------ */
/* Halaman login (auth + absensi)                                     */
/* ------------------------------------------------------------------ */
body.rj-nonav .rj-install, body.rj-nonav .rj-toast { bottom: calc(var(--rj-safe-b) + 12px); }

body.lg-body {
    min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column;
    background: var(--rj-bg);
}
.lg-hero {
    position: relative; overflow: hidden; text-align: center; color: #fff;
    padding: calc(var(--rj-safe-t) + 2.2rem) 1.25rem 4.2rem;
    background:
        radial-gradient(420px 220px at 90% -20%, rgba(246, 210, 122, .16), transparent 70%),
        radial-gradient(380px 240px at -10% 110%, rgba(26, 139, 181, .45), transparent 70%),
        linear-gradient(160deg, var(--rj-navy) 0%, var(--rj-navy-2) 55%, var(--rj-navy-3) 100%);
}
.lg-hero::after {
    content: ""; position: absolute; inset: 0; opacity: .08; pointer-events: none;
    background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 18px 18px;
}
.lg-mark {
    position: relative; z-index: 1;
    width: 3.5rem; height: 3.5rem; border-radius: 1.1rem; margin: 0 auto .8rem;
    background: linear-gradient(135deg, #f6d27a, #e3a82b);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.6rem; color: var(--rj-navy);
    box-shadow: 0 14px 26px -10px rgba(227, 168, 43, .8), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.lg-hero h1 { position: relative; z-index: 1; margin: 0; font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.lg-hero p { position: relative; z-index: 1; margin: .2rem 0 0; font-size: .8rem; color: #9cc3d8; letter-spacing: .02em; }

.lg-card {
    position: relative; z-index: 2;
    width: calc(100% - 2rem); max-width: 400px; margin: -2.6rem auto 0;
    background: #fff; border-radius: 20px; padding: 1.25rem 1.15rem 1.15rem;
    border: 1px solid var(--rj-line);
    box-shadow: 0 24px 40px -22px rgba(10, 37, 64, .45);
}
.lg-card h2 { margin: 0 0 .15rem; font-size: 1.02rem; font-weight: 700; color: var(--rj-ink); }
.lg-card .lg-sub { margin: 0 0 1rem; font-size: .78rem; color: var(--rj-muted); }
.lg-field { margin-bottom: .8rem; }
.lg-field label { display: block; font-size: 11.5px; font-weight: 600; color: #5a6b80; margin-bottom: .3rem; }
.lg-field .lg-in { position: relative; }
.lg-field input { width: 100%; height: 44px !important; padding-left: .9rem !important; border-radius: 12px !important; }
.lg-field .lg-eye {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 38px; height: 38px; border: none; background: none; color: #8392a6; cursor: pointer; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.lg-field .lg-eye svg { width: 19px; height: 19px; }
.lg-field .lg-in.has-eye input { padding-right: 2.8rem; }
.lg-check { display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--rj-muted); margin: .2rem 0 1rem; }
.lg-btn {
    width: 100%; min-height: 46px; border: none; border-radius: 12px; cursor: pointer;
    font-weight: 700; font-size: .92rem; color: #fff; letter-spacing: .01em;
    background: linear-gradient(135deg, var(--rj-brand) 0%, var(--rj-brand-2) 100%);
    box-shadow: 0 12px 20px -12px rgba(11, 110, 153, .9), inset 0 1px 0 rgba(255, 255, 255, .22);
    transition: transform .08s ease, filter .15s ease;
}
.lg-btn:active { transform: scale(.98); }
.lg-btn:disabled { opacity: .7; }
.lg-btn.green { background: linear-gradient(135deg, #0b8f62, #17b684); box-shadow: 0 12px 20px -12px rgba(15, 157, 107, .9), inset 0 1px 0 rgba(255, 255, 255, .22); }
.lg-err { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 10px; padding: .55rem .75rem; font-size: .82rem; margin-bottom: .85rem; }
.lg-foot { text-align: center; font-size: .72rem; color: #8a99ad; margin: 1rem 1rem calc(1rem + var(--rj-safe-b)); line-height: 1.6; }
.lg-foot a { color: var(--rj-brand); font-weight: 600; }
.lg-spacer { flex: 1; }

@media (min-width: 640px) {
    body.lg-body { justify-content: center; }
    .lg-hero { border-radius: 24px; max-width: 400px; margin: 0 auto; width: calc(100% - 2rem); padding-top: 2.2rem; }
}

/* Layout absensi lama (daftar wajah dll) */
.absensi-wrap { max-width: 460px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; padding: calc(var(--rj-safe-t) + 1rem) .85rem calc(var(--rj-safe-b) + 1.5rem); }

/* ------------------------------------------------------------------ */
/* Stok Barang: baris filter harga (tidak memakai .flex.flex-wrap     */
/* supaya tidak ikut aturan grid 2 kolom generik di HP)               */
/* ------------------------------------------------------------------ */
.stok-harga-row {
    width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem .75rem;
    padding-top: .75rem; border-top: 1px solid var(--rj-line);
}
.stok-harga-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #5a6b80; }
.stok-range { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.stok-range input { width: 8rem; min-width: 0; }
.stok-range > span { color: #94a3b8; }

@media (max-width: 900px) {
    body.rj .stok-harga-row { display: grid; grid-template-columns: 1fr; gap: .5rem; }
    body.rj .stok-range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
    body.rj .stok-range input,
    body.rj .stok-harga-row select,
    body.rj .stok-level-locked { width: 100%; min-width: 0; }
    body.rj .stok-level-locked { display: flex; align-items: center; min-height: 40px; }
    body.rj .stok-semua { width: 100%; }
}

/* ------------------------------------------------------------------ */
/* Filter di HP: input berlebar tetap (w-44 dst) jangan melebihi sel  */
/* grid, dan rentang tanggal boleh turun baris                        */
/* ------------------------------------------------------------------ */
@media (max-width: 900px) {
    body.rj .app-content form .flex-col > :is(input, select).w-44,
    body.rj .app-content form .flex-col > :is(input, select).w-40,
    body.rj .app-content form .flex-col > :is(input, select).w-36,
    body.rj .app-content form .flex-col > :is(input, select).w-32 { width: 100%; }

    body.rj #input-mode-tanggal { flex-wrap: wrap; width: 100%; }
    body.rj #input-mode-tanggal input[type=date] { flex: 1 1 8.5rem; min-width: 0; }
    body.rj #input-mode-bulan, body.rj #input-mode-tahun { width: 100%; }
    body.rj #input-mode-bulan > select { flex: 1 1 0; min-width: 0; }
}
