/* Семейное древо — стили форм и древа */

.ftb-menu { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.ftb-menu a { padding: 6px 14px; border-radius: 999px; background: #eef1f4; color: #1f2933; text-decoration: none; font-size: 15px; }
.ftb-menu a:hover { background: #dfe5ea; }

.ftb-notice { padding: 12px 16px; border-radius: 8px; margin: 0 0 16px; border: 1px solid transparent; }
.ftb-notice ul { margin: 0; padding-left: 18px; }
.ftb-ok { background: #e8f6ec; border-color: #b7e2c2; color: #14532d; }
.ftb-err { background: #fdecec; border-color: #f3b9b9; color: #7a1c1c; }
.ftb-info { background: #eaf2fc; border-color: #bcd4f3; color: #1e3a5f; }

.ftb-form { max-width: 760px; }
.ftb-form label { display: block; font-weight: 500; }
.ftb-form input[type=text], .ftb-form input[type=email], .ftb-form input[type=password],
.ftb-form input[type=search], .ftb-form input[type=file], .ftb-form select, .ftb-form textarea {
	width: 100%; box-sizing: border-box; margin-top: 4px; padding: 9px 11px; font-size: 16px;
	border: 1px solid #c3cbd3; border-radius: 6px; background: #fff; color: #1f2933;
}
.ftb-form textarea { resize: vertical; }
.ftb-inline { display: inline-block !important; margin-right: 18px; font-weight: 400 !important; }
.ftb-inline input { width: auto !important; margin-right: 6px; }
.ftb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.ftb-req { color: #c0392b; margin-left: 2px; }
.ftb-hint { color: #5b6773; font-size: 14px; }
.ftb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.ftb-photo { display: block; margin: 6px 0; }
.ftb-photo img { max-width: 120px; height: auto; border-radius: 8px; }

.ftb-btn, .ftb-form input[type=submit], .ftb-form .button, #loginform .button-primary {
	display: inline-block; padding: 10px 20px; border: 0; border-radius: 8px; cursor: pointer;
	background: #2563eb; color: #fff; font-size: 16px; text-decoration: none; line-height: 1.2;
}
.ftb-btn:hover { background: #1d4ed8; color: #fff; }
.ftb-btn-light { background: #e5e9ee; color: #1f2933; margin-left: 8px; }
.ftb-btn-light:hover { background: #d5dbe2; color: #1f2933; }
.ftb-link-btn { background: none; border: 0; padding: 0; color: #b32d2e; cursor: pointer; font-size: inherit; text-decoration: underline; }
.ftb-inline-form { display: inline; margin-left: 12px; }

.ftb-table { width: 100%; border-collapse: collapse; }
.ftb-table th, .ftb-table td { padding: 10px 8px; border-bottom: 1px solid #e3e8ed; text-align: left; vertical-align: top; }
.ftb-st { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; }
.ftb-st-ok { background: #e8f6ec; color: #14532d; }
.ftb-st-wait { background: #fff4d6; color: #7a5b00; }
.ftb-st-bad { background: #fdecec; color: #7a1c1c; }

/* ---------- Древо ---------- */

.ftb-tree { position: relative; margin: 0 0 24px; }
.ftb-tree.ftb-full { position: relative; width: 96vw; max-width: 96vw; left: 50%; transform: translateX(-50%); margin-left: 0 !important; margin-right: 0 !important; box-sizing: border-box; }

.ftb-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.ftb-search { position: relative; flex: 1 1 220px; max-width: 360px; }
.ftb-search input { width: 100%; box-sizing: border-box; padding: 8px 12px; font-size: 15px; border: 1px solid #c3cbd3; border-radius: 8px; }
.ftb-results { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: #fff; border: 1px solid #c3cbd3; border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); }
.ftb-results[hidden] { display: none; }
.ftb-results button { display: block; width: 100%; text-align: left; padding: 8px 10px; background: none; border: 0; cursor: pointer; font-size: 15px; border-radius: 6px; }
.ftb-results button:hover { background: #eef1f4; }
.ftb-zoom { display: flex; gap: 6px; }
.ftb-btn-sm { padding: 7px 14px; border: 1px solid #c3cbd3; background: #fff; border-radius: 8px; cursor: pointer; font-size: 15px; color: #1f2933; }
.ftb-btn-sm:hover { background: #eef1f4; }

.ftb-canvas { height: var(--ftb-h, 640px); background: var(--ftb-bg, #fbfbfa); border: 1px solid #dfe4e9; border-radius: 12px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.ftb-svg { display: block; cursor: grab; }
.ftb-svg:active { cursor: grabbing; }
.ftb-empty { padding: 40px 20px; text-align: center; color: #5b6773; }

.ftb-card { box-sizing: border-box; width: 100%; height: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; border: 1px solid rgba(0, 0, 0, .12); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); cursor: pointer; overflow: hidden; font-family: inherit; line-height: 1.25; }
.ftb-card:hover, .ftb-card:focus { box-shadow: 0 3px 10px rgba(0, 0, 0, .22); outline: none; }
.ftb-card.ftb-hl { outline: 3px solid #f59e0b; }
.ftb-ph { width: 48px; height: 48px; object-fit: cover; border-radius: 50%; flex: 0 0 auto; background: #fff; }
.ftb-txt { min-width: 0; flex: 1 1 auto; }
.ftb-n1, .ftb-n2, .ftb-d { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ftb-n1 { font-weight: 700; font-size: 14px; }
.ftb-n2 { font-size: 13px; }
.ftb-d { font-size: 12px; opacity: .75; margin-top: 2px; }

.ftb-panel { position: absolute; z-index: 30; right: 12px; bottom: 12px; top: 64px; width: min(360px, calc(100% - 24px)); overflow: auto; box-sizing: border-box; padding: 18px; background: #fff; border: 1px solid #dfe4e9; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); color: #1f2933; }
.ftb-panel[hidden] { display: none; }
.ftb-panel h3 { margin: 0 28px 10px 0; font-size: 20px; line-height: 1.25; }
.ftb-panel .ftb-row { margin: 6px 0; }
.ftb-panel .ftb-bio { margin: 12px 0 0; white-space: pre-wrap; }
.ftb-big { display: block; max-width: 100%; max-height: 220px; margin: 0 auto 12px; border-radius: 10px; }
.ftb-close { position: absolute; top: 8px; right: 10px; width: 32px; height: 32px; font-size: 24px; line-height: 1; border: 0; background: none; cursor: pointer; color: #5b6773; }
.ftb-link { background: none; border: 0; padding: 0; color: #2563eb; cursor: pointer; font-size: inherit; text-align: left; text-decoration: underline; }

@media (max-width: 640px) {
	.ftb-panel { top: auto; height: 55%; left: 8px; right: 8px; bottom: 8px; width: auto; }
}

.ftb-open { margin-top: 14px; }

/* ---------- Страница человека ---------- */

.ftb-person { display: flex; flex-wrap: wrap; gap: 28px; align-items: flex-start; }
.ftb-person-photo { flex: 0 0 auto; }
.ftb-person-photo img { display: block; max-width: 260px; width: 100%; height: auto; border-radius: 14px; }
.ftb-person-main { flex: 1 1 320px; min-width: 0; }
.ftb-facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 20px; }
.ftb-facts dt { font-weight: 600; color: #5b6773; }
.ftb-facts dd { margin: 0; }
.ftb-person h3 { margin: 18px 0 8px; }
.ftb-person-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.ftb-person-actions .ftb-btn-light { margin-left: 0; }

/* ---------- Родословная: плитки ---------- */

.ftb-people-search { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; max-width: 520px; }
.ftb-people-search input[type=search] { flex: 1 1 200px; padding: 10px 12px; font-size: 16px; border: 1px solid #c3cbd3; border-radius: 8px; }
.ftb-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.ftb-tile { display: flex; gap: 14px; padding: 14px; border-radius: 14px; border: 1px solid #dfe4e9; background: #fff; color: #1f2933; text-decoration: none; transition: box-shadow .15s, transform .15s; }
a.ftb-tile:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .12); transform: translateY(-2px); color: #1f2933; }
.ftb-tile-m { border-top: 4px solid #8db6f2; }
.ftb-tile-f { border-top: 4px solid #f2a1c0; }
.ftb-tile-o { border-top: 4px solid #cfd6dc; }
.ftb-tile-ph { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: #eef1f4; display: flex; align-items: center; justify-content: center; }
.ftb-tile-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ftb-tile-letter { font-size: 26px; font-weight: 700; color: #6b7783; }
.ftb-tile-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ftb-tile-name { font-size: 17px; line-height: 1.25; }
.ftb-tile-years, .ftb-tile-place { font-size: 14px; color: #5b6773; }
.ftb-tile-bio { font-size: 14px; margin-top: 4px; line-height: 1.4; }
.ftb-pager { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 24px 0 0; }
.ftb-pager a, .ftb-pager span { padding: 6px 12px; border-radius: 8px; background: #eef1f4; text-decoration: none; color: #1f2933; }
.ftb-pager .ftb-pg-cur { background: #2563eb; color: #fff; }

/* ---------- Неизвестные родители в древе ---------- */
.ftb-card.ftb-virt { background: #f4f5f6; border: 1px dashed #aab2ba; box-shadow: none; cursor: default; opacity: .8; justify-content: center; }
.ftb-card.ftb-virt .ftb-n1 { font-weight: 400; font-style: italic; color: #6b7783; }

/* ---------- Поля формы: списки родственников ---------- */
.ftb-multi { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.ftb-multi-row { width: 100%; }
.ftb-multi select { width: 100%; box-sizing: border-box; padding: 9px 11px; font-size: 16px; border: 1px solid #c3cbd3; border-radius: 6px; background: #fff; }
.ftb-form h4 { margin: 22px 0 6px; }
