/* --- RESET & UMUM --- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: #f3f4f6; color: #1f2937; }
a { text-decoration: none; }

/* --- GLOBAL UTILITIES --- */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 16px; border-radius: 8px; border: none; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: 0.2s; gap: 6px; }
.btn-primary { background: #4f46e5; color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-success { background: #d1fae5; color: #065f46; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; display: flex; }

.card { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 18px; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08); border: 1px solid rgba(148, 163, 184, 0.24); }
.modern-card { border-radius: 16px; overflow: hidden; border: 1px solid rgba(79, 70, 229, 0.2); box-shadow: 0 7px 25px rgba(79,70,229,0.16); }

.alert { padding: 12px; border-radius: 8px; margin-bottom: 15px; font-size: 0.9rem; text-align: left; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* Form Elements */
form label { display: block; font-size: 0.9rem; margin: 10px 0 5px; font-weight: 500; color: #4b5563; }
input, select, textarea { width: 100%; padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 1rem; background: #fff; box-sizing: border-box; margin-bottom: 15px; }
.flex { display: flex; gap: 10px; } .flex-1 { flex: 1; }

.text-center { text-align: center; }

/* --- AUTH PAGES (LOGIN, REGISTER, ACTIVATE) --- */
.auth-body { display: flex; justify-content: center; align-items: center; min-height: 100vh; padding: 0; }
.login-card { background: white; padding: 40px; border-radius: 15px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 100%; max-width: 400px; text-align: center; }
.login-card h1 { color: #4f46e5; margin: 10px 0; }
.login-card p { color: #6b7280; font-size: 0.9rem; margin-bottom: 25px; }
.login-card form { text-align: left; margin-bottom: 20px; }
.login-card form label { display: block; font-size: 0.85rem; color: #374151; font-weight: 600; margin-bottom: 5px; }
.login-card .alert { text-align: center; }

.divider { display: flex; align-items: center; margin: 20px 0; color: #9ca3af; font-size: 0.8rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: #e5e7eb; }
.divider::before { margin-right: 10px; }
.divider::after { margin-left: 10px; }

.btn-google {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    background: #ffffff; color: #555; border: 1px solid #d1d5db;
    padding: 12px; text-decoration: none; border-radius: 8px; 
    font-weight: 600; transition: 0.2s; width: 100%; box-sizing: border-box;
}
.btn-google:hover { background: #f9fafb; border-color: #9ca3af; }
.register-link, .link-text { font-size: 0.9rem; margin-top: 20px; text-align: center; }
.register-link a, .link-text a { color: #4f46e5; text-decoration: none; font-weight: 600; }
.success-text { color: #065f46; } .error-text { color: #991b1b; }


/* --- TAMPILAN APP UTAMA (INDEX.PHP) --- */
.app-body { padding-top: 70px; padding-bottom: 80px; } /* Space untuk Header & Bottom Nav */
.container { padding: 0 15px; max-width: 100%; }

/* Mobile Header (Fixed Logo) */
.mobile-header { 
    position: fixed; top: 0; left: 0; right: 0; height: 60px; background: #fff; 
    display: flex; justify-content: center; align-items: center; z-index: 999;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.mobile-header svg { width: 32px; height: 32px; }

/* Mobile Bottom Nav */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: 65px; background: #fff; border-top: 1px solid #e5e7eb;
    display: flex; justify-content: space-around; align-items: center; z-index: 999;
}
.nav-item { display: flex; flex-direction: column; align-items: center; color: #9ca3af; font-size: 0.7rem; text-decoration: none; }
.nav-item.active { color: #4f46e5; }
.nav-item svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; margin-bottom: 2px; }

/* Tombol Tambah Tengah (Mobile) */
.nav-item.add-btn { position: relative; top: -20px; }
.nav-item.add-btn div { 
    width: 48px; height: 48px; background: #4f46e5; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; color: #fff; 
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3); 
}
.nav-item.add-btn svg { stroke: #fff; }

/* Sembunyikan elemen Desktop di Mobile */
.desktop-header, .desktop-nav { display: none; }

/* --- TAMPILAN DESKTOP (LAYAR LEBAR) --- */
@media (min-width: 768px) {
    .app-body { padding-top: 0; padding-bottom: 40px; } /* Reset padding */
    .container { max-width: 1000px; margin: 20px auto; }
    
    /* Sembunyikan elemen Mobile */
    .mobile-header, .bottom-nav { display: none; }
    
    /* Tampilkan elemen Desktop */
    .desktop-header { 
        display: block; background: linear-gradient(135deg, #4f46e5, #6366f1); color: #fff; 
        padding: 15px 0; margin-bottom: 0; 
    }
    .header-inner { max-width: 1000px; margin: 0 auto; padding: 0 15px; display: flex; justify-content: space-between; align-items: center; }
    
    .desktop-nav { 
        display: block; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.05); margin-bottom: 20px; 
    }
    .nav-inner { max-width: 1000px; margin: 0 auto; display: flex; padding: 0 10px; }
    .d-link { 
        padding: 15px 20px; text-decoration: none; color: #4b5563; font-weight: 600; border-bottom: 3px solid transparent; font-size: 0.9rem; 
    }
    .d-link:hover { background: #f9fafb; color: #4f46e5; }
    .d-link.active { border-bottom-color: #4f46e5; color: #4f46e5; }
    .btn-block { width: auto; display: inline-flex; }
}

/* --- DASHBOARD HEADERS --- */
.page-header { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 24px 24px; background: transparent; color: #1f2937; border-bottom: 1px solid #f0f1f3; }
.back-button-link { font-size: 0.85rem; font-weight: 600; color: #6366f1; text-decoration: none; transition: color .2s; }
.back-button-link:hover { color: #4f46e5; }
.tree-title { margin: 0; font-size: 1.65rem; font-weight: 700; line-height: 1.2; color: #1f2937; letter-spacing: -0.4px; }
.btn-add-member { margin-top: 8px; }

/* Menu List di Halaman Akun */
.menu-list a { display: flex; align-items: center; padding: 15px; border-bottom: 1px solid #f3f4f6; color: #374151; font-weight: 500; }
.menu-icon { margin-right: 10px; font-size: 1.2rem; }

/* --- MODERN LIST ITEM STYLING (PERSON) --- */
.person-list { list-style: none; padding: 0; margin: 0; }
.person-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px; margin-bottom: 8px; border-radius: 12px; 
    background: #fff; border: 1px solid #f3f4f6; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.person-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    border-color: #e5e7eb; background: #fafafa;
}
.person-item:active { transform: scale(0.98); }

.person-left {
    display: flex; align-items: center; gap: 15px; flex: 1; min-width: 0;
    text-decoration: none; color: inherit; padding: 5px;
}

.person-avatar {
    width: 50px; height: 50px; border-radius: 50%; background: #f3f4f6;
    overflow: hidden; flex-shrink: 0; border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.person-avatar img { width: 100%; height: 100%; object-fit: cover; }

.person-info { flex: 1; }
.person-name { font-size: 1.05rem; font-weight: 700; color: #1f2937; margin-bottom: 2px; display: block; }
.person-note { font-size: 0.85rem; color: #6b7280; font-weight: 400; }
.person-actions { padding-left: 10px; }

/* --- MODERN PILL MENU / FILTER --- */
.pill-menu {
    display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; margin-top: 10px;
}
.pill-item {
    white-space: nowrap; padding: 8px 16px; border-radius: 99px;
    background: #fff; border: 1px solid #d1d5db; color: #4b5563;
    text-decoration: none; font-size: 0.85rem; font-weight: 500;
    transition: all 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.pill-item:hover { border-color: #4f46e5; color: #4f46e5; }
.pill-item.active { background: #4f46e5; color: #fff; border-color: #4f46e5; box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2); }

.link-name { color: #007bff; text-decoration: none; font-weight: 600; }
.link-name:hover { text-decoration: underline; }

/* --- EXPORT TOOLBAR --- */
.export-toolbar {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
    gap: 15px; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 2px dashed #f3f4f6;
}
.export-label { font-size: 1.1rem; font-weight: 700; color: #374151; display: flex; align-items: center; gap: 8px; }
.export-actions { display: flex; gap: 10px; }

/* --- TREE DIAGRAM STYLES --- */
.tree-container {
    overflow-x: auto; text-align: center; padding: 26px 18px 34px; width: 100%; border-radius: 18px;
    background: radial-gradient(circle at 1px 1px, rgba(148, 163, 184, 0.24) 1px, transparent 0) 0 0 / 22px 22px, linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border: 1px solid rgba(148, 163, 184, 0.32); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7); scrollbar-gutter: stable;
}

#tree-graph-wrapper-placeholder
.tree-graph-wrapper {
    position: relative;
    width: 100%; min-height: 40vh; border-radius: 14px; background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.35); box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08); overflow: hidden;
}

.graph-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    z-index: 40;
    align-items: center;
}
.graph-controls .btn {
    padding: 8px 10px;
    font-size: 0.78rem;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(15,23,42,0.08);
}
.graph-controls .btn:hover { transform: translateY(-2px); }

/* family graph responsive height: prefer viewport-based sizing with sensible mins */
#family-graph { width: 100%; height: min(72vh, 820px); min-height: 420px; }

.tree-legend { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: center; margin-bottom: 12px; font-size: 0.78rem; color: #475569; }
.tree-legend-item { display: inline-flex; align-items: center; gap: 6px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 999px; padding: 4px 10px; }
.tree-legend-line { width: 18px; height: 2px; border-radius: 999px; background: #94a3b8; }
.tree-legend-line.spouse { background: #ef4444; }

.tree { width: max-content; min-width: 100%; margin: 0 auto; display: block; }
.tree ul { padding-top: 26px; position: relative; display: flex; justify-content: center; align-items: flex-start; gap: 8px; margin: 0; }
.tree li { text-align: center; list-style-type: none; position: relative; padding: 26px 8px 0; flex-shrink: 0; }
.tree li::before, .tree li::after { content: ''; position: absolute; top: 0; right: 50%; border-top: 2px solid #94a3b8; width: 50%; height: 26px; }
.tree li::after { right: auto; left: 50%; border-left: 2px solid #94a3b8; }
.tree li:only-child::after, .tree li:only-child::before { display: none; }
.tree li:only-child { padding-top: 0; }
.tree li:first-child::before, .tree li:last-child::after { border: 0 none; }
.tree li:last-child::before { border-right: 2px solid #94a3b8; border-radius: 0 7px 0 0; }
.tree li:first-child::after { border-radius: 7px 0 0 0; }
.tree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; border-left: 2px solid #94a3b8; width: 0; height: 26px; }

.horizontal-parents-wrapper {
    display: flex; align-items: center; justify-content: center; gap: 0; flex-wrap: nowrap;
    padding: 8px 10px; border-radius: 16px; background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(148, 163, 184, 0.35); box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08); backdrop-filter: blur(2px);
}
.marriage-rows { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.marriage-grid { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: nowrap; width: 100%; }
.wives-inline { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; flex: 1; min-width: 0; }
.wives-inline-left { justify-content: flex-end; }
.wives-inline-right { justify-content: flex-start; }
.marriage-inline-unit { display: flex; align-items: center; gap: 2px; }
.marriage-row { display: flex; align-items: center; justify-content: center; gap: 4px; }

.husband-column { position: relative; display: flex; align-items: center; justify-content: center; min-width: 132px; padding-left: 6px; }
.husband-spine { position: absolute; left: 2px; top: 8px; bottom: 8px; width: 3px; background: #ef4444; border-radius: 999px; box-shadow: 0 0 0 1px rgba(255,255,255,0.55) inset; }
.node-wrapper { display: flex; align-items: center; }

.line-connector { width: 24px; min-width: 24px; height: 3px; background: #ef4444; border-radius: 999px; flex-shrink: 0; margin: 0 1px; box-shadow: 0 0 0 1px rgba(255,255,255,0.55) inset; }
.marriage-bridge { background: #ef4444; }

.marriage-link { position: relative; width: 54px; min-width: 54px; height: 22px; display: flex; align-items: center; justify-content: center; }
.marriage-link::before, .marriage-link::after { content: ''; position: absolute; top: 50%; width: 20px; height: 3px; background: #ef4444; border-radius: 999px; transform: translateY(-50%); }
.marriage-link::before { left: 0; } .marriage-link::after { right: 0; }
.marriage-love {
    display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%;
    background: #fff1f2; color: #e11d48; font-size: 12px; line-height: 1;
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.25); border: 1px solid #fecdd3; z-index: 1;
}

.marriage-link-zigzag::before, .marriage-link-zigzag::after { height: 2px; background: #ef4444; }
.marriage-link-zigzag::before { width: 16px; left: 0; top: calc(50% - 3px); transform: none; }
.marriage-link-zigzag::after { width: 16px; right: 0; top: calc(50% + 3px); transform: none; }
.marriage-link-zigzag .marriage-love { transform: translateY(0); }
.husband-node { margin: 0 4px; }
.children-container { display: flex; justify-content: center; align-items: flex-start; gap: 20px; margin-top: 12px; flex-wrap: wrap; }
.marriage-block { display: flex; flex-direction: column; align-items: center; position: relative; min-width: 190px; }
.marriage-line-down { width: 2px; height: 24px; background: #64748b; margin-bottom: 6px; }
.mom-label {
    font-size: 0.72rem; color: #475569; background: #f8fafc; padding: 4px 10px; border-radius: 999px;
    margin-bottom: 8px; font-weight: 700; border: 1px solid #dbeafe; max-width: 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.children-list { display: flex; gap: 10px; padding-top: 12px; position: relative; margin: 0; }
.children-list::before { content: ""; position: absolute; top: 0; left: 12%; right: 12%; height: 2px; background: #cbd5e1; }
.children-list > li { position: relative; padding-top: 22px; }
.children-list > li::before { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 22px; background: #cbd5e1; }

.tree-node-web { text-decoration: none; display: inline-block; margin: 0 2px; position: relative; }
.tree-node-web.node-deceased .node-card-content { opacity: 0.72; background: #f8fafc; }
.tree-node-web.node-deceased .web-photo { filter: grayscale(100%); opacity: 0.85; border-color: #94a3b8; }
.tree-node-web.node-deceased .web-name { color: #64748b; font-weight: 700; }
.tree-node-web.node-deceased::after {
    content: '†'; position: absolute; top: -7px; right: -7px; background: #dc2626; color: #fff;
    width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 700; box-shadow: 0 4px 10px rgba(220, 38, 38, 0.25);
}

.node-card-content {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid #cbd5e1; border-radius: 14px; padding: 10px 10px 8px;
    min-width: 112px; max-width: 150px; box-shadow: 0 7px 16px rgba(15, 23, 42, 0.12);
    position: relative; z-index: 2; transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: visible !important;
}
.node-card-content:hover { transform: translateY(-2px); border-color: #6366f1; box-shadow: 0 12px 20px rgba(79, 70, 229, 0.16); }
.node-card-content.highlight { border-color: #4f46e5; background: #eef2ff; border-width: 2px; }

.web-photo {
    width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
    border: 2px solid #fff; box-shadow: 0 4px 9px rgba(15, 23, 42, 0.15); transition: filter 0.2s;
}
.web-name { font-size: 0.8rem; font-weight: 700; display: block; line-height: 1.25; margin-top: 7px; color: #1e293b; transition: all 0.2s; word-break: break-word; }

/* Node Focus effect */
.node-focused {
    border: 3px solid #4f46e5 !important; background-color: #e0e7ff !important;
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.6) !important; transform: scale(1.15) !important;
    z-index: 10; animation: pulseFocus 2s infinite;
}
@keyframes pulseFocus { 0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(79, 70, 229, 0); } 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); } }
.node-card-wrapper { display: flex; flex-direction: column; align-items: center; text-decoration: none; }

/* Tombol Tree Action */
.tree-action-btn {
    position: absolute; width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; text-decoration: none; font-size: 12px;
    color: white; border: 2px solid white; box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 20; cursor: pointer; transition: transform 0.2s;
}
.tree-action-btn:hover { transform: scale(1.1); }
.btn-tree-edit { top: -8px; left: -8px; background-color: #f59e0b; }
.btn-tree-add { top: -8px; right: -8px; background-color: #10b981; }

@media (max-width: 900px) {
    .tree-container { padding: 16px 12px 22px; }
    .tree-graph-wrapper { min-height: 34vh; }
    /* Allow family graph to scale on smaller screens while keeping minimum touchable area */
    #family-graph { height: min(62vh, 680px); min-height: 360px; }
    .horizontal-parents-wrapper { gap: 0; padding: 8px 8px; border-radius: 14px; }
    .marriage-row { gap: 2px; } .marriage-grid { gap: 4px; } .wives-inline { gap: 4px; }
    .marriage-link { width: 42px; min-width: 42px; }
    .marriage-link::before, .marriage-link::after { width: 14px; }
    .marriage-link-zigzag::before, .marriage-link-zigzag::after { width: 12px; }
    .marriage-love { width: 16px; height: 16px; font-size: 10px; }
    .line-connector { width: 14px; min-width: 14px; }
    .node-card-content { min-width: 96px; max-width: 120px; padding: 8px 8px 7px; }
    .web-photo { width: 48px; height: 48px; }
    .web-name { font-size: 0.74rem; }
    .children-container { gap: 14px; }
    .marriage-block { min-width: 160px; }
}

/* --- RELATIONS CARD / TABLE --- */
.card-relations {
    border-radius: 18px; padding: 16px 18px 14px; background: linear-gradient(145deg, #ffffff, #f7fafc);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08); border: 1px solid rgba(148, 163, 184, 0.25); margin-bottom: 24px;
}
.card-relations-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-relations .section-title { font-size: 1.1rem; margin: 0; font-weight: 700; color: #0f172a; }
.section-subtitle { margin: 2px 0 0; font-size: 0.8rem; color: #6b7280; }
.badge-relations { font-size: 0.75rem; padding: 4px 10px; border-radius: 999px; background: rgba(59, 130, 246, 0.08); color: #1d4ed8; font-weight: 600; border: 1px solid rgba(59, 130, 246, 0.15); white-space: nowrap; }
.empty-relations { padding: 20px 12px 4px; text-align: center; color: #6b7280; font-size: 0.9rem; }
.empty-relations .empty-icon { font-size: 1.9rem; margin-bottom: 6px; }

.table-relations-wrapper { width: 100%; overflow-x: auto; margin-top: 6px; }
.relations-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.relations-table thead tr { background: #f1f5f9; }
.relations-table th, .relations-table td { padding: 8px 10px; }
.relations-table th { text-align: left; font-weight: 600; font-size: 0.78rem; letter-spacing: 0.03em; text-transform: uppercase; color: #6b7280; border-bottom: 1px solid rgba(148, 163, 184, 0.45); }
.relations-table tbody tr.relation-row { cursor: pointer; transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.12s ease; }
.relations-table tbody tr.relation-row:nth-child(even) { background: #ffffff; }
.relations-table tbody tr.relation-row:nth-child(odd) { background: #f9fafb; }
.relations-table tbody tr.relation-row:hover { background: #e0f2fe; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(37, 99, 235, 0.18); }

.relation-person { display: flex; align-items: center; gap: 8px; }
.relation-avatar { width: 34px; height: 34px; border-radius: 999px; background: linear-gradient(135deg, #3b82f6, #6366f1); display: flex; align-items: center; justify-content: center; font-size: 0.9rem; font-weight: 700; color: white; flex-shrink: 0; box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4); }
.relation-text { display: flex; flex-direction: column; }
.relation-name { font-weight: 600; color: #0f172a; text-decoration: none; transition: color 0.15s ease; }
.relation-name:hover { color: #1d4ed8; text-decoration: underline; }
.relation-id { font-size: 0.7rem; color: #9ca3af; }
.relation-type-pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; background: rgba(16, 185, 129, 0.1); color: #047857; font-size: 0.75rem; font-weight: 600; border: 1px solid rgba(16, 185, 129, 0.25); }
.relation-actions { display: inline-flex; gap: 6px; }

.btn-chip { border-radius: 999px; padding: 4px 10px; font-size: 0.75rem; border: none; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 500; transition: background 0.16s ease, transform 0.12s ease, box-shadow 0.12s ease; cursor: pointer; white-space: nowrap; }
.btn-chip-view { background: #eff6ff; color: #1d4ed8; }
.btn-chip-view:hover { background: #dbeafe; transform: translateY(-1px); box-shadow: 0 3px 6px rgba(37, 99, 235, 0.25); }
.btn-chip-delete { background: #fef2f2; color: #b91c1c; }
.btn-chip-delete:hover { background: #fee2e2; transform: translateY(-1px); box-shadow: 0 3px 6px rgba(185, 28, 28, 0.25); }

@media (max-width: 640px) {
    .card-relations { padding: 12px 12px 10px; border-radius: 16px; }
    .relations-table th:nth-child(3), .relations-table td:nth-child(3) { white-space: nowrap; }
    .relation-id { display: none; }
}

/* --- SYSTEM LOADER --- */
#page-loader {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(5px);
    z-index: 9999; display: flex; align-items: center; justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease; opacity: 0; visibility: hidden;
}
#page-loader.active { opacity: 1; visibility: visible; }
.loader-content { width: 80px; height: 80px; animation: breathe 1.5s infinite ease-in-out; }
@keyframes breathe {
    0% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; filter: drop-shadow(0 0 15px rgba(79, 70, 229, 0.4)); }
    100% { transform: scale(0.9); opacity: 0.8; }
}
.fade-in { animation: fadeIn 0.4s ease-out forwards; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
