:root{
  --bg:#0b1220;
  --panel:#111827;
  --panel-2:#172033;
  --panel-3:#0f172a;
  --text:#e5e7eb;
  --muted:#94a3b8;
  --line:#243043;
  --line-soft:rgba(148,163,184,.14);
  --accent:#38bdf8;
  --accent-2:#22c55e;
  --warn:#f59e0b;
  --danger:#ef4444;
  --chip:#162235;
  --shadow:0 14px 36px rgba(0,0,0,.28);
  --shadow-soft:0 8px 20px rgba(0,0,0,.16);
  --radius-xl:24px;
  --radius-lg:18px;
  --radius-md:14px;
  --radius-sm:12px;
}
body.light{
  --bg:#f5f7fb;
  --panel:#ffffff;
  --panel-2:#f8fafc;
  --panel-3:#eef3f8;
  --text:#0f172a;
  --muted:#475569;
  --line:#dbe4ee;
  --line-soft:rgba(15,23,42,.08);
  --accent:#0284c7;
  --accent-2:#16a34a;
  --warn:#d97706;
  --danger:#dc2626;
  --chip:#edf2f7;
  --shadow:0 18px 40px rgba(15,23,42,.08);
  --shadow-soft:0 10px 24px rgba(15,23,42,.06);
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  background:
    radial-gradient(circle at top right, rgba(56,189,248,.10), transparent 26%),
    radial-gradient(circle at bottom left, rgba(34,197,94,.08), transparent 24%),
    var(--bg);
  color:var(--text);
  line-height:1.45;
}
.hidden{display:none !important}
.app-shell{display:grid;grid-template-columns:290px 1fr;min-height:100vh}
.sidebar{
  background:linear-gradient(180deg,var(--panel-3),var(--panel));
  border-right:1px solid var(--line-soft);
  padding:24px 18px;
  position:sticky;
  top:0;
  height:100vh;
  overflow:auto;
}
.brand{
  font-size:1.18rem;
  font-weight:900;
  letter-spacing:.2px;
  margin-bottom:22px;
  line-height:1.2;
}
.brand small{
  display:block;
  color:var(--muted);
  font-weight:600;
  margin-top:8px;
  font-size:.76rem;
}
.nav{display:grid;gap:6px}
.nav button{
  width:100%;
  border:none;
  background:transparent;
  color:var(--text);
  text-align:left;
  padding:13px 14px;
  border-radius:14px;
  cursor:pointer;
  font-weight:700;
  transition:background .18s ease, transform .18s ease, color .18s ease, box-shadow .18s ease;
}
.nav button.active,
.nav button:hover{
  background:linear-gradient(180deg, rgba(56,189,248,.16), rgba(56,189,248,.10));
  box-shadow:inset 0 0 0 1px rgba(56,189,248,.18);
}
.nav button:active{transform:translateY(1px)}
.sidebar .meta{
  margin-top:22px;
  padding-top:18px;
  border-top:1px solid var(--line-soft);
  color:var(--muted);
  font-size:.92rem;
}
.content{padding:28px;min-width:0}
.topbar{
  display:flex;
  gap:18px;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
  margin-bottom:24px;
}
.topbar h1{
  margin:0 0 6px;
  font-size:clamp(1.7rem, 2vw, 2.2rem);
  line-height:1.05;
  letter-spacing:-.03em;
}
.topbar .muted{max-width:760px}
.topbar .filters{display:flex;gap:10px;flex-wrap:wrap;flex:1 1 780px;max-width:820px}
.topbar-right{display:flex;align-items:flex-start;gap:24px;flex-wrap:nowrap;justify-content:space-between;width:min(100%, 1180px)}
.topbar-logos{display:flex;flex-direction:column;align-items:stretch;gap:14px;flex:0 0 248px;justify-content:flex-start;padding-top:4px}
.logo-badge{
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(255,255,255,.96);
  border:1px solid rgba(148,163,184,.22);
  border-radius:22px;
  padding:16px 18px;
  width:200px;
  min-height:132px;
  box-shadow:var(--shadow-soft);
}
.logo-badge img{display:block;max-height:94px;max-width:196px;object-fit:contain;mix-blend-mode:multiply}
.card{
  background:linear-gradient(180deg,var(--panel),var(--panel-2));
  border:1px solid var(--line-soft);
  border-radius:var(--radius-lg);
  padding:18px;
  box-shadow:var(--shadow-soft);
}
.grid{display:grid;gap:18px}
.grid.kpi{grid-template-columns:repeat(6,minmax(0,1fr));gap:14px}
.grid.two{grid-template-columns:minmax(0,1.25fr) minmax(320px,.75fr)}
.grid.three{grid-template-columns:repeat(auto-fit,minmax(280px,1fr))}
.kpi .value{font-size:1.6rem;font-weight:900;line-height:1.05;letter-spacing:-.02em}
.card.kpi{padding:16px 16px 14px;border-radius:20px}
.card.kpi .muted{font-size:.76rem;line-height:1.2;margin-bottom:8px;text-transform:uppercase;letter-spacing:.06em}
.muted{color:var(--muted)}
.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:var(--chip);
  padding:7px 11px;
  border-radius:999px;
  font-size:.79rem;
  font-weight:700;
  border:1px solid var(--line-soft);
}
.badge{padding:5px 10px;border-radius:999px;font-size:.75rem;font-weight:800;letter-spacing:.01em;border:1px solid transparent}
.badge.hotspot{background:#7c3aed20;color:#c4b5fd;border-color:#7c3aed30}
.badge.semi-final{background:#0ea5e920;color:#7dd3fc;border-color:#0ea5e930}
.badge.final{background:#16a34a20;color:#86efac;border-color:#16a34a30}
.badge.extra-final{background:#f59e0b20;color:#fde68a;border-color:#f59e0b30}
.badge.other{background:#6b728020;color:#d1d5db;border-color:#6b728030}
.badge.training{background:#334155;color:#e2e8f0}
.status-active{color:var(--accent-2);font-weight:700}
.status-lost{color:var(--danger);font-weight:700}
.status-finished{color:var(--accent);font-weight:700}
.status-returned{color:var(--warn);font-weight:700}
h1,h2,h3{margin:0 0 12px}
h2{font-size:1.12rem;line-height:1.2;letter-spacing:-.01em}
h3{font-size:1rem;line-height:1.25}
label{display:block;margin-bottom:6px;font-size:.84rem;font-weight:700;color:var(--muted)}
input,select,textarea,button{font:inherit}
input,select,textarea{
  width:100%;
  background:var(--panel-3);
  color:var(--text);
  border:1px solid var(--line);
  border-radius:14px;
  padding:11px 13px;
  transition:border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input::placeholder, textarea::placeholder{color:color-mix(in srgb, var(--muted) 88%, transparent)}
input:focus,select:focus,textarea:focus{
  outline:none;
  border-color:rgba(56,189,248,.55);
  box-shadow:0 0 0 4px rgba(56,189,248,.14);
}
textarea{min-height:96px;resize:vertical}
button.primary,button.secondary,button.danger,button.ghost{
  border:none;
  border-radius:14px;
  padding:10px 15px;
  cursor:pointer;
  font-weight:800;
  letter-spacing:.01em;
  transition:transform .14s ease, opacity .14s ease, box-shadow .14s ease;
}
button:hover{opacity:.96}
button:active{transform:translateY(1px)}
button.primary{background:linear-gradient(180deg,var(--accent),color-mix(in srgb, var(--accent) 78%, #000 22%));color:white;box-shadow:0 10px 24px rgba(2,132,199,.24)}
button.secondary{background:linear-gradient(180deg,var(--accent-2),color-mix(in srgb, var(--accent-2) 82%, #000 18%));color:white;box-shadow:0 10px 24px rgba(22,163,74,.22)}
button.danger{background:linear-gradient(180deg,var(--danger),color-mix(in srgb, var(--danger) 82%, #000 18%));color:white;box-shadow:0 10px 24px rgba(220,38,38,.18)}
button.ghost{background:var(--chip);color:var(--text);border:1px solid var(--line-soft)}
.form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}
.toolbar{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin-bottom:14px}
table{width:100%;border-collapse:separate;border-spacing:0}
th,td{padding:12px 10px;border-bottom:1px solid var(--line-soft);vertical-align:top;font-size:.93rem}
th{color:var(--muted);text-align:left;font-size:.77rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em;position:sticky;top:0;background:linear-gradient(180deg,var(--panel),var(--panel))}
tbody tr:last-child td{border-bottom:none}
tr:hover td{background:rgba(148,163,184,.04)}
.table-wrap{
  overflow:auto;
  border:1px solid var(--line-soft);
  border-radius:16px;
  background:color-mix(in srgb, var(--panel-2) 60%, transparent);
}
.table-wrap table{min-width:100%}
.list-compact{display:grid;gap:10px}
.list-item{display:flex;justify-content:space-between;gap:12px;padding:12px 14px;background:var(--panel-3);border:1px solid var(--line-soft);border-radius:14px}
.chart{width:100%;height:300px;background:var(--panel-3);border:1px dashed var(--line);border-radius:18px;padding:10px;position:relative}
.chart canvas{width:100%;height:100%}
.login{min-height:100vh;display:grid;place-items:center;padding:24px;background:radial-gradient(circle at top right, rgba(56,189,248,.18), transparent 25%), var(--bg)}
.login-card{width:min(460px,100%);padding:28px}
.login-title{font-size:1.7rem;font-weight:950;margin-bottom:6px;letter-spacing:-.03em}
.error{color:#fecaca;background:#7f1d1d;border:1px solid #b91c1c;padding:10px 12px;border-radius:12px}
.success{color:#dcfce7;background:#14532d;border:1px solid #16a34a;padding:10px 12px;border-radius:12px}
.small{font-size:.85rem}
.section{display:none;animation:fadeIn .18s ease}
.section.active{display:block}
.chips{display:flex;gap:8px;flex-wrap:wrap}
.chip{padding:7px 10px;background:var(--chip);border:1px solid var(--line-soft);border-radius:999px;font-size:.84rem}
.right{margin-left:auto}
.inline-actions{display:flex;gap:8px;flex-wrap:wrap}
.sortable{cursor:pointer;user-select:none;position:relative;padding-right:20px}
.sortable::after{content:"↕";position:absolute;right:6px;opacity:.45;font-size:.8em}
.sorted-asc::after{content:"↑";opacity:.9}
.sorted-desc::after{content:"↓";opacity:.9}
.flag-inline{display:inline-block;margin-right:8px;font-size:1rem;vertical-align:baseline}

/* Product polish */
.section > .card + .card,
.section > .grid + .card,
.section > .card + .grid{margin-top:18px}
#dashboard .grid.kpi .card,
#dashboard .card,
#derbies .card,
#pigeons .card,
#races .card,
#results .card,
#highlights .card,
#breeders .card{backdrop-filter:blur(8px)}
#dashboard .grid.kpi .card:nth-child(1){border-top:2px solid rgba(56,189,248,.55)}
#dashboard .grid.kpi .card:nth-child(2){border-top:2px solid rgba(34,197,94,.55)}
#dashboard .grid.kpi .card:nth-child(3){border-top:2px solid rgba(245,158,11,.55)}
#dashboard .grid.kpi .card:nth-child(4){border-top:2px solid rgba(239,68,68,.55)}
#dashboard .grid.kpi .card:nth-child(5){border-top:2px solid rgba(99,102,241,.55)}
#dashboard .grid.kpi .card:nth-child(6){border-top:2px solid rgba(236,72,153,.55)}
#derbies strong,
#pigeons strong,
#races strong,
#highlights strong,
#breeders strong{font-weight:800}
#derbies td:first-child,
#pigeons td:first-child,
#races td:first-child,
#highlights td:first-child{min-width:140px}
#results .table-wrap{overflow-x:auto}
#results .grid.two,
.results-entry-layout{grid-template-columns:1fr}
.rank-input,
#results input[data-rank],
#results input.rank-input{min-width:180px;width:180px}
#results input[data-amount]{min-width:120px}
#results td input,
#results td select{min-height:42px}
#results h2 + .table-wrap,
#highlights h2 + .table-wrap{margin-top:10px}
.highlights-stack{grid-template-columns:1fr}
#highlights .grid.two{grid-template-columns:1fr}
#highlights .card:first-child{margin-bottom:0}
#breeders .card:first-child .muted{font-size:.92rem}
code{background:var(--panel-3);padding:2px 6px;border-radius:8px;border:1px solid var(--line-soft)}

@keyframes fadeIn{from{opacity:.65;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}

@media (max-width:1200px){
  .content{padding:22px}
  .topbar-right{width:100%;flex-wrap:wrap}
  .topbar .filters{max-width:none;flex-basis:100%}
  .topbar-logos{flex-direction:row;flex:1 1 100%;width:100%}
  .logo-badge{width:220px;min-height:122px}
  .logo-badge img{max-height:88px;max-width:180px}
  .grid.kpi{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (max-width:980px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{position:relative;height:auto}
  .topbar-right{justify-content:flex-start}
  .topbar-logos{justify-content:flex-start}
  .grid.two{grid-template-columns:1fr}
  .grid.kpi{grid-template-columns:repeat(2,minmax(0,1fr))}
  .logo-badge{width:190px;min-height:110px;padding:12px 16px}
  .logo-badge img{max-height:76px;max-width:150px}
}
@media (max-width:640px){
  .content{padding:16px}
  .grid.kpi{grid-template-columns:1fr}
  .topbar-logos{flex-direction:column;align-items:flex-start}
  .toolbar{align-items:stretch}
  .toolbar .right{margin-left:0;width:100%}
  button.primary,button.secondary,button.danger,button.ghost{width:100%;justify-content:center}
  .form-grid{grid-template-columns:1fr}
  th,td{padding:10px 8px}
}


/* Icon actions + note indicator */
.inline-actions{
  align-items:center;
  gap:10px;
}
.icon-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:38px;
  height:38px;
  border-radius:12px;
  border:1px solid var(--line-soft);
  background:var(--panel-3);
  color:var(--text);
  cursor:pointer;
  font-size:16px;
  font-weight:700;
  transition:transform .14s ease, box-shadow .14s ease, border-color .14s ease, color .14s ease, background .14s ease;
}
.icon-btn:hover{
  transform:translateY(-1px);
  box-shadow:var(--shadow-soft);
}
.icon-btn-edit:hover,
.icon-btn-edit:focus-visible{
  border-color:rgba(56,189,248,.5);
  color:var(--accent);
  outline:none;
}
.icon-btn-delete:hover,
.icon-btn-delete:focus-visible{
  border-color:rgba(239,68,68,.45);
  color:var(--danger);
  outline:none;
}
.notes-cell{
  text-align:center;
}
.note-indicator,
.note-indicator-empty{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  border-radius:999px;
}
.note-indicator{
  background:rgba(56,189,248,.12);
  border:1px solid rgba(56,189,248,.2);
  cursor:help;
  font-size:15px;
}
.note-indicator-empty{
  color:var(--muted);
  background:transparent;
}


.section-intro{margin:0 0 14px;color:var(--muted);font-size:.95rem}
.field-help{display:block;margin-top:5px;color:var(--muted);font-size:.76rem;line-height:1.35}
.label-with-help{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.help-dot{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:999px;background:var(--chip);border:1px solid var(--line-soft);color:var(--muted);font-size:.64rem;cursor:help}
.table-help{border-bottom:1px dotted currentColor;cursor:help}

/* Expandable pigeon race results */
.pigeon-results-toggle{
  width:34px;
  height:34px;
  font-size:18px;
  line-height:1;
}
.pigeon-results-toggle:hover,
.pigeon-results-toggle:focus-visible{
  border-color:rgba(56,189,248,.5);
  color:var(--accent);
  outline:none;
}
.pigeon-results-row td{
  background:rgba(148,163,184,.035);
  padding:0 10px 14px 10px;
}
.pigeon-results-row:hover td{
  background:rgba(148,163,184,.035);
}
.pigeon-results-panel{
  margin:0 0 4px 44px;
  padding:14px;
  border:1px solid var(--line-soft);
  border-radius:16px;
  background:var(--panel-3);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.02);
}
.pigeon-results-title{
  color:var(--muted);
  font-size:.78rem;
  font-weight:800;
  letter-spacing:.06em;
  margin-bottom:8px;
  text-transform:uppercase;
}
.pigeon-results-table th,
.pigeon-results-table td{
  font-size:.76rem;
  padding:9px 8px;
}

.pigeon-results-panel .table-wrap{display:inline-block;max-width:100%;overflow-x:auto;}
.pigeon-results-table{width:auto;min-width:max-content;table-layout:auto;}
.pigeon-results-table th,
.pigeon-results-table td{white-space:nowrap;width:auto;}
.pigeon-results-table td:nth-child(3){white-space:normal;min-width:180px;max-width:360px;}
.pigeon-results-empty{
  margin:0 0 4px 44px;
  padding:12px 14px;
  border:1px dashed var(--line);
  border-radius:14px;
  color:var(--muted);
  background:var(--panel-3);
  font-size:.9rem;
}

.badge.training{background:#334155;color:#e2e8f0;border-color:#475569}
.badge.inserted{background:#16a34a20;color:#86efac;border-color:#16a34a30}
.badge.updated{background:#0ea5e920;color:#7dd3fc;border-color:#0ea5e930}
.badge.unchanged{background:#6b728020;color:#d1d5db;border-color:#6b728030}
.olr-preview-card{margin-top:10px}

.badge.inventory{background:#64748b20;color:#cbd5e1;border-color:#64748b40}

/* OLR no-results cards */
.olr-no-results-summary{
  border-color:rgba(148,163,184,.22);
  background:linear-gradient(180deg,var(--panel),var(--panel-2));
}
.olr-no-results-box{
  padding:12px 14px;
  border:1px solid var(--line-soft);
  border-radius:14px;
  background:var(--panel-3);
}
.highlight-race-type-filter .pill input{accent-color:var(--accent)}


/* Dashboard derby world map */
.derby-map-card{margin-top:16px}
.derby-map-toolbar{display:flex;gap:12px;align-items:flex-start;justify-content:space-between;flex-wrap:wrap;margin-bottom:12px}
.derby-map-filter{display:flex;gap:8px;align-items:center;min-width:220px}
.derby-map-filter select{min-width:150px}
#derbyWorldMap{width:100%;height:440px;border-radius:18px;border:1px solid var(--line-soft);overflow:hidden;background:var(--panel-3)}
.derby-map-empty{padding:20px;border:1px dashed var(--line);border-radius:18px;color:var(--muted);background:var(--panel-3)}
.derby-map-popup strong{font-weight:900}
.derby-map-popup .muted{font-size:.86rem}
.leaflet-container{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif}
.leaflet-popup-content-wrapper,.leaflet-popup-tip{background:var(--panel);color:var(--text);border:1px solid var(--line-soft)}
.derby-map-pin{font-size:28px;line-height:28px;text-shadow:0 2px 8px rgba(0,0,0,.35)}

/* v29: dark minimalist derby world map with glowing markers and permanent labels */
#derbyWorldMap{
  height:620px;
  border-radius:22px;
  border:1px solid rgba(56,189,248,.16);
  background:radial-gradient(circle at 50% 40%, rgba(56,189,248,.08), transparent 36%), #050a12;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.02), 0 18px 38px rgba(0,0,0,.22);
}
#derbyWorldMap .leaflet-tile-pane{opacity:.82;filter:saturate(.85) contrast(1.08) brightness(.86)}
.derby-glow-marker.active{
  stroke:#7dd3fc;
  fill:#38bdf8;
  filter:drop-shadow(0 0 8px rgba(56,189,248,.95)) drop-shadow(0 0 18px rgba(56,189,248,.35));
}
.derby-glow-marker.inactive{
  stroke:#94a3b8;
  fill:#64748b;
  filter:drop-shadow(0 0 8px rgba(148,163,184,.45));
}
.derby-label-line.active{stroke:#7dd3fc;filter:drop-shadow(0 0 4px rgba(56,189,248,.45))}
.derby-label-line.inactive{stroke:#94a3b8}
.derby-map-label-wrap{background:transparent;border:none;pointer-events:none}
.derby-map-label{
  min-width:136px;
  max-width:168px;
  padding:7px 9px;
  border-radius:13px;
  color:#e5e7eb;
  background:linear-gradient(180deg, rgba(15,23,42,.94), rgba(2,6,23,.88));
  border:1px solid rgba(148,163,184,.22);
  box-shadow:0 14px 30px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.05);
  backdrop-filter:blur(8px);
}
.derby-map-label.active{border-color:rgba(125,211,252,.34);box-shadow:0 14px 30px rgba(0,0,0,.34), 0 0 22px rgba(56,189,248,.10)}
.derby-map-label.inactive{opacity:.72}
.derby-map-label-title{
  font-size:.76rem;
  font-weight:950;
  line-height:1.15;
  letter-spacing:-.01em;
  margin-bottom:3px;
  white-space:normal;
}
.derby-map-label-meta{
  font-size:.64rem;
  line-height:1.18;
  color:#cbd5e1;
  white-space:nowrap;
}
#derbyWorldMap .leaflet-control-attribution{display:block;background:var(--panel);color:var(--text);font-size:11px}
#derbyWorldMap .leaflet-control-attribution a{color:var(--accent,#2bb8ec)}

/* v30: improved map interaction and non-overlapping always-visible labels */
#derbyWorldMap .leaflet-control-zoom{
  border:none;
  box-shadow:0 10px 28px rgba(0,0,0,.35);
}
#derbyWorldMap .leaflet-control-zoom a{
  background:rgba(15,23,42,.92);
  color:#e5e7eb;
  border-color:rgba(148,163,184,.18);
}
#derbyWorldMap .leaflet-control-zoom a:hover{
  background:rgba(30,41,59,.96);
  color:#7dd3fc;
}
#derbyWorldMap .leaflet-interactive{cursor:pointer}
.derby-map-label{
  min-width:188px;
  max-width:230px;
}
.derby-map-label-wrap{z-index:650 !important}
.derby-label-line{stroke-linecap:round}


/* v32: more zoomed-out world map and compact collision labels */
#derbyWorldMap{height:620px;}
.derby-map-label{min-width:136px;max-width:168px;padding:7px 9px;border-radius:13px;}
.derby-map-label-title{font-size:.76rem;line-height:1.1;margin-bottom:3px;}
.derby-map-label-meta{font-size:.64rem;line-height:1.18;}

/* Breeder Intelligence Lab */
.breeder-hero{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-bottom:16px;
  overflow:hidden;
  position:relative;
}
.breeder-hero:after{
  content:"";
  position:absolute;
  inset:auto -60px -80px auto;
  width:260px;
  height:260px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(56,189,248,.18), transparent 68%);
  pointer-events:none;
}
.breeder-hero-badge{
  position:relative;
  z-index:1;
  padding:12px 16px;
  border-radius:999px;
  background:linear-gradient(180deg, rgba(56,189,248,.20), rgba(34,197,94,.13));
  border:1px solid rgba(56,189,248,.22);
  font-weight:900;
  white-space:nowrap;
}
.breeder-kpis{margin-bottom:18px}
.breeder-kpi .value{font-size:1.45rem}
.breeder-feature-grid{grid-template-columns:minmax(0,1.25fr) minmax(360px,.75fr);margin-bottom:18px}
.lineage-card-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(285px,1fr));gap:14px}
.lineage-card{
  background:var(--panel-3);
  border:1px solid var(--line-soft);
  border-radius:20px;
  padding:15px;
  box-shadow:var(--shadow-soft);
}
.lineage-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:12px}
.lineage-card h3{margin:3px 0 0;font-size:1rem;line-height:1.15}
.lineage-rank{color:var(--muted);font-weight:900;font-size:.78rem;letter-spacing:.06em;text-transform:uppercase}
.lineage-power{display:inline-flex;align-items:center;justify-content:center;border-radius:999px;padding:6px 9px;font-weight:900;border:1px solid var(--line-soft);white-space:nowrap}
.lineage-power.elite{background:rgba(34,197,94,.18);color:#86efac}
.lineage-power.strong{background:rgba(56,189,248,.16);color:#7dd3fc}
.lineage-power.solid{background:rgba(245,158,11,.16);color:#fde68a}
.lineage-power.soft{background:rgba(148,163,184,.12);color:var(--muted)}
.lineage-score-row{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin-bottom:12px}
.lineage-score-row div{background:rgba(148,163,184,.07);border:1px solid var(--line-soft);border-radius:14px;padding:9px 8px}
.lineage-score-row span{display:block;color:var(--muted);font-size:.72rem;font-weight:800;text-transform:uppercase;letter-spacing:.04em}
.lineage-score-row strong{display:block;margin-top:2px;font-size:.94rem}
.lineage-distance{display:grid;gap:7px;margin:10px 0 12px}
.lineage-mini-row{display:grid;grid-template-columns:54px 1fr 44px;gap:8px;align-items:center;font-size:.8rem;color:var(--muted)}
.lineage-mini-track{height:9px;background:rgba(148,163,184,.14);border-radius:999px;overflow:hidden;border:1px solid var(--line-soft)}
.lineage-mini-track i{display:block;height:100%;border-radius:999px;background:var(--muted)}
.lineage-mini-track i.elite,.heat-cell.elite{background:linear-gradient(180deg,rgba(34,197,94,.32),rgba(34,197,94,.17));border-color:rgba(34,197,94,.32)}
.lineage-mini-track i.strong,.heat-cell.strong{background:linear-gradient(180deg,rgba(56,189,248,.30),rgba(56,189,248,.15));border-color:rgba(56,189,248,.30)}
.lineage-mini-track i.solid,.heat-cell.solid{background:linear-gradient(180deg,rgba(245,158,11,.27),rgba(245,158,11,.13));border-color:rgba(245,158,11,.28)}
.lineage-mini-track i.soft,.heat-cell.soft{background:linear-gradient(180deg,rgba(148,163,184,.18),rgba(148,163,184,.09));border-color:rgba(148,163,184,.20)}
.lineage-children{display:flex;gap:7px;flex-wrap:wrap}
.lineage-children span{background:var(--chip);border:1px solid var(--line-soft);padding:6px 8px;border-radius:999px;font-size:.78rem}
.lineage-heatmap{display:grid;grid-template-columns:minmax(150px,1.3fr) repeat(3,minmax(82px,1fr));gap:8px;align-items:stretch}
.heat-head{font-weight:900;color:var(--muted);font-size:.76rem;text-transform:uppercase;letter-spacing:.06em;padding:0 6px}
.heat-line{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:var(--panel-3);border:1px solid var(--line-soft);border-radius:12px;padding:10px;font-weight:800;font-size:.86rem}
.heat-cell{border:1px solid var(--line-soft);border-radius:12px;padding:8px;text-align:center;min-height:58px;display:grid;place-items:center}
.heat-cell strong{display:block;font-size:1rem;line-height:1}
.heat-cell span{display:block;color:var(--muted);font-size:.72rem;margin-top:3px}
.breeder-card-row{align-items:start}
.lineage-table-card .table-wrap{max-height:560px}
@media (max-width:1100px){
  .breeder-feature-grid{grid-template-columns:1fr}
}
@media (max-width:720px){
  .breeder-hero{align-items:flex-start;flex-direction:column}
  .lineage-score-row{grid-template-columns:repeat(2,1fr)}
  .lineage-heatmap{grid-template-columns:1fr;gap:6px}
  .heat-head{display:none}
  .heat-line{margin-top:6px}
}


/* v34: breeder heatmap overflow fix + distance definition */
#breeders .card,
#breeders .grid,
.breeder-feature-grid,
.breeder-feature-grid > .card{
  min-width:0;
}
.breeder-feature-grid{
  grid-template-columns:minmax(0,1.25fr) minmax(0,.75fr);
}
.lineage-heatmap{
  width:100%;
  min-width:0;
  grid-template-columns:minmax(0,1.35fr) repeat(3,minmax(72px,1fr));
}
.heat-line,
.heat-cell{
  min-width:0;
}
.heat-cell{
  padding:8px 6px;
  overflow:hidden;
}
.heat-cell strong,
.heat-cell span{
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.distance-definition{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:12px;
  color:var(--muted);
}
.distance-definition span,
.distance-definition strong{
  display:inline-flex;
  align-items:center;
  gap:5px;
  border:1px solid var(--line-soft);
  background:rgba(148,163,184,.08);
  border-radius:999px;
  padding:6px 10px;
  font-size:.82rem;
}
.distance-definition strong{
  color:var(--text);
}
@media (max-width:1350px){
  .breeder-feature-grid{
    grid-template-columns:1fr;
  }
}

/* v35: show full ring numbers in breeder distance heatmap */
.lineage-heatmap{
  grid-template-columns:minmax(148px,148px) repeat(3,minmax(68px,1fr));
  overflow-x:auto;
  padding-bottom:2px;
}
.heat-line{
  white-space:nowrap;
  overflow:visible;
  text-overflow:clip;
  font-size:.82rem;
  padding:10px 8px;
}
@media (max-width:520px){
  .lineage-heatmap{
    grid-template-columns:minmax(150px,150px) repeat(3,minmax(72px,72px));
  }
}

/* v37: compact expanded pigeon race results table */
.pigeon-results-row > td{
  text-align:left;
}
.pigeon-results-panel{
  display:inline-block;
  width:auto;
  max-width:calc(100% - 44px);
  overflow-x:auto;
  padding:12px;
}
.pigeon-results-panel .pigeon-results-title{
  width:max-content;
  max-width:100%;
}
.pigeon-results-table{
  display:inline-table !important;
  width:auto !important;
  min-width:0 !important;
  max-width:none !important;
  table-layout:auto !important;
}
.pigeon-results-table th,
.pigeon-results-table td{
  width:1% !important;
  min-width:0 !important;
  max-width:none !important;
  white-space:nowrap !important;
  padding:8px 12px !important;
}
.pigeon-results-table th:nth-child(3),
.pigeon-results-table td:nth-child(3){
  width:auto !important;
  min-width:150px !important;
  max-width:260px !important;
  white-space:normal !important;
}
.pigeon-results-table th:nth-child(5),
.pigeon-results-table td:nth-child(5),
.pigeon-results-table th:nth-child(6),
.pigeon-results-table td:nth-child(6),
.pigeon-results-table th:nth-child(7),
.pigeon-results-table td:nth-child(7){
  text-align:right;
}
@media (max-width:760px){
  .pigeon-results-panel{
    margin-left:0;
    max-width:100%;
  }
  .pigeon-results-table th,
  .pigeon-results-table td{
    padding:8px 10px !important;
  }
}


/* Cool visual timeline for expandable pigeon race results */
.pigeon-results-visual{
  margin-bottom:16px;
  padding:16px;
  border:1px solid rgba(56,189,248,.16);
  border-radius:20px;
  background:
    radial-gradient(circle at top left, rgba(56,189,248,.14), transparent 30%),
    radial-gradient(circle at bottom right, rgba(34,197,94,.10), transparent 26%),
    linear-gradient(180deg, color-mix(in srgb, var(--panel-2) 72%, transparent), var(--panel-3));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04), 0 14px 34px rgba(0,0,0,.18);
}
.pigeon-results-visual-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-bottom:14px}
.pigeon-results-summary{display:grid;grid-template-columns:repeat(4,minmax(84px,1fr));gap:8px}
.pigeon-results-summary > div{padding:10px 12px;border-radius:16px;background:rgba(15,23,42,.42);border:1px solid var(--line-soft);text-align:center}
body.light .pigeon-results-summary > div{background:rgba(255,255,255,.68)}
.pigeon-results-summary strong{display:block;font-size:1.05rem;line-height:1;letter-spacing:-.02em}
.pigeon-results-summary span{display:block;margin-top:4px;color:var(--muted);font-size:.68rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em}
.pigeon-race-timeline{position:relative;display:grid;gap:12px}
.pigeon-race-timeline::before{content:"";position:absolute;left:18px;top:18px;bottom:18px;width:2px;background:linear-gradient(180deg, rgba(56,189,248,.65), rgba(34,197,94,.45), rgba(245,158,11,.28));border-radius:99px}
.pigeon-race-card{position:relative;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px;margin-left:34px;padding:13px;border-radius:18px;border:1px solid var(--line-soft);background:linear-gradient(90deg, rgba(56,189,248,.08), transparent 36%),color-mix(in srgb, var(--panel-3) 88%, transparent);box-shadow:0 8px 22px rgba(0,0,0,.12)}
.pigeon-race-card.returned{border-color:rgba(34,197,94,.22)}
.pigeon-race-card.missing{opacity:.72;border-color:rgba(239,68,68,.2)}
.race-card-marker{position:absolute;left:-34px;top:15px;width:36px;height:36px;display:grid;place-items:center;border-radius:999px;color:white;font-weight:900;font-size:.82rem;background:linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000 45%));border:3px solid var(--panel-3);box-shadow:0 0 0 1px rgba(56,189,248,.35), 0 8px 18px rgba(56,189,248,.15)}
.race-card-topline{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:4px}
.race-card-date{font-weight:900;letter-spacing:.01em}
.race-card-name{font-weight:800;margin-bottom:10px}
.race-card-name a{color:var(--text)}
.race-card-bars{display:grid;gap:8px}
.race-bar-row{display:grid;grid-template-columns:72px minmax(120px,1fr) 78px;align-items:center;gap:9px;color:var(--muted);font-size:.76rem;font-weight:800}
.race-bar-row strong{color:var(--text);text-align:right;font-size:.78rem}
.race-bar{height:10px;border-radius:999px;overflow:hidden;background:rgba(148,163,184,.16);border:1px solid var(--line-soft)}
.race-bar i{display:block;height:100%;border-radius:inherit}
.race-bar i.distance{width:var(--distance-pct);background:linear-gradient(90deg, rgba(56,189,248,.65), rgba(56,189,248,.95))}
.race-bar i.score{width:var(--score-pct);background:linear-gradient(90deg, rgba(34,197,94,.62), rgba(245,158,11,.85))}
.race-card-stats{display:grid;grid-template-columns:78px repeat(3, minmax(62px,1fr));align-items:stretch;gap:8px;min-width:310px}
.score-orb{width:72px;height:72px;border-radius:999px;display:flex;align-items:center;justify-content:center;gap:1px;align-self:center;background:radial-gradient(circle at center, var(--panel-3) 0 52%, transparent 53%),conic-gradient(var(--accent-2) var(--score-pct), rgba(148,163,184,.18) 0);border:1px solid rgba(34,197,94,.22);box-shadow:inset 0 0 0 5px rgba(15,23,42,.55)}
body.light .score-orb{box-shadow:inset 0 0 0 5px rgba(255,255,255,.70)}
.score-orb span{font-size:1.15rem;font-weight:950;letter-spacing:-.04em}
.score-orb small{color:var(--muted);font-weight:900;align-self:center}
.race-stat{display:flex;flex-direction:column;justify-content:center;min-width:0;padding:8px 10px;border-radius:14px;background:rgba(148,163,184,.08);border:1px solid var(--line-soft)}
.race-stat span{color:var(--muted);font-size:.65rem;font-weight:900;text-transform:uppercase;letter-spacing:.06em}
.race-stat strong{margin-top:4px;font-size:.95rem;white-space:nowrap}
.pigeon-results-table-title{margin:12px 0 8px;color:var(--muted);font-size:.78rem;font-weight:800;letter-spacing:.06em;text-transform:uppercase}
@media (max-width:980px){.pigeon-race-card{grid-template-columns:1fr}.race-card-stats{min-width:0;grid-template-columns:72px repeat(3,1fr)}}
@media (max-width:640px){.pigeon-results-visual{padding:12px}.pigeon-results-summary{grid-template-columns:repeat(2,minmax(0,1fr));width:100%}.pigeon-race-card{margin-left:28px;padding:11px}.pigeon-race-timeline::before{left:14px}.race-card-marker{left:-30px;width:31px;height:31px}.race-card-stats{grid-template-columns:1fr 1fr}.score-orb{width:64px;height:64px}.race-bar-row{grid-template-columns:64px 1fr 64px}}


/* Compact pigeon visual */
.pigeon-results-panel-compact{
  padding:10px;
}
.pigeon-results-visual-head{
  margin-bottom:8px;
}
.pigeon-results-summary div{
  min-width:58px;
}
.pigeon-race-timeline{
  gap:8px !important;
}
.pigeon-race-card{
  padding:10px !important;
  min-height:auto !important;
}
.race-card-main{
  gap:6px !important;
}
.race-card-topline{
  margin-bottom:4px !important;
}
.race-card-name{
  font-size:.92rem !important;
}
.race-bar-row{
  margin:2px 0 !important;
}
.race-card-stats{
  gap:6px !important;
}
.race-stat{
  padding:6px 8px !important;
}
.score-orb{
  width:64px !important;
  height:64px !important;
}

/* Pigeon result PNG export */
.pigeon-results-export-actions{
  display:flex;
  justify-content:flex-end;
  margin:0 0 8px;
}
.pigeon-results-download-btn{
  width:auto !important;
  padding:8px 12px !important;
  font-size:.82rem;
}
.pigeon-results-export-card{
  position:fixed;
  left:-10000px;
  top:0;
  width:1200px;
  padding:22px;
  background:var(--bg);
  color:var(--text);
  border:1px solid var(--line-soft);
  border-radius:22px;
  box-shadow:var(--shadow);
}
.pigeon-results-export-header{
  display:flex;
  justify-content:space-between;
  gap:18px;
  align-items:flex-start;
  margin-bottom:14px;
  padding:18px;
  border:1px solid var(--line-soft);
  border-radius:18px;
  background:linear-gradient(180deg,var(--panel),var(--panel-2));
}
.pigeon-results-export-header h2{
  margin:2px 0 2px;
  font-size:1.8rem;
  letter-spacing:-.03em;
}
.pigeon-results-export-label{
  color:var(--accent);
  font-size:.76rem;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.09em;
}
.pigeon-results-export-meta{
  display:grid;
  grid-template-columns:repeat(2,minmax(160px,1fr));
  gap:8px;
  min-width:460px;
}
.pigeon-results-export-meta div{
  padding:9px 10px;
  border:1px solid var(--line-soft);
  border-radius:14px;
  background:rgba(15,23,42,.35);
}
.pigeon-results-export-meta span{
  display:block;
  color:var(--muted);
  font-size:.65rem;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.08em;
  margin-bottom:2px;
}
.pigeon-results-export-meta strong{
  font-size:.9rem;
}

/* v30: remove duplicate Top % box and tighten result stats */
.race-card-stats{
  grid-template-columns:64px repeat(2, minmax(68px,1fr)) !important;
  min-width:220px !important;
  gap:6px !important;
}
@media (max-width:980px){
  .race-card-stats{grid-template-columns:64px repeat(2,1fr) !important;}
}
@media (max-width:640px){
  .race-card-stats{grid-template-columns:64px repeat(2,1fr) !important;}
}

.lineage-sex-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:1.2em;
  font-weight:900;
  opacity:.95;
}

/* v38: Breeder Analysis grouped father/mother sections with equal sizing */
.lineage-sections-stack{
  display:grid;
  gap:22px;
  margin-bottom:18px;
}
.lineage-section{
  padding:20px;
  background:
    radial-gradient(circle at top right, rgba(56,189,248,.08), transparent 30%),
    linear-gradient(180deg,var(--panel),var(--panel-2));
}
.lineage-section-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:16px;
  padding-bottom:14px;
  border-bottom:1px solid var(--line-soft);
}
.lineage-section-head h2{
  font-size:1.28rem;
  margin-bottom:5px;
}
.lineage-section-summary{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
  min-width:260px;
}
.lineage-section-summary span{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:7px 10px;
  border-radius:999px;
  background:var(--chip);
  border:1px solid var(--line-soft);
  color:var(--muted);
  font-size:.78rem;
  font-weight:900;
  white-space:nowrap;
}
.lineage-section-grid{
  display:grid;
  grid-template-columns:minmax(0,1.3fr) minmax(360px,.85fr) minmax(360px,.85fr);
  gap:16px;
  align-items:stretch;
}
.lineage-section-panel,
.lineage-section-panel > .card{
  min-width:0;
  height:100%;
}
.lineage-section-panel > .card{
  margin:0;
  display:flex;
  flex-direction:column;
}
.lineage-section-panel > .card > h2{
  min-height:34px;
  display:flex;
  align-items:flex-start;
  gap:7px;
  margin-bottom:14px;
}
.lineage-section-panel .lineage-card-grid{
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
}
.lineage-section-panel .lineage-heatmap{
  flex:1;
}
.lineage-section-panel .heat-line{
  min-height:58px;
  display:flex;
  align-items:center;
}
.lineage-section-panel .heat-cell{
  min-height:58px;
}
@media (max-width:1650px){
  .lineage-section-grid{
    grid-template-columns:1fr 1fr;
  }
  .lineage-panel-ranking{
    grid-column:1 / -1;
  }
}
@media (max-width:1050px){
  .lineage-section-grid{
    grid-template-columns:1fr;
  }
  .lineage-section-head{
    flex-direction:column;
  }
  .lineage-section-summary{
    justify-content:flex-start;
    min-width:0;
  }
}

/* Modal overlays for add/edit forms */
#derbyFormWrap:not(.hidden),
#pigeonFormWrap:not(.hidden),
#raceFormWrap:not(.hidden){
  position:fixed;
  inset:0;
  z-index:5000;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding:34px 18px;
  overflow:auto;
  background:rgba(2,6,23,.72);
  backdrop-filter:blur(9px);
}
body.light #derbyFormWrap:not(.hidden),
body.light #pigeonFormWrap:not(.hidden),
body.light #raceFormWrap:not(.hidden){
  background:rgba(15,23,42,.38);
}
#derbyFormWrap:not(.hidden) > .card,
#pigeonFormWrap:not(.hidden) > .card,
#raceFormWrap:not(.hidden) > .card{
  width:min(1120px, calc(100vw - 36px));
  max-height:calc(100vh - 68px);
  overflow:auto;
  margin:0 !important;
  border-radius:24px;
  box-shadow:0 28px 80px rgba(0,0,0,.48);
}
#pigeonFormWrap:not(.hidden) > .card{width:min(1240px, calc(100vw - 36px));}
#derbyFormWrap:not(.hidden) h3,
#pigeonFormWrap:not(.hidden) h3,
#raceFormWrap:not(.hidden) h3{
  position:sticky;
  top:-18px;
  z-index:2;
  margin:-18px -18px 14px;
  padding:18px 18px 14px;
  background:linear-gradient(180deg,var(--panel),color-mix(in srgb, var(--panel) 94%, transparent));
  border-bottom:1px solid var(--line-soft);
  border-radius:24px 24px 0 0;
}
#derbyFormWrap:not(.hidden) .toolbar:last-child,
#pigeonFormWrap:not(.hidden) .toolbar:last-child,
#raceFormWrap:not(.hidden) .toolbar:last-child{
  position:sticky;
  bottom:-18px;
  margin:16px -18px -18px;
  padding:14px 18px 18px;
  background:linear-gradient(0deg,var(--panel),color-mix(in srgb, var(--panel) 94%, transparent));
  border-top:1px solid var(--line-soft);
  border-radius:0 0 24px 24px;
}
@media (max-width:640px){
  #derbyFormWrap:not(.hidden),
  #pigeonFormWrap:not(.hidden),
  #raceFormWrap:not(.hidden){padding:12px;align-items:flex-start;}
  #derbyFormWrap:not(.hidden) > .card,
  #pigeonFormWrap:not(.hidden) > .card,
  #raceFormWrap:not(.hidden) > .card{width:100%;max-height:calc(100vh - 24px);border-radius:18px;}
}

/* Race arrival snapshot chart */
.race-chart-toggle{width:34px;height:34px;font-size:18px;line-height:1}
.race-chart-toggle:hover,.race-chart-toggle:focus-visible{border-color:rgba(56,189,248,.5);color:var(--accent);outline:none}
.race-arrival-row td{padding:0 10px 16px;background:rgba(148,163,184,.035)}
.race-arrival-row:hover td{background:rgba(148,163,184,.035)}
.race-arrival-card{
  margin:0 0 4px 44px;
  padding:18px;
  border:1px solid rgba(56,189,248,.16);
  border-radius:20px;
  background:
    radial-gradient(circle at top right, rgba(56,189,248,.12), transparent 28%),
    linear-gradient(180deg, color-mix(in srgb, var(--panel-3) 92%, #000 8%), var(--panel-3));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03), var(--shadow-soft);
}
.race-arrival-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;flex-wrap:wrap;margin-bottom:12px}
.race-arrival-kicker{display:flex;gap:8px;align-items:center;flex-wrap:wrap;color:var(--muted);font-size:.82rem;font-weight:800;text-transform:uppercase;letter-spacing:.05em;margin-bottom:8px}
.race-arrival-head h3{font-size:1.25rem;margin-bottom:5px;letter-spacing:-.02em}
.race-arrival-metrics{display:grid;grid-template-columns:repeat(4,minmax(110px,1fr));gap:10px;min-width:min(100%,620px)}
.race-arrival-metrics div{padding:11px 12px;border:1px solid var(--line-soft);border-radius:15px;background:rgba(15,23,42,.36)}
body.light .race-arrival-metrics div{background:rgba(255,255,255,.72)}
.race-arrival-metrics span{display:block;color:var(--muted);font-size:.7rem;font-weight:900;text-transform:uppercase;letter-spacing:.06em;margin-bottom:4px}
.race-arrival-metrics strong{display:block;font-size:.95rem;line-height:1.2}
.race-arrival-legend{display:flex;gap:14px;align-items:center;flex-wrap:wrap;color:var(--muted);font-size:.78rem;font-weight:800;margin:8px 0 10px}
.race-arrival-legend span{display:inline-flex;align-items:center;gap:7px}
.race-arrival-legend i{display:inline-block;width:18px;height:10px;border-radius:999px;background:rgba(56,189,248,.35);border:1px solid rgba(56,189,248,.22)}
.race-arrival-legend i.point{width:11px;height:11px;border-radius:999px;background:var(--accent-2);box-shadow:0 0 0 5px rgba(34,197,94,.12)}
.race-arrival-legend i.quantile{width:2px;height:15px;border-radius:999px;background:rgba(245,158,11,.8);box-shadow:0 0 12px rgba(245,158,11,.25);border-color:rgba(245,158,11,.45)}
.race-arrival-plot{position:relative;height:310px;border:1px solid var(--line-soft);border-radius:18px;background:linear-gradient(180deg,rgba(15,23,42,.55),rgba(15,23,42,.32));overflow:hidden;padding:16px 18px 58px}
body.light .race-arrival-plot{background:linear-gradient(180deg,rgba(241,245,249,.92),rgba(248,250,252,.82))}
.race-density-layer{position:absolute;left:18px;right:18px;top:72px;height:90px;border-bottom:1px dashed rgba(148,163,184,.22)}
.race-density-bar{position:absolute;bottom:0;border-radius:7px 7px 0 0;background:linear-gradient(180deg,rgba(56,189,248,.62),rgba(56,189,248,.18));box-shadow:0 0 18px rgba(56,189,248,.11)}
.race-quantile-layer{position:absolute;left:18px;right:18px;top:56px;bottom:72px;pointer-events:none;z-index:2}
.race-quantile-marker{position:absolute;top:0;bottom:0;transform:translateX(-50%);color:#fbbf24;font-size:.66rem;font-weight:900;letter-spacing:.03em;text-shadow:0 1px 6px rgba(0,0,0,.45)}
.race-quantile-marker i{display:block;width:1px;height:100%;margin:0 auto;background:linear-gradient(180deg,rgba(245,158,11,.75),rgba(245,158,11,.18));box-shadow:0 0 12px rgba(245,158,11,.24)}
.race-quantile-marker span{position:absolute;top:-17px;left:50%;transform:translateX(-50%);white-space:nowrap;background:rgba(15,23,42,.74);border:1px solid rgba(245,158,11,.22);border-radius:999px;padding:1px 5px}
body.light .race-quantile-marker span{background:rgba(255,255,255,.82)}
.race-point-layer{position:absolute;left:18px;right:18px;top:168px;bottom:74px;border-top:1px dashed rgba(148,163,184,.16)}
.race-own-point{position:absolute;transform:translate(-50%,-50%);width:22px;height:22px;border:0;background:transparent;padding:0;cursor:pointer;z-index:3}
.race-own-point span{display:block;width:12px;height:12px;margin:5px;border-radius:50%;background:var(--accent-2);box-shadow:0 0 0 4px rgba(34,197,94,.15),0 0 18px rgba(34,197,94,.38);border:1px solid rgba(220,252,231,.9)}
.race-own-point:hover span,.race-own-point:focus-visible span{transform:scale(1.25);box-shadow:0 0 0 7px rgba(34,197,94,.22),0 0 22px rgba(34,197,94,.55);outline:none}
.race-axis{position:absolute;left:18px;right:18px;bottom:45px;height:28px;border-top:1px solid rgba(148,163,184,.28)}
.race-time-tick{position:absolute;top:0;transform:translateX(-50%);height:28px;color:var(--muted);font-size:.72rem;font-weight:800}
.race-time-tick i{display:block;width:1px;height:8px;background:rgba(148,163,184,.45);margin:0 auto 4px}
.race-time-tick span{white-space:nowrap}
.race-day-axis{position:absolute;left:18px;right:18px;bottom:12px;height:26px;border-top:1px solid rgba(245,158,11,.20)}
.race-day-tick{position:absolute;top:0;transform:translateX(-50%);height:26px;color:#fbbf24;font-size:.68rem;font-weight:900;letter-spacing:.02em}
.race-day-tick i{display:block;width:1px;height:100%;background:linear-gradient(180deg,rgba(245,158,11,.45),rgba(245,158,11,.06));margin:0 auto;position:absolute;bottom:26px;left:50%}
.race-day-tick span{position:relative;top:6px;white-space:nowrap;background:rgba(15,23,42,.72);border:1px solid rgba(245,158,11,.20);border-radius:999px;padding:1px 6px}
body.light .race-day-tick span{background:rgba(255,255,255,.85)}

.race-arrival-empty{margin:0 0 4px 44px;padding:16px 18px;border:1px dashed var(--line);border-radius:16px;color:var(--muted);background:var(--panel-3)}
@media (max-width:900px){
  .race-arrival-card,.race-arrival-empty{margin-left:0}
  .race-arrival-metrics{grid-template-columns:repeat(2,minmax(0,1fr));min-width:0;width:100%}
  .race-arrival-plot{height:290px}
}
@media (max-width:560px){.race-arrival-metrics{grid-template-columns:1fr}.race-arrival-plot{height:280px}}

/* Race arrival PNG export */
.race-export-btn{
  margin-left:auto;
  width:auto !important;
  padding:7px 11px !important;
  font-size:.78rem;
}
@media (max-width:640px){.race-export-btn{margin-left:0;width:100% !important}}

.admin-card-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}.permission-hidden{display:none!important}

/* Tenant visibility and Breeder Analysis tenant controls */
.tenant-badge{
  margin-top:10px;
  padding:8px 10px;
  border-radius:14px;
  background:rgba(56,189,248,.12);
  border:1px solid rgba(56,189,248,.24);
  color:var(--text);
  font-size:.78rem;
  font-weight:900;
  line-height:1.25;
}
.breeder-analysis-toolbar{
  margin:12px 0 10px;
  align-items:center;
}
.breeder-analysis-toolbar select{
  background:var(--panel-3);
  color:var(--text);
  border:1px solid var(--line);
  border-radius:12px;
  padding:7px 10px;
}
.tenant-settings-grid{
  margin-bottom:14px;
  padding:12px;
  border:1px solid var(--line-soft);
  border-radius:16px;
  background:var(--panel-3);
}


/* Pedigree / stock module */
#pedigree .pedigree-hero{border-top:2px solid rgba(56,189,248,.5)}.pedigree-layout{display:grid;grid-template-columns:minmax(260px,340px) minmax(0,1fr);gap:18px;margin-top:18px;align-items:start}.stock-list{display:grid;gap:8px;max-height:70vh;overflow:auto;padding-right:4px}.stock-row{display:grid;grid-template-columns:auto 1fr auto;gap:8px;align-items:center;text-align:left;background:var(--panel-3);color:var(--text);border:1px solid var(--line-soft);border-radius:14px;padding:11px 12px;cursor:pointer}.stock-row:hover,.stock-row.active{border-color:rgba(56,189,248,.45);background:linear-gradient(180deg,rgba(56,189,248,.12),rgba(56,189,248,.05))}.stock-row small{grid-column:2/4;color:var(--muted);font-weight:600}.stock-row em{font-style:normal;color:var(--muted);font-size:.74rem;text-transform:uppercase;letter-spacing:.05em}.pedigree-profile{display:grid;grid-template-columns:150px 120px 1fr;gap:16px;align-items:center;margin-bottom:16px;padding-bottom:16px;border-bottom:1px solid var(--line-soft)}.pedigree-photo-wrap{display:grid;gap:6px;color:var(--muted);font-size:.78rem;text-align:center}.pedigree-photo-wrap img,.pedigree-photo-placeholder{width:100%;aspect-ratio:1.15/1;border-radius:18px;border:1px solid var(--line-soft);background:var(--panel-3);object-fit:cover;display:grid;place-items:center;font-size:2.2rem}.pedigree-photo-wrap.eye img,.pedigree-photo-wrap.eye .pedigree-photo-placeholder{border-radius:999px;aspect-ratio:1/1}.pedigree-profile-info h2{font-size:1.6rem;margin-bottom:4px}.pedigree-tree{display:grid;grid-auto-rows:minmax(46px,1fr);gap:8px;min-height:620px;overflow:auto;padding:8px;border-radius:18px;background:rgba(15,23,42,.38);border:1px solid var(--line-soft)}.pedigree-cell{display:flex;min-width:0}.pedigree-box{width:100%;min-height:84px;align-self:stretch;border:1px solid rgba(148,163,184,.22);border-radius:16px;background:linear-gradient(180deg,var(--panel-2),var(--panel-3));padding:10px;overflow:hidden;display:flex;flex-direction:column;justify-content:center}.pedigree-box-empty{opacity:.55;border-style:dashed}.pedigree-box-top{display:flex;gap:7px;align-items:center;font-size:.88rem}.pedigree-sex{font-size:1.1rem;color:var(--accent)}.pedigree-name{font-size:.78rem;color:var(--text);font-weight:700}.pedigree-meta{font-size:.72rem;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.pedigree-facts{font-size:.7rem;color:var(--muted);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.stock-form-card{margin-top:18px}.pedigree-print-header,.pedigree-print-footer{padding:8px 0;text-align:center;color:#111}.pedigree-print-header h1{margin:0;font-size:22px}@media(max-width:1100px){.pedigree-layout{grid-template-columns:1fr}.pedigree-profile{grid-template-columns:120px 100px 1fr}.pedigree-tree{min-height:520px}.stock-list{max-height:320px}}@media(max-width:640px){.pedigree-profile{grid-template-columns:1fr 1fr}.pedigree-profile-info{grid-column:1/-1}.pedigree-tree{grid-auto-rows:minmax(80px,auto)}}


/* Pedigree v4 usability and print polish */
.stock-list-full{margin-top:18px}
.stock-list-horizontal{
  display:grid;
  grid-auto-flow:column;
  grid-template-rows:repeat(2,minmax(64px,auto));
  grid-auto-columns:minmax(240px,280px);
  gap:10px;
  overflow-x:auto;
  overflow-y:hidden;
  padding:4px 2px 10px;
  scroll-snap-type:x proximity;
}
.stock-list-horizontal .stock-row{
  scroll-snap-align:start;
}
.pedigree-full-card{
  margin-top:18px;
  width:100%;
}
.pedigree-scroll{
  width:100%;
  overflow:auto;
  padding-bottom:8px;
}
.pedigree-tree{
  min-width:980px;
}
.pedigree-link-tools{
  margin-top:10px;
}
.pedigree-box-unlinked{
  border-color:rgba(245,158,11,.45)!important;
  background:linear-gradient(180deg,rgba(245,158,11,.14),rgba(245,158,11,.05))!important;
}
.stock-form-card{
  margin-top:18px;
}
@media print{
  body{background:#fff!important;color:#111!important}
  .sidebar,.topbar,.pedigree-hero,.stock-list-card,.toolbar:not(.print-toolbar),#stockFormWrap{display:none!important}
  .app-shell{display:block!important}
  .content{padding:0!important}
  .section{display:block!important}
  .section:not(#pedigree){display:none!important}
  .pedigree-main-card{box-shadow:none!important;border:0!important;background:#fff!important;padding:0!important}
}

/* v5 pedigree race summaries + print/PNG-friendly polish */
.pedigree-race-block{
  margin-top:8px;
  padding:8px 10px;
  border:1px solid var(--line-soft);
  border-radius:12px;
  background:rgba(15,23,42,.35);
}
.pedigree-race-head{
  font-size:.72rem;
  font-weight:900;
  color:var(--text);
  line-height:1.25;
  margin-bottom:4px;
}
.pedigree-race-line{
  font-size:.72rem;
  color:var(--muted);
  line-height:1.25;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.pedigree-profile-info .pedigree-race-block{
  max-width:820px;
  background:var(--panel-3);
}
.pedigree-box .pedigree-race-block{
  padding:6px 7px;
  margin-top:6px;
}
.pedigree-box .pedigree-race-head,
.pedigree-box .pedigree-race-line{
  font-size:.64rem;
}
@media print{
  .pedigree-race-block{background:#fff!important;border:1px solid #d5dae3!important;color:#111!important;}
  .pedigree-race-head{color:#111827!important;}
  .pedigree-race-line{color:#334155!important;}
}

/* v6 pedigree: show full race history and keep cards printable/readable */
.pedigree-tree{
  grid-auto-rows:minmax(104px, auto);
  align-items:stretch;
}
.pedigree-cell{align-items:stretch;}
.pedigree-box{
  justify-content:flex-start;
  min-height:120px;
  overflow:visible;
}
.pedigree-box .pedigree-race-block{
  background:rgba(15,23,42,.42);
  border-color:rgba(148,163,184,.18);
}
.pedigree-race-group + .pedigree-race-group{
  margin-top:8px;
  padding-top:7px;
  border-top:1px dashed var(--line-soft);
}
.pedigree-race-line{
  white-space:normal;
  overflow:visible;
  text-overflow:clip;
}
.pedigree-profile-info .pedigree-race-block{
  max-height:360px;
  overflow:auto;
}
.pedigree-photo-wrap img{
  object-fit:contain;
  background:#fff;
}
@media print{
  .pedigree-box{overflow:hidden!important;}
  .pedigree-race-line{white-space:normal!important;}
}

/* Pedigree v7: full text, sex differentiation, inline actions and wizard */
.pedigree-box{
  position:relative;
  overflow:visible;
  height:auto;
  min-height:140px;
  justify-content:flex-start;
}
.pedigree-box.pedigree-female{
  border-color:rgba(244,114,182,.38);
  background:linear-gradient(180deg,rgba(244,114,182,.12),rgba(30,41,59,.92));
  box-shadow:inset 4px 0 0 rgba(244,114,182,.75);
}
.pedigree-box.pedigree-male{
  border-color:rgba(56,189,248,.34);
  background:linear-gradient(180deg,rgba(56,189,248,.10),rgba(30,41,59,.92));
  box-shadow:inset 4px 0 0 rgba(56,189,248,.72);
}
.pedigree-meta,.pedigree-facts,.pedigree-name{
  white-space:pre-wrap;
  overflow:visible;
  text-overflow:clip;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.pedigree-facts{
  display:block;
  -webkit-line-clamp:unset;
  line-height:1.35;
  margin-top:6px;
}
.pedigree-node-actions{
  position:absolute;
  top:7px;
  right:7px;
  display:flex;
  gap:5px;
  z-index:3;
}
.pedigree-node-btn{
  width:27px;
  height:27px;
  min-width:27px;
  padding:0;
  border-radius:8px;
  display:grid;
  place-items:center;
  border:1px solid var(--line-soft);
  background:rgba(15,23,42,.88);
  color:var(--text);
  cursor:pointer;
  font-size:.9rem;
}
.pedigree-node-btn:hover{transform:translateY(-1px);border-color:var(--accent)}
.pedigree-node-btn.danger:hover{border-color:#ef4444;color:#fecaca}
.pedigree-box-top{padding-right:64px;align-items:flex-start}
.pedigree-race-head,.pedigree-race-line{white-space:pre-wrap;overflow-wrap:anywhere}
.pedigree-wizard .wizard-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(260px,1fr));
  gap:14px;
  margin:16px 0;
}
.wizard-node{
  min-width:0;
  border:1px solid var(--line-soft);
  border-radius:16px;
  padding:14px;
  background:var(--panel-3);
}
.wizard-node.pedigree-female{border-left:5px solid rgba(244,114,182,.8);background:linear-gradient(180deg,rgba(244,114,182,.08),var(--panel-3))}
.wizard-node.pedigree-male{border-left:5px solid rgba(56,189,248,.8);background:linear-gradient(180deg,rgba(56,189,248,.08),var(--panel-3))}
.wizard-node legend{font-weight:900;padding:0 7px}
.wizard-node label{display:block;margin:8px 0 4px}
.wizard-two{display:grid;grid-template-columns:1fr 1fr;gap:10px}
@media(max-width:1100px){.pedigree-wizard .wizard-grid{grid-template-columns:repeat(2,minmax(240px,1fr))}}
@media(max-width:680px){.pedigree-wizard .wizard-grid{grid-template-columns:1fr}}
@media print{
  .pedigree-node-actions{display:none!important}
  .pedigree-box{overflow:hidden!important;box-shadow:none!important;background:#fff!important}
  .pedigree-box.pedigree-female{border-left:3px solid #db2777!important}
  .pedigree-box.pedigree-male{border-left:3px solid #0284c7!important}
  .pedigree-meta,.pedigree-facts,.pedigree-name{white-space:pre-wrap!important;overflow:visible!important}
}

/* Pedigree v8: visual pedigree wizard and refined node actions */
.pedigree-node-btn svg{width:15px;height:15px;fill:currentColor;display:block}
.pedigree-node-btn.edit{background:rgba(15,23,42,.82);color:#dbeafe}
.pedigree-node-btn.delete{background:rgba(15,23,42,.72);color:#94a3b8;border-color:rgba(148,163,184,.22)}
.pedigree-node-btn.delete:hover{background:rgba(127,29,29,.88);border-color:#f87171;color:#fff;transform:translateY(-1px)}
.pedigree-node-btn.edit:hover{background:rgba(3,105,161,.78);color:#fff}
.wizard-pedigree-canvas{
  display:grid;
  grid-template-columns:minmax(300px,1.1fr) minmax(290px,1fr) minmax(280px,1fr);
  grid-template-rows:repeat(4,minmax(185px,auto));
  gap:12px;
  padding:16px;
  margin:16px 0;
  border:1px solid var(--line-soft);
  border-radius:20px;
  background:rgba(15,23,42,.36);
  overflow:auto;
}
.wizard-pedigree-canvas .wizard-node{height:100%;display:flex;flex-direction:column;justify-content:flex-start;margin:0;min-width:280px}
.wizard-node-head{display:flex;align-items:center;justify-content:space-between;margin:-2px 0 4px;color:var(--muted);font-size:.72rem;font-weight:800;letter-spacing:.08em}
.wizard-sex{font-size:1.15rem;color:var(--accent)}
.wizard-pedigree-canvas .wizard-node textarea{min-height:72px;resize:vertical}
@media(max-width:1050px){.wizard-pedigree-canvas{grid-template-columns:repeat(3,minmax(280px,1fr));min-width:900px}}

/* OLR update actions: preserve the existing full-load styling and make the
   recommended Fast Load visually distinct without changing shared buttons. */
.olr-update-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:stretch}
.olr-update-actions button{display:inline-flex;align-items:center;gap:9px;min-height:46px;text-align:left}
.olr-update-actions button small{display:block;font-size:10px;font-weight:500;line-height:1.15;opacity:.78;margin-top:2px}
.olr-btn-icon{font-size:22px;line-height:1}
.olr-fast-load-btn{position:relative;border:1px solid #159a73;background:#18a87d;color:#fff;border-radius:10px;padding:8px 11px;box-shadow:0 4px 12px rgba(24,168,125,.18);cursor:pointer}
.olr-fast-load-btn:hover{filter:brightness(.96);transform:translateY(-1px)}
.olr-fast-load-btn:disabled{opacity:.62;cursor:wait;transform:none}
.olr-recommended-badge{align-self:flex-start;white-space:nowrap;border-radius:999px;background:rgba(255,255,255,.2);padding:3px 6px;font-size:9px;font-weight:800;letter-spacing:.02em}
.olr-full-load-btn{padding:8px 12px}
@media (max-width:720px){.olr-update-actions{width:100%}.olr-update-actions button{flex:1 1 220px}.olr-recommended-badge{display:none}}

/* Distinct OLR update actions */
.olr-update-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:stretch}
.olr-update-actions button{display:inline-flex;align-items:center;gap:9px;min-height:46px;text-align:left}
.olr-update-actions button small{display:block;font-size:10px;font-weight:500;line-height:1.15;opacity:.78;margin-top:2px}
.olr-btn-icon{font-size:22px;line-height:1}
.olr-fast-load-btn{position:relative;border:1px solid #159a73;background:#18a87d;color:#fff;border-radius:10px;padding:8px 11px;box-shadow:0 4px 12px rgba(24,168,125,.18);cursor:pointer}
.olr-fast-load-btn:hover{filter:brightness(.96);transform:translateY(-1px)}
.olr-fast-load-btn:disabled{opacity:.62;cursor:wait;transform:none}
.olr-recommended-badge{align-self:flex-start;white-space:nowrap;border-radius:999px;background:rgba(255,255,255,.2);padding:3px 6px;font-size:9px;font-weight:800;letter-spacing:.02em}
.olr-full-load-btn{padding:8px 12px}
@media (max-width:720px){.olr-update-actions{width:100%}.olr-update-actions button{flex:1 1 220px}.olr-recommended-badge{display:none}}

/* v7 pedigree studio: fast breeding workflow + premium, web-generatable pedigree */
#pedigree{--ped-navy:#14233d;--ped-blue:#eaf3ff;--ped-blue-line:#7aa8df;--ped-red:#fff0f2;--ped-red-line:#e88996;--ped-gold:#c99b43}
#pedigree .pedigree-hero{position:relative;overflow:hidden;border:1px solid rgba(201,155,67,.28);background:linear-gradient(120deg,rgba(20,35,61,.98),rgba(27,51,82,.94));color:#fff}
#pedigree .pedigree-hero:after{content:"";position:absolute;inset:auto -8% -80% 35%;height:220px;background:radial-gradient(ellipse,rgba(255,255,255,.10),transparent 65%);pointer-events:none}
#pedigree .pedigree-hero h2,#pedigree .pedigree-hero .muted{color:#fff}.breeding-active-chip{border-color:rgba(201,155,67,.55)!important;background:rgba(201,155,67,.16)!important;color:#f5d48e!important}
.stock-row em{white-space:nowrap}.stock-row:has(em:first-letter){transition:.16s ease}.stock-row:hover{transform:translateY(-1px)}
.pedigree-editor-card{border-top:3px solid var(--ped-gold)}.breeding-active-field{display:flex;flex-direction:column}.switch-row{display:flex!important;gap:10px;align-items:center;border:1px solid var(--line-soft);border-radius:12px;padding:10px 12px;background:var(--panel-3);cursor:pointer}.switch-row input{width:18px;height:18px}.switch-row span{display:grid}.switch-row small{color:var(--muted);font-weight:500}.parent-picker{display:grid;gap:6px}.parent-picker select{min-height:148px}.parent-filter{margin-bottom:2px}.sticky-form-actions{position:sticky;bottom:0;padding:12px 0 4px;background:linear-gradient(180deg,transparent,var(--panel) 28%);z-index:3}
.pedigree-main-card{border:1px solid rgba(148,163,184,.22);background:linear-gradient(180deg,rgba(255,255,255,.025),transparent)}
.pedigree-tree{gap:7px;padding:12px;background:linear-gradient(135deg,rgba(15,23,42,.52),rgba(30,41,59,.28));border-color:rgba(201,155,67,.18)}
.pedigree-box{position:relative;border-radius:11px;padding:9px 10px;box-shadow:0 5px 16px rgba(0,0,0,.08);transition:transform .15s ease,border-color .15s ease}.pedigree-box:hover{transform:translateY(-1px);z-index:2}.pedigree-box.pedigree-male{border-left:4px solid #5b8fc9;background:linear-gradient(120deg,rgba(59,130,246,.12),var(--panel-2) 55%)}.pedigree-box.pedigree-female{border-left:4px solid #dc6678;background:linear-gradient(120deg,rgba(244,63,94,.11),var(--panel-2) 55%)}.pedigree-box-top strong{font-size:.91rem;letter-spacing:.01em}.pedigree-name{font-size:.82rem;margin-top:2px}.pedigree-facts{-webkit-line-clamp:4;line-height:1.35;margin-top:4px}.pedigree-node-actions{opacity:.2;transition:.15s}.pedigree-box:hover .pedigree-node-actions{opacity:1}
@media print{#pedigree .pedigree-box.pedigree-male{background:#eef6ff!important;border-left:3px solid #5b8fc9!important}#pedigree .pedigree-box.pedigree-female{background:#fff1f3!important;border-left:3px solid #dc6678!important}.pedigree-tree{background:#fff!important;border:0!important;padding:4mm!important;gap:2mm!important}.pedigree-box{box-shadow:none!important;border-radius:2mm!important;color:#111!important}.pedigree-box-top strong,.pedigree-name{color:#111!important}.pedigree-meta,.pedigree-facts{color:#334155!important}}

/* v9 Pedigree Studio — direct-edit breeding workflow */
#pedigree{--ped-navy:#12233d;--ped-navy2:#1c365b;--ped-gold:#c9a35a;--ped-blue:#edf5ff;--ped-blue-strong:#356fae;--ped-rose:#fff1f3;--ped-rose-strong:#b94b5d}
.pedigree-studio-hero{display:flex;justify-content:space-between;align-items:center;gap:24px;padding:24px 28px;border-radius:20px;background:linear-gradient(118deg,#101f36,#1c385e);border:1px solid rgba(201,163,90,.38);box-shadow:0 18px 50px rgba(0,0,0,.14);color:#fff;overflow:hidden;position:relative}
.pedigree-studio-hero:after{content:"";position:absolute;right:12%;top:-120px;width:420px;height:300px;background:radial-gradient(circle,rgba(255,255,255,.12),transparent 68%);pointer-events:none}.pedigree-studio-hero h2{font-size:2rem;margin:3px 0 4px;color:#fff}.pedigree-studio-hero p{margin:0;color:#dbe6f4}.eyebrow{font-size:.67rem;letter-spacing:.16em;font-weight:900;color:var(--ped-gold);text-transform:uppercase}.pedigree-hero-mark{display:flex;align-items:center;gap:14px;z-index:1}.pedigree-hero-mark img{height:56px;max-width:180px;object-fit:contain;filter:drop-shadow(0 3px 12px rgba(0,0,0,.25))}.pedigree-hero-mark span{border-left:1px solid rgba(255,255,255,.25);padding-left:14px;font-weight:800}
.pedigree-control-deck{margin-top:14px;padding:12px 14px}.pedigree-view-tabs{display:flex;gap:7px;overflow:auto;padding-bottom:10px;border-bottom:1px solid var(--line-soft)}.pedigree-view-btn{white-space:nowrap;border:1px solid var(--line-soft);background:var(--panel-3);color:var(--muted);border-radius:999px;padding:8px 12px;font-size:.78rem;font-weight:800;cursor:pointer}.pedigree-view-btn.active{background:var(--ped-navy2);border-color:var(--ped-navy2);color:#fff;box-shadow:0 5px 16px rgba(18,35,61,.22)}.pedigree-filter-row{display:flex;gap:9px;align-items:center;padding-top:11px}.pedigree-filter-row select{width:auto;min-width:145px}.pedigree-search{flex:1;min-width:260px;position:relative}.pedigree-search span{position:absolute;left:12px;top:50%;transform:translateY(-50%);font-size:1.2rem;color:var(--muted)}.pedigree-search input{padding-left:34px}
.pedigree-workspace{display:grid;grid-template-columns:280px minmax(0,1fr);gap:14px;margin-top:14px;align-items:start}.stock-browser{position:sticky;top:80px;padding:12px}.stock-browser-head{display:flex;justify-content:space-between;align-items:center;padding:3px 4px 10px}.stock-browser-head h3{margin:2px 0}.pedigree-stock-list{max-height:74vh;gap:6px}.stock-card{display:grid;grid-template-columns:1fr 34px;gap:4px;border:1px solid var(--line-soft);border-radius:12px;background:var(--panel-3);overflow:hidden;transition:.15s}.stock-card:hover,.stock-card.active{border-color:rgba(53,111,174,.55);box-shadow:0 6px 18px rgba(0,0,0,.08)}.stock-card.active{background:linear-gradient(100deg,rgba(53,111,174,.12),var(--panel-3))}.stock-card-main{display:grid;grid-template-columns:28px 1fr;gap:8px;align-items:center;text-align:left;border:0;background:transparent;color:var(--text);padding:9px;cursor:pointer}.stock-card-main span:nth-child(2){display:grid;min-width:0}.stock-card-main strong{font-size:.78rem}.stock-card-main b{font-size:.72rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.stock-card-main small{font-size:.66rem;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.stock-active-toggle{border:0;border-left:1px solid var(--line-soft);background:transparent;color:#667085;cursor:pointer;font-size:1rem}.stock-active-toggle.on{color:var(--ped-gold);background:rgba(201,163,90,.08)}
.pedigree-document-card{padding:0;overflow:hidden}.pedigree-document-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 18px;border-bottom:1px solid var(--line-soft);background:linear-gradient(90deg,rgba(18,35,61,.06),transparent)}.pedigree-document-toolbar h3{margin:2px 0}.pedigree-document-toolbar>div:last-child{display:flex;gap:7px}.pedigree-profile-premium{grid-template-columns:170px 1fr!important;padding:18px!important;margin:0!important;background:linear-gradient(135deg,rgba(255,255,255,.025),transparent)}.pedigree-profile-premium .pedigree-photo-wrap img,.pedigree-profile-premium .pedigree-photo-placeholder{aspect-ratio:1.25/1;border-radius:12px}.profile-ring{display:flex;align-items:center;gap:10px}.profile-ring>span{font-size:1.4rem}.profile-ring strong,.profile-parentage{font-size:.86rem;color:var(--muted)}.profile-ring h2{margin:0;font-size:1.5rem}.profile-meta{margin:6px 0;color:var(--muted);font-size:.82rem}.breeding-status{display:inline-block;border:1px solid rgba(201,163,90,.45);background:rgba(201,163,90,.11);color:#c79a3d;border-radius:999px;padding:4px 8px;font-size:.66rem;font-weight:900;letter-spacing:.06em}.pedigree-profile-info p{white-space:pre-wrap;line-height:1.45;max-width:1000px;font-size:.8rem}
.pedigree-tree-studio{position:relative;min-width:900px;background:linear-gradient(135deg,rgba(18,35,61,.05),transparent)!important;padding:12px!important;gap:7px!important}.pedigree-generation-head{align-self:end;text-align:center;padding:7px 8px;border-radius:9px 9px 4px 4px;background:var(--ped-navy);color:#fff;display:grid}.pedigree-generation-head strong{font-size:.72rem}.pedigree-generation-head span{font-size:.6rem;opacity:.75;text-transform:uppercase;letter-spacing:.08em}.pedigree-box{cursor:pointer;justify-content:flex-start!important;min-height:64px!important;padding:8px 9px!important}.pedigree-box.pedigree-male{background:linear-gradient(115deg,rgba(53,111,174,.13),var(--panel-2) 65%)!important;border-left:4px solid var(--ped-blue-strong)!important}.pedigree-box.pedigree-female{background:linear-gradient(115deg,rgba(185,75,93,.12),var(--panel-2) 65%)!important;border-left:4px solid var(--ped-rose-strong)!important}.pedigree-box-top{padding-right:0!important}.pedigree-box-top strong{font-size:.76rem!important}.pedigree-active-dot{margin-left:auto;color:var(--ped-gold)}.pedigree-name{font-size:.72rem!important}.pedigree-meta{font-size:.64rem!important}.pedigree-facts{font-size:.63rem!important;line-height:1.28!important;white-space:pre-wrap!important;-webkit-line-clamp:4!important}.pedigree-node-hint{margin-top:auto;padding-top:3px;font-size:.54rem;color:var(--muted);opacity:0;transition:.15s}.pedigree-box:hover .pedigree-node-hint{opacity:.8}.pedigree-add-parent{display:flex!important;align-items:center!important;justify-content:center!important;gap:2px!important;border:1px dashed rgba(148,163,184,.5)!important;background:transparent!important;color:var(--muted)!important;box-shadow:none!important}.pedigree-add-parent:hover{border-color:var(--ped-gold)!important;color:var(--text)!important;background:rgba(201,163,90,.06)!important}.pedigree-add-parent small{font-size:.57rem}.pedigree-empty-plus{font-size:1.15rem;color:var(--ped-gold)}.pedigree-race-head,.pedigree-race-line{font-size:.56rem!important;line-height:1.18!important}.pedigree-race-block{margin-top:4px!important;padding:4px!important}
.parent-sex{width:26px;height:26px;display:grid;place-items:center;border-radius:7px;font-weight:900}.parent-sex.male{background:#e9f3ff;color:#2766a8}.parent-sex.female{background:#fff0f2;color:#b23e53}.parent-sex.unknown{background:rgba(148,163,184,.13);color:var(--muted)}
.pedigree-overlay{position:fixed;inset:0;z-index:10050;background:rgba(3,10,20,.68);backdrop-filter:blur(5px);display:flex;align-items:center;justify-content:center;padding:24px}.pedigree-modal{width:min(760px,96vw);max-height:90vh;overflow:auto;border:1px solid rgba(148,163,184,.28);border-radius:20px;background:var(--panel);box-shadow:0 30px 90px rgba(0,0,0,.35);padding:18px}.pedigree-modal-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;border-bottom:1px solid var(--line-soft);padding-bottom:13px}.pedigree-modal-head h3{font-size:1.35rem;margin:2px 0}.pedigree-modal-head p{margin:0;color:var(--muted);font-size:.78rem}.pedigree-close{border:1px solid var(--line-soft);background:var(--panel-3);color:var(--text);border-radius:999px;width:34px;height:34px;font-size:1.25rem;cursor:pointer}.parent-searchbar{display:grid;grid-template-columns:24px 1fr auto;gap:7px;align-items:center;padding:13px 0}.parent-searchbar>span{font-size:1.3rem;color:var(--muted)}.parent-selector-results{display:grid;gap:12px;max-height:55vh;overflow:auto;padding-right:4px}.parent-result-section{display:grid;gap:5px}.parent-result-label{display:flex;justify-content:space-between;font-size:.62rem;font-weight:900;letter-spacing:.12em;color:var(--muted);padding:4px 3px}.parent-result{display:grid;grid-template-columns:34px 1fr auto;gap:10px;align-items:center;border:1px solid var(--line-soft);background:var(--panel-3);color:var(--text);border-radius:11px;padding:9px 10px;text-align:left;cursor:pointer}.parent-result:hover{border-color:rgba(53,111,174,.5);transform:translateY(-1px)}.parent-result>span:nth-child(2){display:grid}.parent-result strong{font-size:.78rem}.parent-result b{font-size:.72rem}.parent-result small{font-size:.65rem;color:var(--muted)}.parent-result em{font-style:normal;font-size:.58rem;font-weight:900;color:var(--ped-gold);border:1px solid rgba(201,163,90,.35);border-radius:999px;padding:4px 6px}.parent-create-zone{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:14px;padding-top:13px;border-top:1px solid var(--line-soft);color:var(--muted);font-size:.76rem}.pedigree-empty-state{display:grid;place-items:center;text-align:center;gap:4px;padding:30px;color:var(--muted)}.pedigree-empty-state strong{color:var(--text)}
.quick-create-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:16px 0}.quick-create-grid label{display:grid;gap:5px;font-size:.7rem;font-weight:800;color:var(--muted)}.quick-create-grid label.wide{grid-column:1/-1}.quick-active{display:flex!important;flex-direction:row;align-items:center!important;gap:9px;border:1px solid var(--line-soft);border-radius:11px;padding:9px 11px;background:var(--panel-3)}.quick-active input{width:18px;height:18px}.quick-active span{display:grid}.quick-active small{font-weight:500}.pedigree-modal-actions{display:flex;justify-content:flex-end;gap:8px;border-top:1px solid var(--line-soft);padding-top:13px}.pedigree-drawer-overlay{justify-content:flex-end;padding:0}.pedigree-drawer{height:100vh;width:min(520px,96vw);overflow:auto;background:var(--panel);box-shadow:-30px 0 80px rgba(0,0,0,.3);padding:20px}.drawer-identity{display:flex;gap:11px;align-items:center;padding:16px 0}.drawer-identity>div{display:grid}.drawer-identity strong{font-size:1.05rem}.drawer-identity span{font-size:.72rem;color:var(--muted)}.drawer-parent-cards{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-bottom:15px}.drawer-parent-cards button{display:grid;text-align:left;border:1px solid var(--line-soft);border-radius:11px;background:var(--panel-3);color:var(--text);padding:10px;cursor:pointer}.drawer-parent-cards span{font-size:.62rem;color:var(--muted);text-transform:uppercase}.drawer-parent-cards strong{font-size:.75rem;margin-top:3px}.pedigree-toast{position:fixed;right:24px;bottom:24px;z-index:11000;transform:translateY(20px);opacity:0;pointer-events:none;background:#123b2e;color:#fff;border-radius:11px;padding:11px 14px;box-shadow:0 14px 35px rgba(0,0,0,.28);font-size:.78rem;font-weight:800;transition:.2s}.pedigree-toast.error{background:#7f1d1d}.pedigree-toast.show{opacity:1;transform:translateY(0)}
@media(max-width:1100px){.pedigree-workspace{grid-template-columns:1fr}.stock-browser{position:static}.pedigree-stock-list{max-height:260px}.pedigree-studio-hero{padding:18px}.pedigree-hero-mark img{height:42px}}
@media(max-width:700px){.pedigree-filter-row{flex-wrap:wrap}.pedigree-search{min-width:100%;}.pedigree-studio-hero{align-items:flex-start}.pedigree-hero-mark span{display:none}.quick-create-grid{grid-template-columns:1fr}.pedigree-document-toolbar{align-items:flex-start;flex-direction:column}.pedigree-profile-premium{grid-template-columns:1fr!important}.parent-create-zone{align-items:stretch;flex-direction:column}.pedigree-overlay{padding:10px}.drawer-parent-cards{grid-template-columns:1fr}}
@media print{.pedigree-studio-hero,.pedigree-control-deck,.stock-browser,.pedigree-document-toolbar,.pedigree-node-hint,.pedigree-add-parent{display:none!important}.pedigree-workspace{display:block!important;margin:0!important}.pedigree-document-card{border:0!important;box-shadow:none!important}.pedigree-profile-premium{grid-template-columns:42mm 1fr!important;padding:3mm!important;border-bottom:1px solid #d7dce4!important}.pedigree-tree-studio{min-width:0!important;padding:2mm!important;gap:1.2mm!important;background:#fff!important}.pedigree-generation-head{background:#14233d!important;color:#fff!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}.pedigree-box{box-shadow:none!important;border-radius:1.5mm!important;padding:1.4mm!important;color:#111!important}.pedigree-box.pedigree-male{background:#edf5ff!important;border-left:1.2mm solid #356fae!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}.pedigree-box.pedigree-female{background:#fff1f3!important;border-left:1.2mm solid #b94b5d!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}.pedigree-box-top strong{font-size:6.5pt!important}.pedigree-name{font-size:6pt!important}.pedigree-meta,.pedigree-facts{font-size:5.2pt!important;color:#334155!important}.pedigree-race-block{display:none!important}}
/* Pedigree Studio v12 */
.pedigree-stats{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;max-width:720px}.pedigree-stats>span{display:flex;flex-direction:column;min-width:82px;padding:8px 11px;border:1px solid rgba(255,255,255,.22);border-radius:10px;background:rgba(255,255,255,.08);font-size:11px;line-height:1.2}.pedigree-stats strong{font-size:18px;line-height:1.05}/* Pedigree relatives: theme-native, compact and fully scrollable */
.pedigree-relatives{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;margin:12px 18px 16px;padding:0;background:transparent}
.relative-section{min-width:0;border:1px solid var(--line-soft);border-radius:14px;padding:11px;background:linear-gradient(180deg,var(--panel-2),var(--panel-3));box-shadow:0 8px 24px rgba(0,0,0,.08)}
.relative-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:9px;color:var(--text)}
.relative-head strong{font-size:.78rem;letter-spacing:.02em}.relative-head span{font-size:.66rem;font-weight:800;padding:2px 7px;border:1px solid var(--line-soft);border-radius:999px;background:rgba(148,163,184,.12);color:var(--muted)}
.relative-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:7px;max-height:190px;overflow-y:auto;overflow-x:hidden;padding:1px 5px 2px 1px;scrollbar-gutter:stable}
.relative-list::-webkit-scrollbar{width:8px}.relative-list::-webkit-scrollbar-thumb{background:rgba(148,163,184,.28);border-radius:999px}.relative-list::-webkit-scrollbar-track{background:transparent}
.relative-pigeon{display:flex;align-items:center;gap:8px;width:100%;min-width:0;text-align:left;padding:8px 9px;border:1px solid var(--line-soft);border-radius:10px;background:rgba(255,255,255,.025);color:var(--text);cursor:pointer;transition:border-color .15s ease,background .15s ease,transform .15s ease}
.relative-pigeon>span:last-child{display:flex;flex-direction:column;min-width:0;flex:1}.relative-pigeon strong{font-size:.76rem;color:var(--text)}.relative-pigeon b{font-size:.72rem;color:var(--text);font-weight:700}.relative-pigeon small{font-size:.66rem;color:var(--muted)}
.relative-pigeon strong,.relative-pigeon b,.relative-pigeon small{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.relative-pigeon:hover{border-color:rgba(56,189,248,.45);background:rgba(56,189,248,.07);transform:translateY(-1px)}
.profile-sex-icon{width:34px;height:34px;flex:0 0 34px;display:grid;place-items:center;border-radius:50%;font-family:Arial,Helvetica,sans-serif;font-size:25px!important;font-weight:700;line-height:1;background:rgba(148,163,184,.10);border:1px solid var(--line-soft)}.profile-sex-icon.male{color:#62a9ff;border-color:rgba(98,169,255,.35);background:rgba(98,169,255,.09)}.profile-sex-icon.female{color:#ef8194;border-color:rgba(239,129,148,.35);background:rgba(239,129,148,.09)}.profile-sex-icon.unknown{color:var(--muted)}
@media(max-width:900px){.pedigree-stats{justify-content:flex-start}.pedigree-relatives{grid-template-columns:1fr;margin-left:12px;margin-right:12px}.relative-list{max-height:220px}}
@media print{.pedigree-relatives{display:none!important}.pedigree-stats{display:none!important}}
/* Pedigree Studio v21: reliable touch editing on phones/tablets */
.pedigree-box,[data-pedigree-node-id],[data-add-parent-path]{-webkit-tap-highlight-color:rgba(56,189,248,.14);touch-action:pan-x pan-y}
@media (hover:none) and (pointer:coarse){
  .pedigree-node-hint{opacity:.72!important}
  .pedigree-node-hint::first-letter{text-transform:uppercase}
  .pedigree-box:active{border-color:rgba(56,189,248,.6)!important;transform:scale(.995)}
}

/* v22 iOS pedigree interaction: keep native two-axis scrolling, but make cards explicit tap targets. */
.pedigree-scroll [data-pedigree-node-id],.pedigree-scroll [data-add-parent-path]{cursor:pointer;-webkit-user-select:none;user-select:none;}
@media (hover:none) and (pointer:coarse){
  .pedigree-scroll [data-pedigree-node-id],.pedigree-scroll [data-add-parent-path]{-webkit-tap-highlight-color:rgba(56,189,248,.20);}
  .pedigree-scroll [data-pedigree-node-id]:active,.pedigree-scroll [data-add-parent-path]:active{filter:brightness(1.08);}
}

/* v24 — balanced OLR sync actions */
.olr-update-actions{display:grid!important;grid-template-columns:repeat(2,210px);gap:10px;align-items:stretch;justify-content:end}
.olr-update-actions .olr-sync-btn{box-sizing:border-box;width:210px;height:58px;min-height:58px;padding:9px 12px!important;border-radius:12px;display:grid!important;grid-template-columns:28px 1fr;grid-template-rows:1fr;align-items:center;gap:9px;text-align:left;position:relative;font:inherit;cursor:pointer;transition:.15s ease}
.olr-update-actions .olr-fast-load-btn{background:linear-gradient(135deg,#169b78,#1ab783);border:1px solid #21bd8d;color:#fff;box-shadow:0 5px 14px rgba(20,170,125,.16)}
.olr-update-actions .olr-full-load-btn{background:var(--panel-3);border:1px solid var(--line);color:var(--text);box-shadow:none}
.olr-update-actions .olr-sync-btn:hover{transform:translateY(-1px);filter:brightness(1.04)}
.olr-update-actions .olr-btn-icon{font-size:20px;width:28px;text-align:center}
.olr-update-actions .olr-btn-copy{display:block;min-width:0}
.olr-update-actions .olr-btn-copy strong{display:block;font-size:14px;line-height:1.1}
.olr-update-actions .olr-btn-copy small{display:block;font-size:10px;line-height:1.2;margin-top:3px;opacity:.72}
.olr-update-actions .olr-recommended-badge{position:absolute;right:8px;top:6px;padding:2px 6px;font-size:8px;line-height:1.25;background:rgba(255,255,255,.18);border-radius:999px}
@media(max-width:820px){.olr-update-actions{grid-template-columns:1fr 1fr;width:100%}.olr-update-actions .olr-sync-btn{width:100%}}
@media(max-width:520px){.olr-update-actions{grid-template-columns:1fr}.olr-update-actions .olr-sync-btn{width:100%}}

/* OSM standard tiles need no API key; retain a subdued dark presentation in dark mode. */
body:not(.light-mode) #derbyWorldMap .leaflet-tile-pane{opacity:.72;filter:grayscale(.2) invert(.92) hue-rotate(180deg) brightness(.72) contrast(1.18)}
body.light-mode #derbyWorldMap .leaflet-tile-pane{opacity:.88;filter:saturate(.8) contrast(1.03)}

/* v29 AI pedigree import */
.ai-pedigree-btn{border-color:#9a7a2d!important;box-shadow:inset 0 0 0 1px rgba(216,174,67,.16)}
.ai-import-modal{width:min(1180px,94vw);max-height:92vh;overflow:auto}
.ai-upload-zone{margin:18px 0;padding:34px;border:1px dashed #48617e;border-radius:18px;display:flex;align-items:center;justify-content:center;gap:14px;flex-wrap:wrap;background:rgba(28,52,82,.25);text-align:center}
.ai-upload-zone.drag{border-color:#d5aa43;background:rgba(213,170,67,.08)}.ai-upload-zone input{display:none}.ai-upload-zone>span{width:100%;color:var(--muted)}.ai-upload-icon{font-size:32px;color:#d5aa43}
.ai-working{display:flex;align-items:center;gap:14px;padding:16px;border-radius:14px;background:rgba(35,80,120,.18)}.ai-working small{display:block;color:var(--muted);margin-top:4px}.spinner{width:22px;height:22px;border:3px solid rgba(255,255,255,.18);border-top-color:#d5aa43;border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}
.ai-warnings{display:flex;gap:8px;flex-wrap:wrap;padding:12px 14px;margin:12px 0;border-radius:12px;background:rgba(213,170,67,.1);border:1px solid rgba(213,170,67,.3)}.ai-warnings span{color:var(--muted)}
.ai-preview-summary{display:flex;gap:10px;flex-wrap:wrap;margin:16px 0}.ai-preview-summary span{padding:9px 13px;border-radius:999px;background:var(--panel-2,#132238);border:1px solid var(--border,#293a51)}
.ai-import-list{display:grid;gap:10px}.ai-import-row{display:grid;grid-template-columns:38px minmax(0,1fr) 150px;gap:12px;padding:14px;border:1px solid var(--border,#293a51);border-radius:15px;background:var(--panel-2,#111c2e)}.ai-import-check{display:flex;align-items:flex-start;padding-top:4px}.ai-import-check input{width:20px;height:20px}.ai-import-title{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.ai-import-title strong{font-size:18px}.ai-import-title b{font-weight:600}.ai-confidence{font-size:11px;padding:3px 7px;border-radius:999px;background:rgba(213,170,67,.12);color:#d5aa43}.ai-parent-line{margin-top:8px;display:flex;gap:10px;color:var(--muted)}.ai-import-main p{margin:8px 0 0;white-space:pre-wrap}.ai-import-state{align-self:start;padding:8px 10px;border-radius:10px}.ai-import-state strong,.ai-import-state small{display:block}.ai-import-state small{margin-top:3px;color:var(--muted)}.ai-import-state.new{background:rgba(25,180,105,.1)}.ai-import-state.existing{background:rgba(42,130,210,.1)}.ai-conflicts{grid-column:2/-1}.ai-conflicts>div{display:grid;grid-template-columns:120px 1fr 1fr;gap:8px;padding:7px 0;border-top:1px solid var(--border,#293a51);font-size:12px}.ai-import-actions{position:sticky;bottom:0;display:flex;gap:10px;align-items:center;margin-top:16px;padding:14px;background:var(--panel,#101a2b);border-top:1px solid var(--border,#293a51)}.ai-import-actions .spacer{flex:1}
@media(max-width:720px){.ai-import-row{grid-template-columns:32px 1fr}.ai-import-state{grid-column:2}.ai-conflicts{grid-column:1/-1}.ai-conflicts>div{grid-template-columns:1fr}.ai-import-actions{flex-wrap:wrap}.ai-import-actions .spacer{display:none}.ai-import-actions button{flex:1 1 42%}}
.ai-stage-progress{height:7px;margin-top:10px;border-radius:999px;overflow:hidden;background:rgba(255,255,255,.10);border:1px solid rgba(255,255,255,.08)}
.ai-stage-progress>span{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#18b779,#38d996);transition:width .3s ease}

/* v38 – AI Pedigree Assistant */
.ai-assistant-modal{width:min(980px,94vw);max-height:90vh;overflow:auto}
.ai-assistant-presets{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:18px 0}
.ai-assistant-presets button{text-align:left;white-space:normal;min-height:54px}
.ai-assistant-question{display:block;font-weight:800;margin-top:8px}
.ai-assistant-question textarea{width:100%;margin-top:8px;resize:vertical}
.ai-assistant-answer{margin-top:18px;border:1px solid var(--border);border-radius:18px;background:var(--panel-2,rgba(255,255,255,.03));padding:18px;min-height:150px}
.ai-answer-card .eyebrow{display:block;margin-bottom:10px}
.ai-answer-text{white-space:pre-wrap;line-height:1.55;font-size:1rem}
.ai-assistant-loading{padding:30px;text-align:center;font-weight:800;opacity:.8}
.facts-label-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:6px}
.ai-facts-btn{border:1px solid rgba(43,190,255,.45);background:rgba(43,190,255,.10);color:inherit;border-radius:10px;padding:7px 10px;font-weight:800;cursor:pointer}
.ai-facts-btn:hover{background:rgba(43,190,255,.18)}
.ai-facts-btn:disabled{opacity:.55;cursor:wait}
@media(max-width:720px){.ai-assistant-presets{grid-template-columns:1fr}.facts-label-row{align-items:flex-start;flex-direction:column}}

/* v39 AI assistant language control */
.ai-assistant-controls{display:flex;justify-content:flex-end;margin:10px 0 4px}.ai-assistant-controls label{display:flex;align-items:center;gap:10px;font-size:12px;font-weight:700}.ai-assistant-controls select{min-width:130px}

/* v46 duplicate review */
.duplicate-modal{width:min(920px,97vw)}.duplicate-summary{display:flex;justify-content:space-between;gap:18px;align-items:center;padding:14px 2px;color:var(--muted);font-size:.72rem}.duplicate-summary strong{color:var(--text);font-size:.88rem}.duplicate-groups{display:grid;gap:14px;max-height:68vh;overflow:auto;padding-right:4px}.duplicate-group{border:1px solid var(--line-soft);border-radius:14px;padding:12px;background:var(--panel-2)}.duplicate-group-head,.duplicate-actions{display:flex;justify-content:space-between;align-items:center;gap:12px}.duplicate-group-head>div{display:grid}.duplicate-group-head span{font-size:.58rem;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);font-weight:900}.duplicate-group-head strong{font-size:.9rem}.duplicate-candidates{display:grid;gap:7px;margin:11px 0}.duplicate-candidate{display:grid;grid-template-columns:20px 34px 1fr auto;align-items:center;gap:9px;border:1px solid var(--line-soft);border-radius:11px;padding:9px;background:var(--panel-3);cursor:pointer}.duplicate-candidate:has(input:checked){border-color:rgba(201,163,90,.75);box-shadow:inset 0 0 0 1px rgba(201,163,90,.18)}.duplicate-candidate-main{display:grid;min-width:0}.duplicate-candidate-main strong{font-size:.78rem}.duplicate-candidate-main b{font-size:.72rem}.duplicate-candidate-main small,.duplicate-candidate-main em{font-size:.62rem;color:var(--muted);font-style:normal}.duplicate-badge{font-size:.52rem;font-weight:900;letter-spacing:.08em;color:var(--ped-gold);border:1px solid rgba(201,163,90,.4);border-radius:999px;padding:4px 6px}.duplicate-actions{border-top:1px solid var(--line-soft);padding-top:10px}.duplicate-actions span{font-size:.64rem;color:var(--muted)}.duplicate-merged{border-color:rgba(34,197,94,.35)}.duplicate-rejected{opacity:.7}@media(max-width:680px){.duplicate-summary,.duplicate-actions{align-items:flex-start;flex-direction:column}.duplicate-candidate{grid-template-columns:18px 30px 1fr}.duplicate-badge{grid-column:3}.duplicate-actions button{width:100%}}

/* v47 UX additions */
.sidebar-collapse{position:absolute;right:10px;top:10px;width:34px;height:34px;padding:0;z-index:4}
.sidebar{position:relative;transition:width .2s ease}
.app-shell.sidebar-collapsed{grid-template-columns:72px 1fr}
.sidebar-collapsed .sidebar{width:72px}
.sidebar-collapsed .brand,.sidebar-collapsed .sidebar .meta{font-size:0}
.sidebar-collapsed .brand small,.sidebar-collapsed .nav button span:not(.nav-icon){display:none}
.sidebar-collapsed .nav button{justify-content:center;padding-left:8px;padding-right:8px}
.topbar.section-clean .filters,.topbar.section-clean .topbar-logos{display:none}
.export-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:16px 0}
.desc-group{margin:12px 0}.desc-group h4{margin:6px 0}
.facts-highlight-picker{margin-top:10px;padding:12px;border:1px solid var(--border);border-radius:12px;display:grid;gap:8px}
.facts-highlight-picker label{display:flex;gap:8px;align-items:flex-start}
.ai-import-tree{display:grid;grid-template-columns:repeat(4,minmax(190px,1fr));gap:10px;overflow:auto;padding:10px 0}
.ai-import-node{border:1px solid var(--border);border-radius:12px;padding:10px;min-height:120px;position:relative}
.ai-import-node.existing{border-style:solid}.ai-import-node.possible{border-style:dashed}.ai-import-node.disabled{opacity:.38}
.ai-import-node .node-check{position:absolute;right:8px;top:8px}
.sidebar-collapsed .nav button{font-size:0;min-height:42px}.sidebar-collapsed .nav button::first-letter{font-size:18px}.sidebar-collapsed .sidebar-collapse{right:18px}

.nav button{display:flex;align-items:center;gap:10px}.nav-icon{width:22px;text-align:center}.sidebar-collapsed .nav-label{display:none}.sidebar-collapsed .nav-icon{font-size:18px}

/* v47.1 visual fixes: compact sidebar, OLR pigeon picker, descendants */
.sidebar{min-height:100vh;height:100vh;display:flex;flex-direction:column;overflow-x:hidden}
.sidebar .nav{flex:1;align-content:start}
.sidebar .meta{margin-top:auto}
.sidebar-collapse{display:grid;place-items:center;border-radius:10px;background:var(--panel-2);border:1px solid var(--line);color:var(--text);box-shadow:var(--shadow-soft)}
.sidebar-collapsed .sidebar{padding:16px 10px;width:76px;align-items:stretch}
.app-shell.sidebar-collapsed{grid-template-columns:76px minmax(0,1fr)}
.sidebar-collapsed .brand{display:none}
.sidebar-collapsed .sidebar .meta{display:none}
.sidebar-collapsed .sidebar-collapse{position:relative;top:auto;right:auto;width:44px;height:44px;margin:0 auto 22px;font-size:20px}
.sidebar-collapsed .nav{width:100%;gap:10px}
.sidebar-collapsed .nav button{width:52px;height:52px;min-height:52px;margin:0 auto;padding:0;justify-content:center;border-radius:14px;font-size:0;overflow:hidden}
.sidebar-collapsed .nav-icon{width:auto;font-size:21px}
.sidebar-collapsed .nav button.active{background:linear-gradient(180deg,rgba(56,189,248,.18),rgba(56,189,248,.10));box-shadow:inset 0 0 0 1px rgba(56,189,248,.32)}
@media (min-width:721px) and (max-width:980px){.app-shell{grid-template-columns:290px minmax(0,1fr)}.app-shell.sidebar-collapsed{grid-template-columns:76px minmax(0,1fr)}.sidebar{position:sticky;top:0;height:100vh;min-height:100vh}}
@media (max-width:720px){.sidebar{position:relative;height:auto;min-height:0}.sidebar-collapse{display:none}.app-shell.sidebar-collapsed{grid-template-columns:1fr}.sidebar-collapsed .sidebar{width:auto;padding:24px 18px}.sidebar-collapsed .brand{display:block}.sidebar-collapsed .sidebar .meta{display:block}.sidebar-collapsed .nav button{width:100%;height:auto;min-height:0;margin:0;padding:13px 14px;justify-content:flex-start;font-size:inherit}.sidebar-collapsed .nav-label{display:inline}.sidebar-collapsed .nav-icon{width:22px;font-size:inherit}}
.olr-existing-picker{padding:14px;border:1px solid var(--line-soft);border-radius:16px;background:var(--panel-2)}
.olr-existing-picker .parent-searchbar{margin-top:8px}.olr-pigeon-search-results{margin-top:10px;max-height:310px;overflow:auto;display:grid;gap:7px}.olr-pigeon-search-results .parent-result.selected{border-color:rgba(56,189,248,.55);box-shadow:inset 0 0 0 1px rgba(56,189,248,.22)}
.desc-summary{display:flex;gap:8px;align-items:baseline;padding:12px 14px;margin:4px 0 16px;border:1px solid var(--line-soft);border-radius:14px;background:var(--panel-2)}.desc-summary span{color:var(--muted);font-size:.78rem}.desc-generations{display:grid;gap:18px;max-height:68vh;overflow:auto;padding-right:4px}.desc-group{margin:0}.desc-group-head{display:flex;align-items:center;gap:10px;margin:0 0 9px}.desc-generation-number{display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:rgba(56,189,248,.12);border:1px solid rgba(56,189,248,.25);font-weight:900}.desc-group-head h4{margin:0;font-size:.9rem}.desc-group-head small{color:var(--muted)}.desc-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.desc-card{display:grid;grid-template-columns:34px minmax(0,1fr) 18px;align-items:center;gap:9px;text-align:left;padding:10px;border:1px solid var(--line-soft);border-radius:12px;background:var(--panel-2);color:var(--text);cursor:pointer}.desc-card:hover{border-color:rgba(56,189,248,.4);background:var(--panel-3)}.desc-card-main{display:grid;min-width:0}.desc-card-main strong{font-size:.78rem}.desc-card-main b{font-size:.72rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.desc-card-main small{font-size:.62rem;color:var(--muted)}.desc-open{font-size:1.3rem;color:var(--muted)}@media(max-width:700px){.desc-grid{grid-template-columns:1fr}}
\n\n/* v47.2 sidebar refinement: fixed full-height rail + discreet bottom arrow */\n@media (min-width:721px){\n  .sidebar{\n    position:fixed;\n    inset:0 auto 0 0;\n    width:290px;\n    height:100dvh;\n    min-height:100dvh;\n    overflow-y:auto;\n    overflow-x:hidden;\n    z-index:30;\n    padding-bottom:72px;\n  }\n  .app-shell{grid-template-columns:290px minmax(0,1fr)}\n  .content{grid-column:2}\n  .sidebar-collapse{\n    position:fixed;\n    left:244px;\n    right:auto;\n    top:auto;\n    bottom:14px;\n    width:32px;\n    height:32px;\n    margin:0;\n    border:0;\n    border-radius:9px;\n    background:transparent;\n    box-shadow:none;\n    color:var(--muted);\n    font-size:26px;\n    line-height:1;\n    opacity:.62;\n    z-index:35;\n    transition:opacity .16s ease,background .16s ease,color .16s ease,left .2s ease;\n  }\n  .sidebar-collapse:hover{opacity:1;background:var(--panel-2);color:var(--text)}\n  .sidebar-collapsed .sidebar{width:76px;padding:16px 10px 64px}\n  .app-shell.sidebar-collapsed{grid-template-columns:76px minmax(0,1fr)}\n  .sidebar-collapsed .sidebar-collapse{\n    position:fixed;\n    left:34px;\n    right:auto;\n    top:auto;\n    bottom:14px;\n    width:32px;\n    height:32px;\n    margin:0;\n    font-size:26px;\n  }\n}\n/* Columbaverse brand shell */
.columbaverse-brand{height:108px;margin:0 0 18px;display:flex;align-items:center;justify-content:center;overflow:hidden}
.columbaverse-brand img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 6px 14px rgba(0,0,0,.16))}
.login-brand{text-align:center;margin-bottom:10px}.login-brand img{display:block;max-width:290px;max-height:190px;object-fit:contain;margin:0 auto 8px}.login-brand .login-title{text-transform:uppercase;letter-spacing:.12em}
body.light .columbaverse-brand img,body.light .login-brand img{filter:drop-shadow(0 6px 14px rgba(15,23,42,.10))}
.sidebar.collapsed .columbaverse-brand{height:58px;margin:4px 0 18px}.sidebar.collapsed .columbaverse-brand img{width:58px;height:58px}
.tenant-logo-empty{display:none}.tenant-logo-config{display:grid;gap:10px}.tenant-logo-preview{height:84px;display:flex;align-items:center;justify-content:center;border:1px dashed var(--line);border-radius:14px;background:var(--panel-2);padding:8px}.tenant-logo-preview img{max-width:100%;max-height:68px;object-fit:contain}

/* v48.4 sidebar polish: one page scroll, persistent rail background, compact brand */
@media (min-width:721px){
  .app-shell{
    position:relative;
    background:linear-gradient(90deg,var(--panel-3) 0 290px,transparent 290px);
  }
  .app-shell.sidebar-collapsed{
    background:linear-gradient(90deg,var(--panel-3) 0 76px,transparent 76px);
  }
  .sidebar{
    position:sticky;
    top:0;
    align-self:start;
    width:290px;
    height:100vh;
    height:100dvh;
    min-height:100vh;
    min-height:100dvh;
    overflow:visible;
    padding:18px 18px 54px;
    z-index:30;
  }
  .content{grid-column:2}
  .columbaverse-brand{
    height:auto;
    min-height:0;
    margin:0 0 14px;
    padding:2px 20px 0;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:flex-start;
    overflow:visible;
  }
  .columbaverse-brand > img{
    width:auto;
    height:auto;
    max-width:190px;
    max-height:170px;
    object-fit:contain;
  }
  .columbaverse-brand .tenant-badge{
    width:100%;
    margin:10px 0 0;
    text-align:center;
    white-space:normal;
  }
  .sidebar-collapse{
    position:fixed;
    left:244px;
    bottom:14px;
  }
  .sidebar-collapsed .sidebar{
    width:76px;
    padding:14px 10px 54px;
  }
  .sidebar-collapsed .columbaverse-brand{
    display:flex;
    height:auto;
    margin:0 0 18px;
    padding:0;
  }
  .sidebar-collapsed .columbaverse-brand > img{
    display:block;
    width:50px;
    height:50px;
    max-width:50px;
    max-height:50px;
    object-fit:contain;
  }
  .sidebar-collapsed .columbaverse-brand .tenant-badge{display:none}
  .sidebar-collapsed .sidebar-collapse{left:34px;bottom:14px}
}

/* v48.5 expanded sidebar brand layout fix */
@media (min-width:721px){
  .app-shell:not(.sidebar-collapsed) .columbaverse-brand{
    flex:0 0 auto;
    width:100%;
    box-sizing:border-box;
    margin:0 0 18px !important;
    padding:0 10px !important;
    min-height:190px;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:flex-start;
    gap:10px;
  }
  .app-shell:not(.sidebar-collapsed) .columbaverse-brand > img{
    display:block;
    width:150px !important;
    height:150px !important;
    max-width:150px !important;
    max-height:150px !important;
    object-fit:contain;
    flex:0 0 150px;
  }
  .app-shell:not(.sidebar-collapsed) .columbaverse-brand .tenant-badge{
    position:static !important;
    display:block;
    width:100%;
    box-sizing:border-box;
    margin:0 !important;
    padding:8px 10px;
    text-align:center;
    white-space:normal;
    line-height:1.25;
    flex:0 0 auto;
  }
  .app-shell:not(.sidebar-collapsed) .sidebar .nav{
    flex:1 0 auto;
    width:100%;
    margin-top:4px;
  }
  .sidebar-collapse{
    top:auto !important;
    right:auto !important;
    bottom:14px !important;
  }
}

/* v48.6 sidebar viewport-fit fix: keep every menu/footer reachable without a nested scrollbar */
@media (min-width:721px){
  .sidebar{
    box-sizing:border-box;
    display:flex;
    flex-direction:column;
    height:100dvh;
    min-height:100dvh;
    padding:12px 18px 46px;
    overflow:visible;
  }
  .app-shell:not(.sidebar-collapsed) .columbaverse-brand{
    min-height:0;
    margin:0 0 8px !important;
    padding:0 16px !important;
    gap:5px;
  }
  .app-shell:not(.sidebar-collapsed) .columbaverse-brand > img{
    width:112px !important;
    height:112px !important;
    max-width:112px !important;
    max-height:112px !important;
    flex:0 0 112px;
  }
  .app-shell:not(.sidebar-collapsed) .columbaverse-brand .tenant-badge{
    padding:6px 9px;
    line-height:1.15;
    font-size:.84rem;
  }
  .app-shell:not(.sidebar-collapsed) .sidebar .nav{
    flex:0 1 auto;
    display:grid;
    gap:2px;
    margin-top:2px;
    min-height:0;
  }
  .app-shell:not(.sidebar-collapsed) .sidebar .nav button{
    padding:8px 12px;
    min-height:40px;
    border-radius:12px;
  }
  .app-shell:not(.sidebar-collapsed) .sidebar .meta{
    flex:0 0 auto;
    margin-top:auto;
    padding-top:8px;
    font-size:.82rem;
  }
  .app-shell:not(.sidebar-collapsed) .sidebar .meta .pill{padding:6px 10px}
  .app-shell:not(.sidebar-collapsed) .sidebar .meta > div{margin-top:6px !important}
  .app-shell:not(.sidebar-collapsed) .sidebar .meta button{
    padding:8px 10px;
    min-height:38px;
  }
  .sidebar-collapse{bottom:8px !important}
  .sidebar-collapsed .sidebar-collapse{bottom:8px !important}
}

/* On short desktop viewports compress the brand/navigation a little further. */
@media (min-width:721px) and (max-height:780px){
  .app-shell:not(.sidebar-collapsed) .columbaverse-brand > img{
    width:86px !important;height:86px !important;max-width:86px !important;max-height:86px !important;flex-basis:86px;
  }
  .app-shell:not(.sidebar-collapsed) .columbaverse-brand .tenant-badge{font-size:.76rem;padding:5px 7px}
  .app-shell:not(.sidebar-collapsed) .sidebar .nav button{padding:6px 10px;min-height:35px}
  .app-shell:not(.sidebar-collapsed) .sidebar .meta{padding-top:5px}
}
/* V49 administration/i18n */
.admin-enhancement{margin-top:18px}.settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px;margin:16px 0}.settings-grid label,.quota-admin label,.api-key-grid label{display:flex;flex-direction:column;gap:7px}.settings-grid .span2{grid-column:1/-1}.cv-help{display:inline-flex;width:18px;height:18px;border:1px solid var(--border);border-radius:50%;align-items:center;justify-content:center;font-size:11px;cursor:help;opacity:.75}.quota-cards,.portal-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin:14px 0}.quota-card,.portal-stats>div{border:1px solid var(--border);border-radius:14px;padding:12px;display:flex;flex-direction:column;gap:4px}.portal-stats strong{font-size:1.7rem}.portal-admin{border-color:rgba(50,170,230,.45)}.portal-head{display:flex;justify-content:space-between;gap:20px}.quota-admin,.api-key-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px;margin:12px 0 18px}.api-key-row,.translation-editor{display:flex;gap:8px;align-items:center}.api-key-row input,.translation-editor input{min-width:0;flex:1}.translation-editor{margin:12px 0;flex-wrap:wrap}@media(max-width:800px){.settings-grid{grid-template-columns:1fr}.settings-grid .span2{grid-column:auto}.translation-editor>*{width:100%}}
/* Pedigree readability polish */
.pedigree-profile-premium .pedigree-photo-wrap img{object-fit:contain!important;background:var(--panel-3);padding:4px}.pedigree-box{overflow-wrap:anywhere}.pedigree-facts{line-height:1.38!important}.pedigree-meta{white-space:normal!important;line-height:1.3}.pedigree-box:has(.pedigree-photo-placeholder) .pedigree-facts{flex:1}

/* V50 compact Pedigree Studio + structured Administration */
#pedigree .pedigree-control-deck{padding:12px 14px}
#pedigree .pedigree-view-tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:9px}
#pedigree .pedigree-view-btn{min-height:32px;padding:6px 10px;border-radius:10px;font-size:.78rem}
#pedigree .pedigree-filter-row{display:grid;grid-template-columns:minmax(240px,1fr) 120px 135px auto;gap:8px;align-items:center}
#pedigree .pedigree-filter-row>button{min-height:36px;padding:7px 10px;font-size:.78rem}
#pedigree .pedigree-document-toolbar{gap:12px;align-items:center}
#pedigree .pedigree-document-toolbar>div:last-child{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
#pedigree .pedigree-document-toolbar button{min-height:34px;padding:6px 9px;font-size:.76rem}
@media(max-width:1250px){#pedigree .pedigree-filter-row{grid-template-columns:minmax(220px,1fr) 110px 130px}#pedigree .pedigree-filter-row>button{width:auto!important}}
@media(max-width:760px){#pedigree .pedigree-filter-row{grid-template-columns:1fr 1fr}#pedigree .pedigree-search{grid-column:1/-1}}

#admin .card{padding:16px}#admin h2{margin-bottom:4px}#admin h3{margin:0;font-size:1rem}
.cv-admin-shell{display:grid;gap:12px}.cv-admin-section{border:1px solid var(--line-soft);border-radius:16px;background:var(--panel-2);overflow:hidden}
.cv-admin-section>summary{list-style:none;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;cursor:pointer;font-weight:800}
.cv-admin-section>summary::-webkit-details-marker{display:none}.cv-admin-section>summary:after{content:'+';font-size:1.2rem;color:var(--muted)}.cv-admin-section[open]>summary:after{content:'–'}
.cv-admin-section[open]>summary{border-bottom:1px solid var(--line-soft)}.cv-admin-section-body{padding:14px}
.cv-admin-kicker{font-size:.72rem;color:var(--muted);font-weight:700;text-transform:uppercase;letter-spacing:.07em}
#admin .form-grid{gap:10px}#admin .toolbar{gap:7px;margin-bottom:8px}#admin button{min-height:34px;padding:7px 10px;font-size:.8rem}
#admin .tenant-settings-grid{grid-template-columns:repeat(auto-fit,minmax(210px,1fr))}.admin-enhancement{margin-top:12px!important}
.portal-stats{grid-template-columns:repeat(4,minmax(110px,1fr));margin:10px 0 14px}.portal-stats>div{padding:9px 11px}.portal-stats strong{font-size:1.35rem}
.cv-translation-toolbar{display:grid;grid-template-columns:minmax(220px,1fr) 150px auto;gap:8px;margin:10px 0}.cv-translation-table{max-height:520px;overflow:auto;border:1px solid var(--line-soft);border-radius:12px}
.cv-translation-table table{margin:0}.cv-translation-table th{position:sticky;top:0;z-index:2;background:var(--panel-2)}.cv-translation-table td,.cv-translation-table th{padding:7px 8px;vertical-align:middle}
.cv-translation-key{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.72rem;white-space:nowrap}.cv-tr-input{min-width:170px!important;padding:7px 8px!important;font-size:.78rem!important}
.cv-tr-missing{outline:1px dashed rgba(245,158,11,.55)}.cv-tr-save{white-space:nowrap}.cv-translation-count{font-size:.75rem;color:var(--muted)}
@media(max-width:900px){.portal-stats{grid-template-columns:1fr 1fr}.cv-translation-toolbar{grid-template-columns:1fr}.cv-translation-table{overflow:auto}}
#pedigree .pedigree-action-group{display:inline-flex;gap:5px;padding-left:7px;border-left:1px solid var(--line-soft)}

/* v51 split administration */
.admin-page-head{margin:0 0 14px;padding:4px 2px 10px}.admin-page-head h1{margin:3px 0 4px;font-size:clamp(1.45rem,2.3vw,2rem)}
.admin-tenant-context{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:16px 18px;margin-bottom:14px;border:1px solid var(--line-soft);border-radius:16px;background:var(--panel-2)}
.admin-tenant-context h2{margin:3px 0 4px;font-size:1.1rem}.admin-tenant-context p{margin:0}.admin-tenant-context.compact{padding:12px 16px}.admin-tenant-switch{display:flex;gap:8px;align-items:center;min-width:min(100%,420px)}.admin-tenant-switch select{min-width:220px}
.platform-tenant-editor{display:grid;grid-template-columns:minmax(180px,1fr) minmax(240px,2fr) 140px auto;gap:10px;align-items:end}.platform-tenant-editor label{display:flex;flex-direction:column;gap:6px}.platform-tenant-editor .toolbar{margin:0;flex-wrap:nowrap}
#tenantAdmin .card,#platformAdmin .card{margin-top:12px}#platformAdmin .portal-admin{margin-top:0!important}
@media(max-width:900px){.admin-tenant-context{align-items:stretch;flex-direction:column}.admin-tenant-switch{min-width:0;width:100%}.admin-tenant-switch select{min-width:0;flex:1}.platform-tenant-editor{grid-template-columns:1fr 1fr}.platform-tenant-editor .toolbar{grid-column:1/-1}}
@media(max-width:600px){.admin-tenant-switch,.platform-tenant-editor{display:flex;flex-direction:column;align-items:stretch}.admin-tenant-switch button{width:100%}}
.platform-user-editor{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px;align-items:end}.platform-user-editor .toolbar{grid-column:1/-1;margin:0}
/* v51.5 admin clarity */
.tenant-master-card,.tenant-master-grid{max-width:none}.tenant-master-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.tenant-master-grid .span2{grid-column:span 2}.admin-section-heading{display:flex;justify-content:space-between;gap:16px;margin-bottom:14px}.admin-section-heading h2{margin:3px 0 4px}.admin-section-heading p{margin:0;max-width:850px}.platform-user-editor{padding:14px;border:1px solid var(--line-soft);border-radius:14px;background:var(--panel-2)}.platform-user-editor.is-editing{outline:2px solid rgba(50,170,230,.35)}.platform-user-editor-title{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:12px}.platform-user-editor-title strong{font-size:1rem}.cv-admin-section>summary{position:sticky;top:0;z-index:2;background:var(--panel)}
@media(max-width:900px){.tenant-master-grid{grid-template-columns:1fr 1fr}.tenant-master-grid .span2{grid-column:1/-1}}@media(max-width:620px){.tenant-master-grid{grid-template-columns:1fr}.tenant-master-grid .span2{grid-column:auto}}

/* v51.7 AI Pedigree Import V2 */
.ai-import-modal{position:relative;max-width:min(96vw,1500px)!important;width:min(96vw,1500px)!important;max-height:94vh;overflow:auto;padding-top:22px}
.ai-import-close{position:absolute!important;top:12px!important;right:12px!important;z-index:20;width:38px!important;height:38px!important;min-height:38px!important;padding:0!important;border-radius:50%!important;font-size:1.35rem!important;display:grid!important;place-items:center!important}
.ai-upload-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}.ai-upload-actions [hidden]{display:none!important}
.ai-live-card{margin:14px 0;border-color:rgba(50,170,230,.4)}.ai-review-toolbar{display:flex;justify-content:space-between;gap:14px;align-items:center;margin:14px 0;padding:12px 14px;border:1px solid var(--line-soft);border-radius:14px;background:var(--panel-2)}.ai-review-toolbar>div{display:flex;flex-direction:column;gap:3px}.ai-review-toolbar small{color:var(--muted)}
.ai-tree-scroll{overflow:auto;padding:4px 0 14px;scrollbar-gutter:stable}.ai-tree-board{display:flex;align-items:stretch;gap:22px;min-width:max-content;padding:6px}.ai-generation{width:250px;display:flex;flex-direction:column;gap:10px}.ai-generation-head{position:sticky;top:0;z-index:3;display:flex;justify-content:space-between;gap:8px;align-items:center;padding:8px 10px;border:1px solid var(--line-soft);border-radius:10px;background:var(--panel);font-size:.75rem;font-weight:800}.ai-generation-head label{display:flex;align-items:center;gap:5px;font-weight:600;color:var(--muted)}.ai-generation-nodes{display:flex;flex-direction:column;justify-content:space-around;gap:12px;flex:1}.ai-import-node{position:relative;width:250px;display:flex;flex-direction:column;gap:7px;padding:12px;border:1px solid var(--line-soft);border-radius:14px;background:var(--panel-2);transition:.16s ease;box-shadow:0 4px 18px rgba(0,0,0,.08)}.ai-import-node.existing{border-color:rgba(245,158,11,.4)}.ai-import-node.new{border-color:rgba(34,197,94,.32)}.ai-import-node.disabled{opacity:.48;filter:saturate(.6)}.ai-import-node input,.ai-import-node textarea{width:100%;font-size:.78rem;padding:7px 8px}.ai-import-node textarea{resize:vertical}.ai-import-node .node-check{position:absolute;right:9px;top:9px}.ai-node-status{display:flex;flex-direction:column;padding-right:28px}.ai-node-status small{font-size:.66rem;color:var(--muted)}.ai-existing-note{font-size:.68rem;color:var(--muted);padding:6px 7px;border-radius:8px;background:rgba(245,158,11,.08)}.ai-conflicts summary{cursor:pointer;font-size:.72rem;font-weight:800}.ai-conflicts div{display:flex;flex-direction:column;gap:3px;margin-top:6px;padding:7px;border-radius:8px;background:var(--panel)}.ai-conflicts small,.ai-conflicts em{font-size:.65rem}.ai-conflicts em{color:var(--muted)}
@media(max-width:700px){.ai-import-modal{width:98vw!important}.ai-review-toolbar{align-items:stretch;flex-direction:column}.ai-generation{width:220px}.ai-import-node{width:220px}}

/* v51.8 AI review: Pedigree-Studio density + reliable generation controls */
.ai-tree-board.ai-tree-compact{display:grid;grid-template-columns:repeat(var(--ai-gens),minmax(205px,1fr));gap:7px;min-width:max(900px,calc(var(--ai-gens) * 205px));padding:8px;background:linear-gradient(135deg,rgba(18,35,61,.05),transparent)}
.ai-tree-compact .ai-generation{width:auto;min-width:205px;display:grid;grid-template-rows:42px minmax(0,1fr);gap:7px}
.ai-tree-compact .ai-generation-head{position:static;display:flex;min-height:42px;padding:6px 8px;border:0;border-radius:9px 9px 4px 4px;background:var(--ped-navy,#14233d);color:#fff}
.ai-tree-compact .ai-generation-head>span{display:grid;text-align:center;flex:1}.ai-tree-compact .ai-generation-head strong{font-size:.72rem}.ai-tree-compact .ai-generation-head small{font-size:.56rem;opacity:.72;text-transform:uppercase;letter-spacing:.08em}
.ai-tree-compact .ai-generation-head label{position:relative;z-index:5;flex:0 0 auto;color:#fff;font-size:.58rem;cursor:pointer;user-select:none}.ai-tree-compact .ai-generation-head input{width:16px;height:16px;cursor:pointer;accent-color:#38bdf8}
.ai-tree-compact .ai-generation-nodes{display:grid;grid-template-rows:repeat(var(--ai-rows),96px);gap:7px;justify-content:stretch}
.ai-tree-compact .ai-import-node{width:auto;min-width:0;min-height:64px;padding:8px 9px;gap:4px;border-radius:11px;box-shadow:0 5px 16px rgba(0,0,0,.08);overflow:visible;align-self:stretch}
.ai-tree-compact .ai-import-node .node-check{right:7px;top:7px;z-index:4;padding:2px;background:var(--panel-2);border-radius:5px}.ai-tree-compact .ai-import-node .node-check input{width:16px;height:16px;cursor:pointer;accent-color:#38bdf8}
.ai-node-compact{display:flex;flex-direction:column;min-width:0;height:100%}.ai-node-compact .pedigree-box-top{display:flex;align-items:center;gap:5px;padding-right:24px}.ai-node-compact .pedigree-box-top strong{font-size:.76rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ai-node-compact .pedigree-name{font-size:.72rem}.ai-node-compact .pedigree-meta{font-size:.64rem;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ai-node-compact .pedigree-facts{font-size:.63rem;line-height:1.28;display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;margin:4px 0}
.ai-node-footer{display:flex;align-items:center;justify-content:space-between;gap:5px;margin-top:auto;padding-top:5px}.ai-status-pill{font-size:.5rem;font-weight:900;letter-spacing:.05em;padding:2px 5px;border-radius:999px;background:rgba(34,197,94,.1);color:#22c55e}.ai-status-pill.existing{background:rgba(245,158,11,.1);color:#f59e0b}.ai-status-pill.possible{background:rgba(234,179,8,.1);color:#eab308}.ai-node-edit{border:0;background:transparent;color:var(--muted);font-size:.58rem;font-weight:800;padding:2px 4px;cursor:pointer}.ai-node-edit:hover{color:var(--text)}
.ai-node-editor{position:absolute;z-index:12;left:calc(100% + 7px);top:0;width:280px;padding:10px;border:1px solid var(--line-soft);border-radius:12px;background:var(--panel);box-shadow:0 18px 45px rgba(0,0,0,.3)}.ai-node-editor[hidden]{display:none!important}.ai-node-editor label{display:grid;gap:3px;margin-bottom:6px;font-size:.62rem;font-weight:800;color:var(--muted)}.ai-node-editor input,.ai-node-editor textarea{font-size:.72rem!important;padding:6px 7px!important}
.ai-tree-compact .ai-import-node.disabled{opacity:.42;filter:saturate(.55)}
@media(max-width:700px){.ai-tree-board.ai-tree-compact{grid-template-columns:repeat(var(--ai-gens),205px);min-width:max-content}.ai-tree-compact .ai-generation{width:205px}.ai-node-editor{position:fixed;left:12px;right:12px;top:15vh;width:auto;max-height:70vh;overflow:auto}}
/* AI Pedigree Import V3 review */
.ai-tree-compact .ai-node-compact .pedigree-facts{display:block!important;-webkit-line-clamp:unset!important;-webkit-box-orient:initial!important;overflow:visible!important;white-space:pre-wrap;word-break:break-word;margin:4px 0;font-size:.63rem;line-height:1.28}
.ai-tree-compact .ai-import-node{cursor:pointer}.ai-tree-compact .ai-import-node:hover{transform:translateY(-1px);border-color:var(--accent)}.ai-card-pencil{font-size:.72rem;color:var(--muted);opacity:.45}.ai-import-node:hover .ai-card-pencil{opacity:1}.node-check{cursor:default}
.ai-review-drawer{position:fixed;z-index:10030;right:0;top:0;height:100vh;width:min(560px,94vw);overflow:auto;background:var(--panel);border-left:1px solid var(--line-soft);box-shadow:-20px 0 60px rgba(0,0,0,.35);padding:20px;animation:aiDrawerIn .18s ease-out}.ai-review-drawer[hidden]{display:none!important}@keyframes aiDrawerIn{from{transform:translateX(24px);opacity:.4}to{transform:none;opacity:1}}
.ai-drawer-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding-bottom:14px;border-bottom:1px solid var(--line-soft)}.ai-drawer-head h3{margin:3px 0}.ai-drawer-head .pedigree-close{position:static!important;flex:0 0 auto}.ai-merge-actions{display:flex;gap:7px;flex-wrap:wrap;margin:14px 0}.ai-compare-head,.ai-compare-values{display:grid;grid-template-columns:1fr 1fr;gap:10px}.ai-compare-head{font-size:.68rem;font-weight:800;color:var(--muted);padding:0 0 7px}.ai-drawer-fields{display:grid;gap:10px}.ai-drawer-fields>label{display:grid;gap:5px;font-size:.72rem;font-weight:800;color:var(--muted)}.ai-drawer-fields input,.ai-drawer-fields textarea{width:100%}.ai-merge-field{padding:10px;border:1px solid var(--line-soft);border-radius:11px;background:var(--panel-2)}.ai-merge-field>strong{display:block;margin-bottom:7px;font-size:.72rem}.ai-compare-values>div{min-width:0;padding:8px;border-radius:8px;background:var(--panel)}.ai-compare-values small{display:block;font-size:.55rem;color:var(--muted);font-weight:900;letter-spacing:.06em;margin-bottom:4px}.ai-compare-values div div{white-space:pre-wrap;overflow-wrap:anywhere;font-size:.72rem}.ai-field-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:7px}.ai-field-actions button{border:1px solid var(--line-soft);background:transparent;color:var(--muted);border-radius:7px;padding:5px 8px;font-size:.62rem;font-weight:800;cursor:pointer}.ai-field-actions button.selected{background:var(--accent);color:#fff;border-color:var(--accent)}.ai-same{display:inline-block;margin-top:6px;font-size:.63rem;color:#22c55e;font-weight:800}.ai-final-preview{margin:12px 0;padding:10px;border:1px solid var(--line-soft);border-radius:10px}.ai-final-preview summary{cursor:pointer;font-weight:800}.ai-final-preview p{font-size:.72rem;white-space:pre-wrap}.ai-final-preview small{color:var(--muted);font-weight:800}.ai-drawer-actions{position:sticky;bottom:-20px;display:flex;justify-content:flex-end;gap:8px;margin:16px -20px -20px;padding:12px 20px;background:var(--panel);border-top:1px solid var(--line-soft)}
.ai-live-reading{box-shadow:0 0 0 2px color-mix(in srgb,var(--accent) 45%,transparent),0 5px 16px rgba(0,0,0,.08)!important;animation:aiReadPulse 1.1s ease-in-out infinite}.ai-live-waiting{opacity:.38}.ai-live-complete{animation:aiNodeDone .22s ease-out}@keyframes aiReadPulse{50%{transform:translateY(-1px)}}@keyframes aiNodeDone{from{opacity:.45;transform:scale(.985)}to{opacity:1;transform:none}}@media(prefers-reduced-motion:reduce){.ai-review-drawer,.ai-live-reading,.ai-live-complete{animation:none!important;transition:none!important}}@media(max-width:700px){.ai-review-drawer{width:100vw;padding:14px}.ai-compare-head{display:none}.ai-compare-values{grid-template-columns:1fr}.ai-drawer-actions{margin-left:-14px;margin-right:-14px;margin-bottom:-14px}}
/* v51.13 authenticated Home + nested OLR navigation */
.columbaverse-brand{cursor:pointer}.nav-group-toggle{width:100%;display:flex;align-items:center}.nav-chevron{margin-left:auto}.nav-children{display:grid;gap:2px;padding-left:12px;border-left:1px solid var(--border,#2d3440);margin-left:19px}.nav-children button{font-size:.92em}.cv-home{max-width:1240px;margin:0 auto;display:grid;gap:28px}.home-hero{position:relative;overflow:hidden;display:grid;grid-template-columns:1.35fr .65fr;gap:24px;padding:34px;border:1px solid var(--border);border-radius:22px;background:linear-gradient(135deg,var(--panel),var(--panel-2, var(--panel)));box-shadow:0 16px 50px rgba(0,0,0,.08)}.home-hero h1{font-size:clamp(2rem,4vw,3.7rem);line-height:1.02;margin:8px 0}.home-tagline{font-size:1.15rem;font-weight:700}.home-orbit{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:10px;align-content:center}.home-orbit span{border:1px solid var(--border);border-radius:999px;padding:10px 13px;background:var(--panel)}.home-orbit b{opacity:.45}.home-section-head{margin-bottom:12px}.home-quick{display:flex;gap:10px;flex-wrap:wrap}.home-quick-btn{display:flex;align-items:center;gap:8px;padding:12px 15px;border:1px solid var(--border);border-radius:12px;background:var(--panel);color:inherit;cursor:pointer}.home-quick-btn:hover,.prompt-chip:hover{transform:translateY(-1px);border-color:var(--accent)}.assistant-card{border:1px solid var(--border);border-radius:20px;background:var(--panel);padding:22px}.assistant-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-start}.assistant-head h2{margin:4px 0}.assistant-conversation{max-height:420px;overflow:auto;display:grid;gap:10px;margin:16px 0;padding:14px;border-radius:14px;background:var(--bg);min-height:90px}.assistant-welcome{text-align:center;color:var(--muted);padding:20px}.assistant-message{display:flex}.assistant-message>div{max-width:min(760px,88%);padding:11px 13px;border-radius:14px;line-height:1.5}.assistant-message.user{justify-content:flex-end}.assistant-message.user>div{background:var(--accent);color:#fff}.assistant-message.assistant>div{background:var(--panel);border:1px solid var(--border)}.assistant-mark{margin-right:7px}.assistant-loading{color:var(--muted);font-style:italic}.assistant-prompts{display:flex;flex-wrap:wrap;gap:8px;margin:12px 0}.prompt-chip{border:1px solid var(--border);background:transparent;color:inherit;border-radius:999px;padding:8px 11px;cursor:pointer;font-size:.9rem}.assistant-input{display:grid;grid-template-columns:1fr auto;gap:8px;margin-top:14px}.assistant-input input{min-width:0}.assistant-disclaimer{font-size:.78rem;color:var(--muted);margin-top:8px}.home-feature-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.home-feature{border:1px solid var(--border);border-radius:18px;background:var(--panel);padding:22px}.home-feature.feature-wide{grid-column:span 2}.feature-icon{font-size:1.5rem}.feature-flow{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:16px 0}.feature-flow span{padding:6px 9px;border-radius:999px;background:var(--bg);border:1px solid var(--border)}
@media(max-width:800px){.home-hero{grid-template-columns:1fr;padding:22px}.home-orbit{justify-content:flex-start}.home-feature-grid{grid-template-columns:1fr}.home-feature.feature-wide{grid-column:auto}.assistant-head{display:block}.assistant-head .ghost{margin-top:10px}.assistant-input{grid-template-columns:1fr}.home-quick{display:grid;grid-template-columns:1fr 1fr}}
@media(max-width:520px){.home-quick{grid-template-columns:1fr}.assistant-card{padding:15px}}
@media(prefers-reduced-motion:reduce){.home-quick-btn,.prompt-chip{transition:none!important}.home-quick-btn:hover,.prompt-chip:hover{transform:none}}
\n\n/* v51.15 sidebar footer/layout fix */
@media (min-width:721px){
  .sidebar{
    display:flex!important;
    flex-direction:column!important;
    height:100dvh!important;
    min-height:100dvh!important;
    overflow:hidden!important;
    padding-bottom:10px!important;
  }
  .sidebar .columbaverse-brand{flex:0 0 auto!important}
  .sidebar .nav{
    flex:1 1 auto!important;
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    scrollbar-width:thin;
    padding-bottom:8px;
  }
  .sidebar .meta{
    flex:0 0 auto!important;
    margin-top:0!important;
    padding-top:10px!important;
    border-top:1px solid var(--line)!important;
    background:var(--panel-3);
    position:relative;
    z-index:2;
  }
  .sidebar-collapse,
  .sidebar-collapsed .sidebar-collapse{
    position:static!important;
    inset:auto!important;
    flex:0 0 auto!important;
    align-self:flex-end!important;
    width:36px!important;
    height:36px!important;
    margin:10px 0 0!important;
    border:1px solid var(--line)!important;
    border-radius:10px!important;
    background:var(--panel-2)!important;
    box-shadow:none!important;
    opacity:.82!important;
    color:var(--text)!important;
    font-size:24px!important;
  }
  .sidebar-collapse:hover{opacity:1!important;background:var(--panel)!important}
  .sidebar-collapsed .sidebar-collapse{align-self:center!important;margin-top:auto!important}
  .sidebar-collapsed .sidebar .meta{display:none!important}
  .sidebar-collapsed .sidebar .nav{overflow-y:auto!important}
}


/* v51.16 fully integrated sidebar toggle */
@media (min-width:721px){
  .sidebar-toggle-slot{
    flex:0 0 auto!important;
    width:100%!important;
    box-sizing:border-box!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    padding:8px 0 0!important;
    margin:0!important;
    overflow:hidden!important;
  }
  .sidebar-toggle-slot .sidebar-collapse,
  .sidebar-collapsed .sidebar-toggle-slot .sidebar-collapse{
    position:relative!important;
    inset:auto!important;
    left:auto!important;
    right:auto!important;
    top:auto!important;
    bottom:auto!important;
    transform:none!important;
    float:none!important;
    align-self:auto!important;
    flex:0 0 36px!important;
    width:36px!important;
    min-width:36px!important;
    max-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    margin:0!important;
    box-sizing:border-box!important;
  }
  .sidebar-collapsed .sidebar-toggle-slot{
    justify-content:center!important;
    padding:8px 0 0!important;
  }
  .sidebar-collapsed .sidebar-toggle-slot .sidebar-collapse{
    margin:0!important;
  }
}

/* v51.17 UX system: semantic surfaces, clearer hierarchy, Home refinement */
:root{
  --bg-app:var(--bg);--bg-sidebar:var(--panel-3);
  --surface-1:var(--panel);--surface-2:var(--panel-2);--surface-3:#1b2940;
  --border-subtle:var(--line-soft);--border-strong:var(--line);
  --text-primary:var(--text);--text-secondary:#c1cad8;--text-muted:var(--muted);
  --accent-primary:var(--accent);--accent-primary-soft:rgba(56,189,248,.11);
  --accent-gold:#f2b84b;--accent-gold-soft:rgba(242,184,75,.10);
  --success:var(--accent-2);--success-soft:rgba(34,197,94,.10);
}
body.light{--surface-3:#e8f0f8;--text-secondary:#334155;--accent-primary-soft:rgba(2,132,199,.08);--accent-gold:#b7791f;--accent-gold-soft:rgba(183,121,31,.08);--success-soft:rgba(22,163,74,.08)}
body{color:var(--text-primary)}
p,.field-help,.section-intro{color:var(--text-secondary)}
.muted,small{color:var(--text-muted)}
.card{background:linear-gradient(180deg,var(--surface-1),color-mix(in srgb,var(--surface-2) 72%,var(--surface-1)));border-color:var(--border-subtle)}
input,select,textarea{background:color-mix(in srgb,var(--surface-2) 80%,var(--bg-app));border-color:var(--border-strong)}
input:focus,select:focus,textarea:focus{border-color:var(--accent-primary);box-shadow:0 0 0 3px var(--accent-primary-soft)}
thead th{background:color-mix(in srgb,var(--surface-2) 86%,var(--bg-app))}
tbody tr:hover{background:var(--accent-primary-soft)}

/* Mini mode is a top-level rail only. Child navigation can never affect rail geometry. */
@media (min-width:721px){
  .app-shell.sidebar-collapsed .nav-children{display:none!important}
  .app-shell.sidebar-collapsed .nav-group-toggle .nav-chevron{display:none!important}
  .app-shell.sidebar-collapsed .nav-group-toggle{width:52px!important;height:52px!important;min-height:52px!important;margin:0 auto!important;padding:0!important;justify-content:center!important;border-radius:14px!important;font-size:0!important;overflow:hidden!important}
  .app-shell.sidebar-collapsed .nav-group-toggle .nav-icon{font-size:21px!important}
  .app-shell.sidebar-collapsed .sidebar{width:76px!important;min-width:76px!important;max-width:76px!important}
  .app-shell:not(.sidebar-collapsed) .sidebar{width:290px!important;min-width:290px!important;max-width:290px!important}
}

.cv-home-v2{gap:22px}
.home-hero-v2{min-height:230px;padding:30px 34px;background:linear-gradient(125deg,color-mix(in srgb,var(--surface-1) 92%,var(--accent) 8%),var(--surface-2));border-color:color-mix(in srgb,var(--border-strong) 72%,var(--accent) 28%)}
.home-hero-v2:before{content:"";position:absolute;inset:0;background:radial-gradient(circle at 78% 45%,rgba(56,189,248,.12),transparent 25%),radial-gradient(circle at 91% 28%,rgba(242,184,75,.08),transparent 20%);pointer-events:none}
.home-hero-copy{position:relative;z-index:1;align-self:center}.home-hero-v2 h1{font-size:clamp(2rem,3.2vw,3.25rem);margin:6px 0 8px}.home-tagline{color:var(--text-secondary);margin:0 0 12px}.home-tagline span{color:var(--accent-gold)}.home-connected{font-size:1.02rem;color:var(--text-secondary);margin:0;max-width:620px}
.home-constellation{position:relative;min-height:165px;align-self:center}.constellation-core{position:absolute;left:50%;top:50%;translate:-50% -50%;display:grid;place-items:center;width:72px;height:72px;border-radius:50%;font-size:30px;color:var(--accent-gold);background:var(--accent-gold-soft);border:1px solid color-mix(in srgb,var(--accent-gold) 45%,transparent);box-shadow:0 0 40px rgba(56,189,248,.12)}.home-constellation>span{position:absolute;display:flex;gap:7px;align-items:center;padding:8px 11px;border-radius:12px;background:color-mix(in srgb,var(--surface-1) 88%,transparent);border:1px solid var(--border-subtle);color:var(--accent-primary)}.home-constellation small{color:var(--text-secondary);font-weight:700}.c-pedigree{left:3%;top:17%}.c-results{right:0;top:18%}.c-olr{left:34%;bottom:2%}.home-constellation:after{content:"";position:absolute;inset:24px 32px;border:1px dashed color-mix(in srgb,var(--accent-primary) 25%,transparent);border-radius:50%;opacity:.7}
.home-section-head{margin-bottom:10px}.home-section-head h2{margin:3px 0 0;font-size:1.18rem}.eyebrow{color:color-mix(in srgb,var(--accent-primary) 78%,var(--text-muted));font-size:.69rem;letter-spacing:.16em;font-weight:850}
.home-quick-v2{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}.home-quick-v2 .home-quick-btn{min-width:0;text-align:left;align-items:center;padding:13px;background:var(--surface-1);border-color:var(--border-subtle);box-shadow:0 6px 18px rgba(0,0,0,.06)}.home-quick-v2 .home-quick-btn.quick-accent{background:linear-gradient(145deg,var(--accent-primary-soft),var(--surface-1));border-color:color-mix(in srgb,var(--accent-primary) 38%,var(--border-subtle))}.quick-icon{display:grid;place-items:center;width:34px;height:34px;flex:0 0 34px;border-radius:10px;background:var(--surface-2);color:var(--accent-primary);font-size:1.08rem}.home-quick-btn strong{display:block;color:var(--text-primary);font-size:.88rem}.home-quick-btn small{display:block;font-size:.7rem;margin-top:2px;line-height:1.25}.quick-arrow{margin-left:auto;color:var(--text-muted)}
.assistant-card-v2{position:relative;overflow:hidden;background:linear-gradient(145deg,color-mix(in srgb,var(--surface-1) 95%,var(--accent) 5%),var(--surface-1));border-color:color-mix(in srgb,var(--accent-primary) 30%,var(--border-subtle));box-shadow:0 14px 34px rgba(0,0,0,.10)}.assistant-card-v2:before{content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:linear-gradient(var(--accent-primary),var(--accent-gold))}.assistant-head p{margin:5px 0 0;color:var(--text-secondary)}.assistant-eyebrow{color:var(--accent-gold)}.assistant-prompt-groups{display:grid;grid-template-columns:1.05fr .8fr 1.35fr;gap:12px;margin:17px 0}.prompt-group{padding:11px;border-radius:14px;background:color-mix(in srgb,var(--surface-2) 72%,transparent);border:1px solid var(--border-subtle)}.prompt-group>span{display:block;font-size:.66rem;font-weight:850;letter-spacing:.11em;color:var(--text-muted);margin-bottom:8px}.prompt-group .assistant-prompts{margin:0;gap:6px}.prompt-chip{background:var(--surface-1);border-color:var(--border-strong);color:var(--text-secondary);border-radius:10px;text-align:left;padding:7px 9px;line-height:1.25}.prompt-chip:hover{color:var(--text-primary);background:var(--accent-primary-soft);border-color:color-mix(in srgb,var(--accent-primary) 55%,var(--border-strong))}.assistant-conversation{background:color-mix(in srgb,var(--bg-app) 78%,var(--surface-1));border:1px solid var(--border-subtle);min-height:82px;max-height:360px}.assistant-welcome{display:flex;gap:8px;justify-content:center;align-items:center;color:var(--text-muted)}.assistant-welcome span{color:var(--accent-gold)}.assistant-message.assistant>div{background:var(--surface-2);border-color:var(--border-subtle);color:var(--text-secondary)}.assistant-message.user>div{background:linear-gradient(135deg,#0ea5e9,#0284c7);color:#fff}.assistant-input input{background:var(--bg-app)}
.home-feature-grid{grid-template-columns:1.15fr .85fr .85fr;gap:12px}.home-feature{position:relative;overflow:hidden;background:var(--surface-1);border-color:var(--border-subtle);padding:19px}.home-feature.feature-wide{grid-column:span 3}.home-feature:before{content:"";position:absolute;left:0;right:0;top:0;height:3px;background:var(--accent-primary);opacity:.75}.home-feature.feature-ai:before{background:var(--accent-gold)}.home-feature.feature-performance:before{background:var(--success)}.home-feature h3{margin:7px 0}.home-feature p{font-size:.9rem;margin:0 0 14px}.feature-top{display:flex;align-items:center;justify-content:space-between;gap:24px}.feature-top>div{max-width:760px}.feature-icon{color:var(--accent-primary)}.feature-ai .feature-icon{color:var(--accent-gold)}.feature-performance .feature-icon{color:var(--success)}.feature-flow-line{display:grid;grid-template-columns:auto 1fr auto 1fr auto 1fr auto 1fr auto;gap:8px;align-items:center;margin:15px 0 0}.feature-flow-line span{background:var(--surface-2);font-size:.78rem}.feature-flow-line i{height:1px;background:linear-gradient(90deg,var(--border-strong),var(--accent-primary));position:relative}.feature-flow-line i:after{content:"";position:absolute;right:-1px;top:-2px;width:5px;height:5px;border-radius:50%;background:var(--accent-primary)}
@media(max-width:1100px){.home-quick-v2{grid-template-columns:repeat(3,1fr)}.assistant-prompt-groups{grid-template-columns:1fr 1fr}.prompt-group:last-child{grid-column:span 2}.home-feature-grid{grid-template-columns:1fr 1fr}.home-feature.feature-wide{grid-column:span 2}}
@media(max-width:800px){.home-constellation{display:none}.home-hero-v2{grid-template-columns:1fr;min-height:0}.home-quick-v2{grid-template-columns:1fr 1fr}.assistant-prompt-groups{grid-template-columns:1fr}.prompt-group:last-child{grid-column:auto}.home-feature-grid{grid-template-columns:1fr}.home-feature.feature-wide{grid-column:auto}.feature-top{display:block}.feature-top button{margin-top:8px}.feature-flow-line{display:flex;flex-wrap:wrap}.feature-flow-line i{width:18px}.home-feature.feature-wide{grid-column:auto}}
@media(max-width:520px){.home-quick-v2{grid-template-columns:1fr}.home-hero-v2{padding:22px}.assistant-prompt-groups{gap:8px}}

/* v51.18 — first-class Light Mode + structural sidebar QA */
:root{
  --hero-bg:#101d31;
  --hero-bg-2:#13243b;
  --hero-text:#f8fbff;
  --hero-muted:#c4d0df;
  --hero-node-bg:rgba(9,18,33,.72);
  --input-bg:color-mix(in srgb,var(--surface-2) 80%,var(--bg-app));
  --input-border:var(--border-strong);
  --table-header-bg:color-mix(in srgb,var(--surface-2) 86%,var(--bg-app));
  --sidebar-active-bg:rgba(56,189,248,.12);
  --shadow-card:0 10px 28px rgba(0,0,0,.10);
}
body.light{
  --bg-app:#f3f7fb;
  --bg-sidebar:#f7f9fc;
  --surface-1:#ffffff;
  --surface-2:#f5f8fc;
  --surface-3:#eaf1f8;
  --surface-interactive:#eef8fd;
  --text-primary:#102039;
  --text-secondary:#40516a;
  --text-muted:#66758a;
  --text-on-accent:#ffffff;
  --border-subtle:#dce6f0;
  --border-strong:#c8d6e5;
  --accent-primary:#0284c7;
  --accent-primary-soft:#e8f5fc;
  --accent-gold:#b87512;
  --accent-gold-soft:#fff5df;
  --success:#15803d;
  --success-soft:#eaf8ef;
  --input-bg:#ffffff;
  --input-border:#c8d6e5;
  --table-header-bg:#eef4f9;
  --sidebar-active-bg:#dff2fc;
  --shadow-card:0 10px 30px rgba(26,48,76,.08);
  --hero-bg:#102039;
  --hero-bg-2:#152943;
  --hero-text:#f8fbff;
  --hero-muted:#cbd8e7;
  --hero-node-bg:rgba(8,20,38,.74);
}
body.light{background:radial-gradient(circle at top right,rgba(2,132,199,.08),transparent 28%),var(--bg-app);color:var(--text-primary)}
body.light .sidebar{background:linear-gradient(180deg,#f8fbfe,var(--bg-sidebar));border-right-color:var(--border-subtle)}
body.light .nav button{color:var(--text-primary)}
body.light .nav button.active,body.light .nav button:hover{background:var(--sidebar-active-bg);box-shadow:inset 0 0 0 1px rgba(2,132,199,.20)}
body.light .nav-children{border-left-color:var(--border-strong)}
body.light .card,body.light .panel,body.light .home-feature,body.light .assistant-card{background:var(--surface-1);border-color:var(--border-subtle);box-shadow:var(--shadow-card)}
body.light input,body.light select,body.light textarea{background:var(--input-bg);border-color:var(--input-border);color:var(--text-primary)}
body.light input::placeholder,body.light textarea::placeholder{color:#7b899b}
body.light thead th{background:var(--table-header-bg);color:var(--text-primary)}
body.light tbody tr:hover{background:var(--accent-primary-soft)}

/* Branded hero intentionally remains dark in both themes. */
.home-hero-v2{background:linear-gradient(125deg,var(--hero-bg),var(--hero-bg-2))!important;border-color:rgba(56,189,248,.22)!important;color:var(--hero-text)!important;box-shadow:0 18px 44px rgba(13,31,53,.18)}
.home-hero-v2 h1,.home-hero-v2 .eyebrow{color:var(--hero-text)!important}
.home-hero-v2 .eyebrow{color:#47c5f5!important}
.home-hero-v2 .home-tagline,.home-hero-v2 .home-connected{color:var(--hero-muted)!important}
.home-hero-v2 .home-tagline span{color:#f2b84b!important}
.home-hero-v2 .home-constellation>span{background:var(--hero-node-bg)!important;border-color:rgba(125,211,252,.20)!important;color:#49c7f6!important}
.home-hero-v2 .home-constellation small{color:var(--hero-muted)!important}
.home-hero-v2 .home-constellation:after{border-color:rgba(56,189,248,.28)!important}

/* Home daylight surfaces: no dark card may inherit dark text. */
body.light .home-section-head h2{color:var(--text-primary)}
body.light .eyebrow{color:var(--accent-primary)}
body.light .home-quick-v2 .home-quick-btn{background:var(--surface-1);border-color:var(--border-subtle);box-shadow:var(--shadow-card);color:var(--text-primary)}
body.light .home-quick-v2 .home-quick-btn.quick-accent{background:linear-gradient(145deg,var(--accent-primary-soft),#fff);border-color:#b9dff1}
body.light .home-quick-btn strong{color:var(--text-primary)}
body.light .home-quick-btn small{color:var(--text-secondary)}
body.light .quick-icon{background:var(--accent-primary-soft);color:var(--accent-primary)}
body.light .home-quick-btn:hover{background:#f8fcff;border-color:#91cde9;box-shadow:0 14px 30px rgba(2,132,199,.12)}
body.light .assistant-card-v2{background:linear-gradient(145deg,#ffffff,#f8fbfe);border-color:#c7dfec;box-shadow:0 16px 36px rgba(25,53,82,.09);color:var(--text-primary)}
body.light .assistant-head h2{color:var(--text-primary)}
body.light .assistant-head p{color:var(--text-secondary)}
body.light .prompt-group{background:#f3f7fb;border-color:var(--border-subtle)}
body.light .prompt-group>span{color:#53657c}
body.light .prompt-chip{background:#fff;color:#33465f;border-color:#cfdae6}
body.light .prompt-chip:hover{background:var(--accent-primary-soft);color:#0b5279;border-color:#79c4e7}
body.light .assistant-conversation{background:#f5f8fc;border-color:var(--border-subtle)}
body.light .assistant-message.assistant>div{background:#fff;border-color:var(--border-subtle);color:var(--text-secondary)}
body.light .assistant-welcome{color:var(--text-muted)}
body.light .assistant-input input{background:#fff;color:var(--text-primary)}
body.light .home-feature{background:#fff;color:var(--text-primary);border-color:var(--border-subtle);box-shadow:var(--shadow-card)}
body.light .home-feature p{color:var(--text-secondary)}
body.light .feature-flow-line span{background:#f3f7fb;color:var(--text-secondary);border-color:var(--border-subtle)}

/* Structural sidebar: header / independently scrollable nav / fixed footer. */
@media (min-width:721px){
  .sidebar{
    display:flex!important;
    flex-direction:column!important;
    height:100dvh!important;
    min-height:0!important;
    overflow:hidden!important;
    padding:16px 14px 12px!important;
  }
  .sidebar .columbaverse-brand{flex:0 0 auto!important;margin-bottom:10px!important}
  .sidebar .nav{
    flex:1 1 auto!important;
    min-height:0!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    align-content:start!important;
    padding:2px 4px 10px 0!important;
    scrollbar-width:thin;
    scrollbar-color:color-mix(in srgb,var(--text-muted) 30%,transparent) transparent;
  }
  .sidebar .nav::-webkit-scrollbar{width:5px}
  .sidebar .nav::-webkit-scrollbar-thumb{background:color-mix(in srgb,var(--text-muted) 28%,transparent);border-radius:99px}
  .sidebar-footer{flex:0 0 auto!important;display:grid!important;grid-template-columns:1fr auto;gap:8px 10px;align-items:end;padding-top:9px;border-top:1px solid var(--border-subtle);background:var(--bg-sidebar)}
  .sidebar-footer .meta{display:flex!important;flex-wrap:wrap!important;gap:7px!important;min-width:0;margin:0!important;padding:0!important;border:0!important;background:transparent!important}
  .sidebar-footer .meta>div{margin:0!important}
  .sidebar-footer .meta button{padding:7px 9px!important;min-height:34px!important;font-size:.76rem!important;white-space:nowrap}
  .sidebar-toggle-slot{width:auto!important;align-self:end!important;padding:0!important;margin:0!important;overflow:visible!important}
  .sidebar-toggle-slot .sidebar-collapse,.sidebar-collapsed .sidebar-toggle-slot .sidebar-collapse{position:static!important;inset:auto!important;transform:none!important;width:36px!important;min-width:36px!important;height:36px!important;margin:0!important;background:var(--surface-2)!important;border:1px solid var(--border-subtle)!important;color:var(--text-primary)!important;opacity:1!important}
  .app-shell.sidebar-collapsed .sidebar-footer{grid-template-columns:1fr!important;border-top-color:var(--border-subtle)!important}
  .app-shell.sidebar-collapsed .sidebar-footer .meta{display:none!important}
  .app-shell.sidebar-collapsed .sidebar-toggle-slot{justify-self:center!important}
  .app-shell.sidebar-collapsed .nav-children{display:none!important}
  .app-shell.sidebar-collapsed .nav-group-toggle .nav-chevron{display:none!important}
}

/* Compact laptop heights: navigation scrolls, footer never overlays it. */
@media (min-width:721px) and (max-height:800px){
  .sidebar{padding-top:10px!important;padding-bottom:8px!important}
  .app-shell:not(.sidebar-collapsed) .columbaverse-brand>img{max-height:72px!important}
  .app-shell:not(.sidebar-collapsed) .columbaverse-brand .tenant-badge{font-size:.72rem!important;padding:4px 7px!important}
  .sidebar .nav button{padding-top:7px!important;padding-bottom:7px!important;min-height:34px!important}
  .sidebar-footer{padding-top:6px!important}
}

/* Accessible shared interaction states in both themes. */
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--accent-primary);outline-offset:2px}
button.ghost{color:var(--text-primary);border-color:var(--border-subtle)}
body.light button.ghost:hover{background:var(--accent-primary-soft);border-color:#a8d8ee}

@media(max-width:720px){.sidebar-footer{display:block}.sidebar-footer .meta{display:flex;gap:8px;flex-wrap:wrap}.sidebar-toggle-slot{display:none!important}}

/* v51.19 — Light Mode component harmonization + protected Dark Mode logo */
:root{
  --content-max-width:1480px;
  --content-padding:28px;
  --section-gap:18px;
  --shadow-sm:0 4px 14px rgba(16,32,57,.05);
  --shadow-elevated:0 18px 42px rgba(16,32,57,.12);
}
/* Dark-background logo: dedicated outlined asset plus a very restrained optical lift. */
body:not(.light) .cv-theme-logo{filter:drop-shadow(0 0 1px rgba(255,255,255,.48)) drop-shadow(0 0 4px rgba(210,230,255,.10))}
body.light .cv-theme-logo{filter:none}

/* Shared authenticated content rhythm. Home remains its own narrative width. */
.content>.topbar,.content>.section:not(#home){width:min(100%,var(--content-max-width));margin-left:auto;margin-right:auto}
.content>.section:not(#home){padding-bottom:24px}

/* Daylight filter/header composition. */
body.light .topbar:not(.section-clean){padding:16px 18px;border:1px solid var(--border-subtle);border-radius:20px;background:rgba(255,255,255,.82);box-shadow:var(--shadow-card);backdrop-filter:blur(12px)}
body.light .topbar .filters{display:grid;grid-template-columns:repeat(3,minmax(150px,1fr));gap:9px;max-width:none}
body.light .topbar .filters #globalSearch{grid-column:1/-1}
body.light .topbar-right{width:100%;gap:16px}
body.light .topbar-logos{flex:0 0 205px;gap:9px;padding-top:0}
body.light .logo-badge{width:100%;min-height:92px;padding:10px 12px;border-radius:16px;border-color:var(--border-subtle);box-shadow:var(--shadow-sm)}
body.light .logo-badge img{max-height:72px;max-width:165px}

/* Shared daylight surfaces and tables. Dark mode intentionally untouched. */
body.light .section>.card,body.light .section>.grid>.card{border-color:var(--border-subtle);box-shadow:var(--shadow-card)}
body.light .table-wrap{background:#fff;border-color:var(--border-subtle);border-radius:15px;box-shadow:inset 0 1px 0 rgba(255,255,255,.8)}
body.light th{background:#eef4f9;color:#40516a;border-bottom-color:#d4e0eb;font-size:.73rem;letter-spacing:.075em}
body.light td{color:#172a45;border-bottom-color:#e4ebf2}
body.light tbody tr:nth-child(even) td{background:rgba(243,247,251,.46)}
body.light tbody tr:hover td{background:#eaf6fc!important}
body.light .table-wrap td:first-child strong{color:#102039}
body.light .sortable::after{color:#60738b}

/* Compact operational tables; keep information, remove giant empty rows. */
body.light #derbies th,body.light #derbies td,
body.light #pigeons th,body.light #pigeons td,
body.light #races th,body.light #races td{padding-top:10px;padding-bottom:10px}
body.light #derbies tbody tr{height:58px}
body.light #pigeons tbody tr,body.light #races tbody tr{height:52px}
body.light #pigeons td:first-child strong,body.light #races td:first-child strong{font-weight:900;color:#0d2744}
body.light #derbies .badge.finished{background:#e9f8ef;color:#166534;border-color:#b9e7c9}
body.light #derbies .badge.other{background:#eef2f6;color:#5c6b7e;border-color:#d9e1e9}
body.light .badge.hotspot{background:#f2ecff;color:#6d28d9;border-color:#ddd0fb}
body.light .badge.semi-final{background:#e8f6fd;color:#036b9f;border-color:#bde4f6}
body.light .badge.final{background:#e9f8ef;color:#166534;border-color:#b9e7c9}
body.light .badge.extra-final{background:#fff5df;color:#9a5d08;border-color:#f1d59d}
body.light .badge.other{background:#eef2f6;color:#5c6b7e;border-color:#d9e1e9}
body.light .badge.training{background:#e9eef4;color:#42546b;border-color:#d3dde7}

/* Dashboard: same component language as Home, map deliberately remains dark. */
body.light #dashboard .grid.kpi{gap:10px}
body.light #dashboard .card.kpi{background:#fff;border:1px solid var(--border-subtle);border-top:3px solid #38bdf8!important;border-radius:16px;box-shadow:var(--shadow-card)}
body.light #dashboard .card.kpi:nth-child(3){border-top-color:#d39a31!important}
body.light #dashboard .card.kpi:nth-child(4){border-top-color:#94a3b8!important}
body.light #dashboard .card.kpi:nth-child(5){border-top-color:#64748b!important}
body.light #dashboard .card.kpi .muted{color:#65758a}
body.light #dashboard .card.kpi .value{color:#102039}
body.light #dashboard>.card{background:#fff}
body.light #dashboard .derby-map-card,body.light #dashboard [class*="map-card"]{background:#fff}
body.light #derbyWorldMap{background:#06101d;border-radius:14px;overflow:hidden}

/* OLR live update buttons: normal navigation/action hierarchy; green only where it means recommended/success. */
body.light .olr-full-load-btn{background:#f3f7fb!important;color:#233852!important;border-color:#d4e0eb!important}
body.light .olr-fast-load-btn{box-shadow:0 9px 22px rgba(5,150,105,.16)}

/* Long-list shells: stronger hierarchy without hiding data. */
body.light #derbies>.card,body.light #pigeons>.card,body.light #races>.card,body.light #results>.card,body.light #highlights>.card{background:#fff}
body.light #derbies>.card>h2,body.light #pigeons>.card>h2,body.light #races>.card>h2{color:#102039}
body.light #derbies .section-intro,body.light #pigeons .section-intro,body.light #races .section-intro{max-width:850px}

/* Breeder Intelligence: retain density but create visible analytical layers. */
body.light #breeders>.card,body.light #breeders .lineage-section-panel> .card,body.light #breeders .lineage-table-card{background:#fff;border-color:#dce6f0;box-shadow:var(--shadow-card)}
body.light #breeders .lineage-card,body.light #breeders [class*="ranking-card"]{background:#f5f8fc;border-color:#dce6f0;box-shadow:none}
body.light #breeders .lineage-section-panel{margin-top:18px}
body.light #breeders .lineage-section-panel> .card{padding:18px}
body.light #breeders .lineage-section-summary span{background:#eef4f9;color:#53657c;border-color:#d7e2ec}
body.light #breeders .heat-line{background:#eef4f9;color:#17304d;border-color:#d7e2ec}
body.light #breeders .heat-cell{box-shadow:inset 0 0 0 1px rgba(255,255,255,.32)}
body.light #breeders .lineage-table-card .table-wrap{background:#fff}

/* Pedigree Studio: branded header stays dark, daylight controls become one system. */
body.light #pedigree .pedigree-hero{background:linear-gradient(125deg,#102039,#173454)!important;border-color:rgba(56,189,248,.24)!important;box-shadow:0 18px 42px rgba(16,32,57,.15)}
body.light #pedigree .pedigree-hero h1,body.light #pedigree .pedigree-hero h2,body.light #pedigree .pedigree-hero h3{color:#f8fbff!important}
body.light #pedigree .pedigree-hero .muted{color:#cbd8e7!important}
body.light #pedigree .pedigree-toolbar,body.light #pedigree .pedigree-document-card,body.light #pedigree .stock-list-card{background:#fff;border-color:#dce6f0;box-shadow:var(--shadow-card)}
body.light #pedigree .chip{background:#eef4f9;color:#40516a;border-color:#d7e2ec}
body.light #pedigree .chip.active,body.light #pedigree .chip[aria-pressed="true"]{background:#173454;color:#fff;border-color:#173454}

/* Primary blue is navigation/action; green remains semantic success. */
body.light button.primary{background:linear-gradient(180deg,#0796d3,#0278b4);box-shadow:0 9px 22px rgba(2,132,199,.20)}
body.light button.secondary{background:#eef4f9;color:#17304d;border:1px solid #d3dfeb;box-shadow:none}
body.light button.secondary:hover{background:#e5f3fb;border-color:#a9d5e9}
body.light .home-feature button.primary{min-width:170px}

/* Admin/data views also inherit the same daylight table language. */
body.light #tenantAdmin .card,body.light #platformAdmin .card,body.light #admin .card{background:#fff;border-color:#dce6f0;box-shadow:var(--shadow-card)}
body.light .cv-translation-table{background:#fff;border-color:#dce6f0}
body.light .cv-translation-table th{background:#eef4f9}

@media(max-width:1100px){body.light .topbar-right{flex-wrap:wrap}body.light .topbar-logos{flex:1 1 100%;flex-direction:row}.logo-badge{max-width:190px}}
@media(max-width:760px){body.light .topbar:not(.section-clean){padding:12px}body.light .topbar .filters{grid-template-columns:1fr}.content{padding:16px}.content>.section:not(#home){padding-bottom:16px}}

/* v51.20 — entity card views + breeding readability */
.entity-page-card{padding:18px}.entity-page-card>.toolbar:first-child{align-items:flex-start;margin-bottom:14px}.entity-page-card>.toolbar:first-child>div{min-width:0}.entity-year-group+.entity-year-group{margin-top:22px}.entity-year-head{display:flex;align-items:center;gap:10px;margin:4px 2px 10px;border-bottom:1px solid var(--border);padding-bottom:7px}.entity-year-head h3{margin:0}.entity-year-head span{font-size:.78rem;color:var(--muted);font-weight:800}.entity-card-grid{display:grid;gap:12px}.derby-card-grid{grid-template-columns:repeat(auto-fit,minmax(270px,1fr))}.pigeon-card-grid{grid-template-columns:repeat(auto-fill,minmax(235px,1fr))}.entity-card{min-width:0;border:1px solid var(--border);background:var(--panel);border-radius:15px;padding:14px;box-shadow:0 5px 16px rgba(0,0,0,.06);transition:border-color .16s ease,transform .16s ease}.entity-card:hover{border-color:color-mix(in srgb,var(--accent) 55%,var(--border));transform:translateY(-1px)}.entity-card-header{display:flex;align-items:flex-start;justify-content:space-between;gap:10px}.entity-card-kicker{font-size:.72rem;color:var(--muted);font-weight:800;margin-bottom:3px}.entity-card-title{font-size:1.02rem;line-height:1.2;margin:0;overflow-wrap:anywhere}.entity-card-note{font-size:.76rem;color:var(--muted);margin-top:7px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.entity-card-metrics{display:grid;gap:7px;margin:12px 0}.derby-metrics{grid-template-columns:repeat(3,1fr)}.entity-card-metrics>div{border:1px solid var(--border);border-radius:10px;padding:7px;background:color-mix(in srgb,var(--panel) 85%,var(--bg) 15%);min-width:0}.entity-card-metrics strong{display:block;font-size:1rem}.entity-card-metrics span{display:block;font-size:.65rem;color:var(--muted);line-height:1.15;margin-top:2px}.entity-card-metrics .metric-emphasis{border-color:color-mix(in srgb,var(--accent) 45%,var(--border));background:color-mix(in srgb,var(--accent) 8%,var(--panel))}.entity-card-footer{display:flex;align-items:flex-end;justify-content:space-between;gap:8px;border-top:1px solid var(--border);padding-top:9px;margin-top:8px}.entity-card-meta{display:flex;gap:7px;flex-wrap:wrap;color:var(--muted);font-size:.68rem}.entity-card-actions{display:flex;gap:5px;flex:0 0 auto}.entity-empty{grid-column:1/-1;padding:28px;text-align:center;border:1px dashed var(--border);border-radius:14px;color:var(--muted)}
.pigeon-card{padding:12px}.pigeon-card.male{border-left:3px solid rgba(56,189,248,.7)}.pigeon-card.female{border-left:3px solid rgba(244,114,182,.7)}.pigeon-ring{font-size:.96rem;font-weight:900;letter-spacing:.01em;overflow-wrap:anywhere}.pigeon-name{font-size:.74rem;color:var(--muted);margin-top:2px}.pigeon-badges{display:flex;gap:4px;flex-wrap:wrap;justify-content:flex-end}.pigeon-badges .badge{font-size:.62rem;padding:3px 6px}.badge.olr{background:rgba(56,189,248,.12);color:#38bdf8;border:1px solid rgba(56,189,248,.28)}.pigeon-core-meta{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:10px 0 8px}.pigeon-core-meta span{font-size:.72rem;min-width:0;overflow-wrap:anywhere}.pigeon-core-meta b{display:block;font-size:.6rem;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);margin-bottom:2px}.pigeon-parents{display:grid;gap:4px;border-radius:9px;padding:7px 8px;background:color-mix(in srgb,var(--bg) 65%,var(--panel));font-size:.68rem}.pigeon-parents span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.pigeon-parents b{display:inline-grid;place-items:center;width:17px;height:17px;border-radius:5px;background:var(--panel);margin-right:6px}.pigeon-compact-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:5px;margin-top:8px}.pigeon-compact-stats span{min-width:0}.pigeon-compact-stats b{display:block;font-size:.72rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.pigeon-compact-stats small{display:block;font-size:.55rem;color:var(--muted);line-height:1.1;margin-top:2px}.pigeon-card-results{grid-column:1/-1;margin-top:10px;padding-top:10px;border-top:1px solid var(--border);max-height:390px;overflow:auto}.pigeon-card-results.hidden{display:none}
body.light .entity-card{background:#fff;border-color:#d8e3ed;color:#10233d;box-shadow:0 7px 18px rgba(25,53,82,.06)}body.light .entity-card:hover{border-color:#7bc7e9}body.light .entity-card-metrics>div{background:#f5f8fb;border-color:#dce6ef}body.light .pigeon-parents{background:#f3f7fb}body.light .badge.olr{color:#036b9f;background:#e9f7fd;border-color:#b9e4f6}
/* Gold remains a brand accent; dense analytical copy must stay readable in light mode. */
body.light #breeders .lineage-power.solid{background:#fff1cf!important;color:#704507!important;border-color:#e8c978!important}body.light #breeders .lineage-power.elite{color:#176b38!important}body.light #breeders .lineage-power.strong{color:#075d83!important}body.light #breeders .lineage-score-row span,body.light #breeders .lineage-mini-row,body.light #breeders .lineage-rank{color:#53657c!important}body.light #breeders .heat-cell.solid{background:#fff2d6!important;border-color:#e7c77a!important;color:#523608!important}body.light #breeders .heat-cell strong,body.light #breeders .heat-cell b{color:inherit!important}
@media(max-width:900px){.derby-card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.pigeon-card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:620px){.derby-card-grid,.pigeon-card-grid{grid-template-columns:1fr}.entity-page-card{padding:12px}.entity-page-card>.toolbar:first-child{align-items:stretch}.entity-page-card>.toolbar:first-child .right{margin-left:0}.pigeon-compact-stats{grid-template-columns:repeat(2,1fr)}}

/* v51.21 — entity card polish, modal, light map and platform observability */
.entity-card{display:flex;flex-direction:column;height:100%;border-width:1px;box-shadow:0 7px 20px rgba(4,22,44,.09)}
.pigeon-card-body{flex:1;min-width:0}.entity-card-footer{margin-top:auto;min-height:48px}.pigeon-card-footer{align-items:center}.entity-card-links{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.entity-action-link{display:inline-flex;align-items:center;gap:4px;border:1px solid var(--border);background:color-mix(in srgb,var(--panel) 88%,var(--accent) 12%);color:var(--text);border-radius:9px;padding:6px 8px;font-size:.72rem;font-weight:800;text-decoration:none;cursor:pointer}.entity-action-link:hover{border-color:var(--accent);color:var(--accent)}.link-button{font:inherit}.entity-card-actions{margin-left:auto;align-self:flex-end}
.entity-card.is-inactive{background:color-mix(in srgb,var(--panel) 88%,var(--bg) 12%);border-color:color-mix(in srgb,var(--border) 82%,var(--muted) 18%)}.entity-card.is-inactive .entity-card-title,.entity-card.is-inactive .pigeon-ring{color:color-mix(in srgb,var(--text) 72%,var(--muted) 28%)}.entity-card.is-inactive .entity-card-metrics,.entity-card.is-inactive .pigeon-core-meta,.entity-card.is-inactive .pigeon-parents,.entity-card.is-inactive .pigeon-compact-stats{filter:saturate(.55)}.entity-card.is-active{border-color:color-mix(in srgb,var(--border) 80%,var(--accent) 20%)}
body.light .entity-card{border-color:#c8d8e6;box-shadow:0 9px 24px rgba(26,54,82,.09)}body.light .entity-card:hover{border-color:#55b9e3;box-shadow:0 12px 28px rgba(26,54,82,.12)}body.light .entity-card.is-inactive{background:#f3f6f9;border-color:#d7e0e8;box-shadow:0 4px 12px rgba(26,54,82,.045)}body.light .entity-card.is-inactive .badge{background:#e5eaf0;color:#64748b;border-color:#cbd5df}
body.modal-open{overflow:hidden}.cv-modal-backdrop{position:fixed;inset:0;z-index:5000;background:rgba(2,10,24,.66);backdrop-filter:blur(5px);display:flex;align-items:center;justify-content:center;padding:24px}.cv-modal{width:min(1100px,96vw);max-height:min(86vh,900px);display:flex;flex-direction:column;background:var(--panel);color:var(--text);border:1px solid var(--border);border-radius:20px;box-shadow:0 30px 80px rgba(0,0,0,.35);overflow:hidden}.cv-modal-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;padding:18px 20px;border-bottom:1px solid var(--border)}.cv-modal-head h2{margin:3px 0 0}.cv-modal-body{padding:18px 20px;overflow:auto;overscroll-behavior:contain}.pigeon-results-modal .pigeon-result-visual{margin-top:0}body.light .cv-modal{background:#fff;border-color:#cbd9e6;color:#10233d}body.light .cv-modal-backdrop{background:rgba(15,35,58,.42)}
body.light .olr-update-actions .olr-fast-load-btn{background:linear-gradient(135deg,#0788c7,#11a8dc);border-color:#0788c7;color:#fff;box-shadow:0 8px 20px rgba(7,136,199,.20)}body.light .olr-update-actions .olr-fast-load-btn:hover{filter:brightness(.97)}body.light .olr-recommended-badge{background:#e9f8ef!important;color:#08783e!important;border-color:#a9e4bf!important}
body.light #derbyWorldMap{background:#eef5f9!important;border-color:#c9d9e6}body.light #derbyWorldMap .leaflet-tile-pane{opacity:1!important;filter:none!important}body:not(.light) #derbyWorldMap .leaflet-tile-pane{opacity:1;filter:none}
body.light #races .badge,body.light #races .pill{color:#243b55}body.light #races [style*="color:#f"],body.light #races [style*="color: #f"]{color:#8a5a00!important}body.light #races .race-card strong,body.light #races .race-card h3,body.light #races table{color:#10233d}
.platform-observability{display:grid;gap:16px;margin-bottom:18px}.platform-kpi-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px}.platform-kpi{border:1px solid var(--border);border-radius:14px;padding:13px;background:var(--panel-2)}.platform-kpi strong{display:block;font-size:1.55rem;line-height:1}.platform-kpi span{display:block;color:var(--muted);font-size:.72rem;font-weight:800;margin-top:6px}.platform-chart-grid{display:grid;grid-template-columns:1.25fr 1fr;gap:12px}.platform-chart-card{border:1px solid var(--border);border-radius:15px;padding:14px;background:var(--panel-2)}.platform-chart-card h3{margin:0 0 10px}.mini-bars{display:grid;gap:9px}.mini-bar-row{display:grid;grid-template-columns:minmax(90px,150px) 1fr auto;gap:8px;align-items:center;font-size:.75rem}.mini-bar-track{height:9px;border-radius:99px;background:var(--panel-3);overflow:hidden}.mini-bar-fill{height:100%;border-radius:inherit;background:linear-gradient(90deg,var(--accent),#55c9ed)}.audit-toolbar{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}.audit-toolbar input,.audit-toolbar select{min-width:140px}.audit-status{font-size:.68rem;font-weight:900;border-radius:99px;padding:3px 7px;background:var(--panel-3)}.audit-status.success{color:#08783e;background:#e9f8ef}.audit-status.failed{color:#b42318;background:#fff0ee}.audit-meta{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.68rem;white-space:pre-wrap;word-break:break-word}.audit-pagination{display:flex;justify-content:flex-end;align-items:center;gap:8px;margin-top:10px}body.light .platform-kpi,body.light .platform-chart-card{background:#fff;border-color:#d5e2ed;box-shadow:0 5px 15px rgba(24,52,80,.05)}
@media(max-width:800px){.platform-chart-grid{grid-template-columns:1fr}.cv-modal-backdrop{padding:8px}.cv-modal{width:100%;max-height:96vh;border-radius:16px}.entity-card-footer{align-items:flex-start;flex-wrap:wrap}.entity-card-actions{margin-left:auto}}
\n\n/* v51.22 dashboard/pedigree hotfix */
/* Fast Load subtitle must stay readable on the cyan primary action in Light Mode. */
body.light .olr-update-actions .olr-fast-load-btn .olr-btn-copy small{
  color:rgba(255,255,255,.94)!important;
  opacity:1!important;
  font-weight:750;
}
body.light .olr-update-actions .olr-fast-load-btn .olr-btn-copy strong{color:#fff!important}

/* Locally bundled Natural Earth country overview. */
body.light #derbyWorldMap .leaflet-container,
body.light #derbyWorldMap{background:#eaf2f7!important}
body:not(.light) #derbyWorldMap{background:#06111f!important}

/* v51.23 — Pedigree controls + stronger entity cards + Fast Load consistency */
/* Pedigree Studio: explicit 12-column placement prevents controls from colliding. */
#pedigree .pedigree-filter-row{
  display:grid!important;
  grid-template-columns:repeat(12,minmax(0,1fr))!important;
  gap:10px!important;
  align-items:stretch!important;
}
#pedigree .pedigree-filter-row > *{min-width:0!important;width:100%!important;box-sizing:border-box}
#pedigree .pedigree-filter-row .pedigree-search{grid-column:span 6;min-width:0!important}
#pedigree .pedigree-filter-row #stockYear{grid-column:span 2}
#pedigree .pedigree-filter-row #pedigreeDepth{grid-column:span 2}
#pedigree .pedigree-filter-row #aiPedigreeImportBtn{grid-column:span 2}
#pedigree .pedigree-filter-row #duplicateCheckBtn{grid-column:span 6}
#pedigree .pedigree-filter-row #addRangeBtn{grid-column:span 3}
#pedigree .pedigree-filter-row #addStockBtn{grid-column:span 3}
#pedigree .pedigree-filter-row input,
#pedigree .pedigree-filter-row select,
#pedigree .pedigree-filter-row button{height:48px!important;min-height:48px!important}
#pedigree .pedigree-filter-row button{white-space:normal;line-height:1.15}
@media(max-width:1200px){
  #pedigree .pedigree-filter-row .pedigree-search{grid-column:1/-1}
  #pedigree .pedigree-filter-row #stockYear,
  #pedigree .pedigree-filter-row #pedigreeDepth{grid-column:span 6}
  #pedigree .pedigree-filter-row #aiPedigreeImportBtn,
  #pedigree .pedigree-filter-row #duplicateCheckBtn{grid-column:span 6}
  #pedigree .pedigree-filter-row #addRangeBtn,
  #pedigree .pedigree-filter-row #addStockBtn{grid-column:span 6}
}
@media(max-width:700px){
  #pedigree .pedigree-filter-row > *{grid-column:1/-1!important}
}

/* Pigeon + Derby cards: stronger object boundaries in both themes. */
.entity-card{
  border:1.5px solid color-mix(in srgb,var(--border) 68%,var(--text) 32%)!important;
  box-shadow:0 10px 26px rgba(3,15,31,.13)!important;
}
.entity-card:hover{
  border-color:color-mix(in srgb,var(--accent) 68%,var(--text) 32%)!important;
  box-shadow:0 14px 32px rgba(3,15,31,.18)!important;
}
body.light .entity-card{
  background:#fff!important;
  border-color:#9fb3c7!important;
  box-shadow:0 10px 25px rgba(20,48,78,.14)!important;
}
body.light .entity-card:hover{
  border-color:#438fb8!important;
  box-shadow:0 14px 32px rgba(20,48,78,.18)!important;
}
body.light .entity-card.is-inactive{
  background:#eef2f5!important;
  border-color:#bcc7d1!important;
  box-shadow:0 6px 16px rgba(20,48,78,.08)!important;
}
body:not(.light) .entity-card.is-inactive{
  background:color-mix(in srgb,var(--panel) 82%,#667085 18%)!important;
  border-color:color-mix(in srgb,var(--border) 60%,#77869a 40%)!important;
  box-shadow:0 6px 18px rgba(0,0,0,.20)!important;
}

/* Fast Load: green primary action in BOTH themes, with fully white copy. */
.olr-update-actions .olr-fast-load-btn,
body.light .olr-update-actions .olr-fast-load-btn{
  background:linear-gradient(135deg,#079b62,#12b76a)!important;
  border-color:#078a58!important;
  color:#fff!important;
  box-shadow:0 8px 20px rgba(7,155,98,.24)!important;
}
.olr-update-actions .olr-fast-load-btn .olr-btn-copy strong,
.olr-update-actions .olr-fast-load-btn .olr-btn-copy small,
body.light .olr-update-actions .olr-fast-load-btn .olr-btn-copy strong,
body.light .olr-update-actions .olr-fast-load-btn .olr-btn-copy small{
  color:#fff!important;
  opacity:1!important;
}
.olr-update-actions .olr-fast-load-btn:hover,
body.light .olr-update-actions .olr-fast-load-btn:hover{filter:brightness(.95)!important}
.olr-update-actions .olr-recommended-badge,
body.light .olr-update-actions .olr-recommended-badge{
  background:#fff!important;
  color:#087443!important;
  border-color:rgba(255,255,255,.8)!important;
}

/* v51.24 — Race cards, Derby filter and snapshot modal */
.race-filter-bar{display:flex;align-items:end;gap:12px;margin:8px 0 16px;padding:12px;border:1px solid var(--border);border-radius:14px;background:color-mix(in srgb,var(--panel) 90%,var(--bg) 10%)}
.race-filter-bar label{display:grid;gap:5px;min-width:min(360px,100%);font-weight:800}.race-filter-bar label>span{font-size:.72rem;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.race-filter-count{margin-left:auto;padding-bottom:10px;font-weight:800}.race-card-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.race-entity-card{min-height:260px}.race-card-body{flex:1;display:flex;flex-direction:column}.race-card-date-line{display:flex;justify-content:space-between;gap:10px;align-items:flex-start;margin-top:13px;color:var(--text)}.race-card-date-line span{font-size:.72rem;color:var(--muted);text-align:right}.race-card-metrics{grid-template-columns:repeat(3,minmax(0,1fr));margin-top:auto;padding-top:14px}.race-card-footer{align-items:center}.race-snapshot-modal{width:min(1220px,94vw);max-height:90vh}.race-snapshot-modal .cv-modal-body{overflow:auto}.race-snapshot-modal .race-arrival-card{margin:0;box-shadow:none}.race-snapshot-modal .race-arrival-plot{min-width:760px}
body.light .race-filter-bar{background:#f5f8fb;border-color:#c8d8e6}body.light .race-entity-card{background:#fff;color:#10233d;border-color:#9fb3c7!important;box-shadow:0 10px 25px rgba(20,48,78,.14)!important}body.light .race-entity-card:hover{border-color:#438fb8!important;box-shadow:0 14px 32px rgba(20,48,78,.18)!important}body.light .race-snapshot-modal{background:#fff;color:#10233d}body.light .race-snapshot-modal .race-arrival-card{background:#fff;color:#10233d}
@media(min-width:1700px){.race-card-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}@media(max-width:1100px){.race-card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:700px){.race-card-grid{grid-template-columns:1fr}.race-filter-bar{align-items:stretch;flex-direction:column}.race-filter-count{margin-left:0;padding:0}.race-snapshot-modal{width:calc(100vw - 12px);max-height:96vh}.race-snapshot-modal .cv-modal-body{padding:10px}}

/* v51.25 — Race UI polish, accessible snapshot accents and Derby click filters */
:root{--cv-race-gold:#f5b82e;--cv-race-gold-text:#ffd166;--cv-race-gold-border:rgba(245,184,46,.52);--cv-race-gold-soft:rgba(245,184,46,.12)}
body.light{--cv-race-gold:#9a6500;--cv-race-gold-text:#825400;--cv-race-gold-border:#c28a22;--cv-race-gold-soft:#fff4d6}
.race-filter-bar{align-items:flex-start}.race-filter-main{display:grid;gap:7px;min-width:0;flex:1}.race-filter-label{font-size:.7rem;color:var(--muted);font-weight:900;text-transform:uppercase;letter-spacing:.09em}.race-filter-chips{display:flex;flex-wrap:wrap;gap:8px;min-width:0}.race-filter-chip{width:auto!important;min-height:36px;padding:7px 12px;white-space:normal;text-align:center;border:1px solid var(--border-strong,var(--border));background:var(--panel-3);color:var(--muted);border-radius:999px;font-weight:800;cursor:pointer}.race-filter-chip.active,.race-filter-chip[aria-pressed="true"]{background:#173454;border-color:#173454;color:#fff;box-shadow:0 5px 16px rgba(18,35,61,.18)}.race-filter-chip:hover{border-color:var(--accent);color:var(--text)}
body.light .race-filter-bar{background:#f5f8fb;border-color:#c5d2df}body.light .race-filter-chip{background:#eef4f9;color:#40516a;border-color:#c9d7e4}body.light .race-filter-chip.active,body.light .race-filter-chip[aria-pressed="true"]{background:#173454;color:#fff;border-color:#173454}
.race-entity-card{border:1px solid color-mix(in srgb,var(--border) 80%,#64748b 20%);box-shadow:0 7px 20px rgba(0,0,0,.12);transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease}.race-entity-card:hover{transform:translateY(-1px)}
body.light .race-entity-card{background:#fff!important;color:#10233d;border:1px solid #b9c8d7!important;box-shadow:0 8px 22px rgba(20,48,78,.16)!important}body.light .race-entity-card:hover{border-color:#5d91b2!important;box-shadow:0 12px 28px rgba(20,48,78,.20)!important}
.race-arrival-plot{border-color:color-mix(in srgb,var(--line-soft) 80%,var(--cv-race-gold-border) 20%)}.race-quantile-marker{color:var(--cv-race-gold-text);text-shadow:none}.race-quantile-marker i{background:linear-gradient(180deg,color-mix(in srgb,var(--cv-race-gold) 82%,transparent),color-mix(in srgb,var(--cv-race-gold) 22%,transparent));box-shadow:0 0 10px color-mix(in srgb,var(--cv-race-gold) 20%,transparent)}.race-quantile-marker span{background:rgba(15,23,42,.82);border-color:var(--cv-race-gold-border);color:var(--cv-race-gold-text)}.race-arrival-legend i.quantile{background:var(--cv-race-gold);border-color:var(--cv-race-gold-border);box-shadow:none}.race-day-axis{border-top-color:color-mix(in srgb,var(--cv-race-gold) 32%,transparent)}.race-day-tick{color:var(--cv-race-gold-text)}.race-day-tick i{background:linear-gradient(180deg,color-mix(in srgb,var(--cv-race-gold) 52%,transparent),color-mix(in srgb,var(--cv-race-gold) 8%,transparent))}.race-day-tick span{border-color:var(--cv-race-gold-border);color:var(--cv-race-gold-text)}
body.light .race-arrival-plot{background:linear-gradient(180deg,#f4f7fa,#fbfcfd);border-color:#c6d3df;box-shadow:inset 0 0 0 1px rgba(255,255,255,.65)}body.light .race-quantile-marker span{background:var(--cv-race-gold-soft);border-color:var(--cv-race-gold-border);color:var(--cv-race-gold-text);font-weight:900}body.light .race-day-tick span{background:var(--cv-race-gold-soft);border-color:var(--cv-race-gold-border);color:var(--cv-race-gold-text)}body.light .race-quantile-marker i{background:linear-gradient(180deg,rgba(154,101,0,.72),rgba(154,101,0,.18))}
@media(max-width:700px){.race-filter-bar{align-items:stretch}.race-filter-count{margin-left:0;padding:0}.race-filter-chips{gap:6px}.race-filter-chip{padding:7px 10px}}

/* v51.26 — unified entity cards + card/list views */
:root{--entity-card-bg:var(--panel);--entity-card-border:rgba(154,180,210,.48);--entity-card-shadow:0 9px 24px rgba(0,0,0,.22);--entity-card-hover-border:rgba(188,211,236,.72);--entity-card-muted-bg:color-mix(in srgb,var(--panel) 84%,#6b7788 16%)}
body.light{--entity-card-bg:#fff;--entity-card-border:#9fb3c7;--entity-card-shadow:0 10px 25px rgba(20,48,78,.14);--entity-card-hover-border:#438fb8;--entity-card-muted-bg:#eef2f5}
.entity-card{background:var(--entity-card-bg)!important;border:1.5px solid var(--entity-card-border)!important;box-shadow:var(--entity-card-shadow)!important;border-radius:15px!important;overflow:hidden}
.entity-card:hover{border-color:var(--entity-card-hover-border)!important;box-shadow:0 14px 32px rgba(0,0,0,.24)!important}
body.light .entity-card:hover{box-shadow:0 14px 32px rgba(20,48,78,.18)!important}
.entity-card.is-inactive{background:var(--entity-card-muted-bg)!important;opacity:.78}.entity-card.is-inactive:hover{opacity:.92}
body:not(.light) .race-entity-card,body:not(.light) .derby-card,body:not(.light) .pigeon-card{border-color:rgba(160,187,218,.48)!important;box-shadow:0 10px 26px rgba(0,0,0,.28),inset 0 1px 0 rgba(255,255,255,.045)!important}
body:not(.light) .race-entity-card:hover,body:not(.light) .derby-card:hover,body:not(.light) .pigeon-card:hover{border-color:rgba(195,218,241,.72)!important;background:color-mix(in srgb,var(--panel) 94%,white 6%)!important}
.entity-view-toolbar{display:flex;justify-content:flex-end;align-items:center;margin:-2px 0 14px}.cv-view-switch{display:inline-flex;gap:3px;padding:3px;border:1px solid var(--border);background:color-mix(in srgb,var(--panel) 86%,var(--bg));border-radius:11px}.cv-view-btn{border:0;background:transparent;color:var(--muted);font-weight:800;border-radius:8px;padding:7px 10px;cursor:pointer}.cv-view-btn.active{background:#17385f;color:#fff;box-shadow:0 3px 9px rgba(0,0,0,.14)}body.light .cv-view-btn.active{background:#17385f;color:#fff}.cv-view-btn:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.race-toolbar-end{margin-left:auto;display:flex;align-items:center;gap:10px}.race-toolbar-end .race-filter-count{margin:0;padding:0}.race-toolbar-end .cv-view-switch{flex:0 0 auto}
.cv-list-shell{width:100%;overflow:auto;border:1px solid var(--entity-card-border);border-radius:14px;background:var(--entity-card-bg);box-shadow:var(--entity-card-shadow)}.cv-entity-list{width:100%;border-collapse:collapse;min-width:820px}.cv-entity-list th{position:sticky;top:0;z-index:1;background:color-mix(in srgb,var(--entity-card-bg) 88%,var(--bg) 12%);color:var(--muted);font-size:.69rem;text-transform:uppercase;letter-spacing:.055em;text-align:left;padding:10px;border-bottom:1px solid var(--entity-card-border)}.cv-entity-list td{padding:10px;border-bottom:1px solid color-mix(in srgb,var(--entity-card-border) 62%,transparent);vertical-align:middle;font-size:.78rem}.cv-entity-list tbody tr:last-child td{border-bottom:0}.cv-entity-list tbody tr:hover{background:color-mix(in srgb,var(--accent) 6%,var(--entity-card-bg))}.cv-entity-list tr.is-inactive{opacity:.62;background:var(--entity-card-muted-bg)}.cv-entity-list .entity-card-actions{white-space:nowrap;justify-content:flex-end}.cv-entity-list .icon-btn{display:inline-grid;place-items:center;text-decoration:none}
@media(min-width:1450px){.derby-card-grid,.pigeon-card-grid,.race-card-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(max-width:1000px){.derby-card-grid,.pigeon-card-grid,.race-card-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.race-toolbar-end{width:100%;margin-left:0;justify-content:space-between}}@media(max-width:650px){.derby-card-grid,.pigeon-card-grid,.race-card-grid{grid-template-columns:1fr}.entity-view-toolbar{justify-content:stretch}.cv-view-switch{width:100%}.cv-view-btn{flex:1}.race-toolbar-end{align-items:stretch;flex-direction:column}.race-toolbar-end .cv-view-switch{width:100%}}
/* V51.27 Finance */
.finance-toolbar{display:flex;gap:12px;align-items:end;flex-wrap:wrap}.finance-toolbar label,.finance-ahv label{display:grid;gap:5px}.finance-kpis{margin:14px 0}.finance-kpis .card h2{margin:.35rem 0 0}.finance-ahv{margin-bottom:14px}.finance-progress{height:10px;border-radius:999px;background:var(--border,#d8dde5);overflow:hidden;margin:10px 0}.finance-progress i{display:block;height:100%;background:currentColor;border-radius:inherit}.finance-warning{font-weight:700}.finance-status{display:inline-block;padding:3px 8px;border:1px solid currentColor;border-radius:999px;font-size:.8rem}.finance-status.cancelled{opacity:.6;text-decoration:line-through}.finance-editor{margin-top:14px}.finance-form{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.finance-form label{display:grid;gap:5px}.finance-notes{grid-column:span 2}.finance-form textarea{min-height:84px}.finance-editor .actions{display:flex;gap:10px;margin-top:14px}@media(max-width:900px){.finance-form{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:600px){.finance-form{grid-template-columns:1fr}.finance-notes{grid-column:auto}}


/* v51.27.3 Finance + collapsed sidebar regression fix */
@media (min-width:721px){
  .app-shell.sidebar-collapsed{grid-template-columns:76px minmax(0,1fr)!important;background:linear-gradient(90deg,var(--panel-3) 0 76px,transparent 76px)!important}
  .app-shell.sidebar-collapsed .sidebar{box-sizing:border-box!important;width:76px!important;min-width:76px!important;max-width:76px!important;padding-left:10px!important;padding-right:10px!important}
  .app-shell.sidebar-collapsed .sidebar .nav{width:56px!important;max-width:56px!important;overflow-x:hidden!important}
  .app-shell.sidebar-collapsed .sidebar .nav button{box-sizing:border-box!important;width:52px!important;min-width:52px!important;max-width:52px!important;height:52px!important;margin-left:2px!important;margin-right:2px!important;padding:0!important;justify-content:center!important}
  .app-shell.sidebar-collapsed .sidebar .nav button.active{border-radius:14px!important}
  .app-shell.sidebar-collapsed .nav-icon{display:grid!important;place-items:center!important;width:24px!important;min-width:24px!important;font-size:21px!important;line-height:1!important}
}

/* v51.28 — Finance polish + responsive/mobile architecture consolidation */
#finance{max-width:1480px}.finance-toolbar{display:flex;justify-content:space-between;align-items:end;gap:16px;padding:14px 16px}.finance-year{width:150px;margin:0}.finance-toolbar-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.finance-btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:42px;width:auto!important;white-space:nowrap}.finance-btn-small{min-height:36px;padding:7px 11px!important;font-size:.8rem}.finance-kpis{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:12px}.finance-kpis .card{padding:16px 18px;border-radius:16px}.finance-kpi-label{display:block;color:var(--muted);font-size:.75rem;font-weight:800;text-transform:uppercase;letter-spacing:.06em;margin-bottom:7px}.finance-kpis strong{font-size:1.35rem;letter-spacing:-.02em}.finance-card-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px}.finance-card-head h2{margin:4px 0 0}.finance-card-head h2 span{font-size:.8em;color:var(--muted);font-weight:700}.finance-ahv{padding:18px}.finance-ahv p{max-width:920px}.finance-progress{height:8px;background:var(--panel-3);border:1px solid var(--line-soft)}.finance-progress i{background:linear-gradient(90deg,var(--accent),var(--accent-2))}.finance-threshold-editor{display:flex;gap:10px;align-items:end;margin-top:14px;padding-top:14px;border-top:1px solid var(--line-soft)}.finance-threshold-editor label{width:190px;margin:0}.finance-editor{scroll-margin-top:18px}.finance-editor .actions button{width:auto}.finance-editor input,.finance-editor select,.finance-editor textarea{min-width:0}.finance-status{font-size:.72rem;font-weight:800;text-transform:capitalize}.finance-editor button:not(.primary):not(.ghost):not(.secondary):not(.danger),#finance button:not(.primary):not(.ghost):not(.secondary):not(.danger){border:1px solid var(--line-soft);border-radius:14px;padding:10px 15px;background:var(--panel-3);color:var(--text);font-weight:800;cursor:pointer}
body.light #finance .card{background:#fff;border-color:var(--border-subtle);box-shadow:var(--shadow-card)}body.light .finance-progress{background:#edf3f8;border-color:#d8e4ee}

/* Mobile/tablet: one document scroll, no fixed-height app shell. */
@media(max-width:1024px){
  .content{min-width:0}.grid.kpi{grid-template-columns:repeat(2,minmax(0,1fr))}.finance-kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important}.finance-form{grid-template-columns:repeat(2,minmax(0,1fr))}.topbar-right,.topbar .filters{min-width:0}.topbar .filters>*{min-width:0}.cv-modal{max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px)}
}
@media(max-width:720px){
  html,body{min-height:100%;height:auto;overflow-x:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch}body.modal-open{overflow:hidden}.app-shell:not([hidden]),.app-shell.sidebar-collapsed:not([hidden]){display:block!important;min-height:100dvh!important;height:auto!important;background:var(--bg)!important}.sidebar,.sidebar-collapsed .sidebar{position:relative!important;inset:auto!important;width:100%!important;min-width:0!important;max-width:none!important;height:auto!important;min-height:0!important;max-height:none!important;padding:12px 14px!important;overflow:visible!important;display:flex!important;flex-direction:column!important}.columbaverse-brand,.app-shell:not(.sidebar-collapsed) .columbaverse-brand,.sidebar-collapsed .columbaverse-brand{position:static!important;min-height:0!important;height:auto!important;margin:0 0 10px!important;padding:0!important;gap:6px!important;overflow:visible!important}.columbaverse-brand>img,.app-shell:not(.sidebar-collapsed) .columbaverse-brand>img,.sidebar-collapsed .columbaverse-brand>img{width:82px!important;height:82px!important;max-width:82px!important;max-height:82px!important;flex:0 0 auto!important}.columbaverse-brand .tenant-badge,.app-shell:not(.sidebar-collapsed) .columbaverse-brand .tenant-badge,.sidebar-collapsed .columbaverse-brand .tenant-badge{position:static!important;display:block!important;width:min(100%,360px)!important;margin:0 auto!important;padding:5px 9px!important;font-size:.72rem!important;line-height:1.2!important;white-space:normal!important}.sidebar .nav,.sidebar-collapsed .sidebar .nav{flex:none!important;width:100%!important;max-width:none!important;min-height:0!important;max-height:none!important;overflow:visible!important;padding:0!important;margin:0!important;gap:3px!important}.sidebar .nav button,.sidebar-collapsed .sidebar .nav button,.app-shell.sidebar-collapsed .nav-group-toggle{width:100%!important;max-width:none!important;height:auto!important;min-height:42px!important;margin:0!important;padding:9px 11px!important;justify-content:flex-start!important;font-size:.9rem!important;overflow:visible!important}.sidebar-collapsed .nav-label{display:inline!important}.sidebar-collapsed .nav-icon,.sidebar .nav-icon{width:24px!important;min-width:24px!important;font-size:1rem!important}.sidebar-collapsed .nav-children{display:grid!important}.nav-children.hidden{display:none!important}.nav-group-toggle .nav-chevron{display:inline!important;margin-left:auto}.sidebar-footer{display:flex!important;align-items:center!important;justify-content:space-between!important;gap:8px!important;margin-top:10px!important;padding-top:10px!important}.sidebar-footer .meta,.app-shell.sidebar-collapsed .sidebar-footer .meta{display:flex!important;gap:7px!important;flex-wrap:wrap!important}.sidebar-footer .meta button{width:auto!important;min-height:36px!important}.sidebar-toggle-slot{display:none!important}.content{display:block!important;width:100%!important;min-width:0!important;padding:14px!important;overflow:visible!important}.section.active{overflow:visible!important}.topbar{margin-bottom:14px}.topbar-right{width:100%}.topbar .filters{display:grid!important;grid-template-columns:1fr!important;width:100%!important;max-width:none!important}.topbar.section-clean .filters,.topbar.section-clean .topbar-logos{display:none!important}.topbar-logos{width:100%;flex-direction:row;flex-wrap:wrap}.logo-badge{width:min(160px,100%);min-height:90px}.grid.two,.grid.three,.grid.kpi{grid-template-columns:1fr!important}.card{max-width:100%;min-width:0}.toolbar,.inline-actions{max-width:100%}.toolbar>*{min-width:0}.toolbar button,.inline-actions button{max-width:100%}.table-wrap,.cv-list-shell{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}.form-grid{grid-template-columns:1fr!important}.cv-modal-backdrop{padding:6px;align-items:flex-start}.cv-modal{width:calc(100vw - 12px)!important;max-width:calc(100vw - 12px)!important;max-height:calc(100dvh - 12px)!important;margin-top:6px;border-radius:15px}.cv-modal-head{padding:12px 14px}.cv-modal-body{padding:12px 14px}.finance-toolbar{align-items:stretch;flex-direction:column}.finance-year{width:100%}.finance-toolbar-actions{display:grid;grid-template-columns:1fr 1fr}.finance-toolbar-actions .finance-btn{width:100%!important}.finance-toolbar-actions .primary{grid-column:1/-1;grid-row:1}.finance-kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important}.finance-card-head{align-items:flex-start}.finance-threshold-editor{align-items:stretch;flex-direction:column}.finance-threshold-editor label{width:100%}.finance-form{grid-template-columns:1fr!important}.finance-notes{grid-column:auto}.finance-editor .actions{display:grid;grid-template-columns:1fr 1fr}.finance-editor .actions button{width:100%!important}
  #finance .table-wrap{border:0;background:transparent;overflow:visible}#finance table,#finance thead,#finance tbody,#finance tr,#finance td{display:block;width:100%}#finance thead{display:none}#finance tbody{display:grid;gap:10px}#finance tr{padding:12px;border:1px solid var(--line-soft);border-radius:14px;background:var(--panel-3)}#finance td{display:grid;grid-template-columns:110px minmax(0,1fr);gap:8px;padding:6px 0;border:0;font-size:.82rem}#finance td:nth-child(1)::before{content:'Datum'}#finance td:nth-child(2)::before{content:'Typ'}#finance td:nth-child(3)::before{content:'Beschreibung'}#finance td:nth-child(4)::before{content:'Kategorie'}#finance td:nth-child(5)::before{content:'Partner'}#finance td:nth-child(6)::before{content:'Original'}#finance td:nth-child(7)::before{content:'CHF'}#finance td:nth-child(8)::before{content:'Status'}#finance td:nth-child(9)::before{content:'Quelle'}#finance td::before{color:var(--muted);font-size:.68rem;font-weight:900;text-transform:uppercase;letter-spacing:.05em}#finance td:last-child{display:flex;flex-wrap:wrap;gap:6px;padding-top:10px;border-top:1px solid var(--line-soft);margin-top:5px}#finance td:last-child::before{display:none}#finance td[colspan]{display:block;text-align:center;color:var(--muted)}#finance td[colspan]::before{display:none}
}
@media(max-width:430px){.content{padding:10px}.card{padding:14px}.finance-kpis{grid-template-columns:1fr!important}.finance-toolbar-actions{grid-template-columns:1fr}.finance-toolbar-actions .primary{grid-column:auto;grid-row:auto}.finance-card-head{flex-direction:column}.finance-card-head .finance-btn{width:100%!important}#finance td{grid-template-columns:92px minmax(0,1fr)}.sidebar-footer{align-items:stretch;flex-direction:column}.sidebar-footer .meta{width:100%}.sidebar-footer .meta>div{flex:1}.sidebar-footer .meta button{width:100%!important}}

/* v51.29 — Pigeon result-source state */
.pigeon-source-state{margin-top:9px}.result-source-missing{position:relative;display:inline-flex;max-width:100%}.result-source-info{appearance:none;border:1px solid var(--border);background:color-mix(in srgb,var(--panel) 90%,var(--muted) 10%);color:var(--muted);border-radius:999px;padding:5px 8px;display:inline-flex;align-items:center;gap:5px;max-width:100%;font:inherit;font-size:.66rem;font-weight:800;line-height:1.2;cursor:help}.result-source-info:hover,.result-source-info:focus-visible{border-color:color-mix(in srgb,var(--muted) 60%,var(--border));color:var(--text);outline:none}.result-source-tooltip{position:absolute;z-index:80;left:0;bottom:calc(100% + 7px);width:min(290px,calc(100vw - 32px));padding:9px 10px;border-radius:10px;border:1px solid var(--border);background:var(--panel);color:var(--text);box-shadow:0 12px 30px rgba(0,0,0,.2);font-size:.72rem;font-weight:600;line-height:1.4;opacity:0;visibility:hidden;transform:translateY(4px);transition:.14s ease;pointer-events:none}.result-source-missing:hover .result-source-tooltip,.result-source-missing:focus-within .result-source-tooltip,.result-source-missing.is-open .result-source-tooltip{opacity:1;visibility:visible;transform:none}.icon-btn:disabled{opacity:.38;cursor:not-allowed;transform:none}.cv-entity-list .result-source-missing{white-space:nowrap}@media(max-width:620px){.result-source-tooltip{position:fixed;left:16px;right:16px;bottom:18px;width:auto;max-width:none}.result-source-info span{white-space:normal;text-align:left}}

/* Experimental Club Results / RIRO */
.club-metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin:14px 0}
.club-metric{min-height:92px}.club-metric-value{font-size:1.75rem;font-weight:750;margin:.25rem 0}
.club-form-card .form-grid,.club-apply-card .form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:14px}
.club-form-card label,.club-apply-card label{display:flex;flex-direction:column;gap:6px}
.club-form-card input,.club-apply-card input,.club-review-table select{width:100%}
.club-race-candidate{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:10px}
.club-race-candidate .muted{word-break:break-all;font-size:.8rem}
.club-review-table-wrap{overflow:auto}.club-review-table{width:100%;border-collapse:collapse;min-width:900px}
.club-review-table th,.club-review-table td{padding:10px;border-bottom:1px solid var(--border-color,#334155);text-align:left;vertical-align:top}
.club-match{display:inline-block;padding:2px 8px;border-radius:999px;border:1px solid currentColor;font-size:.78rem;font-weight:650;margin-bottom:4px}
.club-match.matched,.club-match.mapped{color:#16a34a}.club-match.review{color:#d97706}.club-match.unmatched{color:#dc2626}
.club-race-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:14px}.club-race-card h3{margin:.35rem 0 .55rem}
.club-review-head{margin-top:18px}
@media(max-width:720px){.club-race-candidate{align-items:stretch;flex-direction:column}.club-review-table{min-width:760px}}

/* v51.31 — Complete Club Results surfaces */
.club-dashboard-grid{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(280px,.8fr);gap:14px;margin-top:14px}.club-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.club-card-head h3{margin:.2rem 0}.club-kicker{font-size:.76rem;font-weight:800;color:var(--muted);text-transform:uppercase;letter-spacing:.04em}.club-recent-race{width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;text-align:left;margin-top:8px;padding:11px 12px;border:1px solid var(--border);border-radius:12px;background:var(--panel-2);color:var(--text)}.club-recent-race span:first-child{display:flex;flex-direction:column;gap:2px}.club-recent-race small{color:var(--muted)}.club-status-list{display:grid;gap:0;margin:8px 0 16px}.club-status-list>div{display:flex;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid var(--border)}.club-empty{display:flex;flex-direction:column;gap:5px;align-items:flex-start;padding:18px;color:var(--muted)}.club-empty strong{color:var(--text)}.club-year-control{display:flex;align-items:center;gap:8px}.club-year-control span{font-size:.8rem;color:var(--muted);font-weight:700}.club-year-control select{min-width:100px}.club-info-banner{display:flex;flex-direction:column;gap:4px;padding:12px 14px;margin-bottom:12px;border:1px solid var(--border);border-radius:12px;background:var(--panel-2)}.club-info-banner.ok{border-color:color-mix(in srgb,#16a34a 50%,var(--border))}.club-info-banner span{color:var(--muted);font-size:.86rem}.club-race-card{display:block;width:100%;text-align:left;color:var(--text);cursor:pointer}.club-race-card:hover{transform:translateY(-1px);border-color:color-mix(in srgb,var(--text) 25%,var(--border))}.club-race-facts{display:flex;gap:8px;flex-wrap:wrap;margin:8px 0}.club-race-facts span{padding:4px 8px;border:1px solid var(--border);border-radius:999px;font-size:.78rem}.club-race-detail{margin-top:16px}.club-row-actions{display:flex;gap:6px;flex-wrap:wrap}.club-row-actions .danger{border-color:color-mix(in srgb,#dc2626 50%,var(--border));color:#fff!important}.club-season-table{min-width:1050px}
@media(max-width:900px){.club-dashboard-grid{grid-template-columns:1fr}.club-year-control{align-items:stretch;flex-direction:column}.club-year-control select{width:100%}}

/* Club Results v51.42 */
.club-import-grid label>span{white-space:nowrap}.club-import-grid label small{min-height:1.1em}.club-race-toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:14px}.club-race-toolbar input,.club-race-toolbar select{min-width:140px;flex:1}.club-view-toggle{display:flex;gap:6px}.club-view-toggle .active{box-shadow:inset 0 0 0 2px var(--accent,#38bdf8)}.club-race-card-rich{display:flex;flex-direction:column;gap:12px}.club-source-pill{font-size:.72rem;font-weight:800;padding:4px 8px;border:1px solid var(--border);border-radius:999px}.club-race-stat-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}.club-race-stat-grid span{display:flex;flex-direction:column;padding:10px;border:1px solid var(--border);border-radius:12px;background:var(--panel-2);text-align:center}.club-race-stat-grid b{font-size:1.05rem}.club-race-stat-grid small{color:var(--muted);font-size:.72rem}.club-card-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:auto}.club-card-actions .danger,.club-row-actions .danger{color:#fff!important}.club-edit-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.club-edit-grid label{display:flex;flex-direction:column;gap:6px}.pedigree-club-block{margin-top:5px;border-top:1px dashed var(--border);padding-top:4px}.pedigree-club-block .pedigree-race-head{font-weight:800}
@media(max-width:760px){.club-race-stat-grid{grid-template-columns:repeat(2,1fr)}.club-edit-grid{grid-template-columns:1fr}.club-race-toolbar>*{width:100%}}
/* v51.50 pedigree export branding */
.pedigree-brand-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:12px}.color-field{display:grid;grid-template-columns:54px 1fr;align-items:center;gap:8px}.color-field input[type=color]{width:54px;height:42px;padding:3px}.color-field code{font-size:12px}.pedigree-brand-preview{margin-top:18px;border:1px solid var(--line);border-radius:16px;overflow:hidden;background:#fff;color:#152033}.pedigree-brand-preview .pb-head{padding:12px 16px;background:#132a45;color:#fff;font-weight:800}.pedigree-brand-preview .pb-box{margin:14px;border:2px solid #8fc9e8;border-radius:10px;padding:14px;display:grid;gap:4px}.pedigree-brand-preview .pb-box strong{font-size:18px;color:#173c66}.pedigree-brand-preview .pb-box b{font-size:17px;color:#c52b55}.pedigree-brand-preview .pb-box em{font-style:normal;font-weight:700;color:#28547e}.pedigree-brand-preview .pb-footer{padding:9px 14px;text-align:right;background:#132a45;color:#fff;font-size:12px}

/* v51.55 compact Club Race actions + Eden RV directory */
.club-card-actions{align-items:center}.club-card-secondary-actions{margin-left:auto;display:flex;gap:6px}.club-card-square-action{width:34px!important;height:34px!important;min-width:34px!important;padding:0!important;border-radius:8px!important;display:inline-grid!important;place-items:center;font-size:17px!important;line-height:1!important}.club-card-square-action.danger{background:transparent!important;color:#ef4444!important;border-color:color-mix(in srgb,#ef4444 45%,var(--border))!important}.club-card-square-action.danger:hover{background:color-mix(in srgb,#ef4444 12%,transparent)!important}.eden-rv-results{display:grid;gap:8px;margin-top:10px;max-height:420px;overflow:auto;padding-right:4px}.eden-rv-result{width:100%;display:grid;grid-template-columns:74px minmax(0,1fr) auto;align-items:center;gap:12px;text-align:left;padding:11px 12px;border:1px solid var(--border);border-radius:11px;background:var(--panel-2);color:var(--text);cursor:pointer}.eden-rv-result:hover{border-color:color-mix(in srgb,var(--accent,#38bdf8) 55%,var(--border));background:var(--panel-3)}.eden-rv-code{font-weight:900;font-variant-numeric:tabular-nums}.eden-rv-copy{display:flex;min-width:0;flex-direction:column;gap:3px}.eden-rv-copy strong{white-space:normal;overflow-wrap:anywhere}.eden-rv-copy small{color:var(--muted)}.eden-rv-select{font-size:.7rem;font-weight:900;text-transform:uppercase;letter-spacing:.05em;padding:6px 8px;border:1px solid var(--border);border-radius:7px}.pedigree-brand-grid select{width:100%}@media(max-width:650px){.eden-rv-result{grid-template-columns:1fr auto}.eden-rv-code{grid-column:1}.eden-rv-copy{grid-column:1}.eden-rv-select{grid-column:2;grid-row:1/3}.club-card-secondary-actions{margin-left:0}}

/* v51.56 - compact Pigeon Mapping row actions */
.club-mapping-actions{justify-content:flex-end;flex-wrap:nowrap;align-items:center;white-space:nowrap}.club-mapping-actions .club-card-square-action{flex:0 0 32px;width:32px!important;height:32px!important;min-width:32px!important;border-radius:7px!important;font-size:16px!important}.club-review-table td:last-child,.club-review-table th:last-child{text-align:right}

/* v51.58: Club race actions use the same compact card controls as pigeon cards/mappings. */
.club-open-square-action{font-size:13px!important}.club-card-actions>.club-open-square-action{margin-right:auto}.club-row-actions{justify-content:flex-end;flex-wrap:nowrap;align-items:center}.club-row-actions .club-card-square-action{flex:0 0 32px;width:32px!important;height:32px!important;min-width:32px!important;border-radius:7px!important}.club-row-actions .club-open-square-action{font-size:12px!important}
.club-review-details>summary{cursor:pointer;display:flex;justify-content:space-between;gap:1rem;align-items:center;padding:1rem 1.1rem;border:1px solid var(--border);border-radius:14px;list-style:none}.club-review-details>summary::-webkit-details-marker{display:none}.club-review-details>summary span:first-child{display:flex;flex-direction:column;gap:.2rem}.club-review-content{display:grid;gap:1rem;margin-top:.75rem}.club-review-state{font-size:.82rem;font-weight:700}.club-review-imported .club-review-state{opacity:.8}.club-competition-edit{display:grid;grid-template-columns:70px minmax(90px,1fr) minmax(90px,1fr);gap:.55rem;align-items:center;max-width:520px}.club-competition-edit input,.club-result-edit{min-width:0;width:100%}.club-review-table .club-result-edit{width:82px;padding:.45rem .5rem}.club-competition-card{grid-column:span 2}@media(max-width:800px){.club-review-table-wrap{overflow-x:auto}.club-review-table{min-width:1050px}.club-competition-edit{grid-template-columns:55px 1fr 1fr}}
.ai-facts-controls{display:inline-flex;align-items:center;gap:8px}.ai-facts-controls select{min-width:150px;max-width:190px}


/* v51.73 — readable pedigree performance: web uses space, export reduces content before type */
.pedigree-tree-studio .pedigree-box{height:auto!important;min-height:100%!important;}
.pedigree-tree-studio .pedigree-performance-block{
  margin-top:10px!important;padding:9px 10px!important;border-radius:10px!important;
  background:color-mix(in srgb,var(--panel-3) 86%,transparent)!important;
}
.pedigree-tree-studio .pedigree-performance-block .pedigree-race-head{
  font-size:.72rem!important;line-height:1.35!important;font-weight:900!important;
  letter-spacing:.015em;margin:7px 0 3px!important;color:var(--text)!important;
}
.pedigree-tree-studio .pedigree-performance-block .pedigree-race-head:first-child{margin-top:0!important;}
.pedigree-tree-studio .pedigree-performance-block .pedigree-race-line{
  font-size:.72rem!important;line-height:1.42!important;color:var(--text-secondary,var(--muted))!important;
  margin:2px 0!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;
}
.pedigree-tree-studio .pedigree-facts{font-size:.68rem!important;line-height:1.38!important;}
@media (min-width:1200px){
  .pedigree-tree-studio .pedigree-performance-block .pedigree-race-head{font-size:.76rem!important;}
  .pedigree-tree-studio .pedigree-performance-block .pedigree-race-line{font-size:.75rem!important;}
}

/* v51.74 — Pedigree export/readability refinements */
.pedigree-tree-studio .pedigree-performance-block .pedigree-race-head{font-size:.78rem!important;}
.pedigree-tree-studio .pedigree-performance-block .pedigree-race-line{font-size:.79rem!important;line-height:1.46!important;}
.ai-existing-text-modal{max-width:720px;}
.ai-existing-text-modal .pedigree-modal-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end;}

/* v51.75 — calmer pedigree section rhythm without inflating global line-height */
.pedigree-tree-studio .pedigree-box-top{margin-bottom:4px!important;}
.pedigree-tree-studio .pedigree-name{margin:2px 0 4px!important;}
.pedigree-tree-studio .pedigree-meta{margin:2px 0 0!important;}
.pedigree-tree-studio .pedigree-facts-section{margin-top:10px!important;}
.pedigree-tree-studio .pedigree-facts-label{margin:0 0 5px!important;font-size:.58rem;font-weight:900;letter-spacing:.055em;color:var(--text-secondary,var(--muted));}
.pedigree-tree-studio .pedigree-facts-section .pedigree-facts{margin:0!important;}
.pedigree-tree-studio .pedigree-performance-block{margin-top:11px!important;}
.pedigree-tree-studio .pedigree-performance-block .pedigree-race-head{margin-top:10px!important;margin-bottom:5px!important;}
.pedigree-tree-studio .pedigree-performance-block .pedigree-race-head:first-child{margin-top:0!important;}

/* Authentication owns the entire app shell, including every responsive navigation. */
#appView[hidden]{display:none!important}
body:not([data-auth-state="authenticated"]) .pedigree-overlay,body:not([data-auth-state="authenticated"]) .cv-modal-backdrop{display:none!important}
/* Billing integrates with the existing administration shell. */
.billing-app-link{display:block;padding:9px 16px;font-weight:600}.billing-banner,#billingLimitAlert{padding:14px;background:#fff1c7;color:#413619}.admin-billing{overflow:hidden}.admin-billing .admin-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:12px}.admin-billing label{display:block;margin:8px 0}.admin-billing input:not([type=checkbox]),.admin-billing select,.admin-billing textarea{display:block;width:100%;max-width:100%}.admin-billing textarea{min-height:250px}.admin-billing .scroll-table{max-width:100%;overflow:auto}.admin-billing td,.admin-billing th{padding:8px;text-align:left}.admin-billing details{margin:20px 0}.admin-billing summary{cursor:pointer;font-weight:700}.billing-plan-editor{border:1px solid var(--border,#bbb);border-radius:10px;padding:15px;margin:15px 0}.admin-billing fieldset{min-width:0;margin:12px 0}

/* Country labels are measured in screen pixels and stay near their marker. */
#derbyWorldMap .derby-map-label-wrap{width:180px!important;height:auto!important;pointer-events:auto}
#derbyWorldMap .derby-map-label{box-sizing:border-box;min-width:0;max-width:none;width:180px;cursor:pointer}
#derbyWorldMap .derby-map-label-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-top:4px}
#derbyWorldMap .derby-map-label-meta{overflow:hidden;text-overflow:ellipsis}
.derby-country-entry{margin-top:10px}

body.light #derbyWorldMap .derby-map-label{background:#fff;color:#142b40;border-color:#aac5d6;box-shadow:0 5px 14px rgba(20,43,64,.14)}
body.light #derbyWorldMap .derby-map-label-meta{color:#425e73}
body.light #derbyWorldMap .derby-map-label.inactive{opacity:.9}
#derbyWorldMap .derby-map-label-wrap:focus-visible{outline:3px solid var(--accent,#2bb8ec);outline-offset:3px;border-radius:13px}

/* Club races use the same collection, cards and list controls as OLR. */
#clubRaces .club-races-page>.toolbar{flex-wrap:wrap;gap:12px}
#clubRaces .club-races-page>.toolbar h2{margin-top:0}
#clubRaces .entity-view-toolbar{margin:0 0 0 auto}
#clubRaces .club-race-toolbar{padding:0;margin:0 0 14px}
#clubRaces .club-race-toolbar input,#clubRaces .club-race-toolbar select{min-width:0;flex:1 1 160px}
#clubRaces .club-race-grid-rich{grid-template-columns:repeat(auto-fit,minmax(min(270px,100%),1fr))}
#clubRaces .club-race-card-rich{gap:0}
#clubRaces .club-race-stat-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:7px}
#clubRaces .club-race-stat-grid>div{overflow-wrap:anywhere}
#clubRaces .club-race-stat-grid span{display:block;padding:0;border:0;border-radius:0;background:transparent;text-align:left}
#clubRaces .club-race-stat-grid strong{font-size:1rem}
#clubRaces .club-race-card-rich .club-source-pill{flex-shrink:0}
#clubRaces .club-card-actions{margin-top:12px}
#clubRaces .club-card-secondary-actions{margin-left:auto}
@media(min-width:1450px){#clubRaces .club-race-grid-rich{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:1000px){#clubRaces .club-race-grid-rich{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){#clubRaces .club-race-grid-rich{grid-template-columns:1fr}#clubRaces .entity-view-toolbar{width:100%;margin:0}#clubRaces .club-race-toolbar>*{width:100%;flex-basis:100%}}

/* Larger subject portrait and compact, keyboard-accessible action selections. */
#pedigree .pedigree-profile-premium{grid-template-columns:minmax(260px,42%) minmax(0,1fr)!important;align-items:start}
#pedigree .pedigree-profile-premium .pedigree-photo-wrap img{aspect-ratio:auto;width:100%;height:auto;padding:0;background:#fff}
#pedigree .pedigree-profile-info{min-width:0;overflow-wrap:anywhere}
#pedigree .pedigree-document-card{overflow:visible}
.pedigree-action-menu{position:relative}
.pedigree-action-menu summary{display:flex;align-items:center;gap:6px;list-style:none;cursor:pointer;border:1px solid var(--line-soft);border-radius:14px;background:var(--panel-3);color:var(--text);min-height:34px;padding:6px 9px;font-size:.76rem;font-weight:700}
.pedigree-action-menu summary::-webkit-details-marker{display:none}
.pedigree-action-menu summary:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.pedigree-action-options{position:absolute;right:0;top:calc(100% + 6px);z-index:20;display:grid;gap:4px;padding:8px;min-width:180px;max-width:calc(100vw - 40px);border:1px solid var(--line-soft);border-radius:14px;background:var(--panel-2);box-shadow:0 12px 30px #0004}
.pedigree-action-options button{text-align:left;width:100%}
@media(max-width:700px){#pedigree .pedigree-profile-premium{grid-template-columns:minmax(0,1fr)!important}.pedigree-profile-premium .pedigree-photo-wrap{width:100%;max-width:520px;justify-self:center}#pedigree .pedigree-document-toolbar>div:last-child{justify-content:flex-start}.pedigree-action-options{position:static;margin-top:6px}.pedigree-document-toolbar>div:last-child{align-items:flex-start}}

/* Equal-sized actions, including native disclosure summaries. */
#pedigree .pedigree-document-toolbar>div:last-child{display:grid!important;grid-template-columns:repeat(4,minmax(130px,1fr));gap:8px;align-items:start}
#pedigree .pedigree-document-toolbar>div:last-child>button,#pedigree .pedigree-action-menu>summary{box-sizing:border-box;width:100%!important;min-height:52px!important;height:52px!important;padding:6px 8px!important;font-size:.85rem!important;display:flex;align-items:center;justify-content:center;gap:6px;margin:0}
#pedigree .pedigree-action-menu{min-width:0;width:100%}
#pedigree .pedigree-photo-wrap.no-photo{min-height:100px;height:120px;align-self:start}
#pedigree .pedigree-photo-wrap.no-photo .pedigree-photo-placeholder{height:100%;min-height:0}
@media(max-width:1100px){#pedigree .pedigree-document-toolbar{flex-direction:column;align-items:stretch}#pedigree .pedigree-document-toolbar>div:last-child{width:100%;grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){#pedigree .pedigree-action-options{min-width:0;width:100%;box-sizing:border-box;max-width:100%}#pedigree .pedigree-action-options button{white-space:normal}}

.import-editor{width:min(1100px,95vw)!important;max-width:95vw!important}.import-editor>label{display:grid;gap:6px;margin:12px 0}.import-editor .table-wrap{margin:12px 0;max-width:100%}.import-editor td input:not([type=checkbox]){min-width:100px}.import-editor td a{overflow-wrap:anywhere}.import-editor td small{display:block}.club-manual-competition{display:grid;grid-template-columns:50px repeat(2,minmax(0,1fr));gap:10px}.club-manual-competition label{display:grid;gap:4px;font-size:.8rem}.import-editor .table-wrap table{min-width:650px}.club-manual-competition input{width:100%;box-sizing:border-box}

#pedigree .pedigree-action-menu>summary svg{width:18px;height:18px;flex:0 0 18px}
#pedigree .pedigree-action-menu>summary span{min-width:0;line-height:1.2}

/* Keep all four stock actions in equal mobile cells. */
@media(max-width:700px){
  #pedigree .pedigree-filter-row > button{grid-column:span 6!important;height:56px!important;min-height:56px!important;padding:6px 8px!important;font-size:.82rem!important}
}

/* A refresh checks the session without briefly presenting the login form. */
body[data-auth-state="loading"] #loginView{display:none!important}

.profile-parentage{margin-top:.35rem;font-weight:400;font-style:italic;line-height:1.45;overflow-wrap:anywhere}
.profile-ring>div{min-width:0}

.ai-tree-compact .ai-node-compact{min-height:0;overflow:hidden}.ai-tree-compact .ai-node-compact .pedigree-facts{flex:1;min-height:0}.ai-tree-compact .ai-node-footer{flex-shrink:0}

.pedigree-breakdown{margin:12px 0}.pedigree-breakdown summary{cursor:pointer;font-weight:700}.pedigree-breakdown-controls{display:flex;gap:12px;flex-wrap:wrap;margin:12px 0}.pedigree-breakdown-controls label{display:grid;gap:5px;flex:1;min-width:180px}.pedigree-breakdown-table{width:100%;text-align:right}.pedigree-breakdown-table caption{text-align:left;font-weight:700;padding:8px 0}.pedigree-breakdown-table th:first-child{text-align:left}.pedigree-breakdown-table th,.pedigree-breakdown-table td{padding:9px;border-bottom:1px solid var(--line-soft)}.ai-unplaced .ai-import-node{display:inline-flex;width:220px;margin:8px;vertical-align:top}

.quick-pigeon-dialog .quick-voice-language{width:auto;max-width:100%;min-height:40px;margin:.2rem 0 .4rem;font-size:.85rem;padding:.4rem .7rem;}

.olr-operation-banner{position:fixed;z-index:150;right:18px;bottom:calc(18px + env(safe-area-inset-bottom,0px));width:min(440px,calc(100vw - 36px));padding:16px 18px;background:var(--panel);color:var(--text);border:1px solid var(--accent,#38bdf8);border-radius:14px;box-shadow:0 14px 45px #0005}.olr-operation-banner strong{font-size:.95rem}.olr-operation-banner p{font-size:.82rem;color:var(--muted);margin:.5rem 0}.olr-operation-banner progress{width:100%;height:10px;accent-color:#38bdf8}

/* Pedigree document hierarchy, inspired by printed breeder records. */
.pedigree-tree-studio .pedigree-box:not(.pedigree-box-empty){font-family:Arial,Helvetica,sans-serif;border:1px solid var(--line);border-radius:6px;padding:12px 13px!important;background:var(--panel)!important;box-shadow:2px 3px 0 #0f172a24,0 8px 20px #0f172a0d;transition:border-color .15s ease,box-shadow .15s ease}.pedigree-tree-studio .pedigree-box:hover{transform:none;border-color:var(--muted);box-shadow:2px 3px 0 #0f172a30,0 10px 22px #0f172a14}.pedigree-tree-studio .pedigree-box.pedigree-male{border-left:3px solid var(--ped-blue-strong)!important}.pedigree-tree-studio .pedigree-box.pedigree-female{border-left:3px solid var(--ped-rose-strong)!important}.pedigree-tree-studio .pedigree-box-top{align-items:baseline;gap:6px}.pedigree-tree-studio .pedigree-box-top strong{font-size:.96rem!important;line-height:1.25;letter-spacing:-.015em;font-weight:700;color:var(--text);font-variant-numeric:tabular-nums}.pedigree-tree-studio .pedigree-sex{font-size:.9rem;flex-shrink:0}.pedigree-tree-studio .pedigree-name{font-size:.92rem!important;line-height:1.28;font-weight:700;font-style:italic;color:#f2a6b6;margin-bottom:5px!important}.pedigree-tree-studio .pedigree-meta{display:grid;gap:3px;font-size:.79rem!important;line-height:1.35!important}.pedigree-tree-studio .pedigree-breeder{font-weight:700;color:#8dcee0}.pedigree-tree-studio .pedigree-color{color:var(--muted)}.pedigree-tree-studio .pedigree-facts-section{margin-top:9px!important}.pedigree-tree-studio .pedigree-facts-label{font-size:.6rem;font-weight:600;letter-spacing:.06em}.pedigree-tree-studio .pedigree-facts{font-size:.8rem!important;line-height:1.45!important;color:var(--text);-webkit-line-clamp:6!important}.pedigree-tree-studio .pedigree-node-hint{font-size:.58rem;line-height:1.3}.pedigree-tree-studio .pedigree-performance-block{border-radius:4px!important;background:var(--panel-2)!important;padding:7px 8px!important}.pedigree-tree-studio .pedigree-performance-block .pedigree-race-head{font-weight:700!important}.pedigree-tree-studio .pedigree-performance-block .pedigree-race-line{line-height:1.4!important}
html[data-theme="light"] .pedigree-tree-studio .pedigree-name,body.light .pedigree-tree-studio .pedigree-name{color:#973e4d}html[data-theme="light"] .pedigree-tree-studio .pedigree-breeder,body.light .pedigree-tree-studio .pedigree-breeder{color:#22677a}
@media print{.pedigree-tree-studio .pedigree-box:not(.pedigree-box-empty){box-shadow:1px 1px 0 #cbd5e1!important;background:#fff!important;padding:1.4mm!important}.pedigree-tree-studio .pedigree-box-top strong{font-size:7pt!important}.pedigree-tree-studio .pedigree-name{font-size:6.5pt!important;color:#973e4d!important}.pedigree-tree-studio .pedigree-meta,.pedigree-tree-studio .pedigree-facts{font-size:5.5pt!important}.pedigree-tree-studio .pedigree-breeder{color:#22677a!important}}
