/* Родовое древо — «семейный альбом»: бумага, чернила, тайга, штемпель. */
:root {
  --paper: #f3ead8;
  --paper-deep: #e8dabd;
  --card: #fbf6eb;
  --ink: #2a2118;
  --ink-2: #4b3c2e;
  --muted: #7a6853;
  --line: rgba(42, 33, 24, .16);
  --line-strong: rgba(42, 33, 24, .32);
  --green: #2c4a39;
  --green-2: #3e6852;
  --rust: #9b3a22;
  --gold: #a9823f;
  --f-display: "Old Standard TT", "Times New Roman", serif;
  --f-body: "Golos Text", "Segoe UI", system-ui, sans-serif;
  --f-hand: "Caveat", "Segoe Print", cursive;
  --radius: 12px;
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 10px 30px -18px rgba(42,33,24,.45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 1.1875rem/1.62 var(--f-body);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(120,84,40,.14), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35  0 0 0 0 .25  0 0 0 0 .12  0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--green); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--rust); }
img { max-width: 100%; display: block; }
code { font-size: .9em; background: rgba(42,33,24,.07); padding: .05em .35em; border-radius: 6px; }
:focus-visible { outline: 3px solid var(--green-2); outline-offset: 3px; border-radius: 6px; }

/* ---------- typography */
.h-page { font: 700 clamp(2.1rem, 4.6vw, 3.2rem)/1.08 var(--f-display); margin: .1em 0 .35em; letter-spacing: -.01em; }
.h-section { font: 700 clamp(1.8rem, 3.6vw, 2.6rem)/1.1 var(--f-display); margin: 0 0 .3em; }
.h-sub { font: 700 1.45rem/1.2 var(--f-display); margin: 1.2em 0 .4em; }
.h-mini { font: 700 1.15rem/1.2 var(--f-display); margin: 1em 0 .2em; }
.lead { font-size: 1.3rem; color: var(--ink-2); max-width: 46ch; }
.section-lead { color: var(--muted); margin: 0 0 1.4em; }
.muted { color: var(--muted); }
.pre { white-space: pre-line; }
.hand { font-family: var(--f-hand); font-weight: 700; font-size: 1.45em; line-height: 1.05; color: var(--green-2); }
.hand--kicker { font-size: 2rem; color: var(--rust); margin: 0; transform: rotate(-2deg); display: inline-block; }
.hand--note { color: var(--rust); transform: rotate(-1.5deg); display: inline-block; margin-top: .4em; }

/* ---------- layout */
.wrap { width: min(1120px, 100% - 32px); margin: 2.2rem auto 4rem; }
.wrap--form { width: min(860px, 100% - 32px); }
.narrow { width: min(720px, 100% - 32px); margin: 3.5rem auto 4rem; }
.center { text-align: center; }
.center .lead { margin-inline: auto; }
.prose h2 { font: 700 1.5rem/1.2 var(--f-display); margin: 1.6em 0 .4em; }
.crumbs { color: var(--muted); font-size: 1rem; margin: 0 0 .4rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 22px; }

/* ---------- masthead */
.masthead { position: sticky; top: 0; z-index: 20; background: rgba(243,234,216,.92); backdrop-filter: blur(6px); border-bottom: 4px double var(--line-strong); }
.masthead__inner { width: min(1180px, 100% - 32px); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand__mark { width: 34px; height: 34px; color: var(--green); }
.brand__text { font: 700 1.45rem/1 var(--f-display); letter-spacing: .02em; }
.topnav { display: flex; align-items: center; gap: 6px 18px; flex-wrap: wrap; justify-content: flex-end; font-size: 1.02rem; }
.topnav a { color: var(--ink-2); text-decoration: none; padding: 6px 2px; border-bottom: 2px solid transparent; }
.topnav a:hover { color: var(--ink); border-color: var(--rust); }
.topnav__cta { color: var(--paper) !important; background: var(--green); padding: 8px 16px !important; border-radius: 999px; border: 0 !important; }
.topnav__cta:hover { background: var(--rust); }
.topnav__admin { color: var(--rust) !important; }
.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: 0; padding: 6px 2px; font: inherit; color: var(--ink-2); cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }
.linkbtn:hover { color: var(--rust); }
.linkbtn--danger { color: var(--rust); }

.flash { width: min(860px, 100% - 32px); margin: 18px auto 0; padding: 14px 18px; border-radius: var(--radius); background: #e4ecdf; border: 1px solid #b9cdb4; color: var(--green); }

/* ---------- hero */
.hero { width: min(1180px, 100% - 32px); margin: 0 auto; display: grid; grid-template-columns: 1.02fr 1fr; gap: 24px; align-items: center; padding: 3.2rem 0 2rem; }
.hero__title { font: 700 clamp(3.6rem, 9.4vw, 7.6rem)/.9 var(--f-display); margin: .1em 0 .25em; letter-spacing: -.025em; }
.hero__clans { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0 0 1.2em; font: 400 1.02rem/1.5 var(--f-display); font-variant: small-caps; letter-spacing: .06em; color: var(--ink-2); max-width: 36rem; }
.hero__clans span:not(:last-child)::after { content: "·"; margin: 0 .55em; color: var(--rust); }
.hero__lead { font-size: 1.3rem; color: var(--ink-2); max-width: 34rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.6rem; }
.hero__tree { margin: 0; }
.tree { width: 100%; height: auto; overflow: visible; }
.tree path { fill: none; stroke: var(--ink-2); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 760; stroke-dashoffset: 760; animation: draw 1.4s cubic-bezier(.6,.1,.3,1) forwards; }
.tree__roots path { stroke: #7b5a37; animation-delay: calc(var(--i) * 90ms + 100ms); }
.tree__trunk { stroke-width: 11 !important; stroke: var(--ink) !important; animation-delay: .75s !important; animation-duration: .7s !important; }
.tree__branches path { stroke: var(--green); animation-delay: calc(var(--i) * 110ms + 1.25s); }
.tree circle { fill: var(--green-2); opacity: 0; animation: pop .45s ease forwards; animation-delay: calc(var(--i) * 110ms + 2.1s); }
.tree text { opacity: 0; animation: fade .6s ease forwards; }
.tree__clan { font: 700 19px var(--f-display); fill: var(--ink); text-anchor: middle; animation-delay: calc(var(--i) * 90ms + .7s) !important; }
.tree__city { font: 700 25px var(--f-hand); fill: var(--green); text-anchor: middle; animation-delay: calc(var(--i) * 110ms + 2.2s) !important; }
.tree__note { font: 700 21px var(--f-hand); fill: var(--rust); text-anchor: middle; animation-delay: 3s !important; }
.tree__note--left { text-anchor: start; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.4); transform-box: fill-box; transform-origin: center; } to { opacity: 1; transform: scale(1); transform-box: fill-box; transform-origin: center; } }

/* ---------- sections */
.intro, .clans, .road, .join, .album { width: min(1120px, 100% - 32px); margin: 0 auto; padding: 3rem 0; border-top: 1px solid var(--line); }
.intro { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; }
.intro p { font-size: 1.2rem; }
.intro__col--note { background: var(--card); padding: 22px 26px; border-radius: var(--radius); box-shadow: var(--shadow); align-self: start; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.card-index {
  position: relative; padding: 22px 22px 34px 34px; border-radius: 6px;
  background: var(--card) repeating-linear-gradient(to bottom, transparent 0 31px, rgba(60,90,140,.13) 31px 32px);
  background-position: 0 58px; box-shadow: var(--shadow); transform: rotate(var(--r, 0deg));
  transition: transform .25s ease, box-shadow .25s ease;
}
.card-index::before { content: ""; position: absolute; left: 22px; top: 0; bottom: 0; width: 2px; background: rgba(155,58,34,.45); }
.card-index::after { content: ""; position: absolute; left: 50%; bottom: 10px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--paper-deep); box-shadow: inset 0 2px 3px rgba(0,0,0,.25); }
.card-index:hover { transform: rotate(0) translateY(-4px); box-shadow: 0 18px 30px -18px rgba(42,33,24,.55); }
.card-index h3 { font: 700 1.75rem/1.1 var(--f-display); margin: 0 0 .35em; }
.card-index p { margin: .3em 0; font-size: 1.04rem; }
.card-index__roots { font-family: var(--f-hand); font-size: 1.5rem !important; color: var(--green-2); line-height: 1.1; }
.card-index__roots span { font: 600 .72rem/1 var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--rust); display: block; margin-bottom: 2px; }

.road__list { list-style: none; margin: 0; padding: 0; position: relative; }
.road__list::before { content: ""; position: absolute; left: 150px; top: 8px; bottom: 8px; width: 2px; background: repeating-linear-gradient(to bottom, var(--ink-2) 0 6px, transparent 6px 12px); }
.road__item { display: grid; grid-template-columns: 150px 1fr; gap: 0 36px; padding: 14px 0; position: relative; }
.road__item::before { content: ""; position: absolute; left: 143px; top: 24px; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 3px solid var(--rust); }
.road__when { font: italic 400 1.45rem/1.2 var(--f-display); margin: .25em 0 0; text-align: right; color: var(--ink-2); }
.road__where { margin: 0; font-size: 2rem; }
.road__item p { margin: .1em 0; }

.steps { list-style: none; padding: 0; margin: 0 0 1.8rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.steps li { background: var(--card); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.steps h3 { font: 700 1.4rem/1.2 var(--f-display); margin: .3em 0; }
.steps p { margin: 0; color: var(--ink-2); font-size: 1.05rem; }
.steps__n { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--rust); color: var(--rust); font: 700 1.4rem var(--f-display); }
.inside { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 28px; }
.inside li { padding-left: 28px; position: relative; }
.inside li::before { content: "✦"; position: absolute; left: 0; color: var(--gold); }

.apply { width: min(980px, 100% - 32px); margin: 1rem auto 4rem; scroll-margin-top: 90px; }
.apply__card { background: var(--card); border-radius: 18px; padding: clamp(22px, 4vw, 44px); box-shadow: 0 30px 60px -40px rgba(42,33,24,.6); border: 1px solid var(--line); position: relative; }
.apply__card::before { content: "заявка"; position: absolute; top: 18px; right: 22px; font: 700 1.1rem var(--f-body); letter-spacing: .3em; text-transform: uppercase; color: var(--rust); border: 2px solid var(--rust); padding: 4px 10px; border-radius: 6px; transform: rotate(6deg); opacity: .55; }

/* ---------- forms */
.form { margin: 0; }
.paper { background: var(--card); border-radius: var(--radius); padding: clamp(18px, 3vw, 30px); box-shadow: var(--shadow); border: 1px solid var(--line); margin: 1.2rem 0; }
.paper--accent { border-left: 5px solid var(--green-2); }
.field { display: block; margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field > span, .field > legend { display: block; font-weight: 600; font-size: 1.02rem; margin-bottom: 6px; color: var(--ink-2); padding: 0; }
.field small { display: block; color: var(--muted); font-size: .95rem; margin-top: 5px; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select {
  width: 100%; font: inherit; font-size: 1.1rem; color: var(--ink); background: #fffdf8;
  border: 2px solid var(--line-strong); border-radius: 10px; padding: 13px 14px; min-height: 54px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--green-2); box-shadow: 0 0 0 4px rgba(62,104,82,.18); }
input[readonly] { background: #f6efe0; }
.field--compact input { min-height: 48px; padding: 10px 12px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.check { display: flex; gap: 12px; align-items: flex-start; margin: 10px 0 20px; font-size: 1.05rem; cursor: pointer; }
.check input { width: 26px; height: 26px; margin-top: 2px; accent-color: var(--green); flex: none; }
.check--inline { display: inline-flex; margin: 0 10px 0 0; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; }
.chip span { display: inline-block; padding: 10px 16px; border: 2px solid var(--line-strong); border-radius: 999px; background: #fffdf8; font-size: 1.02rem; transition: all .15s; }
.chip input:checked + span { background: var(--green); border-color: var(--green); color: #fbf6eb; }
.chip input:focus-visible + span { outline: 3px solid var(--green-2); outline-offset: 2px; }
.person { border: 0; border-top: 2px dashed var(--line-strong); margin: 1.6rem 0 0; padding: 1.2rem 0 0; }
.person:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.person__title { font: 700 1.6rem/1.1 var(--f-display); padding: 0 .4em 0 0; margin-bottom: .6rem; }
.form__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.4rem; }
.form--tight input, .form--tight select { min-height: 42px; padding: 7px 10px; font-size: .98rem; margin-bottom: 6px; }
.inline-form { display: inline-block; margin: 10px 0 0; }
.errors { background: #f6dfd6; border: 1px solid #e0a993; color: #7a2412; padding: 12px 18px; border-radius: var(--radius); margin: 0 0 18px; }
.errors p { margin: .2em 0; }
.notice { background: #e4ecdf; border: 1px solid #b9cdb4; padding: 12px 18px; border-radius: var(--radius); }
.details { margin: .6rem 0; }
.details summary { cursor: pointer; font-weight: 600; padding: 10px 0; color: var(--green); font-size: 1.1rem; }
.details[open] summary { margin-bottom: .6rem; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 1rem 0 1.6rem; }
.filters input, .filters select { width: auto; flex: 1 1 220px; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; padding: 12px 26px; border-radius: 12px; font: 600 1.1rem/1.2 var(--f-body); text-decoration: none; cursor: pointer; border: 2px solid transparent; transition: transform .12s ease, background .15s, box-shadow .15s; }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--green); color: #fbf6eb; box-shadow: 0 10px 20px -12px rgba(44,74,57,.9); }
.btn--primary:hover { background: #233d2f; color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--ink-2); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); }
.btn--wide { width: 100%; margin-top: .6rem; }
.btn--small { min-height: 40px; padding: 6px 14px; font-size: .95rem; }

/* ---------- cabinet */
.dash { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 1.6rem; }
.tile { display: block; text-decoration: none; color: var(--ink); background: var(--card); border-radius: 14px; padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); transition: transform .2s ease, box-shadow .2s ease; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 18px 32px -20px rgba(42,33,24,.6); color: var(--ink); }
.tile h2 { font: 700 1.5rem/1.15 var(--f-display); margin: 0 0 .4em; }
.tile--wide { grid-row: span 2; }
.tile__big { font: 700 3rem/1 var(--f-display); margin: .2em 0 0; color: var(--green); }
.tile__meta { color: var(--muted); margin: .3em 0 0; font-size: 1.02rem; }
.tile__list { list-style: none; padding: 0; margin: 1rem 0 0; }
.tile__list li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 1.02rem; }
.tile__list li em { font-style: normal; color: var(--muted); }
.tile__list li.is-done em { color: var(--green); font-weight: 600; }
.tile__list li.is-part em { color: var(--gold); }
.meter { height: 12px; background: var(--paper-deep); border-radius: 999px; overflow: hidden; margin: .4rem 0 0; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--green-2), var(--green)); border-radius: inherit; }

/* ---------- photos */
.album__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 26px; margin: 1rem 0 2rem; }
.album__grid--admin { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.photo-frame { margin: 0; background: #fffdf8; padding: 12px 12px 10px; box-shadow: 0 14px 26px -18px rgba(42,33,24,.7); position: relative; transform: rotate(-.6deg); }
.photo-frame:nth-child(even) { transform: rotate(.7deg); }
.photo-frame::before, .photo-frame::after { content: ""; position: absolute; width: 26px; height: 26px; background: #3a2f25; opacity: .82; }
.photo-frame::before { top: 4px; left: 4px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.photo-frame::after { bottom: 4px; right: 4px; clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.photo-frame img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--paper-deep); }
.photo-frame figcaption { display: flex; flex-direction: column; gap: 2px; padding: 8px 2px 0; }
.photo-frame figcaption .hand { font-size: 1.35rem; color: var(--ink-2); }
.photo-frame__meta { font-size: .9rem; color: var(--muted); }
.photo-frame__pdf { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--paper-deep); color: var(--rust); font: 700 2rem var(--f-display); text-decoration: none; text-align: center; padding: 8px; }
.photo-frame__pdf small { font: 400 .8rem var(--f-body); color: var(--muted); word-break: break-all; }
.photo-frame form { margin-top: 6px; }
.dropzone { display: grid; place-items: center; text-align: center; gap: 4px; padding: 30px 18px; border: 3px dashed var(--line-strong); border-radius: 16px; background: #fffaf0; cursor: pointer; margin-bottom: 12px; position: relative; }
.dropzone:hover { border-color: var(--green-2); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone__title { font: 700 1.5rem var(--f-display); color: var(--green); }
.dropzone__hint { color: var(--muted); font-size: 1rem; }
.preview { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.preview li { font-size: .95rem; background: var(--paper-deep); border-radius: 8px; padding: 4px 10px; }

/* ---------- moderation status, soon */
.status { align-self: flex-start; font-size: .8rem; letter-spacing: .03em; padding: 2px 9px; border-radius: 999px; background: rgba(42,33,24,.08); color: var(--ink-2); }
.status--approved { background: #dbe8d6; color: var(--green); }
.status--review { background: #f3dcc2; color: #7a3d0e; }
.status--rejected { background: #eee; color: #777; }
.status--pending { background: #e6e1f0; color: #4b3d6b; }
.transcript summary { cursor: pointer; font-size: .9rem; color: var(--green); }
.transcript p { font-size: .9rem; margin: .3em 0 0; background: #fbf7ee; padding: 6px 8px; border-radius: 6px; }
.tile--soon { border-style: dashed; background: transparent; box-shadow: none; }
.tile--soon:hover { transform: none; }

/* ---------- interview */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 1rem 0 1.6rem; }
.slot { background: var(--card); border-radius: 12px; padding: 18px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.slot__when { font: 700 1.4rem/1.2 var(--f-display); margin: 0 0 .2em; }
.slot input { margin: 10px 0; min-height: 46px; }
.slot .btn { width: 100%; }
.slot--mine { box-shadow: none; border: 0; padding: 0; background: none; }

/* ---------- relatives */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.person-card { display: flex; gap: 16px; text-decoration: none; color: var(--ink); background: var(--card); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); border: 1px solid var(--line); transition: transform .2s ease; }
.person-card:hover { transform: translateY(-3px); color: var(--ink); }
.person-card h2 { font: 700 1.3rem/1.15 var(--f-display); margin: 0 0 .2em; }
.person-card p { margin: .2em 0; font-size: 1rem; }
.person-card__help .hand { font-size: 1.3rem; color: var(--rust); }
.avatar { flex: none; width: 74px; height: 74px; border-radius: 50%; overflow: hidden; background: var(--paper-deep); display: grid; place-items: center; border: 3px solid #fffdf8; box-shadow: 0 6px 14px -8px rgba(42,33,24,.6); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar span { font: 700 2rem var(--f-display); color: var(--green); }
.avatar--big { width: 116px; height: 116px; }
.avatar--big span { font-size: 3rem; }
.profile-head { display: flex; gap: 22px; align-items: center; margin-bottom: 1rem; }
.profile-head .h-page { margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: .4em 0; }
.tags span { font-size: .85rem; letter-spacing: .04em; padding: 3px 10px; border-radius: 999px; background: rgba(44,74,57,.1); color: var(--green); }
.socials { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.socials li span { display: inline-block; min-width: 9.5em; color: var(--muted); }

/* ---------- admin */
.rows { display: grid; gap: 16px; }
.row-card { background: var(--card); border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.row-card.is-muted { opacity: .62; }
.row-card header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.row-card h2 { font: 700 1.35rem/1.2 var(--f-display); margin: 0; }
.row-card p { margin: .3em 0; }
.row-card__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.row-card__actions form { display: flex; gap: 10px; align-items: center; margin: 0; }
.badge { font-size: .82rem; padding: 3px 10px; border-radius: 999px; background: rgba(42,33,24,.08); white-space: nowrap; }
.badge--new { background: #f3dcc2; color: #7a3d0e; }
.badge--approved { background: #dbe8d6; color: var(--green); }
.badge--rejected { background: #eee; color: #777; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); font-size: 1.02rem; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font: 700 1rem var(--f-display); background: var(--paper-deep); }
.table form { margin: 0; }
.dl { display: grid; grid-template-columns: minmax(180px, 30%) 1fr; gap: 6px 18px; margin: .4em 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* ---------- chat: keeper and the public helper */
.wrap--chat { width: min(860px, 100% - 32px); }
.chat { display: flex; flex-direction: column; gap: 14px; }
.chat__log { display: flex; flex-direction: column; gap: 12px; max-height: 62vh; overflow-y: auto; padding: 4px 2px; overscroll-behavior: contain; }
.chat--public .chat__log { max-height: 44vh; }
.msg { max-width: 88%; }
.msg p { margin: 0; padding: 12px 16px; border-radius: 16px; white-space: pre-line; font-size: 1.12rem; line-height: 1.55; overflow-wrap: anywhere; }
.msg--bot { align-self: flex-start; }
.msg--bot p { background: #fffdf8; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg--me { align-self: flex-end; }
.msg--me p { background: var(--green); color: #fbf6eb; border-bottom-right-radius: 4px; }
.msg p.is-typing { color: var(--muted); }
.msg__status { display: block; margin-top: 6px; font-size: .95rem; font-style: italic; color: var(--muted); }
.cite { display: inline-block; font-size: .78rem; line-height: 1; padding: 4px 8px; margin: 0 2px; border-radius: 999px; background: rgba(44,74,57,.1); color: var(--green); text-decoration: none; vertical-align: 2px; white-space: nowrap; }
.cite:hover { background: var(--green); color: #fbf6eb; }
.chat__quick { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { font: inherit; font-size: 1rem; padding: 10px 16px; min-height: 46px; border-radius: 999px; border: 2px solid var(--line-strong); background: #fffdf8; color: var(--ink); cursor: pointer; }
.chip-btn:hover { border-color: var(--green-2); color: var(--green); }
.chat__form { display: flex; gap: 10px; align-items: flex-end; }
.chat__form textarea { flex: 1; min-height: 64px; }
.chat__form .btn { flex: none; }
.chat__form .btn[disabled] { opacity: .55; cursor: progress; }
.chat__note { font-size: .95rem; margin: 0; }
.ask { width: min(980px, 100% - 32px); margin: 0 auto; padding: 3rem 0 1rem; border-top: 1px solid var(--line); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.source-entry { font-size: 1.1rem; margin: 0; }

/* ---------- consent and access levels */
.check--big { font-size: 1.12rem; padding: 6px 0; }
.check--big input { width: 30px; height: 30px; }
.levels { display: grid; gap: 14px; margin-bottom: 1rem; }
.level-row { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin: 0; min-width: 0; }
.level-row__label { font-weight: 600; font-size: 1.15rem; padding: 0; }
.level-row__value { color: var(--muted); font-size: 1rem; margin: .2em 0 .7em; white-space: pre-line; overflow-wrap: anywhere; }
.level-row .chip span { padding: 12px 18px; font-size: 1.05rem; }
.ask-row { border-top: 1px dashed var(--line-strong); padding: 10px 0; }
.ask-row:first-of-type { border-top: 0; }
.ask-row p { margin: 0 0 .4em; }
.ask-row .form__actions { margin-top: .4rem; }
.ask-list { list-style: none; padding: 0; margin: .4rem 0 1.4rem; display: grid; gap: 10px; }
.ask-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.ask-list form { margin: 0; }
.tile--keeper { border-left: 5px solid var(--green-2); }
.table-wrap { overflow-x: auto; margin-bottom: 1.4rem; }
.kb-preview { white-space: pre-wrap; overflow-wrap: anywhere; background: #fffdf8; border: 1px solid var(--line); border-radius: 12px; padding: 16px; font-size: .9rem; line-height: 1.5; max-height: 70vh; overflow-y: auto; }

/* ---------- footer */
.footer { border-top: 4px double var(--line-strong); padding: 26px 0 34px; margin-top: 2rem; }
.footer__inner { width: min(1120px, 100% - 32px); margin: 0 auto; color: var(--muted); font-size: 1rem; }
.footer__inner p { margin: .2em 0; }
.footer__hand { font: 700 1.7rem var(--f-hand); color: var(--rust); transform: rotate(-1deg); display: inline-block; }

/* ---------- reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 2rem; }
  .hero__tree { order: 2; max-width: 560px; margin: 0 auto; }
  .intro { grid-template-columns: 1fr; }
  .steps, .inside { grid-template-columns: 1fr; }
  .dash { grid-template-columns: 1fr 1fr; }
  .tile--wide { grid-column: 1 / -1; grid-row: auto; }
}
@media (max-width: 640px) {
  body { font-size: 1.125rem; }
  .masthead__inner { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 0; }
  .topnav { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; width: 100%; padding-bottom: 4px; }
  .topnav a, .topnav .linkbtn { white-space: nowrap; }
  .masthead { position: static; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .dash { grid-template-columns: 1fr; }
  .road__list::before { left: 8px; }
  .road__item { grid-template-columns: 1fr; padding-left: 34px; }
  .road__item::before { left: 1px; }
  .road__when { text-align: left; }
  .people { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .table { font-size: .95rem; }
  .apply__card::before { display: none; }
  .chat__form { flex-direction: column; align-items: stretch; }
  .msg { max-width: 100%; }
  .chat__log, .chat--public .chat__log { max-height: none; overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tree path { stroke-dashoffset: 0; }
  .tree text, .tree circle { opacity: 1; }
  .reveal { opacity: 1; transform: none; }
}
