*{box-sizing:border-box}
body{margin:0;font:16px/1.5 Arial,sans-serif;background:#f5f6f8;color:#202532}
header{display:flex;justify-content:space-between;align-items:center;padding:16px max(5%,calc((100% - 1100px)/2));background:#24364b;color:#fff}
header a{color:#fff;text-decoration:none;margin-right:18px}
.brand{font-weight:bold;font-size:20px}
main{max-width:1100px;margin:32px auto;padding:0 20px;min-height:70vh}
h1{margin-top:0}
.page-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}
.button,button{display:inline-block;background:#2463a6;color:#fff;border:0;border-radius:5px;padding:10px 15px;text-decoration:none;cursor:pointer}
form{background:#fff;padding:20px;border-radius:8px;max-width:760px;box-shadow:0 1px 5px #0001}label{display:block;margin:12px 0}
input,select,textarea{display:block;width:100%;padding:10px;border:1px solid #cbd2dc;border-radius:4px;margin-top:5px;font:inherit}
input[type=checkbox]{display:inline;width:auto}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 18px}
.full{grid-column:1/-1}
table{width:100%;border-collapse:collapse;background:#fff}
th,td{text-align:left;padding:12px;border-bottom:1px solid #e1e5eb}
.stats{display:flex;gap:16px}
.stat{background:#fff;padding:20px 28px;border-radius:8px;display:flex;flex-direction:column}
.stat strong{font-size:30px}
.error{color:#a11}
.page-heading{margin-bottom:20px}
dl{display:grid;grid-template-columns:140px 1fr;gap:8px;background:#fff;padding:20px;border-radius:8px}
dt{font-weight:bold}
dd{margin:0}
footer{text-align:center;padding:24px;color:#687386}

a { 
    text-decoration: none;
    color: gray;
}

@media(max-width:650px){
    .form-grid{grid-template-columns:1fr}
    .full{grid-column:auto}
    .page-heading{align-items:flex-start;gap:10px;flex-direction:column}
}

.card{background:#fff;padding:18px;margin:16px 0;border-radius:8px;box-shadow:0 1px 5px #0001}
.inline-form{max-width:100%;box-shadow:none;padding:0;background:transparent;display:flex;gap:12px;align-items:end;flex-wrap:wrap}
.inline-form label{margin:0;min-width:150px}
.danger{background:#a83b3b}
.status-current{font-weight:bold}
.status-ended{font-weight:bold}
.success { padding: 10px; background: #e7f7e7; border: 1px solid #9ad19a; border-radius: 6px; }
.card small { display: block; margin-top: 4px; color: #666; }

.permission-error {
    max-width: 600px;
    margin: 80px auto;
    padding: 40px;
    text-align: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.permission-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff3cd;
    border-radius: 50%;
    font-size: 32px;
}

.permission-error h1 {
    margin-bottom: 10px;
    color: #333;
}

.permission-error p {
    color: #666;
    font-size: 16px;
}

.permission-help {
    font-size: 14px !important;
    color: #888 !important;
}

.permission-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.permission-actions .secondary {
    background: #6c757d;
}

/* ========================================
   PEOPLE PAGE
======================================== */

.page-description {
    margin-top: 5px;
    color: #777;
}

/* ========================================
   SEARCH SECTION
======================================== */

.search-section {
    margin-top: 25px;
    padding: 25px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.search-header h2 {
    margin: 0 0 5px;
}

.search-header p {
    margin: 0 0 20px;
    color: #777;
    font-size: 14px;
}

.search-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input-wrapper {
    flex: 1;
}

.search-input-wrapper input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    border: 1px solid #ccc;
    border-radius: 7px;
    font-size: 15px;
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: #777;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

/* ========================================
   RESULTS
======================================== */

.results-section {
    margin-top: 25px;
    padding: 25px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.results-header h2 {
    margin: 0 0 5px;
}

.results-header p {
    margin: 0;
    color: #777;
}

.results-count {
    padding: 7px 12px;
    background: #f1f3f5;
    border-radius: 20px;
    font-size: 14px;
    color: #555;
}

/* ========================================
   TABLE
======================================== */

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    text-align: left;
    padding: 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

table td {
    padding: 13px 12px;
    border-bottom: 1px solid #eee;
}

table tbody tr:hover {
    background: #fafafa;
}

.actions {
    white-space: nowrap;
}

.actions a {
    margin-right: 12px;
}

/* ========================================
   EMPTY SEARCH STATE
======================================== */

.search-empty-state {
    margin-top: 25px;
    padding: 60px 20px;
    text-align: center;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.search-empty-icon {
    font-size: 45px;
    margin-bottom: 15px;
}

.search-empty-state h2 {
    margin-bottom: 8px;
}

.search-empty-state p {
    color: #777;
}

/* ========================================
   NO RESULTS
======================================== */

.no-results {
    padding: 50px 20px;
    text-align: center;
    border: 1px dashed #ccc;
    border-radius: 10px;
    background: #fafafa;
}

.no-results-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.no-results h3 {
    margin-bottom: 8px;
}

.no-results p {
    color: #777;
    margin-bottom: 20px;
}

/* ========================================
   MOBILE
======================================== */

@media (max-width: 700px) {

    .search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form .button {
        width: 100%;
        text-align: center;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

}

/* ========================================
   Photo
======================================== */

.person-profile-photo {
    width: 180px;
    height: 180px;
    margin-bottom: 20px;
    border-radius: 50%;
    overflow: hidden;
    background: #f1f3f5;
    border: 4px solid #fff;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

.person-profile-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.person-profile-photo-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 70px;
    color: #aaa;
}

/* =========================================================
   PERSON PROFILE
========================================================= */

.person-page {
    max-width: 1100px;
    margin: 0 auto;
}

/* =========================================================
   PERSON TOP BAR
========================================================= */

.person-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.back-link {
    color: #555;
    text-decoration: none;
}

.back-link:hover {
    color: #000;
    text-decoration: underline;
}

.person-actions {
    display: flex;
    gap: 10px;
}

/* =========================================================
   PERSON PROFILE HEADER
========================================================= */

.person-profile-header {
    display: flex;
    align-items: center;
    gap: 30px;

    padding: 30px;

    background: #fff;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.06);

    margin-bottom: 20px;
}

.person-nickname {
    font-style: italic;
    font-weight: bold;
}

/* =========================================================
   PROFILE PHOTO
========================================================= */

.person-profile-photo-large {
    width: 180px;
    height: 180px;

    flex-shrink: 0;

    border-radius: 50%;
    overflow: hidden;

    background: #f1f3f5;

    border: 5px solid #fff;

    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.15);
}

.person-profile-photo-large img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.person-profile-photo-large .person-profile-photo-empty {
    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 70px;

    color: #aaa;
}

/* =========================================================
   PERSON HEADER INFORMATION
========================================================= */

.person-header-info {
    flex: 1;
}

.person-header-info h1 {
    margin: 0 0 8px;

    font-size: 32px;
    line-height: 1.2;
}

.person-lifespan {
    margin-bottom: 5px;

    font-size: 20px;

    color: #666;
}

.person-gender {
    margin-bottom: 20px;

    color: #888;
}

.person-header-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* =========================================================
   PROFILE CARDS
========================================================= */

.profile-card {
    background: #fff;

    border: 1px solid #e5e7eb;

    border-radius: 12px;

    padding: 25px;

    margin-bottom: 20px;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.profile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 20px;
    padding-bottom: 12px;

    border-bottom: 1px solid #eee;
}

.profile-card-header h2 {
    margin: 0;

    font-size: 20px;
}

.section-action {
    font-size: 14px;

    color: #555;

    text-decoration: none;
}

.section-action:hover {
    text-decoration: underline;
}

/* =========================================================
   PERSONAL INFORMATION
========================================================= */

.personal-info-grid {
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;

    gap: 5px;
}

.info-label {
    font-size: 13px;

    color: #888;

    text-transform: uppercase;

    letter-spacing: 0.5px;
}

.info-value {
    font-size: 16px;

    color: #333;
}

/* =========================================================
   FAMILY COLUMNS
========================================================= */

.family-grid {
    display: grid;

    grid-template-columns: repeat(2, 1fr);

    gap: 20px;
}

/* =========================================================
   FAMILY PERSON
========================================================= */

.family-list {
    display: flex;

    flex-direction: column;

    gap: 8px;
}

.family-person {
    display: flex;

    align-items: center;

    gap: 12px;

    padding: 10px;

    border-radius: 8px;

    color: inherit;

    text-decoration: none;

    transition:
        background 0.15s ease,
        transform 0.15s ease;
}

.family-person:hover {
    background: #f7f7f7;

    transform: translateX(2px);
}

/* =========================================================
   FAMILY PERSON PHOTO
========================================================= */

.family-person-photo {
    width: 48px;
    height: 48px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    border-radius: 50%;

    background: #f1f3f5;

    font-size: 22px;
}

.family-person-photo img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.family-person-info {
    display: flex;

    flex-direction: column;

    gap: 3px;
}

.family-person-info strong {
    font-size: 15px;
}

.family-person-info span {
    font-size: 13px;

    color: #888;
}

/* =========================================================
   CHILDREN
========================================================= */

.children-grid {
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 12px;
}

.child-card {
    display: flex;

    align-items: center;

    gap: 12px;

    padding: 12px;

    border: 1px solid #eee;

    border-radius: 9px;

    color: inherit;

    text-decoration: none;

    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.child-card:hover {
    background: #fafafa;

    border-color: #ddd;
}

.child-photo {
    width: 50px;
    height: 50px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    border-radius: 50%;

    background: #f1f3f5;

    font-size: 22px;
}

.child-photo img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.child-card strong {
    display: block;

    font-size: 15px;
}

.child-card span {
    display: block;

    margin-top: 3px;

    font-size: 13px;

    color: #888;
}

/* =========================================================
   EMPTY FAMILY
========================================================= */

.empty-family {
    padding: 20px;

    text-align: center;

    color: #888;

    background: #fafafa;

    border-radius: 8px;
}

/* =========================================================
   BIOGRAPHY
========================================================= */

.biography {
    color: #444;

    font-size: 15px;

    line-height: 1.7;
}

/* =========================================================
   FAMILY TREE LAYOUT
   ========================================================= */

.tree-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
    align-items: start;
}

/* =========================================================
   TREE AREA
   ========================================================= */

.tree-canvas {
    min-width: 0;
    max-height: 75vh;
    overflow: auto;
    border: 1px solid #d9dee7;
    border-radius: 12px;
    background: #fff;
    padding: 25px;
}

/* =========================================================
   PERSON DETAILS PANEL
   ========================================================= */

.person-details-panel {
    position: sticky;
    top: 20px;
    min-height: 400px;
    background: #fff;
    border: 1px solid #d9dee7;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
    overflow: hidden;
}

.person-details-header {
    padding: 25px 20px 20px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.person-details-photo {
    width: 110px;
    height: 110px;
    margin: 0 auto 15px;
    border-radius: 50%;
    overflow: hidden;
    background: #e2e8f0;
    border: 4px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 45px;
    color: #94a3b8;
}

.person-details-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.person-details-name {
    margin: 0;
    font-size: 22px;
    line-height: 1.3;
    color: #111827;
}

.person-details-lifespan {
    margin-top: 6px;
    color: #64748b;
    font-size: 14px;
}

.person-details-content {
    padding: 20px;
}

.detail-section {
    margin-bottom: 22px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section-title {
    margin: 0 0 10px;
    padding-bottom: 7px;
    border-bottom: 1px solid #e5e7eb;

    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 12px;
}

.detail-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #94a3b8;
}

.detail-value {
    font-size: 14px;
    color: #1e293b;
}

.detail-person-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.detail-person {
    display: flex;
    align-items: center;
    gap: 9px;

    padding: 8px;
    border-radius: 7px;

    color: #1e293b;
    text-decoration: none;

    transition: background .15s ease;
}

.detail-person:hover {
    background: #f1f5f9;
}

.detail-person-avatar {
    width: 34px;
    height: 34px;
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;
    border-radius: 50%;
    background: #e2e8f0;

    font-size: 15px;
}

.detail-person-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-person-name {
    font-size: 13px;
    font-weight: 600;
}

.detail-person-relation {
    font-size: 11px;
    color: #94a3b8;
}

.details-placeholder {
    min-height: 400px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    text-align: center;
    padding: 30px;
}

.details-placeholder-icon {
    width: 70px;
    height: 70px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 15px;

    border-radius: 50%;
    background: #f1f5f9;

    font-size: 32px;
}

.details-placeholder h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.details-placeholder p {
    margin: 0;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
}

.person-details-actions {
    margin-top: 20px;
}

.person-details-actions .tree-btn {
    display: block;
    width: 100%;
    text-align: center;
}

/* =========================================================
   TREE SELECTED PERSON
   ========================================================= */

.person-card.selected {
    border: 2px solid #2563eb;
    background: #eff6ff;
    box-shadow: 0 3px 12px rgba(37, 99, 235, .15);
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 950px) {

    .tree-layout {
        grid-template-columns: 1fr;
    }

    .person-details-panel {
        position: static;
        min-height: auto;
    }

    .details-placeholder {
        min-height: 250px;
    }

    .tree-canvas {
        max-height: none;
    }
}

@media (max-width: 650px) {

    .tree-layout {
        gap: 15px;
    }

    .tree-canvas {
        padding: 15px;
    }

    .person-details-header {
        padding: 20px 15px;
    }

    .person-details-content {
        padding: 15px;
    }
}


/* =========================================================
   NAVIGATION DROPDOWN
   ========================================================= */

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle {
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 10px 12px;
}

.dropdown-arrow {
    display: inline-block;
    font-size: 11px;
    margin-left: 4px;
    transition: transform 0.2s ease;
}


/* Dropdown menu */

 .nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;

    min-width: 190px;

    background: #fff;
    border: 1px solid #d9dee7;
    border-radius: 8px;

    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);

    padding: 6px 0;

    z-index: 1000;
}


/* Open state */

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}


/* Rotate arrow */

 .nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
} 


/* Dropdown links */

 .nav-dropdown-menu a {
    display: block;

    padding: 10px 14px;

    color: #333;
    text-decoration: none;

    white-space: nowrap;
}

.nav-dropdown-menu a:hover {
    background: #f1f3f6;
}


/* Button hover */

.nav-dropdown-toggle:hover {
    opacity: 0.8;
} 


/* db navi */ 


