/* =====================================================================
   Terra Vita Hub v424 — Site-wide UI / CSS consolidation layer
   Purpose: make public Hub pages, protected review rooms, ERS room and
   ERS register read as one institutional product family.
   No routing, auth or Supabase logic is changed here.
   ===================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,300;9..144,400;9..144,500;9..144,600;9..144,700&family=DM+Sans:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap");

:root{
  --tvh-u-ink:#0A2A43;
  --tvh-u-ink-2:#0F3B5C;
  --tvh-u-green:#0C4940;
  --tvh-u-teal:#0B7D73;
  --tvh-u-teal-2:#128C7E;
  --tvh-u-paper:#F8F6EC;
  --tvh-u-paper-2:#FFFDF6;
  --tvh-u-surface:#FFFFFF;
  --tvh-u-muted:#5E6F78;
  --tvh-u-soft:#EEF4F2;
  --tvh-u-line:rgba(10,42,67,.135);
  --tvh-u-line-2:rgba(12,73,64,.18);
  --tvh-u-warn:#A9781F;
  --tvh-u-bad:#A23B2F;
  --tvh-u-good:#0B7D73;
  --tvh-u-radius:28px;
  --tvh-u-radius-sm:18px;
  --tvh-u-radius-xs:12px;
  --tvh-u-shadow:0 24px 70px rgba(10,42,67,.08);
  --tvh-u-shadow-soft:0 14px 38px rgba(10,42,67,.06);
  --tvh-u-container:1440px;
  --tvh-u-sans:"DM Sans",Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  --tvh-u-serif:"Fraunces",Georgia,serif;
  --tvh-u-mono:"JetBrains Mono",ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;
}

html{scroll-behavior:smooth;}
body{
  background:
    radial-gradient(circle at 8% -10%, rgba(11,125,115,.10), transparent 32rem),
    linear-gradient(180deg, #fffdf6 0%, var(--tvh-u-paper) 48rem),
    var(--tvh-u-paper) !important;
  color:var(--tvh-u-ink) !important;
  font-family:var(--tvh-u-sans) !important;
  letter-spacing:normal;
  -webkit-font-smoothing:antialiased;
}
body::before{display:none!important;content:none!important;}
::selection{background:var(--tvh-u-ink);color:var(--tvh-u-paper-2)}

:where(h1,h2,h3,h4,h5,.brand h1,.tvh-logo-name,.hero h2,.page-header h1,h2.big,.module-shell>summary){
  font-family:var(--tvh-u-serif)!important;
  color:var(--tvh-u-ink)!important;
  letter-spacing:-.018em!important;
}
:where(p,li,td,th,input,select,textarea,button,a,span,div){font-family:inherit;}
:where(.mono,.k,.kicker,.meta,.room-k,.live-pack-k,.room-context-k,.status,.source-note,.pill,.badge,.evhead .code,.record,.btn,.hub-return a,nav.tabs button,.tvh-eyebrow,.section-kicker,.eyebrow){font-family:var(--tvh-u-mono)!important;}

/* Universal container rhythm */
:where(.wrap,.tvh-container,.tvh-main,main.wrap){max-width:var(--tvh-u-container)!important;}
:where(.wrap){padding-left:clamp(18px,3vw,34px)!important;padding-right:clamp(18px,3vw,34px)!important;}

/* One header family for Hub + protected legacy pages */
:where(.tvh-header,header.site){
  background:rgba(255,253,246,.96)!important;
  border-bottom:1px solid var(--tvh-u-line)!important;
  backdrop-filter:saturate(1.15) blur(16px)!important;
  box-shadow:0 1px 0 rgba(10,42,67,.025)!important;
}
:where(header.site .wrap.bar,.tvh-header-inner,.bar){
  max-width:var(--tvh-u-container)!important;
  margin:0 auto!important;
  padding:14px clamp(18px,3vw,34px)!important;
  min-height:72px!important;
  gap:14px!important;
}
:where(.tvh-logo,.brand){gap:12px!important;align-items:center!important;}
:where(.brand img){
  width:34px!important;height:34px!important;border-radius:10px!important;
  border:0!important;background:var(--tvh-u-ink)!important;
  box-shadow:0 10px 24px rgba(10,42,67,.12)!important;
}
:where(.brand .ey,.tvh-logo-tag){
  font-family:var(--tvh-u-mono)!important;color:var(--tvh-u-muted)!important;
  letter-spacing:.13em!important;text-transform:uppercase!important;font-size:10px!important;font-style:normal!important;
}
:where(.brand h1){font-size:20px!important;line-height:1.05!important;font-weight:650!important;}
:where(.brand .sub){font-size:12.5px!important;color:var(--tvh-u-muted)!important;font-style:normal!important;}
:where(.bar .meta,.meta,.you-are-here){
  border:1px solid rgba(11,125,115,.20)!important;
  background:rgba(11,125,115,.075)!important;
  color:var(--tvh-u-teal)!important;
  border-radius:999px!important;
  padding:8px 12px!important;
  font-weight:800!important;
  letter-spacing:.10em!important;
}
:where(.hub-return,.room-actions,.button-row,.tvh-hero-actions,.navrow){gap:10px!important;}
:where(.hub-return a,.tvh-nav-primary a,.tvh-nav a){border-radius:999px!important;}

/* Protected step navigation unified with Hub chips */
:where(nav.tabs){
  border-top:1px solid var(--tvh-u-line)!important;
  padding:10px 0 12px!important;
  gap:8px!important;
}
:where(nav.tabs button){
  border:1px solid var(--tvh-u-line)!important;
  background:rgba(255,255,255,.70)!important;
  border-radius:999px!important;
  padding:10px 13px!important;
  color:var(--tvh-u-muted)!important;
  font-size:10.5px!important;
  letter-spacing:.11em!important;
  font-weight:750!important;
  text-transform:uppercase!important;
}
:where(nav.tabs button[aria-selected="true"]){
  color:#fff!important;background:var(--tvh-u-ink)!important;border-color:var(--tvh-u-ink)!important;
}
:where(nav.tabs button[aria-selected="true"]::after){display:none!important;}
:where(nav.tabs button .n){opacity:.72!important;color:inherit!important;font-size:9.5px!important;}

/* Cards and panels */
:where(.tvh-hero-card,.tvh-card,.tvh-section,.route-bar,.module-shell,.panel,.v410-ers-surface,.room-live-feed,.room-context-card,.live-pack-overview,.fnote,.mode,.evcard,.finding,.scorehead,.reso,.opt,.kpi,.tile,.table-wrap,.diagram-card,.next-block){
  background:rgba(255,255,255,.86)!important;
  border:1px solid var(--tvh-u-line)!important;
  border-radius:var(--tvh-u-radius)!important;
  box-shadow:var(--tvh-u-shadow-soft)!important;
}
:where(.panel,.tvh-section,.v410-ers-surface,.room-live-feed,.room-context-card,.live-pack-overview){
  padding:clamp(20px,3vw,32px)!important;
  margin-block:clamp(18px,2.5vw,28px)!important;
}
:where(.module-shell){overflow:hidden!important;}
:where(.evcard,.mode,.finding,.kpi,.tile){border-radius:22px!important;}
:where(.record,pre,code,.codebox){
  background:rgba(10,42,67,.035)!important;
  border:1px solid rgba(10,42,67,.10)!important;
  border-radius:14px!important;
  color:var(--tvh-u-ink)!important;
}

/* Hero + section labels */
:where(.hero,.tvh-hero,.page-header){padding-top:clamp(40px,5vw,74px)!important;padding-bottom:clamp(20px,3vw,34px)!important;}
:where(.k,.kicker,.section-kicker,.eyebrow,.tvh-eyebrow,.v410-k,.room-k,.live-pack-k,.room-context-k){
  color:var(--tvh-u-teal)!important;
  font-weight:850!important;
  letter-spacing:.14em!important;
  text-transform:uppercase!important;
}
:where(.kicker::before){background:var(--tvh-u-teal)!important;}
:where(.lede,.hero p,.page-summary,.tvh-hero .lead,.module-body p,.tile p,.fnote p,.mode p,.small,.source-note){
  color:var(--tvh-u-muted)!important;
}
:where(h2.big,.hero h2,.tvh-hero h1,.page-header h1){
  max-width:18ch;
  line-height:.98!important;
}

/* Buttons and form controls */
:where(.btn,.tvh-cta-primary,.tvh-cta-ghost,.tvh-cta,.btn-primary,.btn-secondary,.hub-return a,.v410-ers-surface a.v410-primary,.v410-ers-surface a.v410-secondary,.cbtn,.chip-opt,.vpick,.resolver-check){
  border-radius:999px!important;
  min-height:42px!important;
  padding:11px 16px!important;
  font-family:var(--tvh-u-mono)!important;
  font-size:11px!important;
  letter-spacing:.10em!important;
  font-weight:800!important;
  text-transform:uppercase!important;
  text-decoration:none!important;
  transition:transform .16s ease,background .16s ease,color .16s ease,border-color .16s ease,box-shadow .16s ease!important;
}
:where(.btn:hover,.hub-return a:hover,.cbtn:hover,.chip-opt:hover,.vpick:hover){transform:translateY(-1px);}
:where(.btn,.btn.primary,.tvh-cta-primary,.v410-ers-surface a.v410-primary){
  background:var(--tvh-u-ink)!important;color:#fffdf6!important;border-color:var(--tvh-u-ink)!important;
}
:where(.btn.ghost,.btn.secondary,.tvh-cta-ghost,.btn-secondary,.hub-return a,.v410-ers-surface a.v410-secondary){
  background:#fff!important;color:var(--tvh-u-ink)!important;border-color:var(--tvh-u-line)!important;
}
:where(.btn.ghost:hover,.tvh-cta-ghost:hover,.hub-return a:hover,.v410-ers-surface a.v410-secondary:hover){
  color:#fff!important;background:var(--tvh-u-teal)!important;border-color:var(--tvh-u-teal)!important;
}
:where(input,select,textarea){
  border-radius:16px!important;
  border:1px solid var(--tvh-u-line)!important;
  background:#fff!important;
  color:var(--tvh-u-ink)!important;
  box-shadow:inset 0 1px 0 rgba(10,42,67,.02)!important;
  min-height:44px!important;
}
:where(input:focus,select:focus,textarea:focus){
  outline:3px solid rgba(11,125,115,.16)!important;
  border-color:rgba(11,125,115,.55)!important;
}

/* Status pills and tags */
:where(.badge,.pill,.mchip,.room-pill,.live-pack-status,.room-status,.status,.tagline,.classtally,.room-context-state){
  border-radius:999px!important;
  border:1px solid var(--tvh-u-line)!important;
  background:#fff!important;
  color:var(--tvh-u-muted)!important;
  font-family:var(--tvh-u-mono)!important;
  font-weight:750!important;
}
:where(.badge[data-on="1"],.pill.sealed,.status[data-kind="ok"],.room-status[data-kind="ok"],.live-pack-status[data-kind="ok"]){
  color:var(--tvh-u-teal)!important;border-color:rgba(11,125,115,.28)!important;background:rgba(11,125,115,.075)!important;
}
:where(.status[data-kind="warn"],.pill.in_review,.context-missing){
  color:var(--tvh-u-warn)!important;border-color:rgba(169,120,31,.30)!important;background:rgba(169,120,31,.08)!important;
}
:where(.status[data-kind="bad"],.missing){
  color:var(--tvh-u-bad)!important;border-color:rgba(162,59,47,.30)!important;background:rgba(162,59,47,.07)!important;
}

/* ERS live reviewer room refinements */
:where(.protected-room-banner,.room-lockbar,.review-context-strip){
  background:linear-gradient(135deg,rgba(11,125,115,.10),rgba(10,42,67,.04))!important;
  border:1px solid rgba(11,125,115,.18)!important;
  border-left:6px solid var(--tvh-u-teal)!important;
  border-radius:22px!important;
  box-shadow:none!important;
}
:where(.room-grid,.live-pack-grid,.ctx-grid,.room-context-fields){gap:14px!important;}
:where(.room-row,.ctx-grid > *, .live-pack-grid > *){
  background:#fff!important;border:1px solid var(--tvh-u-line)!important;border-radius:18px!important;padding:14px!important;
}
:where(.evlist){gap:18px!important;}
:where(.evcard){border-left:5px solid var(--tvh-u-line)!important;overflow:hidden!important;}
:where(.evcard[data-cls="survives"]){border-left-color:var(--tvh-u-good)!important;}
:where(.evcard[data-cls="validate"]){border-left-color:var(--tvh-u-warn)!important;}
:where(.evcard[data-cls="cannot"]){border-left-color:var(--tvh-u-bad)!important;}
:where(.evhead){padding:20px 22px!important;gap:16px!important;}
:where(.evhead .code){color:var(--tvh-u-teal)!important;font-weight:800!important;}
:where(.evhead .t h4){font-size:19px!important;}
:where(.evhead .t .claim){color:var(--tvh-u-muted)!important;}
:where(.evbody){padding:0 22px 22px!important;}
:where(.classbar){gap:10px!important;border-top:1px solid var(--tvh-u-line)!important;}
:where(.cbtn){
  background:#fff!important;color:var(--tvh-u-ink)!important;border:1px solid var(--tvh-u-line)!important;
  box-shadow:0 8px 20px rgba(10,42,67,.045)!important;
}
:where(.cbtn[data-k="survives"]:hover,.cbtn[data-selected="true"][data-k="survives"]){background:rgba(11,125,115,.09)!important;border-color:rgba(11,125,115,.35)!important;color:var(--tvh-u-teal)!important;}
:where(.cbtn[data-k="validate"]:hover,.cbtn[data-selected="true"][data-k="validate"]){background:rgba(169,120,31,.10)!important;border-color:rgba(169,120,31,.38)!important;color:var(--tvh-u-warn)!important;}
:where(.cbtn[data-k="cannot"]:hover,.cbtn[data-selected="true"][data-k="cannot"]){background:rgba(162,59,47,.08)!important;border-color:rgba(162,59,47,.35)!important;color:var(--tvh-u-bad)!important;}
:where(.mtag,.chip-opt){
  border:1px solid var(--tvh-u-line)!important;background:#fff!important;color:var(--tvh-u-muted)!important;border-radius:999px!important;
}
:where(.mtag[aria-pressed="true"],.chip-opt[aria-pressed="true"]){
  background:rgba(11,125,115,.09)!important;color:var(--tvh-u-teal)!important;border-color:rgba(11,125,115,.34)!important;
}

/* Tables and registers */
:where(table){border-collapse:separate!important;border-spacing:0!important;background:#fff!important;}
:where(.table-wrap){overflow:auto!important;}
:where(th){
  background:rgba(12,73,64,.055)!important;
  color:var(--tvh-u-green)!important;
  font-family:var(--tvh-u-mono)!important;
  font-size:10px!important;letter-spacing:.12em!important;text-transform:uppercase!important;
}
:where(td,th){border-bottom:1px solid rgba(10,42,67,.09)!important;}
:where(td strong){font-family:var(--tvh-u-serif)!important;color:var(--tvh-u-ink)!important;}

/* Footer unification */
:where(footer.site,.footer,.tvh-footer){
  border-top:1px solid var(--tvh-u-line)!important;
  background:linear-gradient(180deg,rgba(255,253,246,.92),rgba(248,246,236,1))!important;
  color:var(--tvh-u-muted)!important;
}
:where(footer.site a,.footer a,.tvh-footer a){color:var(--tvh-u-ink)!important;text-decoration:none!important;font-weight:800!important;}
:where(footer.site a:hover,.footer a:hover,.tvh-footer a:hover){color:var(--tvh-u-teal)!important;}

/* Keep hidden legacy/simulation surfaces hidden */
:where(.ers-hidden-legacy,[hidden]){display:none!important;}

@media(max-width:980px){
  :where(header.site .wrap.bar,.bar){align-items:flex-start!important;flex-direction:column!important;}
  :where(.bar .meta,.meta){margin-left:0!important;}
  :where(nav.tabs){padding-bottom:10px!important;}
  :where(.room-grid,.live-pack-grid,.ctx-grid,.kpis,.filters){grid-template-columns:1fr!important;}
  :where(.panel,.tvh-section,.room-live-feed,.room-context-card,.live-pack-overview){border-radius:22px!important;}
}

@media print{
  body{background:#fff!important;color:#000!important;}
  :where(.tvh-header,header.site,nav.tabs,.hub-return,.filters,.room-actions,.tvh-no-print){display:none!important;}
  :where(.panel,.evcard,.live-pack-overview,.room-context-card){box-shadow:none!important;border-color:#bbb!important;}
}
