/* ──────────────────────────────────────────────────────────────
   IMS IT — Design System
   Mengikuti tampilan docs/layout-profile.md:
   - Sidebar gelap #222831 dengan item membulat #393E46
   - Latar halaman biru muda #e2f0fe
   - Font Inter
   - Kartu membulat (rounded-2xl) dengan bayangan halus
   ────────────────────────────────────────────────────────────── */

:root {
    --bs-primary: #3b82f6;
    --bs-primary-rgb: 59, 130, 246;
    --bs-success: #22c55e;
    --bs-success-rgb: 34, 197, 94;
    --bs-warning: #facc15;
    --bs-warning-rgb: 250, 204, 21;
    --bs-info: #06b6d4;
    --bs-info-rgb: 6, 182, 212;
    --bs-danger: #ef4444;
    --bs-danger-rgb: 239, 68, 68;

    --sidebar-bg: #222831;
    --sidebar-item-bg: #393E46;
    --sidebar-hover-bg: #2a2f3a;
    --page-bg: #e2f0fe;
    --card-radius: 1rem;
    --sidebar-width: 260px;
    --topbar-height: 64px;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #c7d2fe transparent;
}

body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background-color: var(--page-bg);
    color: #1e293b;
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ── Sidebar ─────────────────────────────────────────────── */
#wrapper {
    height: 100vh;
    height: 100dvh;
    display: flex;
    overflow: hidden;
}

/* Only the navigation scrolls; brand and account footer stay in view. */
#sidebar-wrapper {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background-color: var(--sidebar-bg);
    transition: transform .3s ease;
    z-index: 1045;
    flex-shrink: 0;
}

/* Content wrapper — sisakan ruang untuk sidebar fixed */
#page-content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    margin-left: var(--sidebar-width);
    transition: margin-left .3s ease;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1.35rem 1.35rem;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    flex-shrink: 0;
    color: inherit;
    text-decoration: none;
    transition: background-color .15s ease;
}

.sidebar-brand:hover,
.sidebar-brand:focus {
    background-color: rgba(255, 255, 255, .04);
    color: inherit;
    text-decoration: none;
}

.sidebar-brand span {
    letter-spacing: .05em;
}

.sidebar-nav {
    padding: 1rem .85rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.sidebar-section-label {
    padding: 1.1rem .6rem .45rem;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #6b7280;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: .8rem;
    width: 100%;
    padding: .72rem .9rem;
    margin-bottom: .2rem;
    border: 0;
    border-radius: .7rem;
    background: transparent;
    color: #b4bac6;
    font-size: .9rem;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.sidebar-item > i:first-child {
    width: 1.4rem;
    text-align: center;
    font-size: .95rem;
    flex-shrink: 0;
}

.sidebar-item:hover {
    background-color: var(--sidebar-hover-bg);
    color: #fff;
    text-decoration: none;
}

.sidebar-item.active {
    background-color: var(--sidebar-item-bg);
    color: #fff;
}

.sidebar-item-sub {
    display: block;
    font-size: .72rem;
    opacity: .6;
    line-height: 1.15;
    margin-top: 2px;
}

.sidebar-caret {
    margin-left: auto;
    font-size: .68rem;
    opacity: .55;
    transition: transform .2s ease;
}

.sidebar-caret.rotate {
    transform: rotate(180deg);
}

.sidebar-subitem {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .9rem .55rem 2.55rem;
    margin: .1rem 0;
    border-radius: .6rem;
    color: #9aa3b2;
    font-size: .84rem;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.sidebar-subitem i {
    width: 1.1rem;
    text-align: center;
    font-size: .85rem;
}

.sidebar-subitem:hover {
    background-color: var(--sidebar-hover-bg);
    color: #fff;
    text-decoration: none;
}

.sidebar-subitem.active {
    background-color: var(--sidebar-item-bg);
    color: #fff;
}

.sidebar-user {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
    background: #1d232c;
    flex-shrink: 0;         /* jangan menyusut — selalu muncul di bawah */
    margin-top: auto;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

.sidebar-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-user-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: .55rem .75rem;
    margin-bottom: .45rem;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: .65rem;
    background: transparent;
    color: #c4cad5;
    font-size: .84rem;
    font-weight: 500;
    text-decoration: none;
    transition: all .15s ease;
}

.sidebar-user-btn:hover {
    background: var(--sidebar-hover-bg);
    color: #fff;
    text-decoration: none;
}

.sidebar-user-btn.logout {
    margin-bottom: 0;
    border-color: rgba(239, 68, 68, .45);
    background: rgba(239, 68, 68, .08);
    color: #fca5a5;
}

.sidebar-user-btn.logout:hover {
    background: rgba(239, 68, 68, .22);
    color: #fff;
}

/* Desktop: sidebar geser keluar layar, content langsung melebar */
#wrapper.sidebar-hidden #sidebar-wrapper {
    transform: translateX(-100%);
}

#wrapper.sidebar-hidden #page-content-wrapper {
    margin-left: 0;
}

.topbar-clock {
    flex-shrink: 0;
}

.notif-wrapper {
    flex-shrink: 0;
}

.topbar-user-wrapper {
    flex-shrink: 0;
}


/* Pastikan sidebar-user menu tidak terlalu rapat */
.sidebar-user-btn {
    gap: 0.5rem;
    justify-content: flex-start !important;
    padding-left: 1rem !important;
}

.sidebar-backdrop {
    display: none;
}

/* Keep the mobile header and its toggle above the off-canvas sidebar. */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        top: var(--topbar-height);
        transform: translateX(-100%);
        width: 280px;
        max-width: calc(100vw - 1rem);
        height: calc(100vh - var(--topbar-height));
        height: calc(100dvh - var(--topbar-height));
    }

    /* Mobile: sidebar tersembunyi by default, content tidak perlu margin */
    #page-content-wrapper {
        margin-left: 0 !important;
    }

    #wrapper.sidebar-open #sidebar-wrapper {
        transform: translateX(0);
        box-shadow: 12px 0 40px rgba(15, 23, 42, .35);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        top: var(--topbar-height);
        background: rgba(15, 23, 42, .55);
        z-index: 1040;
    }

    #wrapper.sidebar-open .sidebar-backdrop {
        display: block;
    }
}

/* ── Bell Notification — shared styles ──────────────────── */
.notif-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Animasi bergetar bell */
@keyframes bell-ring {
    0%, 100% { transform: rotate(0deg); }
    10%       { transform: rotate(-14deg); }
    30%       { transform: rotate(14deg); }
    50%       { transform: rotate(-8deg); }
    70%       { transform: rotate(6deg); }
    90%       { transform: rotate(-3deg); }
}

.notif-bell.ringing > i {
    animation: bell-ring .55s ease 2;
    transform-origin: top center;
}

.notif-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    line-height: 1;
    pointer-events: none;
}

/* Dropdown panel */
.notif-dropdown {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 360px;
    max-width: calc(100vw - 1rem);
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: .5rem;
    box-shadow: 0 20px 50px rgba(15, 23, 42, .18);
    z-index: 2000;
    opacity: 0;
    transform: translateY(-8px) scale(.97);
    visibility: hidden;
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    overflow: hidden;
    max-height: calc(100vh - var(--topbar-height) - 1rem);
    max-height: calc(100dvh - var(--topbar-height) - 1rem);
}

.notif-wrapper [hidden] {
    display: none !important;
}

.notif-dropdown.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1rem .75rem;
    border-bottom: 1px solid #eef2f7;
    background: #fff;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.notif-dropdown-title {
    color: #0f172a;
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.2;
}

.notif-dropdown-subtitle {
    color: #94a3b8;
    font-size: .72rem;
    font-weight: 500;
    margin-top: .15rem;
}

.notif-read-all {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    cursor: pointer;
    color: #2563eb;
    font-size: .88rem;
    font-weight: 600;
    padding: 0;
    border-radius: .55rem;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
    flex-shrink: 0;
}

.notif-read-all:disabled {
    opacity: .5;
    cursor: wait;
}

.notif-read-all:hover {
    background: #dbeafe;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

/* Daftar notifikasi — scroll */
.notif-list {
    max-height: 360px;
    overflow-y: auto;
    background: #fff;
    position: relative;
    z-index: 1;
    min-height: 0;
    overscroll-behavior: contain;
}

.notif-status {
    padding: .75rem 1rem;
    color: #64748b;
    font-size: .8rem;
    flex-shrink: 0;
}

/* Empty state */
.notif-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 2.2rem 1rem;
    color: #94a3b8;
    font-size: .85rem;
    text-align: center;
}

.notif-empty > i {
    font-size: 2rem;
    color: #cbd5e1;
    margin-bottom: .75rem;
}

/* Satu item notifikasi */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .8rem 1rem;
    width: 100%;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: background .12s ease;
    position: relative;
    min-height: 72px;
}

.notif-item:last-child {
    border-bottom: 0;
}

.notif-item:hover {
    background: #f8fafc;
}

.notif-item.unread {
    background: #eff6ff;
}

.notif-item.unread:hover {
    background: #dbeafe;
}

.notif-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
}

.notif-item-body {
    flex: 1;
    min-width: 0;
}

.notif-item-title {
    font-size: .84rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-item.unread .notif-item-title {
    color: #1d4ed8;
}

.notif-item-msg {
    font-size: .78rem;
    color: #64748b;
    margin-top: 2px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.notif-item-time {
    font-size: .7rem;
    color: #94a3b8;
    margin-top: 4px;
}

/* Titik biru unread */
.notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    flex-shrink: 0;
    margin-top: 4px;
}

/* ── Topbar ──────────────────────────────────────────────── */
.app-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    padding: 0 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e5eaf1;
    position: relative;
    z-index: 1025;
    flex-shrink: 0;
    box-shadow: 0 1px 8px rgba(15,23,42,.06);
    flex-wrap: nowrap;
}

.topbar-start {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex: 1 1 auto;
    min-width: 0;
}

/* Tombol hamburger */
.btn-toggler {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: .6rem;
    background: #fff;
    color: #64748b;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
    flex-shrink: 0;
    padding: 0;
    order: -1;
}

.btn-toggler:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.btn-toggler:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Title stays immediately next to the toggle, including on small screens. */
.topbar-title {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    flex: 1;
    min-width: 0;
    font-size: .88rem;
    font-weight: 600;
    color: #475569;
    line-height: 1.35;
    text-align: left;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.topbar-title:hover,
.topbar-title:focus {
    color: #1e3a8a;
    text-decoration: none;
}

.topbar-title-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.topbar-title span {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Grup kanan: clock + bell + user */
.topbar-right {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
    flex-shrink: 0;
    min-width: fit-content;
}

/* Jam */
.topbar-clock {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .75rem;
    border: 1px solid #e2e8f0;
    border-radius: .6rem;
    background: #f8fafc;
    color: #334155;
    font-size: .88rem;
    font-weight: 600;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.topbar-clock .wib-label {
    font-size: .75rem;
    color: #94a3b8;
    font-weight: 500;
}

/* Bell — bersih tanpa border box */
.notif-bell {
    position: relative;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: .6rem;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    font-size: 1.15rem;
    padding: 0;
    transition: background-color .15s ease, color .15s ease;
    flex-shrink: 0;
}

.notif-bell:hover {
    background: #f1f5f9;
    color: #1e40af;
}

.notif-bell > i {
    pointer-events: none;
}

.notif-bell.has-unread,
.notif-bell[aria-expanded="true"] {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #2563eb;
}

.notif-bell:focus-visible,
.notif-read-all:focus-visible,
.notif-item:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
}

/* ── Topbar User Menu ────────────────────────────────────── */
.topbar-user-wrapper {
    position: relative;
}

.topbar-user-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem .6rem .3rem .3rem;
    border: 1px solid #e2e8f0;
    border-radius: 2rem;
    background: #fff;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

.topbar-user-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.topbar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.topbar-user-name {
    font-size: .82rem;
    font-weight: 600;
    color: #334155;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-caret {
    font-size: .65rem;
    color: #94a3b8;
    transition: transform .2s ease;
}

/* Dropdown user */
.topbar-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: .9rem;
    box-shadow: 0 16px 40px rgba(15,23,42,.16);
    z-index: 2000;
    opacity: 0;
    transform: translateY(-6px) scale(.97);
    visibility: hidden;
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
    overflow: hidden;
}

.topbar-user-dropdown.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.topbar-user-info {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}

.topbar-user-avatar-lg {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.topbar-user-menu {
    padding: .4rem;
}

.topbar-menu-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .8rem;
    border-radius: .55rem;
    color: #334155;
    font-size: .84rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .12s ease;
}

.topbar-menu-item i {
    width: 1.1rem;
    text-align: center;
    font-size: .85rem;
    color: #64748b;
}

.topbar-menu-item:hover {
    background: #f1f5f9;
    color: #0f172a;
    text-decoration: none;
}

.topbar-menu-item.danger {
    color: #dc2626;
}

.topbar-menu-item.danger i {
    color: #dc2626;
}

.topbar-menu-item.danger:hover {
    background: #fef2f2;
}

.topbar-menu-divider {
    height: 1px;
    background: #f1f5f9;
    margin: .3rem .4rem;
}

.app-main {
    flex: 1 1 auto;
    padding: 1.75rem;
    overflow-y: auto;
    min-height: 0;
    overscroll-behavior: contain;
}

.app-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: .65rem 1rem;
    background: rgba(255, 255, 255, .78);
    border-top: 1px solid #dbe7f3;
    color: #64748b;
    font-size: .8rem;
    flex-shrink: 0;
    backdrop-filter: blur(12px);
    box-shadow: 0 -1px 8px rgba(15, 23, 42, .04);
}

/* ── Card ────────────────────────────────────────────────── */
.card {
    border: 0;
    border-radius: var(--card-radius);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .08);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #eef2f7;
    border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
}

.card-footer {
    background-color: #fff;
    border-top: 1px solid #eef2f7;
    border-radius: 0 0 var(--card-radius) var(--card-radius) !important;
}

/* ── Button ──────────────────────────────────────────────── */
.btn {
    border-radius: .6rem;
    font-weight: 500;
}

.btn-sm {
    border-radius: .5rem;
}

/* ── Form (sedikit lebih tinggi agar nyaman di web) ──────── */
.form-control,
.form-select {
    border: 1px solid #d1d5db;
    border-radius: .55rem;
    padding: .55rem .85rem;
    min-height: 2.75rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 .22rem rgba(59, 130, 246, .16);
}

textarea.form-control {
    min-height: 8rem;
}

.form-label {
    font-weight: 600;
    font-size: .875rem;
}

.form-text {
    font-size: .78rem;
}

.form-check-input:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* ── Badge ───────────────────────────────────────────────── */
.badge {
    border-radius: 999px;
    font-weight: 600;
}

/* ── Tabel ───────────────────────────────────────────────── */
.table thead th {
    background-color: #f8fafc;
    border-bottom: 1px solid #e5eaf1 !important;
    color: #475569;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.table tbody tr {
    transition: background-color .12s ease;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

.table > :not(caption) > * > * {
    border-bottom-color: #eef2f7;
}

/* ── Pagination ──────────────────────────────────────────── */
.page-link {
    border-radius: .5rem;
    margin: 0 2px;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.page-link:hover {
    color: var(--bs-primary);
    background: #eff6ff;
}

.page-item.active .page-link {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* ── Alert ───────────────────────────────────────────────── */
.alert {
    border: 0;
    border-radius: .8rem;
}

/* ── Breadcrumb ──────────────────────────────────────────── */
.breadcrumb {
    font-size: .82rem;
}

.breadcrumb a {
    color: var(--bs-primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}


/* ── Stat card dashboard ─────────────────────────────────── */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border-radius: var(--card-radius);
    padding: 1.35rem 1.5rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .08);
    transition: transform .2s ease, box-shadow .2s ease;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, .12);
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-label {
    font-size: .73rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b;
}

.stat-number {
    font-size: 1.65rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

/* ── Profil ──────────────────────────────────────────────── */
.profile-avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(59, 130, 246, .35);
}

/* ── Guest layout ────────────────────────────────────────── */
nav.navbar.bg-dark {
    background-color: var(--sidebar-bg) !important;
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-content {
    border: 0;
    border-radius: 1.1rem;
    box-shadow: 0 25px 60px rgba(15, 23, 42, .25);
}

.modal-header {
    border-bottom: 1px solid #eef2f7;
}

.modal-footer {
    border-top: 1px solid #eef2f7;
}

.list-group-item {
    border-color: #eef2f7;
}

/* ── Print aplikasi (browser Ctrl+P) ─────────────────────── */
@media print {
    #sidebar-wrapper,
    .app-topbar,
    .app-footer,
    footer,
    .btn,
    .no-print {
        display: none !important;
    }

    #page-content-wrapper {
        width: 100% !important;
        height: auto !important;
        margin-left: 0 !important;
        overflow: visible !important;
    }

    body.app-shell,
    #wrapper,
    .app-main {
        height: auto !important;
        overflow: visible !important;
    }

    body {
        background: #fff !important;
    }
}

/* ── Komponen lama yang masih dipakai ────────────────────── */
.upload-area {
    border: 2px dashed var(--bs-primary);
    border-radius: .6rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover,
.upload-area.dragover {
    background-color: #eff6ff;
    border-color: #2563eb;
}

.file-preview {
    max-width: 100%;
    max-height: 200px;
    margin-top: 1rem;
    border-radius: .6rem;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--bs-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Mobile Responsive ───────────────────────────────────── */

.app-main {
    min-width: 0;
}

@media (max-width: 991.98px) {
    .app-topbar {
        padding: 0 .75rem;
        gap: .5rem;
        z-index: 1046;
    }

    .topbar-clock {
        font-size: .8rem;
        padding: .3rem .6rem;
    }

    .topbar-clock .me-2 {
        margin-right: .25rem !important;
    }
}

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

    .topbar-start {
        gap: .5rem;
    }

    .topbar-title {
        font-size: .75rem;
    }
}

@media (max-height: 600px) {
    .sidebar-brand {
        padding: .65rem 1rem;
    }

    .sidebar-nav {
        padding-top: .5rem;
        padding-bottom: .5rem;
    }

    .sidebar-user {
        padding: .65rem .75rem;
        padding-bottom: max(.65rem, env(safe-area-inset-bottom));
    }

    .sidebar-user-info {
        margin-bottom: .5rem !important;
    }

    .sidebar-user-btn {
        padding-top: .35rem;
        padding-bottom: .35rem;
        margin-bottom: .3rem;
    }

    .sidebar-avatar {
        width: 36px;
        height: 36px;
        font-size: .9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    #sidebar-wrapper,
    #page-content-wrapper,
    .notif-dropdown {
        transition: none;
    }

    .notif-bell.ringing > i {
        animation: none;
    }
}

@media (max-width: 768px) {
    .app-main {
        padding: .75rem;
    }

    /* Force tables to scroll horizontally within their card */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        font-size: .82rem;
    }

    .table thead th {
        font-size: .7rem;
        white-space: nowrap;
    }

    .table .btn-sm {
        padding: .25rem .4rem;
        font-size: .75rem;
    }

    /* Stat cards in dashboard */
    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 1.15rem;
    }

    .stat-number {
        font-size: 1.3rem;
    }

    /* Header adjustments */
    .app-topbar img {
        height: 24px !important;
    }

    /* Cards */
    .card-body {
        padding: .75rem;
    }

    .card-footer {
        padding: .75rem;
    }

    /* Page titles */
    h1.h3, .h3 {
        font-size: 1.15rem;
    }

    /* Forms - stack buttons */
    .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: .5rem;
    }

    /* Badge sizing */
    .badge {
        font-size: .72rem;
    }

    /* Modal adjustments */
    .modal-dialog {
        margin: .5rem;
    }
}

@media (max-width: 576px) {
    .app-main {
        padding: .5rem;
    }

    .topbar-clock {
        font-size: .72rem;
        padding: .25rem .5rem;
    }

    .topbar-clock span {
        display: inline;
    }

    /* Hide "WIB" text on very small screens to save space */
    .app-topbar .d-flex img {
        display: none !important;
    }

    /* Stack action buttons vertically */
    .text-end .btn-sm {
        margin-bottom: .25rem;
    }
}
