* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f9;
    color: #1f2937;
}

a {
    text-decoration: none;
}

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
}

.login-card,
.card {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 24px;
}

.login-card h1,
.card h2,
.topbar h1 {
    margin-top: 0;
}

.subtitle {
    color: #6b7280;
    margin-top: -4px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
}

.form-group input:focus {
    border-color: #1f4b99;
}

.btn {
    display: inline-block;
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    background: #1f4b99;
    color: #ffffff;
}

.btn-danger {
    background: #b42318;
    color: #ffffff;
}

.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.topbar {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 20px 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .login-card,
    .card,
    .topbar {
        padding: 18px;
    }
}
.form-group select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
    background: #ffffff;
}

.form-group select:focus {
    border-color: #1f4b99;
}

.topbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-secondary {
    background: #475467;
    color: #ffffff;
}
.alert-success {
    background: #dcfce7;
    color: #166534;
}

.search-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: end;
}

.search-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.result-badge,
.mini-badge {
    display: inline-block;
    background: #eef2ff;
    color: #1e3a8a;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 700;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 950px;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    background: #f8fafc;
    font-size: 14px;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 13px;
}

.form-card {
    max-width: 100%;
}

.form-grid {
    display: grid;
    gap: 16px;
}

.form-grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
    resize: vertical;
    min-height: 110px;
    font-family: Arial, Helvetica, sans-serif;
}

textarea:focus {
    border-color: #1f4b99;
}

.check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin: 8px 0 20px;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.detail-full {
    grid-column: 1 / -1;
}

.note-box {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px;
    min-height: 80px;
}

.person-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.person-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.person-card-top h3 {
    margin: 0;
    font-size: 18px;
}

.person-meta p {
    margin: 6px 0;
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .search-row,
    .form-grid.two-col,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
    }

    .list-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
.marriage-list {
    display: grid;
    gap: 12px;
}

.marriage-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 14px;
}

.marriage-item p {
    margin: 6px 0;
}
.relation-list {
    display: grid;
    gap: 10px;
}

.relation-item {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 14px;
}

.relation-item p {
    margin: 4px 0;
}
.action-stack {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.inline-form {
    display: inline-block;
}

.btn-warning {
    background: #b54708;
    color: #ffffff;
}
.ancestor-levels-wrap {
    display: grid;
    gap: 18px;
    justify-items: center;
}

.ancestor-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    align-items: center;
}

.ancestor-row.focus-row {
    padding-top: 8px;
    border-top: 2px solid #cbd5e1;
}
.btn-danger {
    background: #b42318;
    color: #fff;
    border: 1px solid #b42318;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
}

.btn-danger:hover {
    opacity: 0.9;
}
.marriage-item.passive{
    background: #ececec !important;
    border-left: 6px solid #666 !important;
    opacity: 0.55;
    filter: grayscale(100%);
}
.tree-card.passive {
    background: #ececec !important;
    border-color: #9ca3af !important;
    color: #6b7280 !important;
    opacity: 0.70;
}

.spouse-wrap.old-spouse .tree-card {
    background: #f5f5f5 !important;
    border-style: dashed !important;
    border-color: #a1a1aa !important;
    opacity: 0.75;
}

.spouse-wrap.old-spouse + .tree-plus,
.tree-couple-wrap .tree-plus {
    color: #98a2b3;
}
.spouse-wrap.old-spouse .tree-card {
    background: #f3f4f6 !important;
    border: 2px dashed #9ca3af !important;
    opacity: 0.75;
}
.tree-spouse-group{
    display:flex;
    align-items:flex-start;
    justify-content:center;
    gap:14px;
    flex-wrap:wrap;
}

.tree-spouse-main{
    display:flex;
    align-items:center;
}

.tree-spouse-item{
    display:flex;
    align-items:center;
    gap:8px;
}

.tree-spouse-item.old-spouse .tree-card{
    background:#f3f4f6 !important;
    border:2px dashed #9ca3af !important;
    color:#6b7280 !important;
    opacity:0.78;
}
.tree-person-block{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:10px;
}

.tree-person-main{
    display:flex;
    justify-content:center;
}

.tree-spouse-row{
    display:flex;
    justify-content:center;
    gap:10px;
    flex-wrap:wrap;
}
.tree-person-block{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:12px;
}

.tree-person-main{
    display:flex;
    justify-content:center;
}

.tree-spouse-row{
    display:flex;
    justify-content:center;
    align-items:flex-start;
    gap:12px;
    flex-wrap:wrap;
    margin-top:2px;
}

.tree-spouse-card{
    display:flex;
    justify-content:center;
}

.tree-couple-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tree-couple-wrap.multi-spouse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 100%;
}
.spouse-wrap.old-spouse .tree-card {
    background: #f3f4f6 !important;
    border: 2px dashed #9ca3af !important;
    color: #6b7280 !important;
    opacity: 0.78;
}
.tree-person-anchor{
    display:inline-block;
    position:relative;
}

.tree-couple-wrap.multi-spouse{
    display:inline-flex;
    align-items:flex-start;
    justify-content:center;
    gap:8px;
    flex-wrap:wrap;
}

.tree-main-person{
    position:relative;
    display:flex;
    justify-content:center;
}

.tree-main-person::after{
    content:'';
    position:absolute;
    left:50%;
    transform:translateX(-50%);
    bottom:-20px;
    width:2px;
    height:20px;
    background:#cbd5e1;
}


.tree-person-shell{
    position: relative;
    display: inline-block;
    width: 170px; /* ana kişi kartı genişliği */
}

.tree-person-center{
    position: relative;
    width: 170px;
    z-index: 2;
}

.tree-spouses-right{
    position: absolute;
    top: 0;
    left: calc(100% + 12px);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    white-space: nowrap;
}

.tree-spouse-inline{
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.tree-plus{
    font-size: 20px;
    font-weight: 700;
    color: #98a2b3;
    line-height: 1;
    margin-top: 6px;
    flex: 0 0 auto;
}

.spouse-wrap{
    display: flex;
}

.spouse-wrap.old-spouse .tree-card{
    background: #f3f4f6 !important;
    border: 2px dashed #9ca3af !important;
    color: #6b7280 !important;
    opacity: 0.78;
}