:root {
  color-scheme: light;
  --paper: #f7f7f2;
  --white: #fffefa;
  --ink: #21362c;
  --muted: #5e6e63;
  --green: #274b3b;
  --green-hover: #1d3d2e;
  --leaf: #dae6d8;
  --line: #d9ded4;
  --serif: "Songti SC", "Noto Serif CJK SC", SimSun, Georgia, serif;
  --warm: #d7b882;
  --shadow: 0 2px 8px #223b2c08, 0 14px 32px #21382b06;
  font-family: "Aptos", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  font-size: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); min-width: 320px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
a { color: var(--green); }
:focus-visible { outline: 3px solid #769782; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-family: "Songti SC", SimSun, "Noto Serif CJK SC", Georgia, serif; font-size: clamp(2.25rem, 3.3vw, 3.45rem); letter-spacing: -.055em; font-weight: 800; line-height: 1.15; }
.loading { padding: 2rem; color: var(--muted); }

.brand { display: inline-flex; align-items: center; gap: 12px; text-align: left; }
.brand img { display: block; border-radius: 13px; box-shadow: 0 3px 8px #21382b19; }
.brand strong { display: block; line-height: 1.15; font-family: "Songti SC", SimSun, Georgia, serif; font-size: 1.22rem; letter-spacing: .11em; color: var(--ink); white-space: nowrap; }
.brand small { display: block; margin-top: 6px; font-size: .69rem; font-weight: 750; letter-spacing: .13em; color: #668071; white-space: nowrap; }
.brand-button, .text-button { background: none; border: 0; padding: 0; }
.brand-button { flex: 0 0 auto; }
.text-button { font-weight: 650; text-decoration: underline; text-underline-offset: .2em; color: var(--green); }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 14px; min-height: 42px; flex: 0 0 auto; border: 1px solid #d9dfd3; border-radius: 8px;
  background: var(--white); color: var(--green); text-decoration: none; font-size: .9rem;
  font-weight: 680; line-height: 1.25; white-space: nowrap; transition: background .15s, border-color .15s;
}
.button:hover:not(:disabled) { background: #eff3eb; border-color: #acbdaf; }
.button.primary { background: var(--green); color: #fff; border-color: var(--green); }
.button.primary:hover:not(:disabled) { background: var(--green-hover); border-color: var(--green-hover); }
.button.outline { background: transparent; }
.button.quiet { border-color: transparent; background: transparent; }
.button.tiny { min-height: 34px; font-size: .85rem; padding: 0 10px; }
.button.icon-btn { width: 36px; min-height: 36px; padding: 0; }
.button.danger { color: #923e35; }
.button.danger.solid { color: #fff; background: #963e33; border-color: #963e33; }
.button.danger.solid:hover:not(:disabled) { background: #78342d; }
.pill { display: inline-flex; align-items: center; background: #edf3e9; color: #3f634c; border: 1px solid #e0eadc; border-radius: 999px; padding: 4px 8px; font-size: .8rem; font-weight: 630; line-height: 1.15; white-space: nowrap; }
.pill.warm { color: #775923; background: #f4ecdb; border-color: #f0e3c7; }

.login { min-height: 100vh; min-height: 100svh; display: grid; grid-template-columns: minmax(360px, .92fr) minmax(0, 1.08fr); background: var(--white); }
.login-side { display: grid; grid-template-rows: auto 1fr auto; padding: clamp(26px, 5.1vw, 80px) clamp(26px, 6vw, 94px) 35px; align-items: center; }
.login-body { width: min(100%, 400px); justify-self: center; padding: 52px 0; }
.login-tag { color: #4d6d58; background: #edf3e9; font-weight: 700; font-size: .84rem; border-radius: 999px; padding: 7px 12px; display: inline-flex; align-items: center; gap: 6px; margin-bottom: 19px; }
.login h1 { font-size: clamp(2.6rem, 4.6vw, 4.2rem); }
.login-body > p { margin: 16px 0 30px; color: var(--muted); font-size: 1rem; line-height: 1.7; }
.login-side footer { font-size: .84rem; color: var(--muted); }
.login-submit { width: 100%; min-height: 49px; font-size: 1rem; margin-top: 6px; }
.forgot { display: block; margin: 18px auto 0; font-size: .9rem; }
.login-cover { position: relative; min-width: 0; overflow: hidden; background: #223a32 url('/lineage-cover.webp') center 48% / cover no-repeat; display: flex; align-items: flex-end; }
.login-cover::before { position: absolute; inset: 38% 0 0; background: linear-gradient(transparent, #0c211ce6); content: ''; }
.cover-caption { position: relative; color: #fffbed; padding: 10% 10% 9%; }
.cover-caption > span { display: block; height: 1px; width: 47px; margin-bottom: 18px; background: #d9c898; }
.cover-caption p { font-size: .9rem; letter-spacing: .18em; color: #e0dfc5; margin-bottom: 10px; }
.cover-caption h2 { font-family: "Songti SC", SimSun, Georgia, serif; font-size: clamp(2rem, 4.7vw, 4.3rem); line-height: 1.13; letter-spacing: -.03em; }
.success-note { background: #edf3e9; border: 1px solid #e0e8dc; border-radius: 8px; padding: 16px; line-height: 1.6; }
.success-note svg { vertical-align: middle; margin-right: 5px; }

.app-header {
  min-height: 70px; padding: 0 max(30px, calc((100vw - 1392px)/2));
  display: flex; align-items: stretch; justify-content: space-between; gap: 24px;
  background: var(--white); border-bottom: 1px solid var(--line);
}
.brand-button, .header-user { align-self: center; }
.app-header nav { display:flex; align-items:stretch; gap:10px; min-width:0; overflow-x:auto; }
.nav-item { display:flex; align-items:center; gap:7px; padding: 0 13px; border:0; border-bottom:3px solid transparent; background:transparent; color:#5c685f; font-size:.92rem; font-weight:650; }
.nav-item { flex-shrink:0; white-space:nowrap; }
.nav-item:hover { color:var(--green); background:#f5f6ef; }
.nav-item.active { border-bottom-color:#42614d; color:var(--green); }
.nav-count { background:#30513e; color:white; padding:1px 6px; border-radius:8px; }
.header-user { position:relative; z-index:4; }
.header-user summary { display:flex; align-items:center; gap:10px; padding:4px; cursor:pointer; list-style:none; }
.header-user summary::-webkit-details-marker, .account-options summary::-webkit-details-marker { display:none; }
.header-user small, .admin-row small, .directory-card small, .file-title small, .version-main small { display:block; color:var(--muted); margin-top:4px; font-size:.82rem; }
.user-lines strong { font-size:.93rem; }
.user-menu, .account-options[open] > div { z-index:5; position:absolute; min-width:172px; top:calc(100% + 6px); right:0; background:var(--white); border:1px solid var(--line); box-shadow:0 12px 28px #1d312222; padding:8px; border-radius:10px; }
.user-menu > div { padding:8px; }
.user-menu .button { width:100%; justify-content:flex-start; }
.release-notes section + section { margin-top:20px; border-top:1px solid var(--line); padding-top:16px; }
.release-notes h3 { color:var(--green); font-size:1rem; }
.release-notes ul { padding-left:1.25em; margin:8px 0 0; }
.release-notes li { margin:6px 0; line-height:1.6; }
.shell { max-width:1452px; margin:0 auto; padding:24px 30px 48px; }
.page-title { display:flex; align-items:flex-end; justify-content:space-between; gap:20px; padding:8px 0 23px; margin-bottom:20px; border-bottom:1px solid var(--line); }
.eyebrow { display:flex; align-items:center; gap:7px; font-size:.9rem; font-weight:600; color:#60765f; margin-bottom:9px; }
.page-title p { color:var(--muted); margin-top:9px; }
.title-actions, .profile-quick, .profile-tools, .row-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.archive-cover { position:relative; isolation:isolate; overflow:hidden; background:#172f27; color:#fffdf3; border-radius:16px; min-height:182px; display:flex; align-items:center; padding:26px clamp(22px,3.25vw,48px); margin-bottom:22px; }
.cover-image { position:absolute; inset:0 0 0 32%; z-index:-2; background: url('/lineage-cover.webp') 60% 47% / cover; }
.archive-cover::before { content:''; position:absolute; inset:0; z-index:-1; background:linear-gradient(90deg,#182f27 23%,#182f27f0 35%,#182f27b0 48%,#182f2714 75%,#182f2705 100%); }
.archive-identity { min-width:0; max-width:min(900px,85%); }
.archive-kicker, .archive-counts, .archive-counts span, .archive-title { display:flex; align-items:center; }
.archive-kicker { gap:7px; color:#e6d9b6; font-size:.83rem; letter-spacing:.12em; font-weight:600; }
.archive-title { gap:13px; margin:9px 0 15px; }
.archive-title h1 { font-family:var(--serif); font-size:clamp(2.4rem,4.6vw,4.25rem); font-weight:650; letter-spacing:.02em; overflow-wrap:anywhere; text-shadow:0 1px 9px #172c2859; }
.archive-counts { flex-wrap:wrap; gap:13px; color:#e3e8dc; font-size:.85rem; }
.archive-counts span { gap:6px; }
.archive-counts strong { font-variant-numeric:tabular-nums; color:#fff; }
.archive-counts i { width:1px; height:13px; background:#8da08c; }
.button.cover-edit { border:1px solid #aebfac78; color:#ecedde; width:32px; min-height:32px; background:#21382c66; padding:0; border-radius:50%; }
.button.cover-edit:hover:not(:disabled) { background:#3c5849; }
.tree-layout { display:grid; grid-template-columns:minmax(0,1fr) clamp(292px,23vw,350px); gap:18px; align-items:start; }
.graph-card, .inspector, .content-card, .profile-head, .version, .directory-card { min-width:0; background:var(--white); border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow); }
.graph-card { overflow:hidden; }
.graph-head, .graph-foot { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px 18px; }
.graph-head h2 { font:650 1.43rem/1.25 var(--serif); white-space:nowrap; }
.graph-tools { display:flex; gap:7px; }
.graph-tools .button { min-height:35px; }
.graph-foot { padding-block:7px; min-height:42px; }
.graph-title small { display:block; margin-top:4px; font-size:.77rem; color:var(--muted); }
.graph-viewport { position:relative; height:clamp(480px,67vh,740px); overflow:auto; overscroll-behavior:contain; cursor:grab;
  background-color:#f5f3e9; border-block:1px solid #dddcd0;
  background-image:radial-gradient(ellipse at 49% 42%,#fffdf266,transparent 70%),radial-gradient(#a5a38b68 .8px,transparent 1px); background-size:auto,17px 17px;
  scrollbar-width:thin; scrollbar-color:#a1af9f #eff1e7; }
.graph-viewport.panning { cursor:grabbing; user-select:none; }
#graph-spacer { position:relative; overflow:clip; }
#graph-inner { position:absolute; transform-origin:top left; }
.connections { position:absolute; inset:0; pointer-events:none; overflow:visible; }
.connections path { --edge:#829281; fill:none; stroke:var(--edge); stroke-width:1.6px; stroke-linecap:round; stroke-linejoin:round; }
.connections .link-marriage { --edge:#a27c3e; }
.connections .link-former { --edge:#967866; stroke-dasharray:7 4; }
.connections .link-coparent { --edge:#777e80; stroke-dasharray:2 4; }
.connections .link-adoptive, .connections .link-step, .connections .link-guardian { stroke-dasharray:3 3; }
.connections path.connected { stroke-width:2.65px; stroke:color-mix(in srgb,var(--edge) 80%,#263d2e); }
.node { position:absolute; z-index:2; display:flex; flex-direction:column; align-items:center; width:var(--node-width); height:var(--node-height);
  padding:5px 0 3px; gap:3px; border:0; border-radius:9px; background:transparent; color:#263a30; }
.medallion, .inspector-medallion, .profile-medallion, .list-medallion { position:relative; display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; }
.node .medallion { border-radius:50%; padding:3px; background:linear-gradient(145deg,#ebe4ca,#8f805e 46%,#d2c7a8 70%,#8e846a);
  border:1px solid #94866b; box-shadow:0 2px 5px #4d473728; }
.node strong, .node small { display:block; max-width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.node strong { padding:1px 6px 2px; margin-top:2px; border:1px solid transparent; border-radius:5px; font:700 1.07rem/1.16 var(--serif); }
.node small { color:#53655a; font-size:.81rem; line-height:1.28; }
.node:hover strong, .node.in-branch strong { background:#e8e9db; border-color:#aab8a0; }
.node.chosen strong { color:#fffef3; background:#294d3c; border-color:#294d3c; }
.node.chosen .medallion, .node.in-branch .medallion { box-shadow:0 0 0 2px #f8f4e7,0 0 0 4px #42664b,0 3px 7px #34462c33; }
.life-mark { display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto; width:19px; height:19px;
  border:1.5px solid #fcfaf1; border-radius:50%; box-shadow:0 0 0 1px #6a705e80; font:700 12px/1 system-ui,sans-serif; }
:is(.medallion,.inspector-medallion,.profile-medallion,.list-medallion) > .life-mark { position:absolute; bottom:0; right:-1px; }
.life-mark svg { width:13px; height:13px; stroke-width:2; }
.life-mark.living { background:#3c6548; color:white; }
.life-mark.deceased { background:#363b3b; color:white; }
.life-mark.unknown { background:#f5f2e7; color:#625e51; }
.deceased > .portrait, .deceased .medallion > .portrait { filter:grayscale(1); }
.node.deceased .medallion { background:linear-gradient(145deg,#c4c6be,#6c716e 60%,#acb1a8); border-color:#777c76; }
.status-text { color:var(--muted); font-size:.8rem; }
.list-medallion > .life-mark { width:15px; height:15px; right:-3px; bottom:-1px; font-size:10px; }
.list-medallion .life-mark svg { width:10px; height:10px; }
.portrait { position:relative; display:inline-grid; place-items:center; overflow:hidden; flex:0 0 auto; border-radius:50%; height:48px; width:48px;
  font-family:var(--serif); font-weight:600; font-size:1.34rem; border:1px solid #596a5724; }
.portrait img { position:absolute; inset:0; display:block; width:100%; height:100%; object-fit:cover; background-color:inherit; }
.portrait.pine { background:#dae7db; color:#32513d; }
.portrait.rose { background:#f1e1db; color:#7a4e40; }
.portrait.ochre { background:#ece3cd; color:#6c542c; }
.portrait.slate { background:#dee6ea; color:#425d6b; }
.portrait.violet { background:#e7e2ec; color:#68556d; }
.portrait.node-avatar { width:62px; height:62px; border:1px solid #fff9e9cc; font-size:2.1rem; }
.portrait.avatar-tiny { width:29px; height:29px; font-size:.95rem; }
.portrait.avatar-sm { width:36px; height:36px; font-size:1.13rem; }
.portrait.avatar-md { width:54px; height:54px; font-size:1.6rem; }
.portrait.avatar-lg { width:65px; height:65px; font-size:2.1rem; box-shadow:0 0 0 4px #fffef9; }
.portrait.avatar-hero { width:90px; height:90px; font-size:3rem; box-shadow:0 0 0 4px #ffffffca; }
.legend, .zoom { display:flex; align-items:center; gap:13px; font-size:.8rem; color:var(--muted); }
.legend { flex-wrap:wrap; row-gap:5px; }
.legend > span, .graph-key > div > span { display:inline-flex; align-items:center; gap:5px; }
.descent-line { width:17px; border-top:2px solid #718b75; }
.branch-sign { display:inline-block; position:relative; flex:0 0 auto; width:17px; height:15px; color:#926d32; }
.branch-sign::before, .branch-sign::after { content:""; display:block; position:absolute; }
.branch-sign:is(.marriage,.former)::before, .branch-sign:is(.marriage,.former)::after {
  width:10px; height:10px; top:2.5px; border:1.5px solid currentColor; border-radius:50%; }
.branch-sign::before { left:0; }
.branch-sign::after { right:0; }
.branch-sign.former { color:#87695c; }
.branch-sign.former::after { border-style:dashed; }
.branch-sign.coparent::before { left:4px; top:3px; width:9px; height:9px; border:1.5px solid #606f69; transform:rotate(45deg); }
.union-pin { position:absolute; z-index:3; transform:translate(-50%,-50%); display:grid; place-items:center;
  width:24px; height:22px; padding:0; border:1px solid #b3ac97; border-radius:8px; background:#fcfaf1; }
.union-pin:is(:hover,[aria-pressed="true"]) { background:#efe4c5; border-color:#836a3a; box-shadow:0 0 0 2px #ddcba0; }
.graph-key h3, .branch-detail h3 { margin:2px 0 9px; font-size:1rem; }
.graph-key > div { display:flex; flex-wrap:wrap; gap:12px 19px; margin:0 0 22px; }
.graph-key p { line-height:1.65; color:var(--muted); }
.mobile-inspect { display:none; }
.zoom { gap:0; }
.zoom output { width:44px; text-align:center; font-variant-numeric:tabular-nums; }
.zoom .button.icon-btn { border:none; border-radius:5px; min-height:32px; width:32px; }
.zoom .fit { margin-left:5px; }
.inspector { overflow:hidden; }
.inspector-head { padding:10px 16px; min-height:47px; display:flex; align-items:center; justify-content:space-between; color:#546e59; }
.inspector-head > span { display:flex; align-items:center; gap:7px; font-size:.88rem; font-weight:650; }
.inspector-head .icon-btn { width:30px; min-height:30px; border:0; background:transparent; }
.inspector-person { display:flex; align-items:center; gap:16px; padding:4px 18px 14px; }
.inspector-person > div { flex:1; min-width:0; }
.inspector-branch { color:#726036; font-weight:600; font-size:.82rem; }
.person-badges { display:flex; gap:5px; flex-wrap:wrap; }
.inspector h2 { font-family:var(--serif); font-size:1.8rem; line-height:1.21; margin:3px 0; overflow-wrap:anywhere; }
.inspector-person p { color:var(--muted); font-size:.84rem; }
.inspector-actions { display:grid; grid-template-columns:minmax(0,1fr) 41px; gap:7px; margin:0 17px 16px; }
.inspector-actions .button { padding:0 7px; }
.inspector-related { border-top:1px solid var(--line); padding:14px 17px 16px; max-height:clamp(290px,41vh,430px); overflow:auto; scrollbar-width:thin; }
.inspector-related h3 { font:650 1.14rem var(--serif); }
.family-branches { padding-bottom:14px; margin-bottom:14px; border-bottom:1px solid var(--line); }
.family-branches button, .branch-member { display:flex; align-items:center; gap:8px; min-height:40px; padding:5px 2px; width:100%; text-align:left; background:transparent; border:0; border-radius:5px; }
.family-branches button:hover, .branch-member:hover { background:#f0f3eb; }
.family-branches button span { margin-left:auto; color:var(--muted); font-size:.8rem; }
.branch-member strong, .family-branches strong { font-size:.91rem; overflow-wrap:anywhere; }
.branch-member > svg { margin-left:auto; }
.branch-detail { padding:1px 17px 18px; }
.branch-heading { display:flex; align-items:center; gap:9px; margin:4px 0 10px; }
.branch-heading h2 { font-size:1.38rem; }
.branch-detail h3 { margin-top:18px; padding-top:12px; border-top:1px solid var(--line); }
.branch-detail h3 span { font:500 .85rem system-ui,sans-serif; color:var(--muted); }
.marriage-periods { padding-left:20px; margin:9px 0; color:var(--muted); font-size:.88rem; }
.kin-group { margin-top:12px; }
.kin-group h4 { font-weight:600; font-size:.81rem; color:var(--muted); margin-bottom:3px; }
.kin-row { display:flex; align-items:center; gap:5px; }
.kin-row > button:first-child { background:transparent; border:0; border-radius:6px; text-align:left; min-height:39px; padding:4px 0; display:flex; gap:8px; align-items:center; width:100%; min-width:0; }
.kin-row > button:first-child:hover { background:#f0f3eb; }
.kin-row strong { font-size:.91rem; line-height:1.3; overflow-wrap:anywhere; }
.kin-row .kin-label { font-size:.82rem; color:var(--muted); margin-left:auto; text-align:right; }
.kin-row button > svg { flex:0 0 auto; color:#728775; }

.directory-tabs { display:flex; gap:clamp(12px,3vw,30px); border-bottom:1px solid var(--line); }
.directory-tabs button { display:flex; align-items:center; gap:7px; padding:6px 2px 12px; border:0; border-bottom:2px solid transparent; background:none; color:var(--muted); font-size:.95rem; }
.directory-tabs button[aria-selected="true"] { color:var(--green); border-color:var(--green); font-weight:650; }
.directory-tabs button span { padding:1px 6px; border-radius:5px; background:#e8ede3; font-size:.76rem; font-variant-numeric:tabular-nums; }
.directory-toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:16px 0; }
.directory-toolbar > .search-field { flex:1 1 220px; }
.directory-lineages { position:relative; min-width:0; max-width:min(100%,320px); color:var(--green); }
.directory-lineages summary { display:flex; align-items:center; gap:8px; min-height:42px; border:1px solid var(--line); border-radius:8px; padding:6px 12px; background:var(--white); font-size:.9rem; cursor:pointer; list-style:none; }
.directory-lineages summary span { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.directory-lineages summary svg { flex:none; }
.directory-lineages summary::-webkit-details-marker, .profile-other-marriages summary::-webkit-details-marker { display:none; }
.directory-lineage-menu { position:absolute; top:calc(100% + 5px); right:0; width:min(310px,calc(100vw - 36px)); padding:8px; z-index:3; border:1px solid var(--line); border-radius:10px; background:var(--white); box-shadow:0 8px 24px #233c2921; }
.directory-lineage-menu .search-field { width:100%; min-height:36px; padding-inline:8px; }
.directory-lineage-menu .search-field input { padding-block:6px; }
.directory-lineage-options { margin-top:5px; max-height:min(260px,45vh); overflow:auto; overscroll-behavior:contain; }
.directory-lineage-options button { display:flex; align-items:center; justify-content:space-between; gap:6px; width:100%; text-align:start; min-height:36px; padding:7px 9px; background:none; border:0; border-radius:5px; font-size:.9rem; overflow-wrap:anywhere; }
.directory-lineage-options button:is(:hover,[aria-pressed="true"]) { background:#edf2e8; color:var(--green); }
.directory-lineage-options p, .directory-empty { color:var(--muted); padding:12px; }
.directory-empty { grid-column:1/-1; padding:26px 4px; }
.directory-empty button { margin-left:5px; }
.search-field { display: flex; gap: 10px; align-items: center; color: #65806d; background: var(--white); min-height: 46px; padding: 0 14px; border: 1px solid #d6ded3; border-radius: 9px; width: min(100%, 390px); }
.search-field input { padding: 10px 0; outline: none; background: transparent; border: 0; width: 100%; min-width: 0; }
.search-field:focus-within { outline: 2px solid #9ab39d; outline-offset: 1px; }
.directory-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,245px),1fr)); gap:13px; }
.directory-card { display: flex; align-items: center; gap: 12px; padding: 16px; text-align: left; }
.directory-card:hover { border-color: #9cb3a2; background: #fcfdf8; }
.directory-card > span:nth-child(2) { flex: 1; }
.directory-card > span:nth-child(2) { min-width:0; overflow-wrap:anywhere; }
.directory-card strong { font-family:var(--serif); font-size:1.19rem; }
.directory-card > svg { color:#7e907d; flex-shrink:0; }
.directory-card small { font-size: .9rem; }
.find-results { display: grid; gap: 8px; margin-top: 14px; }
.find-results .directory-card { box-shadow: none; padding: 9px; }
.find-results .portrait { height: 37px; width: 37px; font-size: 1.15rem; border-radius: 9px; }

.profile-path { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; color: var(--muted); font-size: .87rem; }
.profile-head { display:flex; align-items:center; gap:22px; padding:clamp(20px,3.2vw,42px); color:#faf9ed; background:linear-gradient(90deg,#203b30 32%,#203b30ed 58%,#203b3094 95%), url('/lineage-cover.webp') right 44%/cover; }
.profile-head .pill { background:#ffffff12; border-color:#ffffff4a; color:#efedd9; }
.profile-head .profile-tools .primary { background:#f1edda; color:#274936; border-color:#f1edda; }
.profile-head .profile-tools .primary:hover { background:#e5e1cb; }
.profile-head .profile-tools .button:not(.primary) { background:#233c32cc; color:#f7f7ee; border-color:#8ca091; }
.profile-head .identity { flex: 1; min-width: 0; }
.profile-head h1 { margin-top: 8px; font-size: clamp(2.1rem, 4vw, 3.5rem); overflow-wrap: anywhere; }
.profile-head p { margin-top:8px; color:#e1e8d8; }
.profile-quick { margin: 13px 0; }
.profile-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 15px; margin-top: 16px; }
.profile-block { min-width:0; }
.profile-block.span-2 { grid-column:1 / -1; }
.profile-block > .content-card { height:100%; }
.timeline { max-width:900px; margin-inline:auto; }
.timeline article { padding:0 0 22px 10px; }
.timeline h3 { font:650 1.4rem/1.5 var(--serif); }
.history-filters { display:flex; flex-wrap:wrap; align-items:end; gap:12px; padding:18px; margin-bottom:20px; background:var(--white); border:1px solid var(--line); border-radius:14px; }
.history-filters .field { flex:1 1 140px; margin:0; }
.history-filters .button { margin-bottom:1px; }
.version { border-left:4px solid var(--change-color,#69836c); }
.change-content { --change-color:#62876c; }
.change-security { --change-color:#987342; }
.change-relations { --change-color:#7276a0; }
.change-media { --change-color:#548491; }
.change-deletion { --change-color:#a6635b; }
.version .file-icon { color:var(--change-color); background:color-mix(in srgb,var(--change-color) 12%,white); }
.change-kind { color:var(--change-color); font-weight:650; margin-right:7px; }
.editor-dialog { width:min(760px,calc(100% - 24px)); border-radius:24px; }
.editor-dialog .dialog-head { padding:18px 26px; }
.editor-dialog .dialog-content { padding:24px 26px 0; }
.editor-dialog .dialog-actions { position:sticky; bottom:0; margin:0 -26px; padding:16px 26px; background:var(--white); border-top:1px solid var(--line); z-index:1; }
.editor-dialog .dialog-actions .button { border-radius:24px; min-width:88px; min-height:42px; }
.editor-dialog .field > span { font-size:.82rem; color:#506457; }
.editor-dialog .field :is(input,select,textarea) { padding:13px; border-radius:10px; background:#fbfcf8; }
.editor-person { display:flex; align-items:center; gap:14px; margin-bottom:24px; }
.editor-person strong { display:block; font:650 1.5rem var(--serif); }
.editor-person small { display:block; color:var(--muted); margin-top:5px; }
.editor-section { margin:8px 0 24px; padding:0 16px; border:1px solid var(--line); border-radius:12px; }
.editor-section > summary { padding:16px 0; cursor:pointer; font-weight:600; }
.editor-section h3 { padding:16px 0; font-size:1rem; }
.rich-text { white-space:pre-wrap; line-height:1.9; overflow-wrap:anywhere; color:#354a3e; max-width:900px; }
.attachment-reference { vertical-align:super; line-height:0; padding:0 2px; }
.attachment-reference button { border:0; background:#e6eedf; color:#305d42; border-radius:4px; padding:2px 5px; font-size:.75rem; font-weight:700; }
.story-image { margin:22px 0; white-space:normal; }
.story-image button { display:block; background:#e9eee2; padding:0; border:0; border-radius:14px; overflow:hidden; max-width:100%; }
.story-image img { display:block; max-width:100%; max-height:460px; object-fit:contain; }
.story-image figcaption { color:var(--muted); font-size:.82rem; margin-top:7px; }
.story-editor { border:1px solid #bccdbd; border-radius:12px; margin-bottom:20px; overflow:hidden; }
.story-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:6px; background:#edf2e8; padding:10px; border-bottom:1px solid var(--line); }
.story-toolbar select { flex:1 1 180px; min-width:0; border:1px solid var(--line); background:var(--white); padding:8px; border-radius:6px; max-width:100%; }
.story-toolbar button { border:0; border-radius:6px; background:var(--white); padding:8px 10px; font-size:.82rem; }
.story-toolbar button:hover { background:#dce8d6; }
.story-input { min-height:245px; padding:20px; line-height:1.9; white-space:pre-wrap; overflow-wrap:anywhere; outline:none; }
.story-input:focus { box-shadow:inset 0 0 0 2px #6c9479; }
.story-editor > .field-hint { padding:10px 14px; margin:0; background:#f7f8f3; }
.editor-reference { display:inline-flex; align-items:center; gap:6px; padding:2px 7px; margin:0 3px; background:#e5edde; border:1px solid #c0d0b7; border-radius:5px; font-size:.82rem; user-select:all; }
.editor-reference:has(img) { display:flex; flex-direction:column; width:max-content; max-width:100%; padding:7px; margin:10px 0; }
.editor-reference img { display:block; max-width:100%; max-height:180px; border-radius:6px; }
.reference-unavailable { color:var(--muted); font-size:.82rem; }
.pets-section { grid-column:1 / -1; }
.pet-card { display:flex; gap:18px; align-items:start; padding:18px 0; border-top:1px solid var(--line); }
.pet-photo { position:relative; display:grid; place-items:center; width:100px; height:100px; border-radius:18px; background:#e9e7d9; flex:0 0 auto; overflow:hidden; font-size:2.8rem; color:#77836d; }
.pet-photo img { width:100%; height:100%; object-fit:cover; }
.pet-card.deceased .pet-photo { filter:grayscale(1); }
.pet-memorial { position:absolute; bottom:4px; right:5px; font-size:17px; color:#fff; background:#393e3b; border-radius:50%; width:23px; height:23px; text-align:center; }
.pet-description { min-width:0; flex:1; }
.pet-description h3 { font:650 1.3rem var(--serif); margin-bottom:5px; }
.pet-description .rich-text { margin:10px 0; font-size:.94rem; }
.version-actions { display:flex; flex-direction:column; gap:6px; align-items:end; }
.restore-options { font-size:.82rem; max-width:190px; }
.restore-options summary { cursor:pointer; padding:7px; }
.restore-options .button { display:block; width:100%; margin-top:5px; white-space:normal; }
.text-preview { white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; line-height:1.8; padding:16px; background:#f2f4ed; border-radius:10px; }
.content-card { min-width: 0; padding: 17px 19px 20px; }
.content-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 15px; }
.content-card h2 { font-size: 1.13rem; }
.content-card header h2 { font:650 1.32rem/1.3 var(--serif); }
.profile-quick .button { border-color:transparent; color:#415d48; background:transparent; }
.file-thumb { width:48px; height:48px; padding:0; overflow:hidden; flex-shrink:0; border:1px solid var(--line); border-radius:7px; background:var(--paper); }
.file-thumb img { width:100%; height:100%; object-fit:cover; }
.account-options { position:relative; }
.account-options summary { display:flex; align-items:center; justify-content:center; gap:7px; min-height:34px; padding:5px 10px; border:1px solid var(--line); border-radius:7px; cursor:pointer; color:var(--green); font-size:.85rem; }
.account-options[open] > div { min-width:145px; }
.account-options .button { display:flex; border:0; width:100%; justify-content:flex-start; }
.admin-row .admin-account { flex-basis:180px; }
.empty, .empty-inline { color: var(--muted); }
.empty { padding: 36px 20px; text-align: center; }
.empty-inline { padding: 10px 0 5px; line-height: 1.6; font-size: .93rem; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.72; }
.timeline { border-left: 1px solid #d7e2d4; margin: 0 4px; padding-left: 14px; }
.timeline article { position: relative; margin-bottom: 20px; min-width: 0; }
.timeline article:last-child { margin-bottom: 0; }
.timeline article::before { position: absolute; content: ''; width: 9px; height: 9px; border: 2px solid var(--white); box-shadow: 0 0 0 1px #a3b59f; background: #75987c; border-radius: 50%; left: -19px; top: 5px; }
.timeline h3 { margin: 6px 0; font-size: 1rem; overflow-wrap: anywhere; }
.timeline .date { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: .88rem; }
.timeline .row-actions { margin-top: 10px; }
.file-row, .admin-row { border-top: 1px solid #e7ece3; padding: 11px 0; min-width: 0; display: flex; align-items: center; gap: 10px; }
.file-row:last-child, .admin-row:last-child { padding-bottom: 0; }
.file-title, .admin-row > div:first-child, .admin-account { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.file-icon { width: 39px; height: 39px; border-radius: 9px; background: #eaf1e6; color: #4e7258; display: grid; place-items: center; flex: 0 0 auto; }
.file-row .row-actions, .admin-row .row-actions { justify-content: flex-end; }
.preview img { max-width: 100%; max-height: 60vh; display: block; margin: auto; }
.preview { margin-bottom: 15px; }
.preview :is(video, audio, iframe) { width: 100%; border: 0; }
.preview iframe { min-height: 55vh; }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.admin-group + .admin-group { margin-top: 22px; }
.admin-group h3 { font-size: 1rem; margin-bottom: 9px; color: #516a58; }
.admin-account strong .pill { vertical-align: middle; margin-left: 5px; }
.version-list { display: grid; gap: 8px; margin-bottom: 12px; }
.version { padding: 13px 15px; display: flex; align-items: flex-start; gap: 11px; }
.version-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.version details { margin-top: 9px; }
.version summary { cursor: pointer; color: var(--green); font-size: .87rem; }
.change-list { display: grid; gap: 12px; margin-top: 10px; }
.change-field { display: grid; grid-template-columns: minmax(55px,.4fr) repeat(2,minmax(0, 1fr)); gap: 6px; margin-top: 5px; font-size: .83rem; }
.change-field span, .change-field del, .change-field ins { padding: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.change-field del { color: #754b44; background: #f7ebea; text-decoration: none; }
.change-field ins { color: #2e5635; background: #e9f2e5; text-decoration: none; }

dialog { padding: 0; width: min(610px, calc(100% - 24px)); max-height: calc(100dvh - 24px); color: var(--ink); background: var(--white); border: 1px solid #d8e2d6; border-radius: 15px; box-shadow: 0 18px 60px #1a352945; overflow: auto; }
dialog::backdrop { background: #162d23a0; backdrop-filter: blur(2px); }
.dialog-head { position: sticky; top: 0; z-index: 1; background: var(--white); border-bottom: 1px solid #e2e8de; min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 17px; }
.dialog-head h2 { font-size: 1.15rem; overflow-wrap: anywhere; }
.dialog-content { padding: 17px; }
.dialog-description { font-size: .95rem; color: var(--muted); line-height: 1.6; margin-bottom: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .91rem; font-weight: 650; margin-bottom: 7px; }
.field :is(input, select, textarea) { display: block; width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; background: var(--white); color: var(--ink); border: 1px solid #ccd8cd; border-radius: 8px; outline: none; }
.field select:not([multiple]) { appearance: none; padding-right: 31px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3E%3Cpath d='m3 6 5 5 5-5' fill='none' stroke='%23547662' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.field :is(input,select,textarea):focus { border-color: #6d9880; box-shadow: 0 0 0 3px #9abcaa44; }
.field textarea { resize: vertical; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.check { display: flex; align-items: center; min-height: 37px; gap: 8px; font-size: .92rem; font-weight: 600; }
.check input { width: 17px; height: 17px; accent-color: var(--green); }
.form-error { color: #943b31; font-size: .9rem; line-height: 1.45; }
.form-error:not(:empty) { margin: 8px 0; }
.field-hint { margin:-5px 0 14px; font-size:.83rem; line-height:1.5; color:var(--muted); }
.layout-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.policy-body h3 { margin: 10px 0; font-size: 1rem; }
.policy-body h3:not(:first-child) { margin-top: 24px; }
#toast:empty { display: none; }
#toast { position: fixed; z-index: 20; bottom: 24px; right: 24px; max-width: min(400px, calc(100vw - 40px)); background: var(--green); color: white; padding: 12px 17px; border-radius: 9px; box-shadow: var(--shadow); font-size: .92rem; }
#toast.error { background: #883e32; }

@media (max-width: 980px) {
  .tree-layout { grid-template-columns:minmax(0,1fr); }
  .inspector { display:grid; grid-template-columns:minmax(220px,1fr) minmax(0,2fr); align-content:start; }
  .inspector-head, .inspector-person, .inspector-actions { grid-column:1; align-self:start; }
  .inspector-related { grid-column:2; grid-row:1 / 4; border-top:0; border-left:1px solid var(--line); max-height:310px; }
  .inspector-related .kin-group { display:grid; grid-template-columns:minmax(95px,.65fr) minmax(0,1fr); gap:0 12px; }
  .inspector-related .kin-group h4 { grid-row:1 / span 6; align-self:start; padding-top:8px; }
  .graph-viewport { height:clamp(425px,61vh,630px); }
  .mobile-inspect { display:flex; align-items:center; justify-content:center; gap:7px; width:100%; min-height:38px; border:0; border-top:1px solid var(--line); background:#f7f8f1; color:var(--green); font-size:.85rem; }
  .mobile-inspect svg { transform:rotate(90deg); }
  .app-header { gap: 15px; padding-inline: 19px; }
  .nav-item { padding-inline: 10px; }
  .shell { padding-inline: 18px; }
  .file-row { flex-wrap: wrap; }
  .file-row .row-actions { width: 100%; justify-content: flex-start; }
}
@media (max-width: 760px) {
  .app-header { height: auto; min-height: 103px; padding: 10px 14px 7px; display: grid; grid-template-columns: 1fr auto; gap: 6px; }
  .app-header nav { grid-row: 2; grid-column: 1/-1; overflow-x: auto; justify-content: flex-start; }
  .brand img { width: 36px; height: 36px; }
  .brand strong { font-size: 1.08rem; }
  .brand small { font-size: .65rem; margin-top: 3px; }
  .nav-item { min-height:40px; padding:7px 9px; font-size:.82rem; gap:5px; white-space:nowrap; flex-shrink:0; }
  .header-user { grid-column: 2; grid-row: 1; justify-self: end; }
  .user-lines { display: none; }
  .shell { padding:13px 13px 30px; }
  .archive-cover { min-height:155px; padding:19px; margin-bottom:13px; border-radius:11px; }
  .archive-cover::before { background:linear-gradient(90deg,#192f26 0%,#192f26f0 30%,#192f2680 65%,#192f2605 100%); }
  .archive-identity { max-width:95%; }
  .archive-title { margin:8px 0 12px; }
  .archive-title h1 { font-size:clamp(2.05rem,7.6vw,3rem); }
  .archive-counts { gap:9px; }
  .archive-counts span { gap:4px; }
  .graph-head { padding:11px 12px; }
  .graph-head h2 { font-size:1.17rem; }
  .graph-tools .button { font-size:.84rem; padding-inline:8px; gap:4px; }
  .inspector { display:block; }
  .inspector-related { border-left:0; border-top:1px solid var(--line); }
  .page-title { flex-wrap: wrap; gap: 13px; margin-bottom: 16px; }
  .page-title p { font-size: .95rem; margin-top: 7px; }
  .tree-layout, .profile-sections, .admin-grid { grid-template-columns: minmax(0,1fr); }
  .profile-block { grid-column:1 / -1; }
  .graph-viewport { height:clamp(365px,54svh,540px); }
  .graph-foot { flex-wrap:wrap; row-gap:3px; }
  .graph-foot .zoom { margin-left:auto; }
  .graph-tools :is(.key-button,.toolbar-search) { font-size:0; gap:0; width:35px; }
  .inspector-related { max-height: none; }
  .profile-head { gap: 13px; flex-wrap: wrap; padding: 16px; }
  .portrait.avatar-hero { width:75px; height:75px; font-size:2.5rem; }
  .profile-tools { flex-basis: 100%; }
  .profile-tools .button, .profile-quick .button { min-height: 38px; }
  .directory-toolbar { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px; }
  .directory-lineages { max-width:min(40vw,180px); }
  .directory-tabs button { font-size:.88rem; }
  .admin-account small { font-size: .79rem; }
  .admin-row { flex-wrap: wrap; }
  .admin-row .row-actions { width: 100%; justify-content: flex-start; }
}
@media (max-width: 660px) {
  .login { grid-template-columns: 1fr; }
  .login-side { padding:20px 24px; min-height:70svh; }
  .login-cover { order:-1; display:flex; min-height:23svh; background-position:50% 45%; }
  .cover-caption { padding:18px 24px; }
  .cover-caption > span { margin-bottom:7px; }
  .cover-caption h2 { font-size:1.75rem; }
  .login-body { justify-self: start; width: min(100%,430px); padding: 24px 0; }
}
@media (max-width: 382px) {
  .nav-item { padding-inline: 7px; gap: 4px; }
  .nav-item svg { width: 14px; height: 14px; }
  .shell { padding-inline: 10px; }
  .button { padding-inline: 10px; }
  .graph-tools .toolbar-search { font-size:0; gap:0; width:34px; }
  .graph-head, .graph-foot { padding-inline: 10px; }
  .legend { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; }
}
