/* ==========================================================================
   DESIGN SYSTEM & CSS CUSTOM PROPERTIES (VARIABLES)
   Tema: Hijau Dominan (Kehidupan & Pertumbuhan) & Merah Hati (Ikatan Darah & Aksen)
   Ikon: 100% Crisp Vector SVG Icons
   Avatar: Clean Typography Initials Badge & Compact Photo Upload
   Formulir: Desain Rapi, Kompak, dengan Accordion/Toggle "Isi Detail"
   ========================================================================== */

:root {
    /* Palet Hijau Dominan */
    --color-green-900: #09261a;
    --color-green-800: #103b29;
    --color-green-700: #19523a;
    --color-green-600: #246d4e;
    --color-green-500: #2f8762;
    --color-green-400: #52a682;
    --color-green-200: #bfe5d4;
    --color-green-100: #e2f4ec;
    --color-green-50: #f0f9f5;

    /* Palet Merah Hati (Aksen Ikatan Darah) */
    --color-maroon-900: #4a0c16;
    --color-maroon-800: #69111f;
    --color-maroon-700: #8b1528;
    --color-maroon-600: #ab1f35;
    --color-maroon-500: #cf2742;
    --color-maroon-100: #fce8eb;
    --color-maroon-50: #fff5f6;

    /* Palet Emas (Kehormatan Leluhur) */
    --color-gold-600: #a1781b;
    --color-gold-500: #c59b27;
    --color-gold-400: #e0b743;
    --color-gold-100: #fdf6e2;

    /* Netral & Permukaan */
    --bg-page: #f4f8f5;
    --bg-surface: #ffffff;
    --bg-surface-glass: rgba(255, 255, 255, 0.88);
    --text-primary: #122119;
    --text-secondary: #4a5c53;
    --text-muted: #788a80;
    --border-color: #dbe8e0;
    --border-focus: #19523a;

    /* Shadow & Elevasi */
    --shadow-sm: 0 2px 6px rgba(16, 59, 41, 0.05);
    --shadow-md: 0 6px 18px rgba(16, 59, 41, 0.08);
    --shadow-lg: 0 14px 36px rgba(16, 59, 41, 0.12);
    --shadow-maroon-glow: 0 0 0 3px rgba(139, 21, 40, 0.25), 0 8px 24px rgba(139, 21, 40, 0.35);

    /* Tipografi */
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Layout & Radius */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --header-height: 124px;
    --mobile-nav-height: 64px;
}

/* ==========================================================================
   RESET & DASAR
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    font-family: var(--font-body);
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-root-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
}

/* ==========================================================================
   SVG VECTOR ICONS UTILITIES
   ========================================================================== */

.svg-icon {
    width: 1.15em;
    height: 1.15em;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.svg-icon.crest-svg {
    width: 24px;
    height: 24px;
    color: var(--color-gold-400);
}

.svg-icon.icon-xs {
    width: 13px;
    height: 13px;
}

.svg-icon.icon-sm {
    width: 16px;
    height: 16px;
}

.btn-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-icon .svg-icon {
    width: 1.15rem;
    height: 1.15rem;
}

/* ==========================================================================
   TYPOGRAPHY INITIALS AVATAR BADGES
   ========================================================================== */

.avatar-initials-badge {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    user-select: none;
    color: #ffffff;
}

.gender-male .avatar-initials-badge,
.avatar-initials-badge.gender-male {
    background: linear-gradient(135deg, var(--color-green-800) 0%, var(--color-green-600) 100%);
    border: 2px solid var(--color-green-400);
}

.gender-female .avatar-initials-badge,
.avatar-initials-badge.gender-female {
    background: linear-gradient(135deg, var(--color-maroon-800) 0%, var(--color-maroon-600) 100%);
    border: 2px solid var(--color-maroon-400);
}

.is-ancestor .avatar-initials-badge,
.avatar-initials-badge.is-ancestor {
    background: radial-gradient(circle at 30% 30%, var(--color-gold-400) 0%, var(--color-gold-600) 100%);
    color: var(--color-green-900);
    border: 2px solid var(--color-gold-500);
}

.avatar-initials-badge.sm {
    font-size: 0.8rem;
}

.avatar-initials-badge.md {
    font-size: 1.05rem;
}

.avatar-initials-badge.lg {
    font-size: 1.6rem;
}

/* ==========================================================================
   COMPACT PHOTO UPLOAD & ACCORDION FORM DESIGN (CLEAN & TIDY)
   ========================================================================== */

.photo-upload-compact-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--color-green-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 2px;
}

.avatar-preview-box.sm {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--color-green-700);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.avatar-preview-box.sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-preview-box.sm .avatar-preview-initials {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--color-green-800);
}

.photo-actions-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    flex-wrap: wrap;
}

.btn-upload-photo-sm {
    background: var(--color-green-700);
    color: #ffffff;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.76rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-upload-photo-sm:hover {
    background: var(--color-green-800);
}

.btn-clear-photo-sm {
    background: transparent;
    border: 1px solid var(--color-maroon-500);
    color: var(--color-maroon-700);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-clear-photo-sm:hover {
    background: var(--color-maroon-700);
    color: #ffffff;
}

.input-photo-url-inline {
    flex: 1;
    min-width: 160px;
    padding: 5px 8px !important;
    font-size: 0.78rem !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #ffffff;
}

/* Toggle Accordion: Isi Detail Tambahan */
.expand-details-toggle-wrap {
    margin: 4px 0 2px 0;
    display: flex;
    align-items: center;
}

.btn-toggle-details {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-green-50);
    border: 1px dashed var(--color-green-400);
    border-radius: var(--radius-sm);
    color: var(--color-green-800);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-toggle-details:hover {
    background: var(--color-green-100);
    border-color: var(--color-green-600);
    color: var(--color-green-900);
}

.btn-toggle-details.is-active {
    background: var(--color-maroon-50);
    border-color: var(--color-maroon-500);
    color: var(--color-maroon-700);
}

.btn-toggle-details .chevron-icon {
    transition: transform 0.25s ease;
}

.btn-toggle-details.is-active .chevron-icon {
    transform: rotate(180deg);
}

.collapsible-details-container {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
    animation: fadeInDown 0.25s ease-out;
}

.form-compact-section-header {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--color-green-800);
    letter-spacing: 0.5px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 3px;
    margin-top: 4px;
}

/* ==========================================================================
   HEADER & NAVBAR
   ========================================================================== */

.app-header {
    background: linear-gradient(135deg, var(--color-green-900) 0%, var(--color-green-800) 60%, var(--color-green-700) 100%);
    color: #ffffff;
    border-bottom: 2px solid rgba(197, 155, 39, 0.3);
    box-shadow: var(--shadow-md);
    z-index: 50;
    flex-shrink: 0;
}

.header-inner {
    max-width: 1500px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-crest {
    width: 44px;
    height: 44px;
    background: #ffffff;
    border: 2px solid var(--color-gold-400);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
    overflow: hidden;
}

.brand-crest-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.brand-titles .app-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #ffffff;
    line-height: 1.2;
}

.brand-titles .app-subtitle {
    font-size: 0.78rem;
    color: var(--color-green-200);
    font-weight: 400;
}

.nav-tabs-container {
    display: flex;
    align-items: center;
    background: rgba(9, 38, 26, 0.6);
    padding: 4px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: transparent;
    border: none;
    border-radius: var(--radius-full);
    color: var(--color-green-200);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.nav-tab-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-tab-btn.active {
    background: linear-gradient(135deg, var(--color-maroon-700), var(--color-maroon-800));
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(139, 21, 40, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-maroon-700) 0%, var(--color-maroon-800) 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(139, 21, 40, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-maroon-600) 0%, var(--color-maroon-700) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(139, 21, 40, 0.45);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: #000000;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.35);
}

.btn-privacy {
    background: rgba(0, 0, 0, 0.25);
    color: var(--color-green-100);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-privacy.unlocked {
    background: var(--color-gold-600);
    color: #ffffff;
}

.btn-search-toggle {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-search-toggle:hover,
.btn-search-toggle.is-active {
    background: var(--color-gold-600);
    border-color: var(--color-gold-400);
    color: #ffffff;
}

.btn-auth {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-auth:hover,
.btn-auth.is-logged-in {
    background: rgba(255, 255, 255, 0.22);
    border-color: var(--color-gold-400);
}

.cloud-sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-green-200);
    cursor: default;
    user-select: none;
    transition: all 0.25s ease;
}

.cloud-sync-badge .sync-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #52b788;
    box-shadow: 0 0 6px #52b788;
    transition: all 0.25s ease;
}

.cloud-sync-badge.connecting .sync-dot {
    background: #ffb703;
    box-shadow: 0 0 6px #ffb703;
    animation: pulseSync 1s infinite alternate;
}

.cloud-sync-badge.offline .sync-dot {
    background: #a0aab2;
    box-shadow: none;
}

@keyframes pulseSync {
    from {
        opacity: 0.4;
        transform: scale(0.85);
    }

    to {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* ==========================================================================
   SUB-HEADER: TOOLBAR PENCARIAN & FILTER (COLLAPSIBLE / ON-DEMAND)
   ========================================================================== */

.sub-header-toolbar {
    background: rgba(16, 59, 41, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    padding: 0 24px;
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, padding 0.3s ease;
}

.sub-header-toolbar.is-open {
    max-height: 180px;
    opacity: 1;
    overflow: visible;
    pointer-events: auto;
    padding: 10px 24px;
}

.toolbar-inner {
    max-width: 1500px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.toolbar-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.toolbar-close-btn:hover {
    background: var(--color-maroon-700);
}

.search-box-wrapper {
    position: relative;
    flex: 1;
    max-width: 480px;
    min-width: 240px;
}

.search-box-wrapper .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.7;
    display: flex;
    align-items: center;
}

.search-box-wrapper input {
    width: 100%;
    padding: 8px 36px 8px 36px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-full);
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 0.88rem;
    outline: none;
    transition: all 0.25s ease;
}

.search-box-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-box-wrapper input:focus {
    background: #ffffff;
    color: var(--text-primary);
    border-color: var(--color-gold-500);
    box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.35);
}

.search-box-wrapper input:focus::placeholder {
    color: var(--text-muted);
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    max-height: 380px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results-dropdown.show {
    display: block;
    animation: fadeInDown 0.2s ease-out;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-green-50);
    cursor: pointer;
    transition: background 0.15s ease;
}

.search-result-item:hover {
    background: var(--color-green-50);
}

.search-result-avatar-wrap {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: hidden;
}

.search-result-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--color-green-600);
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 0.88rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-title .nick {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 4px;
}

.search-result-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.search-result-meta .status-deceased {
    color: var(--color-maroon-700);
    font-weight: 600;
}

.search-focus-btn {
    padding: 6px 10px;
    background: var(--color-maroon-50);
    border: 1px solid var(--color-maroon-100);
    border-radius: var(--radius-sm);
    color: var(--color-maroon-700);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.search-focus-btn:hover {
    background: var(--color-maroon-700);
    color: #ffffff;
}

.search-empty-item {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.filter-controls-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-item label {
    font-size: 0.78rem;
    color: var(--color-green-200);
    font-weight: 500;
}

/* Toolbar Filter Custom Select */
.filter-item .custom-select-wrap {
    min-width: 140px;
}

.filter-item .custom-select-trigger {
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-sm);
    color: #ffffff;
    font-size: 0.8rem;
}

.filter-item .custom-select-trigger:hover,
.filter-item .custom-select-wrap.is-open .custom-select-trigger {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.filter-item .custom-select-options-list {
    background: var(--color-green-900);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.filter-item .custom-select-option {
    color: var(--color-green-100);
}

.filter-item .custom-select-option:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.filter-item .custom-select-option.is-selected {
    background: var(--color-maroon-700);
    color: #ffffff;
}

.filter-item .custom-select-option .option-check-icon {
    color: #ffffff;
}

/* ==========================================================================
   MAIN VIEWPORT & TAMPILAN VIEW
   ========================================================================== */

.app-main-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-page);
}

.app-view-container {
    position: absolute;
    inset: 0;
    display: none;
    overflow: auto;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.app-view-container.active-view {
    display: block;
    opacity: 1;
}

#view-tree.active-view {
    display: flex;
    overflow: hidden;
}

.view-header-intro {
    max-width: 1300px;
    margin: 0 auto 24px auto;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.view-header-intro h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: var(--color-green-900);
    margin-bottom: 4px;
}

.view-header-intro p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ==========================================================================
   VIEW 2: DIREKTORI ANGGOTA KELUARGA (RESPONSIF HP)
   ========================================================================== */

.directory-view-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px 80px 20px;
}

.directory-generation-section {
    margin-bottom: 36px;
}

.section-gen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding: 0 4px;
}

.section-gen-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.section-gen-header .gen-pill {
    background: linear-gradient(135deg, var(--color-maroon-700), var(--color-maroon-900));
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(139, 21, 40, 0.2);
}

.section-gen-header h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--color-green-800);
    line-height: 1.25;
}

.section-gen-header .member-count {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--color-green-800);
    background: var(--color-green-50);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
    white-space: nowrap;
}

.directory-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
}

.directory-member-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    transition: all 0.25s ease;
    cursor: pointer;
}

.directory-member-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-green-400);
}

.directory-member-card.gender-male {
    border-top: 3px solid var(--color-green-600);
}

.directory-member-card.gender-female {
    border-top: 3px solid var(--color-maroon-600);
}

.card-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-avatar-wrap {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.card-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    border-radius: 50%;
}

.card-meta-tags {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.badge-alive {
    background: var(--color-green-100);
    color: var(--color-green-800);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.badge-deceased {
    background: var(--color-maroon-100);
    color: var(--color-maroon-800);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.badge-gender {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.card-body-content {
    flex: 1;
    margin-bottom: 14px;
}

.card-body-content .card-name {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 2px;
}

.card-body-content .card-nickname {
    font-size: 0.8rem;
    color: var(--color-green-700);
    margin-bottom: 8px;
}

.card-detail-line {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.card-detail-line .icon {
    display: inline-flex;
    color: var(--color-green-700);
}

.card-actions-footer {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--color-green-50);
    padding-top: 10px;
}

.card-btn-detail {
    flex: 1;
    padding: 6px 12px;
    background: var(--color-green-50);
    border: 1px solid var(--color-green-200);
    border-radius: var(--radius-sm);
    color: var(--color-green-800);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-btn-detail:hover {
    background: var(--color-green-700);
    color: #ffffff;
}

.card-btn-tree {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--color-maroon-50);
    border: 1px solid var(--color-maroon-100);
    border-radius: var(--radius-sm);
    color: var(--color-maroon-700);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-btn-tree:hover {
    background: var(--color-maroon-700);
    color: #ffffff;
}

/* ==========================================================================
   VIEW 3: TIMELINE SEJARAH KELUARGA
   ========================================================================== */

.timeline-view-wrapper {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px 80px 20px;
}

.timeline-container {
    position: relative;
    padding: 20px 0;
}

.timeline-tree-stem {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--color-maroon-700) 0%, var(--color-green-700) 100%);
    transform: translateX(-50%);
    border-radius: var(--radius-full);
}

.timeline-entry-row {
    position: relative;
    width: 50%;
    padding: 10px 30px;
    margin-bottom: 24px;
}

.timeline-entry-row.left {
    left: 0;
    text-align: right;
}

.timeline-entry-row.right {
    left: 50%;
    text-align: left;
}

.timeline-node-dot {
    position: absolute;
    top: 20px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 3px solid var(--color-maroon-700);
    box-shadow: 0 0 0 4px rgba(139, 21, 40, 0.2);
    z-index: 2;
}

.timeline-entry-row.left .timeline-node-dot {
    right: -9px;
}

.timeline-entry-row.right .timeline-node-dot {
    left: -9px;
}

.timeline-entry-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.timeline-entry-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.timeline-year-badge {
    display: inline-block;
    background: var(--color-maroon-700);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    margin-bottom: 8px;
}

.timeline-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.timeline-entry-row.left .timeline-card-header {
    flex-direction: row-reverse;
}

.timeline-avatar-wrap {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.timeline-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-green-600);
}

.timeline-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.timeline-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.timeline-bio {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 10px;
}

.timeline-open-modal-btn {
    padding: 4px 10px;
    background: var(--color-green-100);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-green-800);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}

/* ==========================================================================
   VIEW 4: STATISTIK & DEMOGRAFI KELUARGA
   ========================================================================== */

.stats-view-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 80px 20px;
}

.stats-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
}

.kpi-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon .svg-icon {
    width: 32px;
    height: 32px;
    color: var(--color-green-700);
}

.kpi-icon.icon-success .svg-icon {
    color: #2ec4b6;
}

.kpi-icon.icon-deceased .svg-icon {
    color: var(--color-maroon-700);
}

.kpi-icon.icon-male .svg-icon {
    color: var(--color-green-600);
}

.kpi-icon.icon-female .svg-icon {
    color: var(--color-maroon-600);
}

.kpi-info h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-green-900);
    line-height: 1;
}

.kpi-info p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stats-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.stats-panel-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.stats-panel-box h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--color-green-800);
    margin-bottom: 16px;
}

.stat-gen-distribution-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-bar-row .stat-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.stat-bar-track {
    width: 100%;
    height: 10px;
    background: var(--color-green-50);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-green-600), var(--color-maroon-700));
    border-radius: var(--radius-full);
    transition: width 0.5s ease-out;
}

.stat-city-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.city-stat-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--color-green-50);
    border: 1px solid var(--color-green-200);
    border-radius: var(--radius-full);
    font-size: 0.82rem;
}

.city-stat-tag .city-name {
    color: var(--text-primary);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.city-stat-tag .city-count {
    background: var(--color-green-700);
    color: #ffffff;
    font-size: 0.72rem;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

/* ==========================================================================
   MODAL DETAIL PROFIL (DESKTOP MODAL / HP BOTTOM-SHEET)
   ========================================================================== */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 38, 26, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.profile-modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 600px;
    max-height: 88vh;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 210;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.profile-modal-container.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.modal-drag-handle-mobile {
    display: none;
    width: 40px;
    height: 4px;
    background: var(--border-color);
    border-radius: var(--radius-full);
    margin: 8px auto;
}

.profile-modal-header {
    background: linear-gradient(135deg, var(--color-green-900) 0%, var(--color-green-800) 100%);
    color: #ffffff;
    padding: 18px 22px;
    position: relative;
    border-bottom: 2px solid var(--color-gold-500);
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.profile-header-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.profile-avatar-large {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--color-gold-500);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-primary-details .profile-tags-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
    flex-wrap: wrap;
}

.gen-badge {
    background: var(--color-gold-500);
    color: var(--color-green-900);
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

.status-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

.status-badge.alive {
    background: rgba(82, 166, 130, 0.3);
    color: var(--color-green-100);
    border: 1px solid var(--color-green-400);
}

.status-badge.deceased {
    background: rgba(207, 39, 66, 0.3);
    color: #ffd1d7;
    border: 1px solid var(--color-maroon-500);
}

.residence-badge {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.profile-name {
    font-family: var(--font-heading);
    font-size: 1.18rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.profile-nickname {
    font-size: 0.82rem;
    color: var(--color-green-200);
}

.profile-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-section-card {
    background: var(--color-green-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}

.profile-section-card .section-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-green-800);
    margin-bottom: 8px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 3px;
}

.info-grid-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
}

.full-width-info-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.info-cell {
    display: flex;
    flex-direction: column;
}

.info-cell .cell-label,
.full-width-info-row .cell-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.info-cell .cell-value,
.full-width-info-row .cell-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.contact-info-box {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.78rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.contact-icon {
    color: var(--color-green-700);
    display: flex;
    align-items: center;
}

.profile-bio-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.relatives-links-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rel-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.78rem;
}

.rel-role {
    width: 100px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.rel-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    flex: 1;
}

.relative-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-green-800);
    cursor: pointer;
    transition: all 0.15s ease;
}

.relative-link-btn:hover {
    background: var(--color-maroon-700);
    color: #ffffff;
    border-color: var(--color-maroon-700);
}

.profile-modal-footer {
    padding: 12px 20px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.btn-modal-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.btn-highlight {
    background: var(--color-maroon-700);
    color: #ffffff;
}

.btn-highlight:hover {
    background: var(--color-maroon-600);
}

.btn-danger {
    background: var(--color-maroon-50);
    border-color: var(--color-maroon-100);
    color: var(--color-maroon-700);
}

.btn-danger:hover {
    background: var(--color-maroon-700);
    color: #ffffff;
}

/* ==========================================================================
   MODAL 2: FORM TAMBAH & EDIT ANGGOTA KELUARGA (CMS KOMPAK)
   ========================================================================== */

.form-modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 220;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    overflow: hidden;
}

.form-modal-container.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.form-modal-header {
    padding: 14px 20px;
    background: var(--color-green-900);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--color-gold-500);
}

.form-modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
}

.member-form-body {
    padding: 14px 18px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-row-grid {
    display: grid;
    gap: 10px;
}

.form-row-grid.two-col {
    grid-template-columns: 1fr 1fr;
}

.form-row-grid.three-col {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.form-group label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-green-600);
    box-shadow: 0 0 0 2px rgba(36, 109, 78, 0.2);
}

/* ==========================================================================
   CUSTOM DROPDOWN / SELECT STYLING (MODERN, CLEAN & COMPACT)
   ========================================================================== */

.custom-select-wrap {
    position: relative;
    width: 100%;
    user-select: none;
}

.custom-select-trigger {
    width: 100%;
    padding: 6px 10px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    min-height: 33px;
}

.custom-select-trigger:hover {
    border-color: var(--color-green-500);
}

.custom-select-wrap.is-open .custom-select-trigger,
.custom-select-trigger:focus-visible {
    border-color: var(--color-green-600);
    box-shadow: 0 0 0 2px rgba(36, 109, 78, 0.2);
}

.custom-select-value {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
}

.custom-select-value.placeholder {
    color: var(--text-muted);
}

.custom-select-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.custom-select-wrap.is-open .custom-select-arrow {
    transform: rotate(180deg);
    color: var(--color-green-700);
}

.custom-select-options-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 220px;
    overflow-y: auto;
    padding: 4px;
    z-index: 300;
    display: none;
}

.custom-select-wrap.is-open .custom-select-options-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: fadeInDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-select-option {
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.custom-select-option:hover {
    background: var(--color-green-50);
    color: var(--color-green-900);
}

.custom-select-option.is-selected {
    background: var(--color-green-100);
    color: var(--color-green-900);
    font-weight: 700;
}

.custom-select-option .option-check-icon {
    display: none;
    align-items: center;
    color: var(--color-green-700);
    flex-shrink: 0;
}

.custom-select-option.is-selected .option-check-icon {
    display: inline-flex;
}

/* Custom Scrollbar for Dropdown List */
.custom-select-options-list::-webkit-scrollbar {
    width: 5px;
}

.custom-select-options-list::-webkit-scrollbar-track {
    background: transparent;
}

.custom-select-options-list::-webkit-scrollbar-thumb {
    background: var(--color-green-200);
    border-radius: var(--radius-full);
}

.custom-select-options-list::-webkit-scrollbar-thumb:hover {
    background: var(--color-green-400);
}

.checkbox-form-group {
    justify-content: flex-end;
}

.custom-switch-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    height: 36px;
}

.custom-switch-card:hover {
    border-color: var(--color-maroon-400);
    background: var(--color-maroon-50);
}

.custom-switch-input {
    display: none;
}

.custom-switch-slider {
    position: relative;
    width: 34px;
    height: 18px;
    background-color: #d1d5db;
    border-radius: var(--radius-full);
    transition: background-color 0.25s ease;
    flex-shrink: 0;
}

.custom-switch-slider::before {
    content: "";
    position: absolute;
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.custom-switch-input:checked+.custom-switch-slider {
    background-color: var(--color-maroon-700);
}

.custom-switch-input:checked+.custom-switch-slider::before {
    transform: translateX(16px);
}

.custom-switch-text {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    white-space: nowrap;
}

.custom-switch-card:has(.custom-switch-input:checked) {
    border-color: var(--color-maroon-600);
    background: var(--color-maroon-50);
}

.custom-switch-card:has(.custom-switch-input:checked) .custom-switch-text {
    color: var(--color-maroon-800);
}

.form-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   MODAL 3: KELOLA DATA (JSON)
   ========================================================================== */

.data-modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 500px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 220;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    overflow: hidden;
}

.data-modal-container.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.data-modal-header {
    padding: 14px 18px;
    background: var(--color-green-900);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-modal-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data-action-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px;
    background: var(--color-green-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.data-card-info h3 {
    font-size: 0.85rem;
    color: var(--color-green-900);
    margin-bottom: 2px;
}

.data-card-info p {
    font-size: 0.74rem;
    color: var(--text-secondary);
}

.data-action-card.danger-zone {
    background: var(--color-maroon-50);
    border-color: var(--color-maroon-100);
}

.data-action-card.danger-zone h3 {
    color: var(--color-maroon-800);
}

/* ==========================================================================
   MODAL 4: AUTENTIKASI PENGGUNA (FIREBASE AUTH)
   ========================================================================== */

.auth-modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 440px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 220;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    overflow: hidden;
}

.auth-modal-container.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.auth-modal-header {
    padding: 22px 20px 16px 20px;
    background: linear-gradient(135deg, var(--color-green-900), var(--color-green-800));
    color: #ffffff;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-brand-badge {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--color-gold-400);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.auth-brand-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.auth-modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: #ffffff;
    margin-bottom: 4px;
}

.auth-modal-header p {
    font-size: 0.78rem;
    color: var(--color-green-200);
}

.auth-modal-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-alert-box {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--color-maroon-50);
    border: 1px solid var(--color-maroon-600);
    color: var(--color-maroon-800);
}

.btn-google-auth {
    width: 100%;
    padding: 10px 16px;
    background: #ffffff;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-google-auth:hover {
    background: var(--color-green-50);
    border-color: var(--color-green-500);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-google-auth .google-svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 10px;
}

.auth-tab-pills {
    display: flex;
    background: var(--color-green-50);
    padding: 3px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.auth-tab-btn {
    flex: 1;
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab-btn.active {
    background: var(--color-green-800);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(16, 59, 41, 0.3);
}

.auth-email-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-block-auth {
    width: 100%;
    justify-content: center;
    padding: 9px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 4px;
}

/* User Profile Card When Logged In */
.auth-user-profile-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--color-green-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.auth-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-green-700), var(--color-green-900));
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-gold-400);
    overflow: hidden;
    flex-shrink: 0;
}

.auth-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-user-info {
    flex: 1;
    min-width: 0;
}

.auth-user-info h3 {
    font-size: 0.95rem;
    color: var(--color-green-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-user-info p {
    font-size: 0.76rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-user-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    color: #2b9348;
    background: rgba(43, 147, 72, 0.12);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    margin-top: 4px;
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */

.app-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--color-green-900);
    color: #ffffff;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--color-gold-500);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    gap: 6px;
}

.app-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    display: flex;
    align-items: center;
    color: #2ec4b6;
}

/* ==========================================================================
   RESPONSIVE DESIGN (SMARTPHONE & TABLET)
   ========================================================================== */

.mobile-bottom-nav,
.fab-mobile-add {
    display: none;
}

@media (max-width: 900px) {
    .header-inner {
        padding: 10px 14px;
        gap: 10px;
    }

    .desktop-nav {
        display: none;
    }

    .header-actions .btn-action span:not(.btn-icon-wrap) {
        display: none;
    }

    .header-actions .btn-action {
        padding: 7px 10px;
        border-radius: var(--radius-sm);
    }

    .stats-details-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 8px 12px;
        gap: 8px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .brand-section {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .brand-crest {
        width: 36px;
        height: 36px;
        min-width: 36px;
        border-radius: 10px;
        flex-shrink: 0;
    }

    .brand-crest .crest-svg {
        width: 18px;
        height: 18px;
    }

    .brand-titles {
        min-width: 0;
        overflow: hidden;
    }

    .brand-titles .app-title {
        font-size: 1.02rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.2;
    }

    .brand-titles .app-subtitle {
        font-size: 0.68rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 140px;
        line-height: 1.2;
        margin: 0;
    }

    .header-actions {
        display: flex;
        align-items: center;
        gap: 5px;
        flex-shrink: 0;
    }

    .header-actions .btn-action {
        width: 34px;
        height: 34px;
        min-width: 34px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 9px;
    }

    .header-actions .btn-action span:not(.btn-icon-wrap) {
        display: none !important;
    }

    .header-actions .btn-action .svg-icon {
        width: 16px;
        height: 16px;
    }

    .cloud-sync-badge {
        padding: 4px 8px;
        gap: 5px;
    }

    .cloud-sync-badge .sync-text {
        font-size: 0.68rem;
        max-width: 60px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sub-header-toolbar.is-open {
        max-height: 240px;
        padding: 10px 12px;
    }

    .toolbar-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .search-box-wrapper {
        max-width: 100%;
        min-width: 0;
    }

    .filter-controls-group {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .filter-item {
        flex: 1;
        min-width: 0;
        gap: 4px;
    }

    .filter-item label {
        font-size: 0.72rem;
    }

    .filter-item .custom-select-wrap {
        min-width: 0;
        width: 100%;
    }

    /* Direktori Header & Cards pada HP */
    .directory-view-wrapper {
        padding: 14px 12px 120px 12px;
    }

    .directory-generation-section {
        margin-bottom: 24px;
    }

    .section-gen-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 12px;
        padding: 0;
    }

    .section-gen-title-wrap {
        gap: 8px;
    }

    .section-gen-header .gen-pill {
        font-size: 0.68rem;
        padding: 2px 7px;
    }

    .section-gen-header h3 {
        font-size: 1.05rem;
    }

    .section-gen-header .member-count {
        font-size: 0.72rem;
        padding: 2px 7px;
    }

    .directory-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .directory-member-card {
        padding: 14px 12px;
    }

    .view-header-intro {
        margin-bottom: 16px;
        padding-bottom: 8px;
    }

    .view-header-intro h2 {
        font-size: 1.3rem;
    }

    .view-header-intro p {
        font-size: 0.8rem;
    }

    /* Modal Profil pada HP (Bottom Sheet) */
    .profile-modal-container {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        max-height: 88vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }

    .profile-modal-container.active {
        transform: translateY(0);
    }

    .modal-drag-handle-mobile {
        display: block;
    }

    .profile-modal-header {
        padding: 14px 16px;
    }

    .profile-modal-body {
        padding: 12px 16px;
        gap: 10px;
    }

    .profile-avatar-large {
        width: 58px;
        height: 58px;
    }

    .profile-name {
        font-size: 1.05rem;
    }

    /* Modal Form CMS pada HP */
    .form-modal-container {
        width: 95%;
        max-height: 92vh;
        border-radius: 16px;
    }

    .form-modal-header {
        padding: 12px 16px;
    }

    .form-modal-header h2 {
        font-size: 1.05rem;
    }

    .member-form-body {
        padding: 12px 14px;
        gap: 8px;
    }

    .form-row-grid.two-col,
    .form-row-grid.three-col {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .photo-actions-inline {
        flex-direction: column;
        align-items: stretch;
    }

    .input-photo-url-inline {
        width: 100%;
    }

    /* Bottom Navigation & FAB pada HP (Material 3 Pill Style) */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 62px;
        background: rgba(9, 38, 26, 0.96);
        backdrop-filter: blur(16px);
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        z-index: 100;
        justify-content: space-around;
        align-items: center;
        padding: 4px 6px;
        padding-bottom: env(safe-area-inset-bottom, 6px);
    }

    .mobile-bottom-nav .nav-tab-btn {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 4px 8px;
        flex: 1;
        cursor: pointer;
        user-select: none;
    }

    .mobile-bottom-nav .nav-tab-btn .tab-icon {
        width: 48px;
        height: 26px;
        border-radius: var(--radius-full);
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        transition: all 0.22s ease;
        color: var(--color-green-200);
    }

    .mobile-bottom-nav .nav-tab-btn .tab-icon .svg-icon {
        width: 18px;
        height: 18px;
    }

    .mobile-bottom-nav .nav-tab-btn .tab-label {
        font-size: 0.7rem;
        font-weight: 600;
        color: var(--color-green-200);
        line-height: 1.2;
        letter-spacing: 0.2px;
        transition: color 0.2s ease;
    }

    /* Active State: Icon Pill Indicator */
    .mobile-bottom-nav .nav-tab-btn.active .tab-icon {
        background: linear-gradient(135deg, var(--color-maroon-700), var(--color-maroon-800));
        color: #ffffff;
        box-shadow: 0 2px 8px rgba(139, 21, 40, 0.45);
        border: 1px solid rgba(255, 255, 255, 0.25);
    }

    .mobile-bottom-nav .nav-tab-btn.active .tab-label {
        color: #ffffff;
        font-weight: 800;
    }

    .fab-mobile-add {
        display: flex;
        position: fixed;
        bottom: calc(62px + 14px);
        right: 14px;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--color-maroon-700), var(--color-maroon-800));
        color: #ffffff;
        border: 2px solid var(--color-gold-500);
        box-shadow: 0 6px 18px rgba(139, 21, 40, 0.5);
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 90;
        transition: transform 0.2s ease;
    }

    .fab-mobile-add .svg-icon {
        width: 22px;
        height: 22px;
    }

    .fab-mobile-add:active {
        transform: scale(0.92);
    }

    /* Timeline pada HP */
    .timeline-view-wrapper {
        padding: 14px 12px 120px 12px;
    }

    .timeline-tree-stem {
        left: 16px;
        transform: none;
    }

    .timeline-entry-row {
        width: 100%;
        left: 0 !important;
        padding-left: 36px;
        padding-right: 4px;
        margin-bottom: 16px;
        text-align: left !important;
    }

    .timeline-entry-row .timeline-node-dot {
        left: 8px !important;
        right: auto !important;
        width: 16px;
        height: 16px;
        top: 14px;
    }

    .timeline-entry-row.left .timeline-card-header {
        flex-direction: row;
    }

    .timeline-entry-card {
        padding: 12px 14px;
    }

    /* Stats pada HP */
    .stats-view-wrapper {
        padding: 14px 12px 120px 12px;
    }

    .stats-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 16px;
    }

    .kpi-card {
        padding: 10px 12px;
        gap: 8px;
    }

    .kpi-icon .svg-icon {
        width: 24px;
        height: 24px;
    }

    .kpi-info h3 {
        font-size: 1.25rem;
    }

    .kpi-info p {
        font-size: 0.7rem;
    }

    .stats-details-grid {
        gap: 12px;
    }

    .stats-panel-box {
        padding: 14px;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   PWA (PROGRESSIVE WEB APP) & MOBILE INSTALL STYLES
   ========================================================================== */

/* 1. Tombol Pasang PWA di Header */
.btn-install-pwa {
    background: linear-gradient(135deg, var(--color-green-700) 0%, var(--color-green-900) 100%);
    border: 1px solid var(--color-gold-500);
    color: var(--color-gold-400);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(197, 155, 39, 0.2);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-install-pwa:hover {
    background: linear-gradient(135deg, var(--color-green-600) 0%, var(--color-green-800) 100%);
    color: #ffffff;
    border-color: var(--color-gold-400);
    box-shadow: 0 4px 14px rgba(197, 155, 39, 0.35);
    transform: translateY(-1px);
}

.btn-install-pwa .btn-icon-wrap {
    color: var(--color-gold-400);
}

.btn-install-pwa:hover .btn-icon-wrap {
    color: #ffffff;
}

.animate-pop {
    animation: pwaPopGlow 1.2s ease-out;
}

@keyframes pwaPopGlow {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 2. Floating Install Banner (Mobile Bottom / Desktop Floating) */
.pwa-install-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    width: calc(100% - 32px);
    max-width: 480px;
    z-index: 999;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.pwa-install-banner.banner-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.pwa-install-banner.banner-hidden {
    transform: translateX(-50%) translateY(120px);
    opacity: 0;
    pointer-events: none;
}

.pwa-banner-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(16, 59, 41, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(224, 183, 67, 0.35);
    border-radius: 18px;
    box-shadow: 0 12px 32px rgba(9, 38, 26, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.pwa-banner-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--color-green-900);
    border: 1.5px solid var(--color-gold-400);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pwa-banner-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pwa-banner-info {
    flex: 1;
    min-width: 0;
}

.pwa-banner-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 2px 0;
    font-family: var(--font-body);
}

.pwa-banner-desc {
    font-size: 0.75rem;
    color: var(--color-green-200);
    margin: 0;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-pwa-dismiss {
    background: transparent;
    border: none;
    color: var(--color-green-200);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-pwa-dismiss:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.btn-pwa-install {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--color-gold-400) 0%, var(--color-gold-500) 100%);
    color: var(--color-green-900);
    font-size: 0.82rem;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(197, 155, 39, 0.35);
    transition: all 0.2s;
}

.btn-pwa-install:hover {
    background: linear-gradient(135deg, #fff3b0 0%, var(--color-gold-400) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(197, 155, 39, 0.45);
}

.btn-pwa-install .svg-icon {
    stroke-width: 2.5;
}

/* 3. Modal Panduan Instalasi iOS Safari */
.pwa-guide-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: calc(100% - 32px);
    max-width: 440px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(9, 38, 26, 0.35);
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.pwa-guide-modal.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.pwa-guide-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: linear-gradient(135deg, var(--color-green-800) 0%, var(--color-green-900) 100%);
    color: #ffffff;
    position: relative;
}

.pwa-guide-crest {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    overflow: hidden;
    border: 1.5px solid var(--color-gold-400);
    flex-shrink: 0;
}

.pwa-guide-crest img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pwa-guide-header-text h3 {
    margin: 0 0 3px 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    font-family: var(--font-heading);
}

.pwa-guide-header-text p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--color-green-200);
}

.pwa-guide-header .modal-close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.pwa-guide-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pwa-step-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 14px;
    background: var(--color-green-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-green-100);
}

.pwa-step-item .step-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: var(--color-green-700);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(25, 82, 58, 0.3);
}

.pwa-step-item .step-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.45;
}

.pwa-step-item .step-text strong {
    color: var(--color-green-800);
}

.ios-inline-icon {
    display: inline-block;
    padding: 1px 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    font-size: 0.9rem;
    vertical-align: middle;
}

/* 4. Network Status Toast (Online / Offline) */
.pwa-network-toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    z-index: 2000;
    padding: 8px 18px;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
}

.pwa-network-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.pwa-network-toast.offline-state {
    background: #8b1528;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.pwa-network-toast.online-state {
    background: #19523a;
    color: #ffffff;
    border: 1px solid var(--color-green-400);
}

/* 5. Update Toast (New Version) */
.pwa-update-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1002;
    background: var(--bg-surface);
    border: 1px solid var(--color-gold-400);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    box-shadow: 0 12px 32px rgba(9, 38, 26, 0.25);
    display: flex;
    align-items: center;
    gap: 16px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-update-toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.update-toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.update-toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--color-green-100);
    color: var(--color-green-700);
    display: flex;
    align-items: center;
    justify-content: center;
}

.update-toast-text strong {
    display: block;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.update-toast-text p {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-update-action {
    padding: 6px 14px;
    background: var(--color-green-700);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-update-action:hover {
    background: var(--color-green-600);
}

/* 6. Generic Toast */
.pwa-generic-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(40px);
    background: rgba(16, 59, 41, 0.95);
    backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(224, 183, 67, 0.3);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
    max-width: 90vw;
}

.pwa-generic-toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Responsiveness for Mobile Devices */
@media (max-width: 768px) {
    .pwa-install-banner {
        bottom: calc(var(--mobile-nav-height, 62px) + 8px);
        width: calc(100% - 16px);
        max-width: 420px;
        left: 50%;
        transform: translateX(-50%);
    }

    .pwa-banner-card {
        padding: 7px 10px;
        gap: 8px;
        border-radius: 12px;
    }

    .pwa-banner-icon {
        width: 32px;
        height: 32px;
        min-width: 32px;
        border-radius: 8px;
    }

    .pwa-banner-info {
        min-width: 0;
        flex: 1 1 auto;
    }

    .pwa-banner-title {
        font-size: 0.78rem;
        font-weight: 700;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .pwa-banner-desc {
        display: none;
        /* Sembunyikan deskripsi panjang di HP agar kanvas tidak terhalang */
    }

    .pwa-banner-actions {
        display: flex;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
    }

    .btn-pwa-dismiss {
        padding: 4px 6px;
        font-size: 0.72rem;
    }

    .btn-pwa-install {
        padding: 5px 10px;
        font-size: 0.74rem;
        border-radius: 6px;
        gap: 4px;
    }

    .btn-pwa-install span {
        white-space: nowrap;
    }

    .btn-install-pwa .btn-install-label {
        display: none;
        /* Icon only on compact mobile headers */
    }

    .pwa-guide-modal {
        top: auto;
        bottom: 0;
        left: 0;
        transform: translateY(100%);
        width: 100%;
        max-width: 100%;
        border-radius: 24px 24px 0 0;
    }

    .pwa-guide-modal.active {
        transform: translateY(0);
    }

    /* Guest Banner Compact di HP */
    .guest-mode-banner {
        padding: 5px 10px;
    }

    .guest-banner-inner {
        gap: 6px;
        font-size: 0.74rem;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: nowrap;
    }

    .guest-banner-inner span:not(.guest-pill) {
        flex: 1 1 auto;
        text-align: left;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.72rem;
    }

    .guest-pill {
        font-size: 0.64rem;
        padding: 2px 6px;
        flex-shrink: 0;
    }

    .guest-banner-login-btn {
        font-size: 0.72rem;
        padding: 2px 8px;
        white-space: nowrap;
        flex-shrink: 0;
        border-radius: 5px;
    }
}

@media (max-width: 480px) {
    .cloud-sync-badge {
        padding: 0;
        width: 28px;
        height: 28px;
        min-width: 28px;
        border-radius: 50%;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .cloud-sync-badge .sync-text {
        display: none !important;
    }

    .cloud-sync-badge .sync-dot {
        margin: 0;
    }

    .header-actions {
        gap: 4px;
    }

    .header-actions .btn-action {
        width: 32px;
        height: 32px;
        min-width: 32px;
        border-radius: 8px;
    }

    .header-actions .btn-action .svg-icon {
        width: 15px;
        height: 15px;
    }

    .brand-titles .app-title {
        font-size: 0.96rem;
    }

    .brand-titles .app-subtitle {
        max-width: 100px;
    }

    .guest-banner-inner span:not(.guest-pill) {
        font-size: 0.68rem;
    }
}

/* ==========================================================================
   AUTH GUARD OVERLAY (PREVENT FLICKER & SMOOTH TRANSITION)
   ========================================================================== */
.auth-guard-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #051a11;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s ease;
}

.auth-guard-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-guard-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 360px;
}

.auth-guard-logo-box {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #c59b27;
    box-shadow: 0 0 25px rgba(197, 155, 39, 0.35);
    margin-bottom: 20px;
    animation: guardLogoPulse 2s infinite ease-in-out;
}

.auth-guard-logo-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-guard-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.auth-guard-subtitle {
    font-size: 0.88rem;
    color: #9dd8bd;
    margin-bottom: 24px;
}

.auth-guard-spinner-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.7);
}

.auth-guard-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(197, 155, 39, 0.25);
    border-top-color: #c59b27;
    border-radius: 50%;
    animation: guardSpin 0.75s linear infinite;
}

@keyframes guardSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes guardLogoPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(197, 155, 39, 0.3);
    }

    50% {
        transform: scale(1.04);
        box-shadow: 0 0 32px rgba(197, 155, 39, 0.55);
    }
}

/* ==========================================================================
   GUEST MODE BANNER NOTICE
   ========================================================================== */
.guest-mode-banner {
    background: linear-gradient(90deg, #103b29 0%, #194f38 100%);
    border-bottom: 1px solid rgba(197, 155, 39, 0.4);
    padding: 9px 16px;
    z-index: 100;
    width: 100%;
}

.guest-banner-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 0.85rem;
    color: #ffffff;
    flex-wrap: wrap;
    text-align: center;
}

.guest-pill {
    background: var(--color-gold-500);
    color: var(--color-green-950);
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.guest-banner-login-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffffff !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.guest-banner-login-btn:hover {
    background: #ffffff;
    color: var(--color-green-900) !important;
}