:root {
  --ink: #1d1b18;
  --ink-soft: #55504a;
  --paper: #fbf8f2;
  --card: #ffffff;
  --line: #e2dbd0;
  --accent: #7a3b2e;
  --accent-ink: #ffffff;
  --ok: #24603c;
  --warn: #7a4a00;
  --radius: 10px;
  --max: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f2ece3;
    --ink-soft: #b8afa3;
    --paper: #17150f;
    --card: #201d17;
    --line: #3a352c;
    --accent: #d99a6c;
    --accent-ink: #201d17;
  }
}

* { box-sizing: border-box; }

html { font-size: 18px; }
@media (min-width: 900px) { html { font-size: 19px; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.skip {
  position: absolute; left: -9999px; top: 0; padding: .6rem 1rem; background: var(--card);
}
.skip:focus { left: 1rem; top: 1rem; z-index: 10; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line);
  background: var(--card);
}
.brand {
  font-variant: small-caps; letter-spacing: .18em; font-weight: 700;
  font-size: 1.15rem; color: var(--ink); text-decoration: none;
}
.top nav { display: flex; align-items: center; gap: 1rem; font-size: .95rem; }
.who { color: var(--ink-soft); }

main { max-width: var(--max); margin: 0 auto; padding: 2rem 1.2rem 4rem; }

h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 .6rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; margin: 1.8rem 0 .6rem; }
p { margin: .5rem 0 1rem; }
.lede { font-size: 1.15rem; color: var(--ink-soft); max-width: 46ch; }
.subtle, .muted { color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: .82rem; display: block; margin-top: .2rem; }
.crumb { font-size: .85rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-soft); margin: 0 0 .3rem; }
.empty { color: var(--ink-soft); font-style: italic; }

.hero { padding: 3rem 0 2rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); }

.actions { display: flex; gap: .7rem; flex-wrap: wrap; margin: 1.4rem 0; }

.btn {
  display: inline-block; padding: .62rem 1.05rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: .95rem; text-decoration: none; cursor: pointer;
  min-height: 44px;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }

button.link {
  background: none; border: 0; padding: 0; font: inherit; font-size: .95rem;
  color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
form.inline { display: inline; }

.grid3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 2rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; margin: 1.4rem 0; }
.card h2 { margin-top: 0; }

.narrow { max-width: 34rem; }
.stack { display: flex; flex-direction: column; gap: .9rem; margin-top: 1.2rem; }
.row { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
.grow { flex: 1 1 260px; }

label { display: block; font-size: .92rem; color: var(--ink-soft); }
input, select, textarea {
  width: 100%; margin-top: .3rem; padding: .62rem .7rem; font: inherit; font-size: 1rem;
  color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; min-height: 44px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, button.link:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

.alert {
  background: #fdecea; color: #7a1d12; border: 1px solid #f3c2bb;
  padding: .7rem .9rem; border-radius: 8px; font-size: .95rem;
}
@media (prefers-color-scheme: dark) {
  .alert { background: #3a1712; color: #ffd9d2; border-color: #6b2a20; }
}

.tag {
  display: inline-block; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 999px; padding: .1rem .5rem;
  color: var(--ink-soft); vertical-align: middle;
}
.tag.warn { color: var(--warn); border-color: var(--warn); }
.tag.vis-private { color: var(--accent); border-color: var(--accent); }

.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }

.search { margin: 1.4rem 0 1rem; }

table.people { width: 100%; border-collapse: collapse; font-size: .98rem; }
table.people th, table.people td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); }
table.people th { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); font-weight: 600; }
table.people tr:hover td { background: var(--card); }

ul.list { list-style: none; padding: 0; margin: 1rem 0; }
ul.list li { padding: .7rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .7rem; align-items: center; }

ul.rel { list-style: none; padding: 0; margin: .3rem 0 1rem; }
ul.rel li { padding: .35rem 0; }

.cols { display: grid; gap: 2rem; grid-template-columns: 1fr 1fr; margin-top: 1.6rem; }
@media (max-width: 780px) { .cols { grid-template-columns: 1fr; gap: 1rem; } }

.pre { white-space: pre-wrap; }

.foot {
  border-top: 1px solid var(--line); padding: 1.4rem 1.2rem; color: var(--ink-soft);
  font-size: .82rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  max-width: var(--max); margin: 0 auto;
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* unions: each one is a record, shown as a small block so several read clearly */
.union {
  border-left: 3px solid var(--line);
  padding-left: .8rem;
  margin: .8rem 0;
}
.union p { margin: .25rem 0; }
.hint.inline { display: inline; }
.row.compact { gap: .5rem; margin-top: .3rem; }
.row.compact select { flex: 1 1 140px; width: auto; min-height: 38px; padding: .35rem .5rem; font-size: .9rem; }
.btn.small { padding: .35rem .7rem; min-height: 38px; font-size: .85rem; }

/* --- tree --------------------------------------------------------------- */
/* The redesign's palette, geometry and typography live in one block near the end of this file
   (`#tree` theme). The pre-2.8 rules that used to sit here were deleted in 2.10.0: one of them
   (`#tree .node .name { text-anchor: middle }`) carried more specificity than the new
   `#tree .name { text-anchor: start }` and silently pulled every name left, under the portrait.
   If a tree rule is ever duplicated here, the browser picks the more specific one, not the newer
   one — measure with ops/tree-layout-probe.js after touching either block. */

.legend { font-size: .82rem; color: var(--ink-soft); display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; margin-top: .8rem; }
.legend .key { display: inline-block; width: 26px; height: 0; border-top: 2px solid var(--ink-soft); margin-right: .3rem; }
.legend .key.adopted { border-top: 2px dashed #2f6f8f; }
.legend .key.step { border-top: 2px dotted #7a4a00; }
.legend .key.unc { border-top: 2px dashed var(--line); }


/* --- relationship narrator ---------------------------------------------- */
.answer h2 { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; text-transform: capitalize; }
.answer .sentence {
  font-size: 1.12rem; line-height: 1.6; background: var(--paper);
  border-left: 4px solid var(--accent); padding: .9rem 1rem; border-radius: 0 var(--radius) var(--radius) 0;
}
.answer h3 { font-size: 1rem; margin: 1.4rem 0 .5rem; color: var(--ink-soft); }
ol.chain { margin: 0; padding-left: 1.2rem; }
ol.chain li { padding: .35rem 0; }
ol.chain strong { font-weight: 600; }


/* --- timeline, gallery, share -------------------------------------------- */
ol.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
ol.timeline li { position: relative; padding: .5rem 0 .5rem 1rem; }
ol.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 1rem; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent);
}
ol.timeline .when { font-variant-numeric: tabular-nums; font-weight: 600; margin-right: .5rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6rem; }
.gallery img { width: 100%; height: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.gallery .doc { display: grid; place-items: center; height: 120px; border: 1px dashed var(--line); border-radius: 8px; font-size: .85rem; text-decoration: none; }
.story p { margin-bottom: 1.1rem; }
label.check { display: flex; gap: .5rem; align-items: center; }
label.check input { width: auto; min-height: 0; }
.token { font-family: ui-monospace, monospace; font-size: 1.05rem; background: var(--paper); padding: .6rem .8rem; border-radius: 8px; word-break: break-all; }

/* ===================================================================
   V2 additions — review queue, editing, bulk entry, export choice
   Same palette, same type; nothing here changes the historical look.
   =================================================================== */

.lifespan { font-variant-numeric: tabular-nums; }

.notice {
  border: 1px solid var(--line);
  border-left: 4px solid var(--ok);
  background: var(--card);
  border-radius: var(--radius);
  padding: .6rem .9rem;
  margin: .8rem 0;
}
.notice.warn { border-left-color: var(--warn); }
.notice ul { margin: .3rem 0 .1rem 1.1rem; padding: 0; }

.error {
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--card);
  padding: .6rem .9rem;
  margin: .8rem 0;
  font-weight: 600;
}

.tag.status-living    { border-color: var(--ok); }
.tag.status-deceased  { border-color: var(--ink-soft); }
.tag.vis-public       { border-color: var(--ok); }

.choices { list-style: none; margin: 0; padding: 0; }
.choices li {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .5rem .7rem;
  margin: 0 0 .6rem 0;
  background: var(--card);
}
.choices li.chosen { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.choices .hint { margin: .25rem 0 0; }

table.grid {
  width: 100%;
  border-collapse: collapse;
  margin: .6rem 0 1rem;
  font-size: .92rem;
}
table.grid th, table.grid td {
  text-align: left;
  padding: .35rem .5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.grid thead th { color: var(--ink-soft); font-weight: 600; }
table.grid th { white-space: nowrap; }

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .7rem .9rem;
  margin: 1rem 0;
}
legend { padding: 0 .35rem; color: var(--ink-soft); }

.inline-form { display: inline; margin: 0; }
.btn.small { padding: .15rem .5rem; font-size: .82rem; }
.btn.danger { border-color: var(--accent); color: var(--accent); }

.names-edit { margin-top: 2rem; }
.names .rel, .names-edit table { margin-top: .4rem; }
.names li { margin: .15rem 0; }
.actions.addrel { gap: .3rem; flex-wrap: wrap; }
.actions-cell { white-space: nowrap; }
.actions-cell form + form { margin-left: .3rem; }

/* bulk entry: ten rows have to stay readable on a phone */
.bulk-grid input, .bulk-grid select { width: 100%; min-width: 4.5rem; }
.bulk-grid td.num { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.bulk-grid td.err { color: var(--accent); font-size: .85rem; }
.bulk-grid tr.row-error { background: color-mix(in srgb, var(--accent) 6%, transparent); }

@media (max-width: 720px) {
  .bulk { overflow-x: auto; }
  .bulk-grid { min-width: 640px; }
}


/* ---- Timeline (V2.7.3) ------------------------------------------------------------------
   A vertical rule with entries hung off it. The date is the anchor for the eye; the certainty tag
   sits beside it because "about 1930" and "1930" are different claims and must not look identical. */
.timeline { list-style: none; margin: 0 0 1.5rem; padding: 0 0 0 1.1rem; border-left: 2px solid var(--rule, #d9cfc2); }
.tl-item { position: relative; padding: 0 0 1rem 0.9rem; }
.tl-item::before { content: ""; position: absolute; left: -1.45rem; top: 0.45rem; width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--accent, #7a4b2a); }
.tl-when { margin: 0; font-weight: 600; }
.tl-what { margin: 0.15rem 0 0; }
.tl-place { color: var(--muted, #6b5d4d); }

/* ---- Map (V2.7.3) ----------------------------------------------------------------------
   Drawn, not fetched: no tiles means no third party learns which villages this family is looking at. */
.mapwrap { background: #f4efe7; border: 1px solid var(--rule, #d9cfc2); border-radius: 10px; overflow: hidden; }
.family-map { display: block; width: 100%; height: auto; }
.map-sea { fill: #f4efe7; }
.map-dot { fill: #7a4b2a; fill-opacity: 0.75; stroke: #fff; stroke-width: 1.5; }
.map-label { font-size: 12px; fill: #2b2118; }

/* ---- Book (V2.7.3) --------------------------------------------------------------------- */
.book { max-width: 46rem; }
.book-chapter { border-top: 1px solid var(--rule, #d9cfc2); margin-top: 1.5rem; padding-top: 0.75rem; }
.photo-strip { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.photo-strip figure { margin: 0; max-width: 14rem; }
.photo-strip img { width: 100%; height: auto; border-radius: 6px; }
.nowrap { white-space: nowrap; }
@media print {
  .top, .bottomnav, .actions, .ubar { display: none !important; }
  .book { max-width: none; }
  .book-chapter { break-inside: avoid; }
}

/* ============================================================================ MODERN HERITAGE
   The tree's palette, scoped to #tree so the rest of ROOTS is untouched. Two themes, one component
   set: data-theme on <html> swaps tokens and nothing else. */

:root,
[data-theme="heritage"] {
  --tree-paper: #fbf7ee; --tree-card: #fffdf8; --tree-card-edge: #e2d7c4;
  --tree-ink: #221f1a; --tree-soft: #6f6455; --tree-line: #b3a48c;
  --tree-forest: #1f4d3a; --tree-gold: #a8823f;
  --tree-band-a: #f6efe0; --tree-band-b: #fbf7ee; --tree-band-ink: #a1907a;
  --tree-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
[data-theme="minimal"] {
  --tree-paper: #fafafa; --tree-card: #ffffff; --tree-card-edge: #dcdcdc;
  --tree-ink: #141414; --tree-soft: #5f5f5f; --tree-line: #c2c2c2;
  --tree-forest: #1a1a1a; --tree-gold: #8a8a8a;
  --tree-band-a: #ffffff; --tree-band-b: #fafafa; --tree-band-ink: #b0b0b0;
  --tree-serif: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.treewrap { background: var(--tree-paper); border: 1px solid var(--tree-card-edge);
  border-radius: 16px; padding: 6px; overflow: hidden; touch-action: none; }
#tree { display: block; margin: 0 auto; width: 100%; height: auto; max-height: 78vh; }

#tree .band { fill: var(--tree-band-a); }
#tree .band-1 { fill: var(--tree-band-b); }
#tree .band-label { font-family: var(--tree-serif); font-size: 11px; letter-spacing: .09em;
  text-transform: uppercase; fill: var(--tree-band-ink); }

#tree .card { fill: var(--tree-card); stroke: var(--tree-card-edge); stroke-width: 1.5;
  transition: stroke .15s ease, stroke-width .15s ease; }
#tree .node.focus .card { stroke: var(--tree-forest); stroke-width: 2.5; }
#tree .node.foreign .card { stroke-dasharray: 5 4; stroke: var(--tree-soft); }

#tree .name { font-family: var(--tree-serif); font-size: 15px; font-weight: 600;
  fill: var(--tree-ink); text-anchor: start; }
#tree .dates { font-family: var(--tree-serif); font-size: 12px; fill: var(--tree-soft);
  text-anchor: start; font-variant-numeric: tabular-nums; }
#tree .badge { font-family: var(--tree-serif); font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; fill: var(--tree-soft); text-anchor: start; }

#tree .monogram text { font-family: var(--tree-serif); font-size: 16px; font-weight: 600;
  fill: #fffdf8; text-anchor: middle; dominant-baseline: middle; }
#tree .monogram.tint-0 rect { fill: #2f5d4a; }
#tree .monogram.tint-1 rect { fill: #7a4b2a; }
#tree .monogram.tint-2 rect { fill: #8a6a2f; }
#tree .monogram.tint-3 rect { fill: #4a5568; }
#tree .monogram.tint-4 rect { fill: #6b4257; }
#tree .monogram.tint-5 rect { fill: #55613f; }

#tree .edge { fill: none; stroke: var(--tree-line); stroke-width: 1.6; stroke-linecap: round; }
#tree .edge.union { stroke: var(--tree-forest); stroke-width: 2.6; }
#tree .edge.nature-adoptive { stroke-dasharray: 4 4; stroke-width: 2; stroke: #2f6f8f; }
#tree .edge.nature-step { stroke-dasharray: 9 3 2 3; stroke-width: 2; stroke: var(--tree-gold); }
#tree .edge.nature-foster { stroke-dasharray: 2 4; stroke-width: 2; stroke: var(--tree-gold); }
#tree .edge.nature-unknown { stroke-dasharray: 6 6; opacity: .55; }
#tree .edge-connection { stroke: var(--tree-soft); stroke-width: 2; stroke-dasharray: 2 5; }

#tree a:hover .node .card, #tree a:focus-visible .node .card {
  stroke: var(--tree-gold); stroke-width: 2.5; }
#tree a:focus-visible { outline: none; }
.legend { font-family: var(--tree-serif); }
.legend .key.union { border-top: 3px solid var(--tree-forest); }
.legend .key.unc { border-top-style: dotted; }

@media (prefers-reduced-motion: reduce) { #tree .card { transition: none; } }
@media (max-width: 640px) { #tree .name { font-size: 14px; } #tree .band-label { font-size: 10px; } }

/* --- tree interactions (2.10.0) ----------------------------------------- */
/* Everything here is additive and scoped under .tree-layout / .tree-panel so the rest of ROOTS is
   untouched. No layout animation: the panel's grid column changes instantly, only its own opacity
   and 6 px offset move, and only when the reader has not asked for reduced motion. */

.treehead { align-items: flex-start; }
.tree-actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: flex-start; }
.tree-controls { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;
  justify-content: space-between; margin: .5rem 0 .75rem; }
.tree-modes { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { display: inline-block; padding: .3rem .7rem; border: 1px solid var(--tree-card-edge);
  border-radius: 999px; font-size: .84rem; color: var(--tree-soft); text-decoration: none;
  background: var(--tree-card); }
.chip:hover { border-color: var(--tree-forest); color: var(--tree-forest); }
.chip.is-on { background: var(--tree-forest); border-color: var(--tree-forest); color: #fffdf8; }
.tree-depth { display: flex; gap: .4rem; align-items: center; font-size: .85rem;
  color: var(--tree-soft); font-family: var(--tree-serif); }
.tree-depth select { min-height: 36px; padding: .2rem .4rem; border-radius: 8px;
  border: 1px solid var(--tree-card-edge); background: var(--tree-card); color: var(--tree-ink); }

.tree-search { position: relative; display: flex; gap: .35rem; }
.tree-search input { min-height: 38px; width: 190px; padding: .3rem .6rem; border-radius: 8px;
  border: 1px solid var(--tree-card-edge); background: var(--tree-card); color: var(--tree-ink);
  font-family: var(--tree-serif); }
.tree-search input:focus { outline: 2px solid var(--tree-gold); outline-offset: 1px; }
.tree-results { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0;
  margin: 0; padding: .25rem; list-style: none; background: var(--tree-card);
  border: 1px solid var(--tree-card-edge); border-radius: 12px;
  box-shadow: 0 10px 28px rgba(30, 24, 16, .12); max-height: 300px; overflow: auto; }
.tree-result { padding: .4rem .55rem; border-radius: 8px; cursor: pointer; font-family: var(--tree-serif);
  display: flex; justify-content: space-between; gap: .6rem; }
.tree-result .dates { color: var(--tree-soft); font-size: .78rem; white-space: nowrap; }
.tree-result[aria-selected="true"], .tree-result:hover { background: var(--tree-band-a); }
.tree-result.is-empty { color: var(--tree-soft); cursor: default; font-size: .82rem; }

.tree-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.treewrap.is-swapping { opacity: .55; transition: opacity .12s ease; }

#tree .node-link { cursor: pointer; }
#tree .node-link.is-selected .card { stroke: var(--tree-gold); stroke-width: 3; }
#tree .node-toggle rect { fill: var(--tree-paper); stroke: var(--tree-card-edge); stroke-width: 1; }
#tree .node-toggle text { font-family: var(--tree-serif); font-size: 11px; font-weight: 600;
  fill: var(--tree-soft); text-anchor: middle; }
#tree .node-toggle:hover rect, #tree .node-toggle:focus-visible rect { fill: var(--tree-forest);
  stroke: var(--tree-forest); }
#tree .node-toggle:hover text, #tree .node-toggle:focus-visible text { fill: #fffdf8; }
#tree .node.is-collapsed .card { stroke-dasharray: 6 4; }

.tree-panel { background: var(--tree-card); border: 1px solid var(--tree-card-edge);
  border-radius: 16px; padding: 1rem 1.1rem 1.2rem; font-family: var(--tree-serif);
  color: var(--tree-ink); }
.tree-panel[hidden] { display: none; }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tree-panel:not([hidden]) { animation: panel-in .14s ease-out; }
.panel-head { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: .8rem;
  align-items: start; }
.panel-head h2 { margin: .1rem 0 .2rem; font-size: 1.15rem; line-height: 1.25; }
.panel-dates { margin: 0; color: var(--tree-soft); font-size: .86rem; }
.panel-avatar .monogram { display: grid; place-items: center; width: 72px; height: 72px;
  border-radius: 18px; color: #fffdf8; font-weight: 600; font-size: 1.35rem; }
.panel-avatar img { width: 72px; height: 72px; border-radius: 18px; object-fit: cover; }
.panel-avatar .tint-0 { background: #2f5d4a; } .panel-avatar .tint-1 { background: #7a4b2a; }
.panel-avatar .tint-2 { background: #8a6a2f; } .panel-avatar .tint-3 { background: #4a5568; }
.panel-avatar .tint-4 { background: #6b4257; } .panel-avatar .tint-5 { background: #55613f; }
.panel-close { background: none; border: 0; font-size: 1.3rem; line-height: 1; color: var(--tree-soft);
  cursor: pointer; padding: .1rem .2rem; }
.panel-close:hover { color: var(--tree-ink); }
.panel-bio { margin: .8rem 0 0; font-size: .92rem; line-height: 1.45; }
.panel-facts { margin: .8rem 0 0; display: grid; gap: .4rem; }
.panel-facts div { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: .5rem; }
.panel-facts dt { color: var(--tree-soft); font-size: .78rem; text-transform: uppercase;
  letter-spacing: .06em; padding-top: .1rem; }
.panel-facts dd { margin: 0; font-size: .9rem; }
.panel-facts a { color: var(--tree-forest); }
.panel-meta { margin: .8rem 0 0; font-size: .82rem; color: var(--tree-soft); }
.panel-meta a { color: var(--tree-forest); }
.panel-actions, .panel-add { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .9rem; }
.panel-add { align-items: center; }
.panel-error { margin: 0; font-size: .9rem; }
.key-hint { font-family: var(--tree-serif); border: 1px solid var(--tree-card-edge);
  border-radius: 999px; padding: 0 .35rem; font-size: .8rem; }

@media (max-width: 1099px) {
  .tree-panel:not([hidden]) { position: fixed; left: 10px; right: 10px; bottom: 10px; z-index: 40;
    max-height: 62vh; overflow: auto; box-shadow: 0 18px 42px rgba(30, 24, 16, .22); }
}
@media (max-width: 640px) {
  .tree-search input { width: 100%; }
  .tree-search { flex: 1 1 100%; }
  .tree-actions { width: 100%; }
  .tree-controls { gap: .6rem; }
}
@media (prefers-reduced-motion: reduce) {
  .tree-panel:not([hidden]) { animation: none; }
  .treewrap.is-swapping { transition: none; }
}
