/* ============================================================
   FILE: assets/css/style.css
   Style utama aplikasi Pelayanan Desa
   Menggunakan CSS variable untuk warna tema dinamis:
       --color-primary        (warna utama, dari database)
       --color-primary-dark   (warna utama versi gelap)
       --color-primary-light  (warna utama versi terang)
       --color-primary-rgb    (warna utama format R, G, B)
   ============================================================ */

/* ------------------------------------------------------------
   0. DEFAULT TEMA (fallback jika belum di-inject)
   ------------------------------------------------------------ */
:root {
    --color-primary: #006837;
    --color-primary-dark: #004d28;
    --color-primary-light: #e6f4ec;
    --color-primary-rgb: 0, 104, 55;
}

/* ------------------------------------------------------------
   1. RESET & BASE
   ------------------------------------------------------------ */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ------------------------------------------------------------
   2. BACKGROUND DEKORATIF (pola titik)
   ------------------------------------------------------------ */
.bg-dots {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.05;
    pointer-events: none;
    background-image: radial-gradient(#ffffff 1px, transparent 1px);
    background-size: 24px 24px;
}

.bg-dots-green {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 0.05;
    pointer-events: none;
    background-image: radial-gradient(var(--color-primary) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* ------------------------------------------------------------
   3. SCROLLBAR
   ------------------------------------------------------------ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}
::-webkit-scrollbar-thumb {
    background: rgba(var(--color-primary-rgb), 0.4);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-primary-rgb), 0.7);
}

/* ------------------------------------------------------------
   4. KOMPONEN: CARD PUTIH
   ------------------------------------------------------------ */
.card-white {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .card-header {
        padding: 1rem 1.5rem;
    }
}

.card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .card-body {
        padding: 1.5rem;
    }
}

/* ------------------------------------------------------------
   5. KOMPONEN: FORM
   ------------------------------------------------------------ */
.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
}

.form-label .required {
    color: #ef4444;
}

.form-hint {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.6875rem;
    color: #94a3b8;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    color: #1e293b;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: #94a3b8;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.15);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Input dengan ikon di dalam */
.form-input-icon {
    position: relative;
}

.form-input-icon .icon-left {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    padding-left: 0.875rem;
    display: flex;
    align-items: center;
    pointer-events: none;
    color: #94a3b8;
}

.form-input-icon .icon-right {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    padding-right: 0.875rem;
    display: flex;
    align-items: center;
    color: #94a3b8;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.form-input-icon .icon-right:hover {
    color: #475569;
}

.form-input-icon .form-input {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
    background: #f8fafc;
    border-radius: 0.75rem;
}

.form-input-icon .form-input:focus {
    background: #ffffff;
}

/* ------------------------------------------------------------
   6. KOMPONEN: FILE UPLOAD DROPZONE
   ------------------------------------------------------------ */
.upload-box {
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 1rem;
    text-align: center;
    background: rgba(248, 250, 252, 0.5);
    transition: border-color 0.2s, background 0.2s;
}

.upload-box:hover {
    border-color: rgba(var(--color-primary-rgb), 0.5);
    background: rgba(var(--color-primary-rgb), 0.04);
}

.upload-box input[type="file"] {
    width: 100%;
    font-size: 0.75rem;
    color: #475569;
    cursor: pointer;
}

.upload-box input[type="file"]::file-selector-button {
    margin-right: 0.75rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--color-primary);
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s;
}

.upload-box input[type="file"]::file-selector-button:hover {
    background: var(--color-primary-dark);
}

.upload-box.video input[type="file"]::file-selector-button {
    background: #334155;
}
.upload-box.video input[type="file"]::file-selector-button:hover {
    background: #1e293b;
}

/* ------------------------------------------------------------
   7. KOMPONEN: TOMBOL
   ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
}

.btn-secondary {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
}
.btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
}

.btn-gold {
    background: #D4AF37;
    color: var(--color-primary-dark);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.35);
}
.btn-gold:hover:not(:disabled) {
    background: #facc15;
}

/* ------------------------------------------------------------
   8. KOMPONEN: INFO BOX
   ------------------------------------------------------------ */
.info-box {
    background: rgba(255, 255, 255, 0.95);
    border-left: 4px solid #D4AF37;
    border-radius: 0.75rem;
    padding: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    box-shadow: 0 10px 25px -8px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
}

.info-box i {
    color: #D4AF37;
    font-size: 1rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.info-box .info-text {
    font-size: 0.75rem;
    line-height: 1.6;
    color: #334155;
}

.info-box .info-text b {
    color: var(--color-primary);
}

/* ------------------------------------------------------------
   9. KOMPONEN: FILE PREVIEW / CURRENT FILE
   ------------------------------------------------------------ */
.current-file {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

.current-file img {
    width: 3rem;
    height: 3rem;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #ffffff;
}

.current-file .icon-box {
    width: 3rem;
    height: 3rem;
    border-radius: 0.5rem;
    background: #1e293b;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.current-file .file-meta {
    font-size: 0.75rem;
    min-width: 0;
}

.current-file .file-meta .label {
    font-weight: 600;
    color: #334155;
}

.current-file .file-meta .name {
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.preview-new {
    margin-top: 0.75rem;
    padding: 0.625rem;
    background: var(--color-primary-light);
    border: 1px solid rgba(var(--color-primary-rgb), 0.3);
    border-radius: 0.5rem;
}

.preview-new .label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin-bottom: 0.375rem;
}

.preview-new img {
    width: 4rem;
    height: 4rem;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid var(--color-primary);
}

/* ------------------------------------------------------------
   10. KOMPONEN: RIWAYAT CARD
   ------------------------------------------------------------ */
.riwayat-card {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.riwayat-card .title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.riwayat-card .title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.4;
    margin: 0;
}

@media (min-width: 768px) {
    .riwayat-card .title {
        font-size: 1rem;
    }
}

.riwayat-card .badge-active {
    font-size: 0.625rem;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    flex-shrink: 0;
}

.riwayat-card .desc {
    font-size: 0.75rem;
    color: #475569;
    line-height: 1.6;
    margin: 0;
}

@media (min-width: 768px) {
    .riwayat-card .desc {
        font-size: 0.875rem;
    }
}

.riwayat-card .media-img {
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    height: 10rem;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.riwayat-card .media-img img {
    height: 100%;
    object-fit: contain;
}

.riwayat-card .media-video {
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #000000;
}

.riwayat-card .media-video video {
    width: 100%;
    max-height: 10rem;
}

/* ------------------------------------------------------------
   11. SECTION HEADER
   ------------------------------------------------------------ */
.section-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1rem;
}

.section-title .icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.section-title h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

@media (min-width: 768px) {
    .section-title h2 {
        font-size: 1.125rem;
    }
}

/* ------------------------------------------------------------
   12. SWEETALERT2 OVERRIDE (ikut tema dinamis)
   ------------------------------------------------------------ */
.swal2-popup {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    border-radius: 1rem !important;
}

.swal2-title {
    font-weight: 700 !important;
    color: #1e293b !important;
}

.swal2-html-container {
    color: #64748b !important;
    font-size: 0.9rem !important;
}

.swal2-confirm {
    background-color: var(--color-primary) !important;
    border-radius: 0.75rem !important;
    padding: 0.65rem 1.5rem !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.3) !important;
}

.swal2-confirm:hover {
    background-color: var(--color-primary-dark) !important;
}

.swal2-cancel {
    background-color: #e2e8f0 !important;
    color: #475569 !important;
    border-radius: 0.75rem !important;
    padding: 0.65rem 1.5rem !important;
    font-weight: 600 !important;
}

.swal2-cancel:hover {
    background-color: #cbd5e1 !important;
}

.swal2-toast {
    border-radius: 0.9rem !important;
    padding: 0.8rem 1rem !important;
}

.swal2-toast .swal2-title {
    font-size: 0.9rem !important;
    font-weight: 700 !important;
}

.swal2-toast .swal2-html-container {
    font-size: 0.8rem !important;
}

/* ------------------------------------------------------------
   13. LOGIN PAGE
   ------------------------------------------------------------ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    overflow-x: hidden;
    background: #f1f5f9;
}

.login-card {
    width: 100%;
    max-width: 56rem;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr;
    position: relative;
    z-index: 10;
    border: 1px solid #f1f5f9;
}

@media (min-width: 768px) {
    .login-card {
        grid-template-columns: 1fr 1fr;
    }
}

/* Panel Kiri (Warna Tema) */
.login-brand {
    background: linear-gradient(
        135deg,
        var(--color-primary) 0%,
        var(--color-primary-dark) 50%,
        var(--color-primary-dark) 100%
    );
    padding: 2rem;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    bottom: -2.5rem;
    left: -2.5rem;
    width: 10rem;
    height: 10rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
}

.login-brand::after {
    content: '';
    position: absolute;
    top: -2.5rem;
    right: -2.5rem;
    width: 10rem;
    height: 10rem;
    background: rgba(212, 175, 55, 0.2);
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
}

.login-brand-inner {
    position: relative;
    z-index: 10;
}

.login-brand-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.login-brand-logo {
    width: 3rem;
    height: 3rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    flex-shrink: 0;
}

.login-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-brand-logo i {
    font-size: 1.5rem;
    color: #D4AF37;
}

.login-brand-sub {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.75);
    margin: 0;
}

.login-brand-title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    margin: 0;
    color: #ffffff;
}

.login-brand-body {
    margin-top: 2rem;
}

.login-badge {
    display: inline-block;
    background: rgba(212, 175, 55, 0.2);
    color: #D4AF37;
    border: 1px solid rgba(212, 175, 55, 0.3);
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.login-brand-headline {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.3;
    margin: 0.5rem 0 0;
    color: #ffffff;
}

.login-brand-desc {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 0.5rem;
    line-height: 1.6;
    font-weight: 300;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.login-brand-footer {
    position: relative;
    z-index: 10;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.75);
}

.login-brand-footer .quote {
    font-style: italic;
}

.login-brand-footer .version {
    font-family: ui-monospace, monospace;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
}

/* Panel Kanan (Form) */
.login-form-panel {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #ffffff;
}

@media (min-width: 768px) {
    .login-form-panel {
        padding: 2.5rem;
    }
}

.login-form-header {
    margin-bottom: 1.5rem;
}

.login-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.login-form-sub {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.login-form-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    border-top: 1px solid #f1f5f9;
    padding-top: 1rem;
    line-height: 1.6;
}

.login-form-footer b {
    color: #475569;
}

.btn-login {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--color-primary);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.25);
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
}

.btn-login:hover:not(:disabled) {
    background: var(--color-primary-dark);
    box-shadow: 0 6px 16px rgba(var(--color-primary-rgb), 0.35);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.login-alert {
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: #fef2f2;
    border-left: 4px solid #ef4444;
    border-radius: 0 0.5rem 0.5rem 0;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: #b91c1c;
    font-size: 0.875rem;
}

.login-alert i {
    color: #ef4444;
    font-size: 1.125rem;
    margin-top: 1px;
    flex-shrink: 0;
}

.login-alert strong {
    display: block;
    font-weight: 600;
    margin-bottom: 0.125rem;
}

/* Lokasi Desa di panel kiri */
.login-brand-loc {
    font-size: 0.68rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    margin: 0.25rem 0 0;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

@media (max-width: 640px) {
    .login-brand-loc {
        font-size: 0.62rem;
    }
}

/* ------------------------------------------------------------
   14. LOGIN — VIDEO BACKGROUND & VIDEO INLINE
   ------------------------------------------------------------ */
.login-brand-video {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    z-index: 0;
    opacity: 0.35;
    pointer-events: none;
}

.login-brand-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(var(--color-primary-rgb), 0.85) 0%,
        rgba(var(--color-primary-rgb), 0.9) 50%,
        rgba(var(--color-primary-rgb), 0.85) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.login-brand.has-video .login-brand-inner,
.login-brand.has-video .login-brand-footer {
    position: relative;
    z-index: 2;
}

.login-video-play {
    margin-top: 1.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    font-family: inherit;
}

.login-video-play:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.login-video-play i {
    color: #D4AF37;
    font-size: 0.75rem;
}

/* Video inline di panel kiri login */
.login-video-inline {
    margin-top: 1rem;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: #000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    position: relative;
}

.login-video-inline video {
    display: block;
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: cover;
    background: #000;
}

.login-video-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    letter-spacing: 0.02em;
    pointer-events: none;
}

.login-video-caption i {
    color: #D4AF37;
    font-size: 0.75rem;
}

/* Panel kiri lebih lebar kalau ada video inline */
@media (min-width: 768px) {
    .login-card:has(.login-video-inline) {
        grid-template-columns: 1.15fr 1fr;
    }
}

/* ------------------------------------------------------------
   15. RESPONSIVE TWEAKS
   ------------------------------------------------------------ */
@media (max-width: 640px) {
    .info-box {
        padding: 0.75rem;
    }

    .card-header {
        padding: 0.875rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }
}


/* ============================================================
   16. DIAGRAM STRUKTUR PERANGKAT DESA
   Tree vertical dengan garis sambung SVG
   ============================================================ */

.diagram-wrapper {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2rem 1rem;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 1rem;
    border: 1px solid #f1f5f9;
    -webkit-overflow-scrolling: touch;
}

.diagram-tree {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    min-width: max-content;
    margin: 0 auto;
}

/* ---------- LEVEL (baris) ---------- */
.diagram-level {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 1.5rem;
    position: relative;
    padding: 1.75rem 0;
    flex-wrap: nowrap;
}

.diagram-level:first-child {
    padding-top: 0.5rem;
}

.diagram-level:last-child {
    padding-bottom: 0.5rem;
}

/* ---------- NODE ---------- */
.diagram-node {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 140px;
    max-width: 180px;
    z-index: 2;
}

/* ---------- FOTO ---------- */
.diagram-foto {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: #f1f5f9;
    border: 3px solid #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 0 0 2px #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.diagram-node:hover .diagram-foto {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), 0 0 0 2px var(--color-primary);
}

.diagram-foto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.diagram-foto .placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    color: #64748b;
    font-size: 1.75rem;
}

/* Foto Kepala Desa — lebih besar + border emas */
.diagram-node.kepala .diagram-foto {
    width: 100px;
    height: 100px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12), 0 0 0 3px #D4AF37;
}

.diagram-node.kepala .diagram-foto .placeholder {
    font-size: 2.25rem;
}

/* ---------- INFO ---------- */
.diagram-info {
    margin-top: 0.75rem;
    text-align: center;
    padding: 0.5rem 0.75rem;
    background: #ffffff;
    border-radius: 0.625rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    min-width: 140px;
    transition: all 0.2s;
}

.diagram-node:hover .diagram-info {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.diagram-nama {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.diagram-jabatan {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

/* ---------- SVG CONNECTOR (garis penghubung) ---------- */
#diagramConnector {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

#diagramConnector path {
    stroke: #94a3b8;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .diagram-wrapper {
        padding: 1.25rem 0.75rem;
    }

    .diagram-level {
        gap: 1rem;
        padding: 1.25rem 0;
    }

    .diagram-node {
        min-width: 110px;
        max-width: 130px;
    }

    .diagram-foto {
        width: 64px;
        height: 64px;
        border-width: 2px;
    }

    .diagram-node.kepala .diagram-foto {
        width: 80px;
        height: 80px;
    }

    .diagram-info {
        min-width: 110px;
        padding: 0.375rem 0.5rem;
        margin-top: 0.5rem;
    }

    .diagram-nama {
        font-size: 0.75rem;
        max-width: 120px;
    }

    .diagram-jabatan {
        font-size: 0.625rem;
        max-width: 120px;
    }
}

@media (max-width: 480px) {
    .diagram-level {
        gap: 0.75rem;
        padding: 1rem 0;
    }

    .diagram-node {
        min-width: 90px;
        max-width: 110px;
    }

    .diagram-foto {
        width: 52px;
        height: 52px;
    }

    .diagram-node.kepala .diagram-foto {
        width: 68px;
        height: 68px;
    }

    .diagram-info {
        min-width: 90px;
        padding: 0.25rem 0.375rem;
    }

    .diagram-nama {
        font-size: 0.6875rem;
        max-width: 100px;
    }

    .diagram-jabatan {
        font-size: 0.5625rem;
        max-width: 100px;
    }
}


/* ============================================================
   17. UTILITY PENGGANTI TAILWIND
   Ditambahkan karena Tailwind CDN dihapus dari login.php
   ============================================================ */

/* ---------- Base body ---------- */
body {
    background-color: #f1f5f9;
    color: #1e293b;
    min-height: 100vh;
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

/* ---------- Min-width helper ---------- */
.min-w-0 { min-width: 0; }

/* ---------- Margin helpers ---------- */
.mt-3 { margin-top: 0.75rem; }
.mt-5 { margin-top: 1.25rem; }
.mb-4 { margin-bottom: 1rem; }
.mr-1 { margin-right: 0.25rem; }

/* ---------- Text helpers ---------- */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-slate-500 { color: #64748b; }
.text-slate-800 { color: #1e293b; }
.text-amber-800 { color: #92400e; }
.font-sans { font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif; }
.opacity-50 { opacity: 0.5; }

/* ---------- Background helpers ---------- */
.bg-slate-100 { background-color: #f1f5f9; }

/* ---------- Rate limit alert (pengganti bg-amber-50 + border-amber-200) ---------- */
.login-rate-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 0.5rem;
    color: #92400e;
    font-size: 0.875rem;
    line-height: 1.5;
}

.login-rate-alert i {
    color: #d97706;
    margin-top: 2px;
    flex-shrink: 0;
}

/* ---------- Form group spacing (pengganti mt-4) ---------- */
.form-group-spacing {
    margin-top: 1rem;
}

/* ---------- Attempt info (pengganti mt-3 text-xs text-slate-500) ---------- */
.login-attempt-info {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #64748b;
    line-height: 1.4;
}

.login-attempt-info i {
    color: #94a3b8;
    margin-right: 0.25rem;
}

.login-attempt-info b {
    color: #334155;
    font-weight: 700;
}

/* ---------- Button login spacing (pengganti mt-5) ---------- */
.btn-login {
    margin-top: 1.25rem;
}

/* ---------- Icon size di tombol ---------- */
.btn-login i.text-xs,
.btn-login .text-xs {
    font-size: 0.75rem;
}

/* ---------- Headline spacing di brand body ---------- */
.login-brand-headline.mt-3 {
    margin-top: 0.75rem;
}