/* Rodovid Atelier — 2026. The personal archive, not a new data model.
   This is a strictly visual layer above the existing Ukrainian UI.
   CRITICAL: genealogy card geometry is 220px × 102px; never alter it. */
:root{
  --rv-page:#f1f5f8;--rv-panel:#fff;--rv-panel2:#f7f9fc;
  --rv-fg:#172b3e;--rv-muted:#60768b;--rv-border:#dce5ec;
  --rv-accent:#216ba7;--rv-royal:#102d4b;
  --rv-gold:#d1a458;--rv-green:#268970;
  --rv-shadow:0 12px 34px rgba(12,40,67,.085);
  --atelier-halo:rgba(33,107,167,.12);
}
:root[data-theme="dark"]{
  --rv-page:#091522;--rv-panel:#12273b;--rv-panel2:#1a3045;
  --rv-fg:#ecf4fa;--rv-muted:#b4c9d8;--rv-border:#344b61;
  --rv-accent:#8fcaff;--rv-royal:#081725;
  --rv-gold:#ebc47d;--rv-green:#79d5bd;
  --rv-shadow:0 18px 48px rgba(0,0,0,.2);
  --atelier-halo:rgba(117,198,255,.16);
}
:root[data-theme="sepia"],:root[data-theme="archive"]{--atelier-halo:rgba(147,108,58,.12)}
*{scrollbar-color:var(--rv-border) transparent}
body{color:var(--rv-fg);-webkit-font-smoothing:antialiased}
.app,.main{background:var(--rv-page)}
.sidebar{
  background:linear-gradient(171deg,#102b43 0%,#183a58 56%,#102e45 100%);
  border-right:1px solid rgba(224,237,248,.14);
}
:root[data-theme="dark"] .sidebar{background:linear-gradient(171deg,#061320,#122f47 63%,#091725)}
:root[data-theme="sepia"] .sidebar{background:linear-gradient(170deg,#423d34,#5b5340)}
:root[data-theme="archive"] .sidebar{background:linear-gradient(165deg,#343b31,#57533d 62%,#34352c)}
.sidebar .brand{position:relative}
.sidebar .brand .mark,.auth-card .brand .mark{
  border-radius:15px;
  background:linear-gradient(140deg,rgba(255,255,255,.12),rgba(212,171,98,.13));
  box-shadow:inset 0 1px 0 #ffffff22,0 8px 20px #07162519;
}
.sidebar .brand strong{letter-spacing:.16em;font-weight:800}
.sidebar .menu-label{font-size:10px;letter-spacing:.15em;color:#b4c8d6}
.sidebar .menu{gap:4px}
.sidebar .nav{
  border-radius:11px;
  min-height:42px;
  transition:background .2s ease,border-color .2s ease,box-shadow .2s ease;
}
.sidebar .nav:hover{background:rgba(255,255,255,.11);transform:none}
.sidebar .nav.active{
  background:linear-gradient(90deg,rgba(215,185,124,.22),rgba(255,255,255,.085))!important;
  border-color:#d5b57466!important;
  box-shadow:inset 3px 0 #e7c27e,0 4px 12px #09172618;
}
.sidebar :is(.project,.help){border-radius:15px}
.sidebar #tree-selector{
  min-height:39px;border:1px solid #ffffff44;border-radius:10px;
  background:rgba(255,255,255,.10);color:#fff;padding:8px;
}
.sidebar #tree-selector option{color:#192d41}
.sidebar #create-tree{
  border-radius:10px;min-height:38px;border:1px solid #d5b57466;
  background:rgba(213,181,116,.13);color:#fff;
}
.sidebar #create-tree:hover{background:rgba(213,181,116,.24)}
.topbar{
  background:var(--rv-panel);
  border-bottom:1px solid var(--rv-border);
  box-shadow:0 5px 18px rgba(10,34,57,.035);
}
.heading h1,.section-header h2,.auth-card h1{
  font-family:"Noto Serif",Georgia,serif;
  font-weight:700;letter-spacing:-.055em;
}
.heading h1{font-size:clamp(21px,2.4vw,29px)}
.heading .eyebrow{letter-spacing:.15em}
.topbar .actions{gap:10px;min-width:0}
.topbar .search{
  border:1px solid var(--rv-border);border-radius:13px;
  background:var(--rv-panel2);
  box-shadow:inset 0 1px 2px rgba(0,0,0,.015);
}
.topbar .search:focus-within{
  border-color:var(--rv-accent);
  box-shadow:0 0 0 3px var(--atelier-halo);
}
:where(.topbar,.toolbar,.modal,.auth-card) .button{
  border-radius:11px;
}
.button.primary{
  background:linear-gradient(125deg,#18476f,#17658f);
  border-color:#1b557f;box-shadow:0 6px 18px rgba(21,86,136,.16);
  color:#fff;
}
.button.primary:hover{background:linear-gradient(125deg,#1a547e,#207fa7)}
:root[data-theme="dark"] .button.primary{background:linear-gradient(130deg,#275c86,#287aa2)}
.button.secondary,.topbar .button:not(.primary){
  border-color:var(--rv-border);color:var(--rv-fg);
  background:var(--rv-panel2);
}
.button.secondary:hover,.topbar .button:not(.primary):hover{border-color:var(--rv-accent)}
.toolbar{
  background:var(--rv-panel);
  border-bottom:1px solid var(--rv-border);
}
.toolbar select,.tree-mode-picker select,.theme-picker select{
  background:var(--rv-panel2);color:var(--rv-fg);
  border:1px solid var(--rv-border);
  border-radius:10px;min-height:37px;
}
.toolbar .toolname{letter-spacing:.02em;font-weight:800}
.toolbar .zoom{border-radius:11px;overflow:hidden}
.toolbar .zoom button:hover{background:var(--atelier-halo)}
.canvas{
  background-color:var(--rv-page);
  background-image:
    radial-gradient(circle at 55% 15%,var(--atelier-halo),transparent 40%),
    radial-gradient(var(--rv-border) .72px,transparent .9px);
  background-size:100% 100%,25px 25px;
}
:root[data-theme="dark"] .canvas{
  background-image:
    radial-gradient(circle at 55% 15%,rgba(40,106,150,.12),transparent 44%),
    radial-gradient(#59728842 .7px,transparent .95px);
}
#nodes .person{
  /* Deliberately preserve exact JS geometry. */
  width:220px;height:102px;
  border-radius:14px;
  box-shadow:0 8px 20px rgba(24,54,77,.09);
  transition:box-shadow .18s ease,border-color .18s ease;
}
#nodes .person:hover,#nodes .person:focus-within{
  box-shadow:0 15px 32px rgba(21,62,94,.17);
}
:root[data-theme="dark"] #nodes .person{
  background:var(--rv-panel);color:var(--rv-fg);
  box-shadow:0 8px 24px rgba(0,0,0,.22);
}
:root[data-theme="dark"] #nodes .person:hover{box-shadow:0 14px 35px #0007}
#nodes .parent-slot{border-radius:12px}
.list-person,.stat,.about-card,.release-card,.kinship-tool,
#detail.detail,.modal,.auth-card{
  border-color:var(--rv-border);
  box-shadow:var(--rv-shadow);
}
.list-person,.stat,.about-card,.release-card{border-radius:15px}
.list-person:hover,.stat:hover{box-shadow:0 14px 35px rgba(12,40,67,.11)}
#detail .panel-section{border-color:var(--rv-border)}
#detail .identity h2{font-family:"Noto Serif",Georgia,serif;line-height:1.27}
.modal{border-radius:19px;background:var(--rv-panel);color:var(--rv-fg)}
.modal .modal-header{background:var(--rv-panel)}
.modal .field-grid :is(input,select,textarea){
  min-height:39px;border-radius:10px;
  border:1px solid var(--rv-border);
  background:var(--rv-panel2);color:var(--rv-fg);
}
.modal .field-grid textarea{line-height:1.5}
.auth-wrap{
  min-height:100dvh;
  background:
    radial-gradient(circle at 13% 20%,rgba(245,198,98,.19),transparent 33%),
    radial-gradient(circle at 90% 77%,rgba(87,184,220,.19),transparent 36%),
    linear-gradient(145deg,#102b45,#0d2539 65%,#1c425b);
}
.auth-card{border-radius:24px;padding:clamp(24px,3vw,41px)}
.auth-card h1{font-size:clamp(28px,3vw,38px)}
.auth-card input{border-radius:10px;background:var(--rv-panel2);color:var(--rv-fg);border-color:var(--rv-border)}
.auth-card input:focus{border-color:var(--rv-accent);box-shadow:0 0 0 3px var(--atelier-halo)}
.auth-card .auth-signature{border-top:1px solid var(--rv-border);padding-top:13px}
.site-credit{color:var(--rv-muted)}
/* Accessibility: keyboard navigation and text selection remain explicit. */
:where(button,a,input,select,textarea,summary):focus-visible{
  outline:3px solid var(--rv-accent)!important;
  outline-offset:3px;
}
:where(.nav,.button,.person,button){-webkit-tap-highlight-color:transparent}
@media(max-width:1100px){
 .heading h1{font-size:22px}
 .topbar .actions{gap:6px}
}
@media(max-width:700px){
  .auth-wrap{padding:calc(env(safe-area-inset-top,0px) + 12px) 12px calc(env(safe-area-inset-bottom,0px) + 14px)}
  .auth-card{border-radius:18px;padding:23px 18px}
  .topbar{box-shadow:none}
  #toolbar .toolbar-tools{gap:6px}
  .tree-mode-picker select{max-width:150px}
  .list-person,.about-card,.stat{border-radius:12px}
  .modal{max-height:95dvh}
}
@media(prefers-reduced-motion:reduce){
 .sidebar .nav,#nodes .person,.button,.list-person,.stat{transition:none!important;animation:none!important}
}

/* Transparent platform diagnostics, measured locally — never uploaded. */
#platform-diagnostics{
  border:1px solid #ffffff3d;border-radius:11px;
  min-width:36px;min-height:36px;background:#ffffff12;color:#fff;
  font-size:19px;line-height:1;
}
#platform-diagnostics:hover{border-color:#e0be7b;background:#ffffff20}
.platform-health-dialog{
  position:fixed;inset:auto;margin:auto;
  width:min(760px,calc(100vw - 26px));max-height:min(90dvh,900px);
  padding:0;overflow:auto;border:1px solid var(--rv-border);
  border-radius:20px;background:var(--rv-panel);color:var(--rv-fg);
  box-shadow:0 35px 110px rgba(3,17,30,.4);
}
.platform-health-dialog::backdrop{background:rgba(2,14,25,.64);backdrop-filter:blur(3px)}
.platform-health-head{
  position:sticky;top:0;z-index:1;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:21px 24px 16px;background:var(--rv-panel);border-bottom:1px solid var(--rv-border);
}
.platform-health-head h2{font-family:"Noto Serif",Georgia,serif;font-size:23px;letter-spacing:-.035em;margin:5px 0 0}
.platform-health-head [data-platform-close]{
  background:var(--rv-panel2);border:1px solid var(--rv-border);
  border-radius:11px;color:var(--rv-fg);width:38px;height:38px;font-size:24px;
}
.platform-health-content{padding:21px 24px;max-width:100%;overflow-wrap:anywhere}
.platform-health-intro{font-size:13px;line-height:1.6;color:var(--rv-muted);margin:0 0 18px}
.platform-health-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.platform-health-item{padding:16px;border:1px solid var(--rv-border);border-radius:14px;background:var(--rv-panel2)}
.platform-health-item-top{display:flex;align-items:center;gap:9px}
.platform-health-symbol{display:grid;place-items:center;width:30px;height:30px;flex:0 0 30px;border-radius:9px;background:var(--atelier-halo);color:var(--rv-accent)}
.platform-health-item strong{font-size:13px;flex:1}
.platform-health-status{font-size:10px;font-weight:700;color:var(--rv-muted);text-align:right}
.platform-health-item p{font-size:11px;line-height:1.55;color:var(--rv-muted);margin:10px 0 0}
.platform-health-guidance{margin-top:17px;padding:17px;border:1px solid var(--rv-border);border-radius:14px}
.platform-health-guidance h3{margin:0 0 8px;font-size:15px}
.platform-health-guidance p{font-size:12px;line-height:1.65;margin:0;color:var(--rv-muted)}
.platform-health-links{display:flex;flex-wrap:wrap;gap:9px;margin-top:14px}
.platform-health-links a{
  display:inline-flex;align-items:center;padding:9px 10px;min-height:36px;
  border:1px solid var(--rv-border);border-radius:9px;
  color:var(--rv-accent);text-decoration:none;font-size:11px;font-weight:750;
}
.platform-health-links a:hover{border-color:var(--rv-accent);background:var(--atelier-halo)}
.platform-health-foot{
  position:sticky;bottom:0;display:flex;justify-content:flex-end;gap:10px;
  padding:15px 24px;background:var(--rv-panel);border-top:1px solid var(--rv-border);
}
@media(max-width:630px){
 .platform-health-dialog{max-height:94dvh;border-radius:15px}
 .platform-health-head{padding:15px}
 .platform-health-head h2{font-size:19px}
 .platform-health-content{padding:13px}
 .platform-health-grid{grid-template-columns:minmax(0,1fr)}
 .platform-health-foot{padding:12px;flex-wrap:wrap}
 .platform-health-foot button{flex:1;min-width:110px}
}

.platform-perf-consent{margin-top:15px;padding:17px;border-radius:14px;background:var(--rv-panel2);border:1px solid var(--rv-border)}
.platform-perf-consent h3{font-size:15px;margin:0 0 8px}
.platform-perf-consent p{font-size:12px;line-height:1.6;color:var(--rv-muted);margin:0 0 13px}
.platform-perf-consent button{min-height:37px}
.platform-perf-state{display:block;font-size:11px;color:var(--rv-muted);margin-top:9px}

/* Capacity review is local-only and never loads extra Firebase SDKs. */
.archive-capacity-report{margin:14px 0;padding:17px;border:1px solid var(--rv-border);border-radius:14px;background:var(--rv-panel2);max-width:100%;overflow-wrap:anywhere}
.archive-capacity-report[hidden]{display:none!important}
.archive-capacity-top{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.archive-capacity-top h3{font-size:15px;margin:0}
.archive-capacity-status{padding:5px 9px;border-radius:9px;background:var(--atelier-halo);font-size:11px;font-weight:800}
.archive-capacity-watch,.archive-capacity-high{color:#b46916;background:#d9942b1b}
.archive-capacity-blocked{color:#b93446;background:#c53b501c}
.archive-capacity-number{font-size:25px;font-weight:850;letter-spacing:-.04em;margin:9px 0}
.archive-capacity-progress{display:block;width:100%;height:11px;accent-color:var(--rv-accent)}
.archive-capacity-stats,.archive-capacity-advice,.archive-capacity-explain{font-size:12px;line-height:1.6;margin:10px 0;color:var(--rv-fg)}
.archive-capacity-explain{font-size:11px;color:var(--rv-muted)}
.archive-capacity-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.rodovid-cloud-notice{padding:11px 18px;text-align:center;font-size:12px;font-weight:700;color:var(--rv-fg);background:var(--atelier-halo);border-bottom:1px solid var(--rv-border)}
body[data-remote-accent="forest"]{--rv-accent:#21866b;--atelier-halo:rgba(46,163,131,.14)}
body[data-remote-accent="amber"]{--rv-accent:#b17c25;--atelier-halo:rgba(207,148,58,.14)}
body[data-remote-accent="ocean"]{--rv-accent:#216ba7;--atelier-halo:rgba(33,107,167,.12)}
@media(max-width:640px){.archive-capacity-report{padding:13px}.archive-capacity-top h3{font-size:14px}.archive-capacity-actions button{width:100%}}
