/* V52 — platform-wide visual QA, coherence, accessibility and performance polish */
:root{--rr-max:1220px;--rr-purple:#a94cff;--rr-purple-2:#7d2be8;--rr-border:rgba(181,116,220,.26)}
html,body{max-width:100%;overflow-x:clip}
body{min-width:0}
main{min-width:0}
img,svg,video,canvas{max-width:100%}
button,a,input,select,textarea{touch-action:manipulation}
input,select,textarea{max-width:100%;box-sizing:border-box}
:where(p,li,dd,td,th,a,button,label,h1,h2,h3){overflow-wrap:anywhere}

/* Stronger shared page hierarchy. */
.rr-pagehead{padding-top:clamp(34px,5vw,72px)!important;padding-bottom:clamp(28px,4vw,56px)!important}
.rr-pagehead>div,.rr-shell,.section,.gbk-section,.admin-shell,.member-shell{max-width:var(--rr-max)}
.rr-pagehead h1{max-width:980px;line-height:.94!important;letter-spacing:-.045em}
.rr-pagehead p{max-width:820px;line-height:1.68}
.rr-crumb{font-size:12px!important;letter-spacing:.05em}

/* The modern pagehead is the canonical intro. V52 removes the duplicate legacy subheroes. */
.rr-pagehead + .section,.rr-pagehead + .gbk-section{margin-top:0}

/* Consistent navigation controls. */
.nav{z-index:1000}
.nav .brand{white-space:nowrap}
.nav #menuBtn{cursor:pointer}
.nav #menuBtn[aria-expanded="true"]{border-color:rgba(184,83,255,.75)!important;box-shadow:0 0 0 3px rgba(168,76,255,.12)}
.nav a.active,.nav a[aria-current="page"]{color:var(--rr-purple)!important}

/* Make cards feel intentional in both themes. */
.rr-card,.member-panel,.admin-card,.panel,.feature-card,.tool-card{box-sizing:border-box}
html[data-theme="dark"] .rr-card,html[data-theme="dark"] .member-panel,html[data-theme="dark"] .admin-card{border-color:rgba(187,112,225,.28)}
html[data-theme="light"] .rr-card,html[data-theme="light"] .member-panel,html[data-theme="light"] .admin-card{box-shadow:0 14px 40px rgba(63,38,82,.07)}

/* Compound library: improve scan speed and reduce rendering work on the huge static catalog. */
.compound-grid .compound-card{content-visibility:auto;contain-intrinsic-size:420px;scroll-margin-top:110px}
.compound-card .data-row{align-items:start}
.compound-card .expand-body{line-height:1.6}
@media(min-width:900px){.compound-grid{align-items:start}}

/* Evidence / tools pages: cleaner card rhythm. */
.evidence-stack,.feature-grid,.rr-source-ladder{gap:16px!important}
.evidence-stack>* ,.feature-grid>* ,.rr-source-ladder>*{min-width:0}

/* Nasal Guide: remove legacy duplicate search styling and keep the hero image contained. */
.nasal-hero-v26 .sprayer-image-wrap img{object-fit:contain!important;max-height:520px}
.nasal-hero-v26 .hero-actions{flex-wrap:wrap}
.nasal-portal-row>*{min-width:0}
@media(max-width:760px){
  .nasal-hero-v26{padding-top:34px!important}
  .nasal-hero-v26 .nasal-hero-grid{grid-template-columns:1fr!important;gap:24px!important}
  .nasal-hero-v26 .sprayer-image-wrap{min-height:260px!important}
  .nasal-hero-v26 .sprayer-image-wrap img{max-height:320px!important}
  .nasal-portal-row{grid-template-columns:1fr!important}
  .guide-nav{overflow-x:auto;white-space:nowrap;scrollbar-width:none}
  .guide-nav::-webkit-scrollbar{display:none}
}

/* Member dashboard: the mode is a label, not a fake count. */
.member-stat #modeStat{font-size:clamp(18px,2vw,28px)!important;line-height:1.05!important;letter-spacing:-.02em!important}
.member-stats{align-items:stretch}
.member-stat{min-width:0}
.collection-create{grid-template-columns:minmax(0,1fr) auto!important}
@media(max-width:620px){.collection-create{grid-template-columns:1fr!important}.collection-create .member-btn{width:100%}}

/* Admin: stronger hierarchy, readable controls, and horizontal tab navigation on narrow screens. */
.admin-tabs{position:sticky;top:72px;z-index:30;background:color-mix(in srgb,var(--bg,#0a0810) 94%,transparent);backdrop-filter:blur(14px);padding-block:10px}
.admin-tabs button{min-height:42px}
.admin-form textarea{min-height:110px;resize:vertical}
.admin-form label{gap:7px}
.admin-list>*{min-width:0}
@media(max-width:900px){
  .admin-tabs{display:flex!important;overflow-x:auto!important;flex-wrap:nowrap!important;scrollbar-width:none;top:68px}
  .admin-tabs::-webkit-scrollbar{display:none}
  .admin-tabs button{flex:0 0 auto;white-space:nowrap}
  .admin-two{grid-template-columns:1fr!important}
}

/* Generic table safety outside the GBK directory. */
.rr-table-wrap{width:100%;overflow:auto;border-radius:14px;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch}
.rr-table-wrap>table{min-width:640px;width:100%}

/* GBK directory: preserve V51 cards but make action buttons full-width and stable. */
@media(max-width:760px){
  .directory-actions .dossier-btn{width:100%!important;box-sizing:border-box!important}
  .directory td[data-label="Actions"]{padding-left:14px!important;padding-top:42px!important}
  .directory td[data-label="Actions"]::before{width:auto!important;right:14px}
}

/* Small-screen readability. */
@media(max-width:760px){
  .rr-pagehead{padding-inline:20px!important}
  .rr-pagehead h1{font-size:clamp(42px,13vw,68px)!important}
  .section,.rr-shell,.gbk-section{padding-left:20px!important;padding-right:20px!important}
  .actions,.member-actions,.admin-actions{gap:10px;flex-wrap:wrap}
  .actions>a,.member-actions>a{min-height:46px;display:inline-flex;align-items:center;justify-content:center}
}

.gbk-hero .gbk-display{font:clamp(55px,7vw,105px)/.9 Impact,Haettenschweiler,'Arial Narrow Bold',sans-serif;margin:5px 0 18px}.gbk-hero .gbk-display em{color:#c84cf5;font-style:normal}
/* V54 calculator clarity */
.required-chip{display:inline-flex;align-items:center;margin-left:.45rem;padding:.14rem .42rem;border:1px solid rgba(190,69,255,.45);border-radius:999px;font-size:.62rem;font-weight:800;letter-spacing:.08em;color:#d79cff;vertical-align:middle}
.calc-input-error{outline:2px solid #cf4cff!important;outline-offset:2px;box-shadow:0 0 0 4px rgba(190,69,255,.12)!important}
.calc-field-message{display:block;margin-top:.45rem;color:#e0aaff;font-size:.84rem;font-weight:700}
#totalAmount::placeholder,#rTotal::placeholder{color:rgba(190,190,205,.55);font-style:italic}
