:root {
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-2: #edf1ec;
  --ink: #121815;
  --muted: #6f7b73;
  --line: #dfe5df;
  --brand: #1f2b24;
  --accent: #d7ff4f;
  --accent-ink: #172006;
  --danger: #c83f3f;
  --success: #23875b;
  --shadow: 0 18px 50px rgba(25, 39, 30, .08);
  --radius: 22px;
  --radius-sm: 14px;
  --max: 1220px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.app-shell { min-height: 100vh; padding-bottom: 86px; }
.container { width: min(calc(100% - 32px), var(--max)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(18px);
  background: rgba(245, 247, 244, .88);
  border-bottom: 1px solid rgba(223, 229, 223, .75);
}
.topbar-inner {
  min-height: 72px;
  display: grid;
  grid-template-columns: auto minmax(260px, 520px) auto;
  align-items: center;
  gap: 24px;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 900; letter-spacing: -.03em; }
.brand-mark {
  width: 39px;
  height: 39px;
  border-radius: 12px;
  background: var(--brand);
  display: grid;
  place-items: center;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-name small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; line-height: 1; margin-top: 2px; }

.global-search { position: relative; }
.global-search input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--surface);
  padding: 12px 48px 12px 18px;
  outline: none;
  box-shadow: 0 6px 20px rgba(24, 37, 29, .05);
}
.global-search input:focus { border-color: #b7c1b8; box-shadow: 0 0 0 4px rgba(31,43,36,.07); }
.global-search button {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: grid;
  place-items: center;
}

.top-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.icon-btn, .avatar-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
}
.icon-btn { width: 42px; }
.avatar-btn { width: 42px; padding: 3px; overflow: hidden; }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }

.main { padding: 28px 0 50px; }

.hero {
  position: relative;
  min-height: 380px;
  border-radius: 30px;
  overflow: hidden;
  color: white;
  background: #17211b;
  box-shadow: var(--shadow);
}
.hero-media { position: absolute; inset: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; opacity: .54; }
.hero-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(13,19,15,.94) 0%, rgba(13,19,15,.73) 46%, rgba(13,19,15,.12) 100%); }
.hero-content { position: relative; z-index: 1; max-width: 710px; padding: 52px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(215,255,79,.16);
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.hero h1 { font-size: clamp(38px, 6vw, 68px); line-height: .98; letter-spacing: -.055em; margin: 20px 0 18px; max-width: 670px; }
.hero p { font-size: 18px; color: rgba(255,255,255,.78); max-width: 600px; margin: 0 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  border: 0;
  border-radius: 14px;
  min-height: 46px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 25px rgba(215,255,79,.18); }
.btn-dark { background: var(--brand); color: white; }
.btn-light { background: rgba(255,255,255,.1); color: white; border: 1px solid rgba(255,255,255,.24); }
.btn-soft { background: var(--surface-2); color: var(--ink); }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-danger { background: #fff0f0; color: var(--danger); }
.btn-sm { min-height: 38px; padding: 0 13px; border-radius: 11px; font-size: 14px; }

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  border-radius: 20px;
  overflow: hidden;
  background: var(--line);
  margin-top: 18px;
  box-shadow: var(--shadow);
}
.stat { background: var(--surface); padding: 24px; }
.stat strong { display: block; font-size: 28px; letter-spacing: -.04em; }
.stat span { color: var(--muted); font-size: 14px; }

.section { margin-top: 36px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: clamp(24px, 4vw, 34px); letter-spacing: -.04em; }
.section-head p { margin: 4px 0 0; color: var(--muted); }
.section-link { color: var(--muted); font-weight: 750; font-size: 14px; }

.dog-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.dog-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
}
.dog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.dog-card-media { aspect-ratio: 1.22; position: relative; overflow: hidden; background: #dfe5df; }
.dog-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.dog-card:hover img { transform: scale(1.035); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
}
.badge-floating { position: absolute; top: 12px; left: 12px; background: rgba(17,24,20,.78); color: white; backdrop-filter: blur(10px); }
.badge-verified { background: #e7f8ef; color: #23734f; }
.badge-male { background: #eaf2ff; color: #3b65a4; }
.badge-female { background: #ffedf4; color: #a64b71; }
.badge-demo { background: #fff7dc; color: #7e641d; }
.dog-card-body { padding: 16px; }
.dog-card h3 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.025em; }
.meta { color: var(--muted); font-size: 13px; }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line); }
.owner { display: flex; align-items: center; gap: 8px; min-width: 0; }
.owner img { width: 27px; height: 27px; border-radius: 50%; object-fit: cover; }
.owner span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; font-weight: 750; }

.feed-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.feed-list { display: grid; gap: 18px; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.post-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 18px; }
.post-author { display: flex; align-items: center; gap: 11px; }
.post-author img { width: 43px; height: 43px; border-radius: 14px; object-fit: cover; }
.post-author strong { display: block; }
.post-author span { color: var(--muted); font-size: 12px; }
.post-copy { padding: 0 18px 16px; }
.post-copy p { margin: 0; }
.post-copy a { font-weight: 800; color: #315f43; }
.post-media { aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); }
.post-media img { width: 100%; height: 100%; object-fit: cover; }
.post-actions { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.post-actions button { border: 0; background: transparent; min-height: 50px; font-weight: 750; color: var(--muted); }
.post-actions button:hover { background: var(--surface-2); color: var(--ink); }

.sidebar { display: grid; gap: 18px; position: sticky; top: 94px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel h3 { margin: 0 0 14px; font-size: 18px; letter-spacing: -.02em; }
.quick-list { display: grid; gap: 12px; }
.quick-item { display: flex; align-items: center; gap: 11px; }
.quick-item img { width: 48px; height: 48px; border-radius: 14px; object-fit: cover; }
.quick-item strong { display: block; font-size: 14px; }
.quick-item span { color: var(--muted); font-size: 12px; }

.page-title { margin-bottom: 24px; }
.page-title h1 { margin: 0; font-size: clamp(32px, 5vw, 52px); letter-spacing: -.05em; }
.page-title p { color: var(--muted); margin: 7px 0 0; max-width: 700px; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; margin-bottom: 20px; }
.filter-bar input, .filter-bar select { border: 1px solid var(--line); background: var(--bg); min-height: 42px; border-radius: 12px; padding: 0 12px; outline: none; }
.filter-bar input { flex: 1; min-width: 210px; }

.profile-hero { background: var(--surface); border: 1px solid var(--line); border-radius: 28px; overflow: hidden; box-shadow: var(--shadow); }
.profile-cover { height: 250px; position: relative; background: var(--surface-2); }
.profile-cover > img { width: 100%; height: 100%; object-fit: cover; }
.profile-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(10,15,12,.5)); }
.profile-main { position: relative; padding: 0 30px 26px; }
.profile-avatar { width: 128px; height: 128px; border-radius: 30px; overflow: hidden; border: 6px solid var(--surface); margin-top: -64px; position: relative; z-index: 2; background: var(--surface-2); }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-top: 14px; }
.profile-info h1 { margin: 0; font-size: 34px; letter-spacing: -.04em; }
.profile-info p { margin: 4px 0 0; color: var(--muted); }
.profile-numbers { display: flex; gap: 26px; margin-top: 18px; }
.profile-numbers strong { display: block; font-size: 20px; }
.profile-numbers span { color: var(--muted); font-size: 12px; }

.dog-hero { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); background: var(--surface); border: 1px solid var(--line); border-radius: 28px; overflow: hidden; box-shadow: var(--shadow); }
.dog-hero-media { min-height: 540px; background: var(--surface-2); }
.dog-hero-media img { width: 100%; height: 100%; object-fit: cover; }
.dog-hero-info { padding: 40px; display: flex; flex-direction: column; }
.dog-hero-info h1 { margin: 10px 0 7px; font-size: clamp(40px, 5vw, 62px); line-height: 1; letter-spacing: -.055em; }
.dog-subtitle { color: var(--muted); font-size: 16px; }
.dog-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.data-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.data-cell { background: var(--surface); padding: 15px; }
.data-cell span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 800; }
.data-cell strong { display: block; margin-top: 3px; font-size: 14px; }
.dog-owner-box { margin-top: auto; padding-top: 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.tabs { display: flex; gap: 8px; overflow-x: auto; margin: 22px 0; padding-bottom: 2px; }
.tab { white-space: nowrap; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; min-height: 42px; padding: 0 15px; font-weight: 800; color: var(--muted); }
.tab.active { background: var(--brand); color: white; border-color: var(--brand); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.info-list { display: grid; }
.info-row { display: grid; grid-template-columns: 180px 1fr; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); }
.info-row strong { text-align: right; }

.pedigree-wrap { overflow-x: auto; padding-bottom: 10px; }
.pedigree-tree { min-width: 900px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 22px; align-items: stretch; }
.pedigree-node { border: 1px solid var(--line); background: var(--surface); border-radius: 15px; padding: 13px; min-height: 94px; display: flex; flex-direction: column; justify-content: center; position: relative; }
.pedigree-node::before { content: ""; position: absolute; left: -23px; top: 50%; width: 22px; height: 1px; background: #bdc6be; }
.pedigree-node.root::before { display: none; }
.pedigree-node strong { font-size: 14px; }
.pedigree-node span { color: var(--muted); font-size: 12px; }
.pedigree-node.missing { border-style: dashed; color: var(--muted); background: #fafbfa; }
.gen-label { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 8px; }

.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.gallery-item { border-radius: 16px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); }
.gallery-item:first-child { grid-column: span 2; grid-row: span 2; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }

.form-shell { max-width: 860px; margin: 0 auto; }
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 28px; box-shadow: var(--shadow); }
.form-section + .form-section { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
.form-section h2 { margin: 0 0 5px; font-size: 22px; letter-spacing: -.03em; }
.form-section > p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 800; font-size: 13px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fbfcfb;
  padding: 12px 13px;
  outline: none;
}
.field input, .field select { min-height: 47px; }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #9ca99f; box-shadow: 0 0 0 4px rgba(31,43,36,.06); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 20px; }
.empty strong { display: block; color: var(--ink); font-size: 20px; margin-bottom: 6px; }

.toast { position: fixed; right: 20px; bottom: 98px; z-index: 60; background: var(--brand); color: white; padding: 14px 17px; border-radius: 14px; box-shadow: 0 20px 45px rgba(14,22,17,.25); animation: toastIn .25s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

.mobile-nav {
  display: none;
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 12px;
  z-index: 40;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(17,24,20,.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 20px;
  padding: 7px;
  box-shadow: 0 15px 50px rgba(16,24,19,.25);
}
.mobile-nav a { min-height: 52px; color: rgba(255,255,255,.58); border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10px; font-weight: 750; }
.mobile-nav a.active { color: var(--accent); background: rgba(255,255,255,.06); }
.mobile-nav svg { width: 20px; height: 20px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(10,15,12,.68); display: grid; place-items: center; padding: 20px; }
.modal { width: min(100%, 460px); background: var(--surface); border-radius: 22px; padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.modal h2 { margin: 0 0 8px; }
.modal p { color: var(--muted); margin: 0 0 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

@media (max-width: 1050px) {
  .dog-grid { grid-template-columns: repeat(3, 1fr); }
  .feed-layout, .content-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; grid-template-columns: repeat(2, 1fr); }
  .dog-hero { grid-template-columns: 1fr; }
  .dog-hero-media { min-height: 430px; }
}

@media (max-width: 780px) {
  .app-shell { padding-bottom: 98px; }
  .topbar-inner { grid-template-columns: 1fr auto; min-height: 64px; }
  .global-search { grid-column: 1 / -1; grid-row: 2; padding-bottom: 10px; }
  .top-actions .icon-btn, .top-actions .btn { display: none; }
  .main { padding-top: 18px; }
  .hero { min-height: 520px; }
  .hero-content { padding: 32px 24px; }
  .hero-media::after { background: linear-gradient(0deg, rgba(13,19,15,.96) 0%, rgba(13,19,15,.62) 68%, rgba(13,19,15,.18) 100%); }
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .dog-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { grid-template-columns: 1fr; }
  .mobile-nav { display: grid; }
  .profile-cover { height: 190px; }
  .profile-main { padding: 0 18px 22px; }
  .profile-info { flex-direction: column; }
  .dog-hero-info { padding: 24px; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
}

@media (max-width: 520px) {
  .container { width: min(calc(100% - 22px), var(--max)); }
  .brand-name { font-size: 14px; }
  .hero { border-radius: 23px; }
  .hero h1 { font-size: 42px; }
  .hero p { font-size: 16px; }
  .hero-actions .btn { width: 100%; }
  .stat { padding: 17px; }
  .stat strong { font-size: 23px; }
  .dog-grid { grid-template-columns: 1fr; }
  .dog-card-media { aspect-ratio: 1.45; }
  .section-head { align-items: flex-start; }
  .profile-numbers { width: 100%; justify-content: space-between; gap: 10px; }
  .data-grid { grid-template-columns: 1fr; }
  .dog-owner-box { align-items: flex-start; flex-direction: column; }
  .info-row { grid-template-columns: 1fr; gap: 3px; }
  .info-row strong { text-align: left; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .form-card { padding: 20px; border-radius: 20px; }
}
