/* ============================================
   DASHBOARD PERANGKAT DESA — PROFESIONAL UI/UX
   Design system kelas dunia
   ============================================ */

:root {
    --pd-primary: #0d9488;
    --pd-primary-light: #14b8a6;
    --pd-primary-dark: #0f766e;
    --pd-primary-50: #f0fdfa;
    --pd-primary-100: #ccfbf1;
    --pd-bg: #f1f5f9;
    --pd-bg-subtle: #f8fafc;
    --pd-surface: #ffffff;
    --pd-border: #e2e8f0;
    --pd-border-strong: #cbd5e1;
    --pd-text: #0f172a;
    --pd-text-muted: #64748b;
    --pd-text-subtle: #94a3b8;
    --pd-text-light: #94a3b8;
    --pd-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    --pd-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.04);
    --pd-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
    --pd-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.08);
    --pd-radius: 14px;
    --pd-radius-sm: 10px;
    --pd-radius-lg: 18px;
    --pd-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --pd-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

body.theme-dark, body.perangkat-dashboard.theme-dark {
    --pd-bg: #0f1419;
    --pd-bg-subtle: #141a24;
    --pd-surface: #1a1f2e;
    --pd-border: rgba(255, 255, 255, 0.08);
    --pd-border-strong: rgba(255, 255, 255, 0.16);
    --pd-text: #e5e7eb;
    --pd-text-muted: #9ca3af;
    --pd-text-subtle: #6b7280;
    --pd-text-light: #6b7280;
    --pd-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    --pd-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    --pd-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.2);
    --pd-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3,
body.theme-dark h4,
body.theme-dark h5,
body.theme-dark h6,
body.theme-dark .card-header {
    color: var(--pd-text) !important;
}

body.theme-dark .card-header {
    background-color: var(--pd-bg-subtle);
    border-bottom-color: var(--pd-border) !important;
}

body.perangkat-dashboard {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--pd-bg);
    color: var(--pd-text);
    margin: 0;
    padding: 0;
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15px;
    line-height: 1.55;
    letter-spacing: -0.01em;
}

/* ============================================
   SIDEBAR — Premium navigation
   ============================================ */

.dashboard-sidebar {
    width: 280px;
    background: var(--pd-surface);
    border-right: 1px solid var(--pd-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s var(--pd-ease-out), width 0.3s var(--pd-ease-out);
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.04);
}

.dashboard-sidebar.collapsed {
    transform: translateX(-100%);
}

@media (min-width: 1025px) {
    .dashboard-sidebar.collapsed {
        transform: translateX(0);
        width: 72px;
    }
    
    .dashboard-sidebar.collapsed .sidebar-logo h1,
    .dashboard-sidebar.collapsed .nav-item span:not(.material-icons),
    .dashboard-sidebar.collapsed .nav-group-title,
    .dashboard-sidebar.collapsed .nav-group-arrow,
    .dashboard-sidebar.collapsed .user-details,
    .dashboard-sidebar.collapsed .logout-btn span:not(.material-icons),
    .dashboard-sidebar.collapsed .nav-group-menu {
        display: none;
    }
    
    .dashboard-sidebar.collapsed .nav-item {
        justify-content: center;
        padding: 0.65rem;
    }
    
    .dashboard-sidebar.collapsed .nav-group-toggle {
        justify-content: center;
        padding: 0.65rem;
    }
    
    .dashboard-sidebar.collapsed .sidebar-logo {
        justify-content: center;
    }
    
    .dashboard-main.sidebar-collapsed {
        margin-left: 72px;
    }
}

.sidebar-header {
    padding: 1.5rem 1.5rem;
    border-bottom: 1px solid var(--pd-border);
    background: linear-gradient(180deg, var(--pd-surface) 0%, var(--pd-bg-subtle) 100%);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.sidebar-logo .logo-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: var(--pd-radius-sm);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.sidebar-logo h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--pd-text);
    margin: 0;
    letter-spacing: -0.025em;
    line-height: 1.3;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.nav-section {
    margin-bottom: 0.5rem;
}

/* Laravel-style Navigation Groups */
.nav-group {
    margin-bottom: 0.25rem;
}

.nav-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--pd-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--pd-transition);
    border-left: 3px solid transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    position: relative;
}

.nav-group-toggle:hover {
    background: rgba(15, 118, 110, 0.06);
    color: var(--pd-primary);
    border-left-color: var(--pd-primary);
}

.nav-group-toggle.active {
    background: rgba(15, 118, 110, 0.08);
    color: var(--pd-primary);
    font-weight: 600;
    border-left-color: var(--pd-primary);
}

.nav-group-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.nav-group-icon .material-icons {
    font-size: 1.25rem;
}

.nav-group-title {
    flex: 1;
    text-align: left;
}

.nav-group-arrow {
    font-size: 1.25rem !important;
    transition: transform 0.2s ease;
    color: var(--pd-text-light);
}

.nav-group-toggle.active .nav-group-arrow {
    transform: rotate(90deg);
    color: var(--pd-primary);
}

.nav-group-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, padding 0.2s ease;
    opacity: 0;
    background: rgba(0, 0, 0, 0.02);
    padding: 0;
}

.nav-group-menu.show {
    max-height: 1000px;
    opacity: 1;
    padding: 0.25rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    color: var(--pd-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--pd-transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #f3f4f6;
    color: var(--pd-primary);
    border-left-color: var(--pd-primary);
}

.nav-item.active {
    background: var(--pd-primary-50);
    color: var(--pd-primary);
    font-weight: 600;
    border-left-color: var(--pd-primary);
}

.nav-sub-item {
    padding-left: 3.5rem !important;
    font-size: 0.8125rem;
    font-weight: 400;
}

.nav-sub-item.active {
    background: var(--pd-primary-50);
    color: var(--pd-primary);
    font-weight: 500;
    border-left-color: var(--pd-primary);
}

.nav-sub-category {
    padding: 0.5rem 1rem 0.25rem 3.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pd-text-muted);
}

.nav-sub-divider {
    padding: 0.5rem 1rem 0.25rem 3.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pd-text-subtle);
    margin-top: 0.25rem;
    border-top: 1px solid var(--pd-border);
    padding-top: 0.5rem;
}

.nav-sub-sub-item {
    padding-left: 4.25rem !important;
    font-size: 0.8rem;
}

.nav-item .material-icons {
    font-size: 1.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-badge {
    margin-left: auto;
    background: #dc2626;
    color: white;
    border-radius: 12px;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--pd-border);
    background: var(--pd-bg);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--pd-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.user-avatar .material-icons {
    font-size: 1.5rem;
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--pd-text);
}

.user-role {
    font-size: 0.75rem;
    color: var(--pd-text-muted);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #fef2f2;
    color: #dc2626;
    text-decoration: none;
    border: none;
    border-radius: var(--pd-radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--pd-transition);
    width: 100%;
    justify-content: center;
    cursor: pointer;
    font-family: inherit;
}

.logout-btn:hover {
    background: #fee2e2;
    color: #b91c1c;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.dashboard-main {
    flex: 1;
    margin-left: 280px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s var(--pd-ease-out);
}

.dashboard-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--pd-border);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: block;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--pd-text);
    border-radius: var(--pd-radius);
    transition: var(--pd-transition);
}

.sidebar-toggle:hover {
    background: #f3f4f6;
}

.sidebar-toggle .material-icons {
    font-size: 1.5rem;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--pd-text);
    border-radius: var(--pd-radius);
    transition: var(--pd-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover {
    background: var(--pd-bg);
    color: var(--pd-primary);
}
.theme-toggle .material-icons {
    font-size: 1.4rem;
}
.theme-icon-dark { display: none; }
.theme-icon-light { display: inline-flex; }
body.perangkat-dashboard.theme-dark .theme-icon-dark { display: inline-flex; }
body.perangkat-dashboard.theme-dark .theme-icon-light { display: none; }

/* Foto profil di header & dropdown */
.user-dropdown-avatar {
    overflow: hidden;
}
.user-dropdown-avatar img.user-dropdown-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.user-menu-trigger .user-menu-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--pd-text);
    margin: 0;
    letter-spacing: -0.025em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-user .material-icons {
    color: var(--pd-text-light);
    cursor: pointer;
    transition: var(--pd-transition);
}

.header-user .material-icons:hover {
    color: var(--pd-primary);
}

/* Notification Dropdown */
.notification-dropdown {
    position: relative;
}

.notification-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--pd-text);
    border-radius: var(--pd-radius);
    transition: var(--pd-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-btn:hover {
    background: #f3f4f6;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #dc2626;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    border: 2px solid white;
}

.notification-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--pd-surface);
    border-radius: var(--pd-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 320px;
    max-width: 400px;
    z-index: 1000;
    border: 1px solid var(--pd-border);
    animation: slideDown 0.2s ease;
}

.notification-dropdown-menu.show {
    display: block;
}

.notification-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pd-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--pd-text);
}

.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--pd-text-light);
    border-radius: 4px;
    transition: var(--pd-transition);
}

.notification-close:hover {
    background: #f3f4f6;
    color: var(--pd-text);
}

.notification-body {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pd-border);
    text-decoration: none;
    color: var(--pd-text);
    transition: var(--pd-transition);
}

.notification-item:hover {
    background: #f9fafb;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon .material-icons {
    font-size: 1.25rem;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--pd-text);
    margin-bottom: 0.25rem;
}

.notification-text {
    font-size: 0.75rem;
    color: var(--pd-text-light);
}

.notification-empty {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--pd-text-light);
}

.notification-empty .material-icons {
    font-size: 3rem;
    color: var(--pd-text-light);
    opacity: 0.3;
    margin-bottom: 0.5rem;
}

.notification-empty p {
    margin: 0;
    font-size: 0.875rem;
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f9fafb;
    border-radius: var(--pd-radius);
    cursor: pointer;
    transition: var(--pd-transition);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    color: var(--pd-text);
    font-family: inherit;
}

.user-menu-trigger:hover {
    background: #f3f4f6;
}

.user-menu-trigger .material-icons:last-child {
    font-size: 1.25rem;
    color: var(--pd-text-light);
    transition: transform 0.2s ease;
}

.user-dropdown-menu.show ~ .user-menu-trigger .material-icons:last-child,
.user-menu-trigger.active .material-icons:last-child {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--pd-surface);
    border-radius: var(--pd-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    z-index: 1000;
    border: 1px solid var(--pd-border);
    animation: slideDown 0.2s ease;
    overflow: hidden;
}

.user-dropdown-menu.show {
    display: block;
}

.user-dropdown-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pd-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f9fafb;
}

.user-dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--pd-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.user-dropdown-avatar .material-icons {
    font-size: 1.5rem;
}

.user-dropdown-info {
    flex: 1;
    min-width: 0;
}

.user-dropdown-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--pd-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-role {
    font-size: 0.75rem;
    color: var(--pd-text-light);
    margin-top: 0.125rem;
}

.user-dropdown-body {
    padding: 0.5rem 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--pd-text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--pd-transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.user-dropdown-item:hover {
    background: #f9fafb;
    color: var(--pd-primary);
}

.user-dropdown-item .material-icons {
    font-size: 1.25rem;
    color: var(--pd-text-light);
    width: 24px;
}

.user-dropdown-item:hover .material-icons {
    color: var(--pd-primary);
}

.user-dropdown-item.logout-item {
    color: #dc2626;
}

.user-dropdown-item.logout-item:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.user-dropdown-item.logout-item .material-icons {
    color: #dc2626;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--pd-border);
    margin: 0.5rem 0;
}

.dashboard-content {
    flex: 1;
    padding: 1.75rem 2rem 3rem;
    background: var(--pd-bg);
}

/* Breadcrumb — minimal & clear */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
    font-size: 0.8125rem;
    color: var(--pd-text-muted);
}

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

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

.breadcrumb a:not(:last-child)::after {
    content: '›';
    margin-left: 0.5rem;
    color: var(--pd-text-subtle);
    font-weight: 400;
}

.breadcrumb .breadcrumb-item {
    color: var(--pd-text-light);
}

.breadcrumb .breadcrumb-item.active {
    color: var(--pd-text);
    font-weight: 500;
}

/* Modal — backdrop blur, smooth scale */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.25s var(--pd-ease-out);
}

.modal.show {
    display: flex;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--pd-surface);
    border-radius: var(--pd-radius-lg);
    box-shadow: var(--pd-shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.04);
    max-width: 420px;
    width: 90%;
    animation: modalSlideUp 0.35s var(--pd-ease-out);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(16px) scale(0.98);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--pd-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--pd-radius-lg) var(--pd-radius-lg) 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--pd-text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--pd-text-light);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: var(--pd-transition);
}

.modal-close:hover {
    background: #f3f4f6;
    color: var(--pd-text);
}

.modal-body {
    padding: 1.5rem 1.75rem;
    color: var(--pd-text);
}

.modal-body p {
    margin: 0;
}

.modal-footer {
    padding: 1.25rem 1.75rem 1.5rem;
    border-top: 1px solid var(--pd-border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    border-radius: 0 0 var(--pd-radius-lg) var(--pd-radius-lg);
}

/* Notification Dropdown */
.notification-dropdown {
    position: relative;
}

.notification-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--pd-text);
    border-radius: var(--pd-radius);
    transition: var(--pd-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-btn:hover {
    background: #f3f4f6;
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #dc2626;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    border: 2px solid white;
}

.notification-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--pd-surface);
    border-radius: var(--pd-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 320px;
    max-width: 400px;
    z-index: 1000;
    border: 1px solid var(--pd-border);
    animation: slideDown 0.2s ease;
}

.notification-dropdown-menu.show {
    display: block;
}

.notification-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pd-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--pd-text);
}

.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--pd-text-light);
    border-radius: 4px;
    transition: var(--pd-transition);
}

.notification-close:hover {
    background: #f3f4f6;
    color: var(--pd-text);
}

.notification-body {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pd-border);
    text-decoration: none;
    color: var(--pd-text);
    transition: var(--pd-transition);
}

.notification-item:hover {
    background: #f9fafb;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notification-icon .material-icons {
    font-size: 1.25rem;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--pd-text);
    margin-bottom: 0.25rem;
}

.notification-text {
    font-size: 0.75rem;
    color: var(--pd-text-light);
}

.notification-empty {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--pd-text-light);
}

.notification-empty .material-icons {
    font-size: 3rem;
    color: var(--pd-text-light);
    opacity: 0.3;
    margin-bottom: 0.5rem;
}

.notification-empty p {
    margin: 0;
    font-size: 0.875rem;
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f9fafb;
    border-radius: var(--pd-radius);
    cursor: pointer;
    transition: var(--pd-transition);
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    color: var(--pd-text);
    font-family: inherit;
}

.user-menu-trigger:hover {
    background: #f3f4f6;
}

.user-menu-trigger .material-icons:last-child {
    font-size: 1.25rem;
    color: var(--pd-text-light);
    transition: transform 0.2s ease;
}

.user-dropdown-menu.show ~ .user-menu-trigger .material-icons:last-child,
.user-menu-trigger.active .material-icons:last-child {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--pd-surface);
    border-radius: var(--pd-radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    z-index: 1000;
    border: 1px solid var(--pd-border);
    animation: slideDown 0.2s ease;
    overflow: hidden;
}

.user-dropdown-menu.show {
    display: block;
}

.user-dropdown-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pd-border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #f9fafb;
}

.user-dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--pd-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.user-dropdown-avatar .material-icons {
    font-size: 1.5rem;
}

.user-dropdown-info {
    flex: 1;
    min-width: 0;
}

.user-dropdown-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--pd-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-dropdown-role {
    font-size: 0.75rem;
    color: var(--pd-text-light);
    margin-top: 0.125rem;
}

.user-dropdown-body {
    padding: 0.5rem 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--pd-text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--pd-transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}

.user-dropdown-item:hover {
    background: #f9fafb;
    color: var(--pd-primary);
}

.user-dropdown-item .material-icons {
    font-size: 1.25rem;
    color: var(--pd-text-light);
    width: 24px;
}

.user-dropdown-item:hover .material-icons {
    color: var(--pd-primary);
}

.user-dropdown-item.logout-item {
    color: #dc2626;
}

.user-dropdown-item.logout-item:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.user-dropdown-item.logout-item .material-icons {
    color: #dc2626;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--pd-border);
    margin: 0.5rem 0;
}

/* ============================================
   DASHBOARD — CLEAN CARDS & WIDGETS
   ============================================ */

.filament-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* Welcome Card — premium hero */
.filament-welcome-card {
    background: linear-gradient(135deg, var(--pd-primary) 0%, var(--pd-primary-dark) 100%);
    border-radius: var(--pd-radius-lg);
    padding: 2rem 2.25rem;
    border: none;
    box-shadow: var(--pd-shadow-md), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    position: relative;
    overflow: hidden;
}

.filament-welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
    background: radial-gradient(ellipse at 100% 50%, rgba(255,255,255,0.12) 0%, transparent 60%);
    pointer-events: none;
}

.filament-welcome-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

.filament-welcome-title {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    letter-spacing: -0.025em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.filament-welcome-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9375rem;
}

.filament-welcome-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--pd-radius);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Stat Widgets — minimal & clean */
.filament-widgets-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin-bottom: 0.25rem;
}

@media (max-width: 1200px) {
    .filament-widgets-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.filament-widget {
    background: var(--pd-surface);
    border-radius: var(--pd-radius);
    padding: 1.5rem 1.75rem;
    border: 1px solid var(--pd-border);
    box-shadow: var(--pd-shadow);
    transition: transform 0.2s var(--pd-ease-out), box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

.filament-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.filament-widget:hover {
    border-color: var(--pd-border-strong);
    box-shadow: var(--pd-shadow-md);
    transform: translateY(-2px);
}

.filament-widget:hover::before {
    opacity: 1;
}

.filament-widget-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.filament-widget-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--pd-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.filament-widget-blue .filament-widget-icon { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.filament-widget-blue::before { background: #3b82f6; }

.filament-widget-yellow .filament-widget-icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.filament-widget-yellow::before { background: #f59e0b; }

.filament-widget-pink .filament-widget-icon { background: linear-gradient(135deg, #ec4899, #db2777); }
.filament-widget-pink::before { background: #ec4899; }

.filament-widget-green .filament-widget-icon { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.filament-widget-green::before { background: var(--pd-primary); }

.filament-widget-content {
    flex: 1;
    min-width: 0;
}

.filament-widget-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pd-text-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.filament-widget-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
    color: var(--pd-text);
}

.filament-widget-blue .filament-widget-value { color: #2563eb; }
.filament-widget-yellow .filament-widget-value { color: #d97706; }
.filament-widget-pink .filament-widget-value { color: #db2777; }
.filament-widget-green .filament-widget-value { color: var(--pd-primary); }

.filament-widget-description {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Badges */
.filament-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1;
}

.filament-badge-success {
    background: #d1fae5;
    color: #065f46;
}

.filament-badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.filament-badge-info {
    background: #e0f2fe;
    color: #0369a1;
}

.filament-badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Content Grid */
.filament-content-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

@media (max-width: 1200px) {
    .filament-content-grid {
        grid-template-columns: 1fr;
    }
}

/* Content Widget — clean card */
.filament-content-widget {
    background: var(--pd-surface);
    border-radius: var(--pd-radius);
    border: 1px solid var(--pd-border);
    box-shadow: var(--pd-shadow);
    overflow: hidden;
    transition: var(--pd-transition);
}

.filament-content-widget:hover {
    border-color: var(--pd-border-strong);
    box-shadow: var(--pd-shadow-md);
}

.filament-content-widget-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--pd-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--pd-surface);
}

.filament-content-widget-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--pd-text);
    margin: 0;
    letter-spacing: -0.01em;
}

.filament-content-widget-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filament-content-widget-body {
    padding: 0;
}

/* List */
.filament-list {
    display: flex;
    flex-direction: column;
}

.filament-list-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--pd-border);
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.filament-list-item:last-child {
    border-bottom: none;
}

.filament-list-item:hover {
    background: var(--pd-bg);
}

.filament-list-item-content {
    flex: 1;
    min-width: 0;
}

.filament-list-item-title {
    display: block;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--pd-text);
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: color 0.15s ease;
}

.filament-list-item-title:hover {
    color: var(--pd-primary);
}

.filament-list-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filament-list-item-date {
    font-size: 0.8125rem;
    color: var(--pd-text-light);
}

.filament-list-item-description {
    font-size: 0.8125rem;
    color: var(--pd-text-light);
    margin-top: 0.25rem;
}

.filament-list-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Buttons */
.filament-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    gap: 0.375rem;
}

.filament-button-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.filament-button-primary {
    background: var(--pd-primary);
    color: white;
}

.filament-button-primary:hover {
    background: var(--pd-primary-dark);
    color: white;
}

.filament-button-info {
    background-color: #3b82f6;
    color: white;
}

.filament-button-info:hover {
    background-color: #2563eb;
    color: white;
}

.filament-button-success {
    background-color: #10b981;
    color: white;
}

.filament-button-success:hover {
    background-color: #059669;
    color: white;
}

.filament-link {
    color: var(--pd-primary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s ease;
}

.filament-link:hover {
    color: #0f4a35;
    text-decoration: underline;
}

/* Empty State */
.filament-empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--pd-text-light);
}

.filament-empty-state p {
    margin: 0;
    font-size: 0.9375rem;
}

/* Legacy Support */
.dashboard-card {
    background: var(--pd-surface);
    border-radius: var(--pd-radius);
    box-shadow: var(--pd-shadow);
    border: 1px solid var(--pd-border);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--pd-transition);
}

.dashboard-card:hover {
    box-shadow: var(--pd-shadow-hover);
    transform: translateY(-2px);
}

.dashboard-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--pd-text);
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--pd-border);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--pd-surface);
    border-radius: var(--pd-radius);
    padding: 1.5rem;
    box-shadow: var(--pd-shadow);
    border: 1px solid var(--pd-border);
    transition: var(--pd-transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.stat-card:hover::before {
    transform: translateX(100%);
}

.stat-card:hover {
    box-shadow: var(--pd-shadow-hover);
    transform: translateY(-3px);
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--pd-text-light);
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--pd-primary);
    margin: 0.5rem 0;
}

.stat-meta {
    font-size: 0.75rem;
    color: var(--pd-text-light);
}

/* ============================================
   MESSAGES
   ============================================ */

.messages-container {
    margin-bottom: 1.5rem;
    margin-top: 0;
    position: sticky;
    top: 0;
    z-index: 99;
    animation: slideDown 0.3s var(--pd-ease-out);
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--pd-radius-sm);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9375rem;
    border: 1px solid transparent;
    animation: slideDown 0.3s var(--pd-ease-out);
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-color: #bfdbfe;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: var(--pd-transition);
}

.close-btn:hover {
    opacity: 1;
}

/* ============================================
   CRUD STYLING
   ============================================ */

/* Card — elevated container for list/detail */
.card {
    background: var(--pd-surface);
    border-radius: var(--pd-radius);
    border: 1px solid var(--pd-border);
    box-shadow: var(--pd-shadow);
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    box-shadow: var(--pd-shadow-md);
    border-color: var(--pd-border-strong);
}

/* Action Bar — page toolbar */
.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-filter {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-filter form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-filter input,
.search-filter select {
    padding: 0.625rem 1rem;
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-radius-sm);
    font-size: 0.9375rem;
    background: var(--pd-surface);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-filter input:focus,
.search-filter select:focus {
    outline: none;
    border-color: var(--pd-primary);
    box-shadow: 0 0 0 3px var(--pd-primary-50);
}

/* Tables — modern, readable */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--pd-surface);
    font-size: 0.9375rem;
}

table thead {
    background: var(--pd-bg-subtle);
    border-bottom: 2px solid var(--pd-border);
}

table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--pd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--pd-border);
    color: var(--pd-text);
    vertical-align: middle;
}

table tbody tr {
    transition: background 0.15s ease;
}

table tbody tr:hover {
    background: var(--pd-primary-50);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   FORMS — Layout & kontrol rapi
   ============================================ */

.form-container {
    max-width: 720px;
    margin: 0 auto;
}

.card.form-container,
.card .form-container {
    padding: 2rem 2.25rem;
}

.form-container > form,
.card form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Section judul di dalam form */
.form-section-title,
.form-container h3,
.card form h3 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--pd-text);
    margin: 0 0 1.25rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--pd-border);
    letter-spacing: -0.01em;
}

.form-section-title:not(:first-child),
.card form h3:not(:first-child) {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--pd-border);
}

/* Baris dua kolom */
.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

@media (max-width: 640px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .form-row-2-1 {
        grid-template-columns: 1fr;
    }
}

.form-row-2-1 {
    grid-template-columns: 2fr 1fr;
}

.form-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.8125rem;
    color: var(--pd-text-muted);
}

.form-file-preview {
    margin-top: 0.75rem;
}

.form-file-preview img {
    max-width: 150px;
    max-height: 150px;
    object-fit: cover;
    border: 1px solid var(--pd-border);
    padding: 0.5rem;
    border-radius: var(--pd-radius-sm);
}

.form-file-preview--logo img {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    padding: 0.75rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group:last-of-type {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--pd-text);
}

.form-group label + .form-control,
.form-group label + select,
.form-group label + textarea,
.form-group .form-control,
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="date"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
    display: block;
    width: 100%;
    margin-top: 0;
}

/* Error di bawah field */
.form-group .alert-danger,
.form-group .error,
.form-group .invalid-feedback {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--pd-radius-sm);
}

.form-group .error {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    list-style: none;
    padding-left: 0.75rem;
}

.form-group .error li {
    list-style: none;
}

/* Input & select */
.form-control {
    width: 100%;
    padding: 0.6875rem 1rem;
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-radius-sm);
    font-size: 0.9375rem;
    background: var(--pd-surface);
    color: var(--pd-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

/* Make plain <select> readable in light theme too (pakai background-color agar panah tidak reset) */
body.perangkat-dashboard:not(.theme-dark) select {
    background-color: #ffffff;
    color: #0f172a !important;
    font-weight: 600;
}

body.perangkat-dashboard:not(.theme-dark) select option {
    color: #0f172a !important;
    font-weight: 600;
}

/* Placeholder option (value="") should look subtle, selected value should not */
body.perangkat-dashboard:not(.theme-dark) select option[value=""] {
    color: #9ca3af !important;
    font-weight: 500;
}

body.perangkat-dashboard:not(.theme-dark) select:required:invalid {
    color: #9ca3af !important;
    font-weight: 500;
}

.form-control:focus {
    border-color: var(--pd-primary);
    box-shadow: 0 0 0 3px var(--pd-primary-50);
    outline: none;
}

.form-control::placeholder {
    color: var(--pd-text-subtle);
}

select.form-control {
    appearance: none;
    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='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 16px;
    padding-right: 2.5rem;
}

/* Light theme: make chevron a bit darker + pastikan panah di kanan */
body.perangkat-dashboard:not(.theme-dark) select.form-control {
    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='%23111827' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 16px;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

input[type="file"].form-control {
    padding: 0.5rem;
    font-size: 0.875rem;
}

/* Checkbox & radio */
.form-check-input {
    width: 1.125rem;
    height: 1.125rem;
    margin-right: 0.5rem;
    accent-color: var(--pd-primary);
    vertical-align: middle;
}

.form-check-label {
    font-size: 0.9375rem;
    color: var(--pd-text);
    vertical-align: middle;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Tombol aksi form (Simpan / Batal) */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--pd-border);
}

.form-actions .btn {
    min-width: 0;
}

/* Fallback: div dengan flex gap untuk form actions */
.card form > div[style*="flex"]:last-child,
.card form > div[style*="gap"]:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.75rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--pd-border);
}

/* CKEditor dalam form */
.form-group .cke {
    border-radius: var(--pd-radius-sm);
    border: 1px solid var(--pd-border);
    overflow: hidden;
}

.form-group .cke_focus {
    border-color: var(--pd-primary);
    box-shadow: 0 0 0 3px var(--pd-primary-50);
}

/* Buttons — clear hierarchy */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--pd-radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--pd-primary);
    color: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
    background: var(--pd-primary-dark);
    color: white;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.btn-success {
    background: #059669;
    color: white;
}

.btn-success:hover {
    background: #047857;
    color: white;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
    color: white;
}

.btn-secondary {
    background: var(--pd-bg-subtle);
    color: var(--pd-text);
    border: 1px solid var(--pd-border);
}

.btn-secondary:hover {
    background: var(--pd-border);
    color: var(--pd-text);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn i {
    font-size: 0.9em;
}

/* Badges — pill style */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-info {
    background: #e0f2fe;
    color: #0369a1;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-secondary {
    background: var(--pd-border);
    color: var(--pd-text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding: 1rem 0;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-radius-sm);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--pd-text);
    background: var(--pd-surface);
    transition: all 0.2s ease;
}

.pagination .current {
    background: var(--pd-primary);
    color: white;
    border-color: var(--pd-primary);
}

.pagination a:hover {
    background: var(--pd-primary-50);
    border-color: var(--pd-primary);
    color: var(--pd-primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--pd-text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state p {
    margin: 0;
    font-size: 0.9375rem;
}

/* ============================================
   CKEditor Styling
   ============================================ */

/* Ensure CKEditor is visible */
.cke {
    visibility: visible !important;
    display: block !important;
}

.cke_inner {
    visibility: visible !important;
    display: block !important;
}

.cke_contents {
    visibility: visible !important;
    display: block !important;
}

.cke_editable {
    visibility: visible !important;
    display: block !important;
}

/* CKEditor in dashboard card */
.dashboard-card .cke {
    margin: 0 !important;
}

.dashboard-card .cke_inner {
    background: #e5e5e5 !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .dashboard-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .dashboard-sidebar.active {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }
    
    .dashboard-main {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    /* Overlay saat sidebar terbuka di mobile — tap untuk tutup */
    body.perangkat-dashboard.sidebar-open-mobile::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
        pointer-events: auto;
    }
    body.perangkat-dashboard.sidebar-open-mobile {
        overflow: hidden;
    }
}

@media (max-width: 768px) {
    .dashboard-content {
        padding: 1rem;
    }
    
    .stat-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-header {
        padding: 1rem;
    }

    /* Filament Responsive */
    .filament-widgets-grid {
        grid-template-columns: 1fr;
    }

    .filament-content-grid {
        grid-template-columns: 1fr;
    }

    .filament-welcome-content {
        flex-direction: column;
        text-align: center;
    }

    .filament-welcome-icon {
        font-size: 2.5rem;
    }

    .filament-content-widget-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .filament-content-widget-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .filament-list-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .filament-list-item-actions {
        width: 100%;
        justify-content: flex-start;
    }
}



/* ============================================
   KATEGORI SURAT SECTION
   ============================================ */

.filament-section {
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.filament-section-header {
    margin-bottom: 1.5rem;
}

.filament-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--pd-text);
    margin: 0;
    letter-spacing: -0.01em;
}

.filament-kategori-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

.filament-kategori-card {
    background: var(--pd-surface);
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all var(--pd-transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.filament-kategori-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--pd-primary), var(--pd-primary-light));
    opacity: 0;
    transition: opacity var(--pd-transition);
}

.filament-kategori-card:hover {
    border-color: var(--pd-primary-light);
    box-shadow: var(--pd-shadow-md);
    transform: translateY(-2px);
}

.filament-kategori-card:hover::before {
    opacity: 1;
}

.filament-kategori-icon {
    font-size: 2.5rem;
    color: var(--pd-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--pd-primary-50);
    border-radius: var(--pd-radius-sm);
    transition: all var(--pd-transition);
}

.filament-kategori-card:hover .filament-kategori-icon {
    background: var(--pd-primary-100);
    transform: scale(1.1);
}

.filament-kategori-content {
    flex: 1;
}

.filament-kategori-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--pd-text);
    margin: 0 0 0.75rem 0;
    letter-spacing: -0.01em;
}

.filament-kategori-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filament-kategori-stat {
    font-size: 0.8125rem;
    color: var(--pd-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.filament-kategori-stat strong {
    color: var(--pd-primary);
    font-weight: 700;
}

/* Responsive */
@media (max-width: 1200px) {
    .filament-kategori-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .filament-kategori-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .filament-kategori-card {
        padding: 1.25rem;
    }
    
    .filament-kategori-icon {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }
    
    .filament-kategori-name {
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .filament-kategori-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .filament-kategori-card {
        padding: 1rem;
    }
    
    .filament-kategori-icon {
        width: 45px;
        height: 45px;
        font-size: 1.75rem;
        margin-bottom: 0.75rem;
    }
    
    .filament-kategori-name {
        font-size: 0.8125rem;
        margin-bottom: 0.5rem;
    }
    
    .filament-kategori-stat {
        font-size: 0.75rem;
    }
}

/* ============================================
   DARK THEME — Dashboard Perangkat Desa
   ============================================ */

body.perangkat-dashboard.theme-dark {
    --pd-bg: #0f172a;
    --pd-bg-subtle: #1e293b;
    --pd-surface: #1e293b;
    --pd-border: #334155;
    --pd-border-strong: #475569;
    --pd-text: #f1f5f9;
    --pd-text-muted: #cbd5e1;
    --pd-text-subtle: #94a3b8;
    --pd-text-light: #94a3b8;
    --pd-primary-50: rgba(13, 148, 136, 0.2);
    --pd-primary-100: rgba(13, 148, 136, 0.25);
    --pd-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --pd-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.25), 0 2px 6px rgba(0, 0, 0, 0.2);
    --pd-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.35), 0 4px 16px rgba(0, 0, 0, 0.2);
    --pd-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.3);
}

body.perangkat-dashboard.theme-dark .dashboard-sidebar {
    box-shadow: 2px 0 24px rgba(0, 0, 0, 0.2);
}

body.perangkat-dashboard.theme-dark .nav-item:hover,
body.perangkat-dashboard.theme-dark .sidebar-toggle:hover,
body.perangkat-dashboard.theme-dark .notification-close:hover,
body.perangkat-dashboard.theme-dark .notification-btn:hover,
body.perangkat-dashboard.theme-dark .user-menu-trigger:hover,
body.perangkat-dashboard.theme-dark .modal-close:hover {
    background: var(--pd-bg-subtle);
}

body.perangkat-dashboard.theme-dark .notification-item:hover,
body.perangkat-dashboard.theme-dark .user-dropdown-item:hover {
    background: var(--pd-bg-subtle);
}

body.perangkat-dashboard.theme-dark .user-menu-trigger,
body.perangkat-dashboard.theme-dark .user-dropdown-header {
    background: var(--pd-bg-subtle);
}

/* Cards & header use surface; ensure borders visible in dark */
body.perangkat-dashboard.theme-dark .card {
    border-color: var(--pd-border);
}

body.perangkat-dashboard.theme-dark .dashboard-header {
    background: rgba(30, 41, 59, 0.9);
    border-color: var(--pd-border);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

/* Dark theme: form inputs, tables, cards use surface/border */
body.perangkat-dashboard.theme-dark input:not([type="submit"]):not([type="button"]),
body.perangkat-dashboard.theme-dark textarea,
body.perangkat-dashboard.theme-dark select {
    background: var(--pd-surface) !important;
    border-color: var(--pd-border) !important;
    color: var(--pd-text) !important;
}

body.perangkat-dashboard.theme-dark input::placeholder,
body.perangkat-dashboard.theme-dark textarea::placeholder {
    color: var(--pd-text-muted);
}

/* Alert / danger in dark */
body.perangkat-dashboard.theme-dark .alert-danger,
body.perangkat-dashboard.theme-dark .text-danger,
body.perangkat-dashboard.theme-dark .bg-danger {
    background: rgba(220, 38, 38, 0.2) !important;
    color: #fca5a5 !important;
    border-color: rgba(220, 38, 38, 0.4);
}

body.perangkat-dashboard.theme-dark .btn-danger {
    background: #dc2626;
    color: #fff;
}

body.perangkat-dashboard.theme-dark .badge.bg-danger {
    background: rgba(220, 38, 38, 0.35) !important;
    color: #fca5a5;
}
