/* База данных такс — оформление. Без фреймворков, один файл.
   Шрифты: Marmelad (заголовки, клички, цифры) + PT Sans (текст, таблицы).
   Палитра: хвойный зелёный + янтарный акцент под «рыжину» таксы. */
:root {
  --bg: #f4f6f0;
  --bg-2: #eaf0e6;
  --panel: #ffffff;
  --ink: #1b2a20;
  --ink-2: #5b6c5f;
  --line: #dde6da;
  --accent: #1f5136;
  --accent-2: #2f7d4f;
  --accent-soft: #e7f0e8;
  --amber: #b5762a;
  --amber-soft: #fbf1e0;
  --ok: #2f6f4f;
  --warn: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 42, 32, .05), 0 10px 28px rgba(27, 42, 32, .07);
  --shadow-lg: 0 2px 6px rgba(27, 42, 32, .07), 0 18px 44px rgba(27, 42, 32, .12);
  --display: "Marmelad", "PT Sans", "Segoe UI", system-ui, sans-serif;
  --text: "PT Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --male: #2f6bb3;
  --female: #b3386b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.6 var(--text);
  color: var(--ink);
  background:
    radial-gradient(1100px 460px at 82% -180px, var(--bg-2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; }
h1 { font-size: 30px; margin: 0 0 10px; letter-spacing: .1px; }
h2 { font-size: 21px; margin: 28px 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.main { padding: 24px 16px 44px; }
.muted { color: var(--ink-2); }
.dim { color: #8b9a8d; font-size: 13px; }

/* ---------- шапка ---------- */
.topbar {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 0 rgba(27, 42, 32, .03);
}
.topbar-in { display: flex; align-items: center; gap: 18px; height: 66px; }
.logo {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--display); font-size: 18px; color: var(--ink);
  white-space: nowrap;
}
.logo:hover { text-decoration: none; color: var(--ink); }
.logo b { color: var(--amber); font-weight: 400; font-size: .72em; letter-spacing: .5px; }
.logo-dog { width: 46px; height: 23px; fill: var(--accent); flex: 0 0 46px; }
.logo-cut { fill: #fff; }
.nav { display: flex; gap: 4px; margin-left: 6px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 8px 12px; border-radius: 9px; color: var(--ink-2);
  font-weight: 700; font-size: 14px;
}
.nav a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.nav a.is-active { background: var(--accent-soft); color: var(--accent); }
.topbar-right { display: flex; gap: 8px; align-items: center; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-block; padding: 10px 17px; border-radius: 10px;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  font: inherit; font-weight: 700; cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s, box-shadow .15s;
}
.btn:hover {
  background: var(--accent-2); border-color: var(--accent-2);
  color: #fff; text-decoration: none; box-shadow: var(--shadow);
}
.btn:active { transform: translateY(1px); }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); box-shadow: none; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn-danger { background: transparent; color: var(--warn); border-color: #e9cdc9; }
.btn-danger:hover { background: #fdf1f0; color: var(--warn); border-color: var(--warn); box-shadow: none; }

/* ---------- уведомления ---------- */
.flashes { margin-top: 12px; }
.flash {
  padding: 11px 15px; border-radius: 11px; margin-bottom: 8px;
  background: var(--accent-soft); color: var(--ok);
  border: 1px solid #cbe0cf; border-left: 3px solid var(--ok);
}
.flash-error {
  background: #fdf1f0; color: var(--warn);
  border-color: #f0cdc9; border-left-color: var(--warn);
}

/* ---------- карточки ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 12px; }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

.dcard {
  display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.dcard:hover {
  border-color: var(--accent-2); text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-lg); transform: translateY(-2px);
}
.dcard-photo {
  width: 60px; height: 60px; border-radius: 10px; overflow: hidden; flex: 0 0 60px;
  background: linear-gradient(150deg, var(--accent-soft), #f6ede0);
  display: flex; align-items: center; justify-content: center;
}
.dcard-photo img { width: 100%; height: 100%; object-fit: cover; }
.dcard-ph { font-family: var(--display); font-size: 24px; color: var(--accent-2); }
/* силуэт-заглушка вместо фото (dog_silhouette()) */
.dog-sil { display: block; width: 100%; height: 100%; fill: var(--accent-2); opacity: .82; }
.dcard-photo .dog-sil { width: 84%; height: auto; }
.dog-photo-main .dog-sil { width: 66%; height: auto; opacity: .5; }
.dcard-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dcard-name { font-family: var(--display); font-size: 15.5px; }
.dcard-meta { font-size: 13px; color: var(--ink-2); }
.dcard-dim { color: #8b9a8d; }

/* ---------- строка собаки ---------- */
.dlist { display: flex; flex-direction: column; gap: 7px; }
.dline {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.dline:hover { border-color: var(--accent-2); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.dline-photo {
  width: 38px; height: 38px; border-radius: 9px; overflow: hidden; flex: 0 0 38px;
  background: linear-gradient(150deg, var(--accent-soft), #f6ede0);
}
.dline-photo img { width: 100%; height: 100%; object-fit: cover; }
.dline-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dline-name { font-family: var(--display); font-size: 15px; }
.dline-sub { font-size: 12.5px; color: var(--ink-2); }
.dline-badges { display: flex; gap: 5px; }
.badge {
  font-size: 11.5px; padding: 2px 8px; border-radius: 20px;
  background: var(--amber-soft); color: var(--amber);
  font-weight: 700; white-space: nowrap;
}
.badge-kids { background: var(--accent-soft); color: var(--ok); }

/* ---------- пол ---------- */
.sex { font-weight: 700; }
.sex-m { color: var(--male); }
.sex-f { color: var(--female); }

/* ---------- поиск/фильтры ---------- */
.searchbar { display: flex; gap: 8px; flex-wrap: wrap; }
.searchbar input[type=search] { flex: 1; min-width: 220px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(47, 125, 79, .16);
}
textarea { width: 100%; min-height: 70px; resize: vertical; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.chip {
  padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); font-size: 13px;
}
.chip:hover { border-color: var(--accent-2); color: var(--accent); text-decoration: none; }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- таблица ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  font-family: var(--display); font-size: 12px; text-transform: uppercase;
  letter-spacing: .6px; color: var(--ink-2); background: var(--bg-2);
}
th:first-child { border-radius: 8px 0 0 8px; }
th:last-child { border-radius: 0 8px 8px 0; }
tbody tr:hover { background: var(--accent-soft); }
.table-wrap { overflow-x: auto; }

/* ---------- карточка собаки ---------- */
.dog-profile {
  display: grid; gap: 22px; align-items: start;
  grid-template-columns: 300px minmax(0, 1fr);
}
.dog-media { display: flex; flex-direction: column; gap: 10px; }
.dog-photo-main {
  aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(150deg, var(--accent-soft), #f6ede0);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center;
}
.dog-photo-main img { width: 100%; height: 100%; object-fit: cover; }
.dog-ph-mark { font-family: var(--display); font-size: 62px; color: var(--accent-2); }
.dog-photo-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.dog-info { min-width: 0; }
.dog-title { font-size: 30px; margin: 0 0 4px; line-height: 1.25; }
.dog-sub { color: var(--ink-2); margin: 0 0 14px; font-size: 15.5px; }
.dog-variety { color: var(--accent); font-weight: 700; }

/* панель фактов: OTЕЦ / МАТЬ / ОКРАС / СТРАНА — как в крупных базах */
.dog-meta-grid {
  display: grid; gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.meta-item { background: var(--panel); padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.meta-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--ink-2); font-weight: 700;
}
.meta-value { font-size: 15px; color: var(--ink); }
a.meta-value:hover { color: var(--accent-2); text-decoration: none; }
.meta-empty { color: #a9b6aa; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 5px 18px; margin: 0; }
dl.facts dt { color: var(--ink-2); font-size: 13.5px; }
dl.facts dd { margin: 0; }

/* ---------- родословная ---------- */
.ped { display: flex; flex-direction: column; gap: 9px; }
.ped-self {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff; border-radius: 11px; padding: 12px 15px;
  display: flex; gap: 10px; align-items: baseline; box-shadow: var(--shadow);
}
.ped-self a { color: #fff; font-family: var(--display); font-size: 18px; }
.ped-sub { font-size: 13px; opacity: .85; }
.ped-gen { display: flex; gap: 10px; align-items: stretch; }
.ped-genlabel {
  flex: 0 0 70px; font-family: var(--display); font-size: 12px;
  color: var(--ink-2); padding-top: 9px; text-align: right;
}
.ped-row { display: grid; gap: 6px; flex: 1; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ped-cell {
  display: block; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; color: var(--ink); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.ped-cell:hover { border-color: var(--accent-2); text-decoration: none; color: var(--ink); background: var(--accent-soft); }
.ped-cell.is-empty { background: transparent; border-style: dashed; color: #b3c0b4; }
.ped-cell.is-repeat { background: var(--amber-soft); border-color: #e5c48d; }
.rep { color: var(--amber); font-weight: 700; }
.depth { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 13.5px; color: var(--ink-2); }
.depth-label { font-family: var(--display); }
.depth-btn {
  min-width: 32px; text-align: center; padding: 5px 9px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 13px;
}
.depth-btn:hover { border-color: var(--accent-2); color: var(--accent); text-decoration: none; }
.depth-btn.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* родословная колонками: поколение = колонка, как в крупных базах */
.ped-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.ped-cols {
  display: grid; gap: 10px; min-width: 640px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-items: start;
}
.ped-col { display: flex; flex-direction: column; gap: 6px; }
.ped-colhead {
  font-family: var(--display); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .6px; color: var(--ink-2);
  border-bottom: 2px solid var(--accent-2); padding-bottom: 5px;
}
.ped-card {
  display: flex; gap: 8px; align-items: center; padding: 7px 8px;
  border: 1px solid var(--line); border-left: 3px solid var(--accent-2);
  border-radius: 10px; background: #fff; color: var(--ink); min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
.ped-card:hover { border-color: var(--accent-2); border-left-color: var(--accent); text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.ped-card.is-self { border-left-color: var(--amber); background: var(--amber-soft); }
.ped-card.is-repeat { border-left-color: var(--amber); background: var(--amber-soft); }
.ped-card.is-empty { border-left-color: var(--line); border-style: dashed; background: transparent; color: #b3c0b4; }
.ped-card-photo {
  width: 34px; height: 34px; border-radius: 8px; overflow: hidden; flex: 0 0 34px;
  background: linear-gradient(150deg, var(--accent-soft), #f6ede0);
  display: flex; align-items: center; justify-content: center;
}
.ped-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.ped-card-ph { font-family: var(--display); font-size: 15px; color: var(--accent-2); }
.ped-card-body { display: flex; flex-direction: column; min-width: 0; }
.ped-card-name { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.ped-card-sub { font-size: 11.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* счётчик в табе */
.tab-n {
  display: inline-block; min-width: 18px; text-align: center;
  padding: 0 5px; border-radius: 20px; background: var(--accent-soft);
  color: var(--accent); font-size: 12px; font-family: var(--text); font-weight: 700;
}
.tabs a.is-on .tab-n { background: rgba(255, 255, 255, .25); color: #fff; }
.tabs-more { margin-left: auto; font-size: 13px; font-family: var(--text); }

/* ---------- достижения ---------- */
.ach-group { margin-bottom: 16px; }
.ach-title {
  font-family: var(--display); text-transform: uppercase; font-size: 12px;
  letter-spacing: .7px; color: var(--accent);
  border-bottom: 1px solid var(--line); padding-bottom: 5px;
}
.ach-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.ach-list li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ach-name { font-weight: 700; }
.ach-date, .ach-issuer, .ach-detail { font-size: 13px; color: var(--ink-2); }
.ach-detail { color: #8b9a8d; }
.inline { display: inline; margin: 0; }
.link-del {
  border: 0; background: transparent; color: var(--warn); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 0 3px;
}

/* ---------- COI ---------- */
.coi { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.coi-val { font-family: var(--display); font-size: 26px; }
.coi-low { color: var(--ok); }
.coi-mid { color: var(--amber); }
.coi-high { color: var(--warn); }
.coi-bar { height: 8px; border-radius: 4px; background: var(--bg-2); flex: 1; min-width: 120px; overflow: hidden; }
.coi-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--amber)); }
.coi-list { font-size: 13px; color: var(--ink-2); }

/* ---------- цифры ---------- */
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow);
}
.stat b { display: block; font-family: var(--display); font-weight: 400; font-size: 28px; color: var(--accent); line-height: 1.2; }
.stat span { font-size: 13px; color: var(--ink-2); }

/* ---------- пагинация ---------- */
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 24px 0 4px; }

/* ---------- формы ---------- */
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-family: var(--display); font-size: 13px; color: var(--ink-2); }
.field-full { grid-column: 1 / -1; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check input { width: auto; }
.findbox { position: relative; }
.findbox input { width: 100%; }
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
  background: #fff; border: 1px solid var(--line); border-radius: 0 0 10px 10px;
  box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto; display: none;
}
.suggest.is-open { display: block; }
.suggest button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 8px 11px; cursor: pointer; font: inherit; border-bottom: 1px solid var(--bg-2);
}
.suggest button:hover { background: var(--accent-soft); }
.picked { font-size: 13px; color: var(--ok); min-height: 18px; }

/* ---------- подвал ---------- */
.footer { border-top: 1px solid var(--line); background: var(--panel); margin-top: 34px; }
.footer-in { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); padding: 24px 16px 12px; }
.footer-col { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; color: var(--ink-2); }
.footer-col b { font-family: var(--display); font-weight: 400; font-size: 16px; color: var(--ink); }
.footer-col a { color: var(--ink-2); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { padding: 8px 16px 20px; font-size: 12.5px; color: #8b9a8d; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 9px 9px 0 0; color: var(--ink-2); font-family: var(--display); }
.tabs a.is-on { background: var(--accent); color: #fff; }
.tabs a:hover { text-decoration: none; background: var(--accent-soft); color: var(--accent); }
.tabs a.is-on:hover { background: var(--accent-2); color: #fff; }

.hero {
  display: flex; align-items: center; gap: 26px;
  padding: 34px 30px; margin-bottom: 6px; border-radius: 18px;
  background:
    radial-gradient(520px 220px at 88% 0%, rgba(181, 118, 42, .14), transparent 65%),
    linear-gradient(135deg, #eef4ea, #e2eee3);
  border: 1px solid var(--line);
}
.hero-text { flex: 1; min-width: 0; }
.hero h1 { font-size: 36px; }
.hero p { color: var(--ink-2); max-width: 720px; font-size: 16px; }
.hero-dog {
  flex: 0 0 220px; width: 220px; height: 110px; fill: var(--accent);
  opacity: .16; transform: scaleX(-1);
}
.hero-cut { fill: #eef4ea; }

/* заголовок секции со ссылкой «ещё» */
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 28px 0 12px;
}
.sec-head h2 { margin: 0; }
.more { font-size: 13.5px; font-weight: 700; white-space: nowrap; }

/* две колонки рядом */
.two-col {
  display: grid; gap: 14px; margin-top: 22px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* горизонтальная прокрутка широкой родословной на узких экранах */
.ped-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ped-scroll .ped { min-width: 560px; }

@media (max-width: 900px) {
  .hero-dog { display: none; }
  .hero { padding: 26px 22px; }
  .dog-profile { grid-template-columns: 1fr; }
  .dog-media { flex-direction: row; align-items: flex-start; gap: 12px; }
  .dog-photo-main { flex: 0 0 46%; }
  .dog-photo-actions { flex-direction: column; align-items: stretch; }
}

@media (max-width: 640px) {
  .topbar-in { height: auto; padding: 11px 0; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; margin-left: 0; }
  .dog-media { flex-direction: column; }
  .dog-photo-main { width: 100%; flex: none; }
  .ped-genlabel { flex-basis: 54px; }
  .hero { padding: 22px 16px; }
  .hero h1 { font-size: 28px; }
  h1 { font-size: 26px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .stat { padding: 12px 13px; }
  .stat b { font-size: 23px; }
  .searchbar { flex-direction: column; }
  .searchbar .btn { width: 100%; }
  .dline-badges { flex-direction: column; gap: 3px; align-items: flex-end; }
  .dog-title { font-size: 25px; }
  .dog-meta-grid { grid-template-columns: 1fr 1fr; }
  .tabs-more { margin-left: 0; width: 100%; }
  dl.facts { grid-template-columns: 1fr; gap: 2px 0; }
  dl.facts dt { margin-top: 6px; }
}

/* ---------- демо-баннер ---------- */
.demo-banner {
  background: linear-gradient(90deg, var(--amber-soft), #fdf6ea);
  border-bottom: 1px solid #ecd9b6;
  color: #6d4a17;
  font-size: 13.5px;
}
.demo-banner-in {
  display: flex; align-items: center; gap: 9px;
  padding-top: 8px; padding-bottom: 8px;
}
.demo-banner b { color: #8a5a1a; }
.demo-dot {
  flex: none; width: 9px; height: 9px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(181, 118, 42, .22);
}