/* =====================================================
   Silsilah Keluarga - Stylesheet
   ===================================================== */
:root {
    --primary: #7c5cff;
    --primary-dark: #6a48f2;
    --primary-light: #f1edff;
    --male: #3b82f6;
    --male-light: #eaf2ff;
    --female: #ec4899;
    --female-light: #fdeef6;
    --green: #10b981;
    --green-light: #e6f9f1;
    --gray: #6b7280;
    --gray-light: #f1f2f4;
    --bg: #f7f7fb;
    --card: #ffffff;
    --text: #1f2333;
    --text-muted: #6b7280;
    --border: #eaeaf2;
    --radius: 16px;
    --shadow: 0 4px 20px rgba(31, 35, 51, 0.06);
    --shadow-hover: 0 8px 28px rgba(31, 35, 51, 0.12);
    --sidebar-w: 260px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Playfair Display', serif; margin: 0; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
.text-muted { color: var(--text-muted); }
.small { font-size: 0.8rem; }
.text-end { text-align: right; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #2a1f5e, #1c1440);
    color: #fff;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.brand-icon { font-size: 2rem; }
.brand-title { font-family: 'Playfair Display', serif; font-weight: 700; font-size: 1.15rem; }
.brand-sub { font-size: 0.75rem; opacity: 0.65; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px; border-radius: 10px;
    color: rgba(255,255,255,0.75); font-size: 0.92rem; font-weight: 500;
    transition: background 0.2s, color 0.2s;
}
.sidebar-nav a i { font-size: 1.1rem; width: 20px; text-align: center; }
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav a.active { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(124,92,255,0.4); }

.sidebar-user {
    border-top: 1px solid rgba(255,255,255,0.1); padding-top: 18px; margin-top: 18px;
}
.sidebar-user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar-icon {
    width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,0.12);
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0;
}
.user-name { font-size: 0.88rem; font-weight: 600; color: #fff; }
.user-settings-link { font-size: 0.74rem; color: rgba(255,255,255,0.6); }
.user-settings-link:hover { color: #fff; }
.logout-link {
    display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: rgba(255,255,255,0.75);
    padding: 9px 12px; border-radius: 8px; transition: background 0.2s;
}
.logout-link:hover { background: rgba(255,80,80,0.15); color: #ff8080; }
.sidebar-footer { font-size: 0.72rem; opacity: 0.4; margin-top: 14px; }

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 99;
}

.sidebar-toggle {
    display: none;
    position: fixed; top: 16px; left: 16px; z-index: 101;
    background: var(--card); border: none; border-radius: 10px;
    width: 44px; height: 44px; font-size: 1.3rem;
    box-shadow: var(--shadow); cursor: pointer;
}

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    padding: 32px 40px;
    min-width: 0;
    max-width: 100%;
}

/* ---------- Page Header ---------- */
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 16px; margin-bottom: 28px;
    background: linear-gradient(120deg, var(--primary-light), #fff);
    border-radius: var(--radius); padding: 22px 28px;
    border: 1px solid #ece7ff;
}
.page-header h1 { font-size: clamp(1.35rem, 3vw, 1.8rem); font-weight: 700; margin-bottom: 4px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 20px; border-radius: 10px; font-weight: 500; font-size: 0.9rem;
    border: none; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-outline { background: var(--card); color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--gray-light); }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-block { width: 100%; justify-content: center; padding: 13px 20px; font-size: 0.95rem; }

/* ---------- Stat Cards ---------- */
.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 18px; margin-bottom: 30px;
}
.stat-card {
    background: var(--card); border-radius: var(--radius); padding: 20px;
    display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 14px; display: flex;
    align-items: center; justify-content: center; font-size: 1.4rem; color: #fff; flex-shrink: 0;
}
.bg-purple { background: linear-gradient(135deg, #a78bfa, #7c5cff); }
.bg-blue { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.bg-pink { background: linear-gradient(135deg, #f472b6, #ec4899); }
.bg-green { background: linear-gradient(135deg, #34d399, #10b981); }
.bg-gray { background: linear-gradient(135deg, #9ca3af, #6b7280); }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* ---------- Section Card ---------- */
.section-card { background: var(--card); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); margin-bottom: 24px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.section-header h2 { font-size: 1.3rem; }
.section-header a { color: var(--primary); font-size: 0.88rem; font-weight: 500; }

/* ---------- Member Mini Cards (dashboard) ---------- */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.member-mini-card {
    display: flex; align-items: center; gap: 12px; padding: 14px;
    border: 1px solid var(--border); border-radius: 14px; transition: all 0.2s;
}
.member-mini-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.mini-avatar {
    width: 46px; height: 46px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-weight: 600; color: #fff;
}
.member-mini-card.male .mini-avatar { background: var(--male); }
.member-mini-card.female .mini-avatar { background: var(--female); }
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mini-name { font-weight: 600; font-size: 0.92rem; }
.mini-sub { font-size: 0.78rem; color: var(--text-muted); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state i { font-size: 2.6rem; opacity: 0.35; margin-bottom: 12px; display: block; }
.empty-state p { margin-bottom: 16px; }

/* ---------- Search box ---------- */
.search-box {
    display: flex; align-items: center; gap: 10px; background: var(--gray-light);
    padding: 10px 16px; border-radius: 10px; min-width: 220px;
}
.search-box input { border: none; background: transparent; outline: none; font-family: inherit; font-size: 0.9rem; width: 100%; }
.search-box i { color: var(--text-muted); }
.search-box-full { margin-bottom: 20px; max-width: 420px; position: relative; }
.clear-search { color: var(--text-muted); }

/* ---------- Data Table ---------- */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th {
    text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted); padding: 12px 14px; border-bottom: 2px solid var(--border);
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover { background: #fafafe; }
.table-avatar {
    width: 40px; height: 40px; border-radius: 50%; overflow: hidden; display: flex;
    align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 0.8rem;
}
.table-avatar.male { background: var(--male); }
.table-avatar.female { background: var(--female); }
.table-avatar img { width: 100%; height: 100%; object-fit: cover; }
.table-name { font-weight: 600; }
.table-name:hover { color: var(--primary); }

.badge { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 0.74rem; font-weight: 600; }
.badge-blue { background: var(--male-light); color: var(--male); }
.badge-pink { background: var(--female-light); color: var(--female); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-gray { background: var(--gray-light); color: var(--gray); }

.action-btns { display: flex; gap: 8px; justify-content: flex-end; }
.icon-btn {
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    border-radius: 8px; background: var(--gray-light); color: var(--text); transition: all 0.2s;
}
.icon-btn:hover { background: var(--primary-light); color: var(--primary); }
.icon-btn.danger:hover { background: #fee2e2; color: #dc2626; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 22px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group-full { grid-column: 1 / -1; }
.form-group label { font-size: 0.85rem; font-weight: 600; }
.req { color: #dc2626; }
.form-group input[type=text], .form-group input[type=date], .form-group select, .form-group textarea {
    padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px;
    font-family: inherit; font-size: 0.9rem; background: #fcfcfe; outline: none; transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); background: #fff; }
.form-group textarea { resize: vertical; }
.form-actions { display: flex; gap: 12px; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }

.photo-upload-group { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 18px; }
.photo-preview {
    width: 84px; height: 84px; border-radius: 50%; background: var(--gray-light);
    display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
    border: 2px dashed var(--border); font-size: 1.6rem; color: var(--text-muted);
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

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

/* ---------- Alerts ---------- */
.alert { padding: 14px 18px; border-radius: 12px; margin-bottom: 20px; font-size: 0.9rem; }
.alert-danger { background: #fef2f2; color: #b91c1c; }
.alert-danger ul { padding-left: 18px; list-style: disc; }
.alert-success { background: var(--green-light); color: #047857; display: flex; align-items: center; gap: 8px; }

/* ---------- Profile Page ---------- */
.profile-card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 24px; }
.profile-banner { height: 90px; }
.profile-banner.male { background: linear-gradient(135deg, #93c5fd, #3b82f6); }
.profile-banner.female { background: linear-gradient(135deg, #f9a8d4, #ec4899); }
.profile-header { display: flex; align-items: flex-end; gap: 20px; padding: 0 28px; margin-top: -46px; flex-wrap: wrap; }
.profile-avatar {
    width: 108px; height: 108px; border-radius: 50%; border: 5px solid #fff; background: var(--primary);
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 2rem; font-weight: 700;
    overflow: hidden; box-shadow: var(--shadow); flex-shrink: 0;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-title { padding-bottom: 10px; }
.profile-title h1 { font-size: 1.5rem; }
.profile-badges { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.profile-body { padding: 26px 28px 30px; }
.profile-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 24px; }
.info-item { display: flex; align-items: flex-start; gap: 12px; }
.info-item i { font-size: 1.2rem; color: var(--primary); margin-top: 2px; }
.info-item span { display: block; font-size: 0.76rem; color: var(--text-muted); }
.info-item strong { font-size: 0.94rem; }
.profile-bio { background: var(--gray-light); border-radius: 12px; padding: 18px 20px; margin-bottom: 24px; }
.profile-bio h3 { font-size: 1rem; margin-bottom: 8px; }
.profile-bio p { margin: 0; line-height: 1.6; font-size: 0.92rem; }

.relations-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.relation-block h3 { font-size: 0.95rem; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.relation-people { display: flex; flex-wrap: wrap; gap: 10px; }
.relation-chip {
    display: flex; align-items: center; gap: 8px; padding: 7px 14px 7px 7px;
    border-radius: 30px; border: 1px solid var(--border); font-size: 0.85rem; font-weight: 500;
    transition: all 0.2s;
}
.relation-chip:hover { border-color: var(--primary); background: var(--primary-light); }
.chip-avatar {
    width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 700; color: #fff; overflow: hidden; flex-shrink: 0;
}
.chip-avatar img { width: 100%; height: 100%; object-fit: cover; }
.relation-chip.male .chip-avatar { background: var(--male); }
.relation-chip.female .chip-avatar { background: var(--female); }

/* ---------- Family Tree Visualization ---------- */
.tree-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tree-legend { display: flex; gap: 22px; margin-bottom: 16px; font-size: 0.85rem; color: var(--text-muted); flex-wrap: wrap; }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: middle; }
.legend-dot.male { background: var(--male); }
.legend-dot.female { background: var(--female); }
.legend-symbol { margin-right: 4px; }

.tree-viewport {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    overflow: auto; padding: 50px 40px; min-height: 420px;
}
.tree-canvas { transform-origin: top left; transition: transform 0.2s ease; width: max-content; }

.family-tree, .family-tree ul {
    display: flex; padding-top: 30px; position: relative;
}
.family-tree { justify-content: center; }
.family-tree ul { padding-top: 40px; }
.family-tree li {
    display: flex; flex-direction: column; align-items: center;
    list-style: none; position: relative; padding: 0 14px;
}

/* connecting lines */
.family-tree li::before, .family-tree li::after {
    content: ''; position: absolute; top: 0; border-top: 2px solid #d8d5ea;
}
.family-tree ul li::before { left: 0; width: 50%; height: 40px; top: -40px; }
.family-tree ul li::after { right: 0; left: 50%; width: 50%; height: 40px; top: -40px; border-left: 2px solid #d8d5ea; }
.family-tree ul li:only-child::before, .family-tree ul li:only-child::after { display: none; }
.family-tree ul li:first-child::before { border: none; }
.family-tree ul li:last-child::after { border: none; }
.family-tree ul li:only-child { padding-top: 0; }
.family-tree > li { padding-top: 0; }
.family-tree > li::before, .family-tree > li::after { display: none; }
.family-tree ul::before {
    content: ''; position: absolute; top: -40px; left: 50%; height: 40px;
    border-left: 2px solid #d8d5ea;
}
.family-tree > ul::before { display: none; }
.tree-node-group::after {
    content: ''; position: absolute; bottom: -30px; left: 50%; height: 30px; width: 0;
    border-left: 2px solid #d8d5ea; display: none;
}
.family-tree li:has(> ul) > .tree-node-group::after { display: block; }

.tree-node-group { display: flex; align-items: center; gap: 6px; position: relative; padding-bottom: 30px; }
.spouse-link { color: #d8d5ea; font-size: 1.1rem; }

.tree-node {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: #fff; border: 2px solid var(--border); border-radius: 14px;
    padding: 12px 16px; width: 118px; transition: all 0.2s; box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.tree-node:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.tree-node.male { border-color: var(--male); }
.tree-node.female { border-color: var(--female); }
.tree-node.highlight { box-shadow: 0 0 0 4px var(--primary-light), 0 0 0 2px var(--primary); }

.node-avatar {
    width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; overflow: hidden;
}
.tree-node.male .node-avatar { background: var(--male); }
.tree-node.female .node-avatar { background: var(--female); }
.node-avatar img { width: 100%; height: 100%; object-fit: cover; }
.node-name { font-size: 0.8rem; font-weight: 600; text-align: center; line-height: 1.2; }
.node-years { font-size: 0.68rem; color: var(--text-muted); }

/* ---------- Spouse mode toggle ---------- */
.spouse-mode-toggle { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.radio-pill {
    display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 30px;
    border: 1px solid var(--border); font-size: 0.85rem; cursor: pointer; transition: all 0.2s; background: #fcfcfe;
}
.radio-pill:has(input:checked) { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.radio-pill input { accent-color: var(--primary); }
.spouse-mode-field input[type=text] {
    padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px;
    font-family: inherit; font-size: 0.9rem; background: #fcfcfe; outline: none; width: 100%;
}
.spouse-mode-field select {
    padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px;
    font-family: inherit; font-size: 0.9rem; background: #fcfcfe; outline: none; width: 100%;
}
.spouse-mode-field small { display: block; margin-top: 6px; }

/* ---------- Riwayat Pernikahan (multi baris, mendukung menikah lebih dari 1x) ---------- */
.marriage-row {
    background: #fcfcfe; border: 1px solid var(--border); border-radius: 12px;
    padding: 16px; margin-bottom: 14px; position: relative;
}
.marriage-row-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px 16px; align-items: start;
    padding-right: 40px;
}
.marriage-row-grid .form-group { gap: 4px; }
.marriage-row-grid label { font-size: 0.76rem; color: var(--text-muted); font-weight: 600; }
.marriage-row .remove-marriage-btn { position: absolute; top: 14px; right: 14px; }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; margin-top: 4px; }

.marriage-status-badge {
    display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 0.72rem; font-weight: 600;
    white-space: nowrap;
}
.marriage-status-badge.status-cerai { background: #fef3c7; color: #92400e; }
.marriage-status-badge.status-meninggal { background: var(--gray-light); color: var(--gray); }

.marriage-list { display: flex; flex-direction: column; gap: 10px; }
.marriage-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.marriage-order-badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.7rem; font-weight: 700;
    background: var(--primary-light); color: var(--primary-dark); white-space: nowrap;
}

/* Label kecil di bawah node pohon, mis. "Pernikahan ke-2" pada anak */
.node-tag { font-size: 0.62rem; color: var(--primary-dark); background: var(--primary-light); border-radius: 8px; padding: 1px 6px; margin-top: 2px; display: inline-block; }

/* ---------- Filter Kakek/Nenek untuk Ayah/Ibu (form tambah/edit) ---------- */
.parent-filter-group {
    background: var(--primary-light);
    border: 1px dashed #d6c9ff;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: -6px;
}
.parent-filter-group label { display: flex; align-items: center; gap: 6px; color: var(--primary-dark); }
.parent-filter { width: 100%; }

/* ---------- Root/Punjer selector on tree page ---------- */
.root-selector-card { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; padding: 18px 22px; }
.root-selector-card label { font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.root-selector-card select {
    padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; font-family: inherit;
    font-size: 0.92rem; background: #fcfcfe; max-width: 420px;
}
.tree-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.zoom-controls { display: flex; gap: 8px; }
.external-node { opacity: 0.85; border-style: dashed !important; cursor: default; }
.external-node:hover { transform: none; box-shadow: none; }
.external-chip { cursor: default; }
.external-chip:hover { border-color: var(--border); background: transparent; }

/* ---------- Settings page ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }

/* ---------- Auth (login/setup) page ---------- */
.auth-body { background: linear-gradient(135deg, #2a1f5e, #7c5cff); min-height: 100vh; display: flex; align-items: center; justify-content: center; font-family: 'Poppins', sans-serif; padding: 20px; }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card { background: #fff; border-radius: 20px; padding: 40px 34px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.auth-brand { text-align: center; margin-bottom: 6px; }
.auth-brand .brand-icon { font-size: 2.6rem; display: block; margin-bottom: 8px; }
.auth-brand h1 { font-size: 1.4rem; color: var(--text); }
.auth-sub { text-align: center; color: var(--text-muted); font-size: 0.88rem; margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .form-group input {
    padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; font-family: inherit;
    font-size: 0.92rem; width: 100%; background: #fcfcfe; outline: none; transition: border-color 0.2s;
}
.auth-form .form-group input:focus { border-color: var(--primary); background: #fff; }
.auth-form label { font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; padding: 80px 20px 30px; }
    .d-lg-none { display: block; }
}

@media (max-width: 768px) {
    /* Ubah tabel menjadi kartu agar tidak perlu scroll horizontal */
    .data-table { min-width: 0; }
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr {
        margin-bottom: 14px; border: 1px solid var(--border); border-radius: 14px;
        padding: 6px 16px; box-shadow: var(--shadow);
    }
    .data-table td {
        border: none; padding: 10px 0; display: flex; justify-content: space-between; align-items: center;
        border-bottom: 1px solid var(--gray-light);
    }
    .data-table td:last-child { border-bottom: none; }
    .data-table td[data-label]::before {
        content: attr(data-label); font-weight: 600; color: var(--text-muted);
        font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; margin-right: 12px;
    }
    .data-table td:first-child { justify-content: flex-start; padding-top: 16px; }
    .data-table td:first-child::before { display: none; }
    .data-table td:last-child { justify-content: flex-end; padding-bottom: 16px; }
    .table-name { font-size: 1rem; }
}

@media (max-width: 576px) {
    .page-header { flex-direction: column; align-items: flex-start; padding: 18px 20px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-icon { width: 44px; height: 44px; font-size: 1.2rem; }
    .stat-value { font-size: 1.25rem; }
    .section-card { padding: 18px; border-radius: 14px; }
    .profile-header { padding: 0 16px; gap: 14px; }
    .profile-avatar { width: 84px; height: 84px; font-size: 1.5rem; }
    .profile-body { padding: 18px 16px 24px; }
    .profile-title h1 { font-size: 1.25rem; }
    .tree-viewport { padding: 24px 12px; }
    .tree-controls { flex-direction: column; align-items: stretch; }
    .zoom-controls { justify-content: center; }
    .search-box, .search-box-full { min-width: 0; width: 100%; }
    .btn { padding: 10px 16px; font-size: 0.85rem; }
    .marriage-row-grid { grid-template-columns: 1fr; padding-right: 0; }
    .marriage-row .remove-marriage-btn { position: static; margin-top: 8px; width: 100%; height: 38px; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; justify-content: center; }
    .action-btns { flex-wrap: wrap; }
    .photo-upload-group { flex-direction: column; align-items: flex-start; }
    .spouse-mode-toggle { flex-direction: column; }
    .radio-pill { justify-content: center; }
    .auth-card { padding: 30px 24px; }
}

@media (max-width: 380px) {
    .stat-grid { grid-template-columns: 1fr; }
}
