/*
 * Baltique OS Core 2.4.0.2
 * Official Light Visual System — Magdalena reference palette.
 *
 * Palette sampled from the approved premium patient-experience artwork:
 * canvas      #F4EEE9
 * canvas soft #F8F3EF
 * surface     #FFFDFC
 * surface 2   #FAF5F1
 * surface 3   #F2EAE5
 * line        #E0D2C7
 * line strong #CDB6A7
 * accent      #9D6258
 * accent soft #F0DDD7
 * accent pale #F8ECE8
 * text        #2F261E
 * text muted  #6E6058
 * gold        #8A6737
 *
 * This stylesheet is intentionally loaded last. It normalises legacy dark-only
 * modules without changing the official dark theme.
 */

html:not([data-theme="dark"]){
  --balt-bg:#F4EEE9;
  --balt-bg-soft:#F8F3EF;
  --balt-canvas:#F4EEE9;
  --balt-canvas-soft:#F8F3EF;
  --balt-panel:#FFFDFC;
  --balt-panel-2:#FAF5F1;
  --balt-panel-3:#F2EAE5;
  --balt-sidebar-bg:#F7EEE8;
  --balt-topbar-bg:rgba(255,253,252,.97);
  --balt-input-bg:#FFFDFC;
  --balt-border:#E0D2C7;
  --balt-border-strong:#CDB6A7;
  --balt-border-soft:rgba(157,98,88,.18);
  --balt-text:#2F261E;
  --balt-text-strong:#211A15;
  --balt-muted:#6E6058;
  --balt-subtle:#796B63;
  --balt-hover:#F4E4DE;
  --balt-selected:#F0DDD7;
  --balt-accent:#9D6258;
  --balt-accent-hover:#875149;
  --balt-accent-strong:#7D463F;
  --balt-accent-soft:#F0DDD7;
  --balt-accent-pale:#F8ECE8;
  --balt-accent-text:#FFFFFF;
  --balt-gold:#8A6737;
  --balt-gold-soft:#F2E7D3;
  --balt-link:#8C4E45;
  --balt-link-hover:#6F3A33;
  --balt-focus:#A66B61;
  --balt-danger:#9B3F4B;
  --balt-danger-bg:#FCEDEF;
  --balt-success:#3F704F;
  --balt-success-bg:#EDF6F0;
  --balt-warning:#8A5D20;
  --balt-warning-bg:#FFF5E3;
  --balt-info:#5E6672;
  --balt-info-bg:#F1F3F6;
  --balt-shadow-sm:0 1px 2px rgba(63,43,34,.04),0 4px 14px rgba(63,43,34,.05);
  --balt-shadow:0 14px 38px rgba(82,55,44,.10);
  --balt-shadow-lg:0 24px 64px rgba(82,55,44,.14);
  --bg:#F4EEE9;
  --panel:#FFFDFC;
  --card:#FFFDFC;
  --text:#2F261E;
  --muted:#6E6058;
  --line:#E0D2C7;
  --sidebar:#F7EEE8;
  --topbar:#FFFDFC;
  --input:#FFFDFC;
  --pro-surface:#FFFDFC;
  --pro-surface-2:#FAF5F1;
  --pro-line:#E0D2C7;
  --pro-muted:#6E6058;
  color-scheme:light;
  accent-color:#9D6258;
}

/* ---------- Global canvas and shell ---------- */
html:not([data-theme="dark"]),
html:not([data-theme="dark"]) body,
html:not([data-theme="dark"]) body.strategy-bg,
html:not([data-theme="dark"]) .shell,
html:not([data-theme="dark"]) .main,
html:not([data-theme="dark"]) .page,
html:not([data-theme="dark"]) .page-wrap,
html:not([data-theme="dark"]) .content,
html:not([data-theme="dark"]) .content-area,
html:not([data-theme="dark"]) .app-shell,
html:not([data-theme="dark"]) .workspace-shell{
  background:#F4EEE9!important;
  color:#2F261E!important;
}
html:not([data-theme="dark"]) body.strategy-bg{
  background:
    radial-gradient(circle at 88% 3%,rgba(196,141,129,.10),transparent 30%),
    radial-gradient(circle at 8% 92%,rgba(224,210,199,.36),transparent 34%),
    linear-gradient(180deg,#F8F3EF 0%,#F4EEE9 100%)!important;
}
html:not([data-theme="dark"]) .shell{
  background:linear-gradient(90deg,#F7EEE8 0,var(--balt-sidebar-width,280px),#F4EEE9 var(--balt-sidebar-width,280px),#F4EEE9 100%)!important;
}

/* ---------- Sidebar ---------- */
html:not([data-theme="dark"]) :where(.sidebar,.side-nav,.app-sidebar,.main-sidebar,.navigation-panel){
  background:linear-gradient(180deg,#FBF5F1 0%,#F7EEE8 100%)!important;
  color:#2F261E!important;
  border-color:#E0D2C7!important;
  box-shadow:10px 0 30px rgba(82,55,44,.045)!important;
}
html:not([data-theme="dark"]) :where(.sidebar .brand,.sidebar .side-foot,.sidebar .nav,.sidebar .nav-group,.sidebar details,.sidebar details[open]){
  background:transparent!important;
  color:#2F261E!important;
  border-color:#E0D2C7!important;
}
html:not([data-theme="dark"]) .sidebar .brand{
  border-bottom:1px solid #E0D2C7!important;
}
html:not([data-theme="dark"]) :where(.sidebar summary,.sidebar a,.sidebar span,.sidebar small,.sidebar label,.sidebar strong){
  color:#5E514A!important;
}
html:not([data-theme="dark"]) :where(.sidebar a:hover,.sidebar a.active,.sidebar summary:hover,.sidebar details[open]>summary){
  background:#F0DDD7!important;
  color:#2F261E!important;
  border-color:#D9BFB5!important;
}
html:not([data-theme="dark"]) .sidebar a.active{
  box-shadow:inset 3px 0 0 #9D6258!important;
}
html:not([data-theme="dark"]) .sidebar :where(svg,path){
  color:currentColor;
}

/* ---------- Top bar ---------- */
html:not([data-theme="dark"]) :where(.topbar,.app-topbar,.header-bar,.main-header){
  background:rgba(255,253,252,.97)!important;
  color:#2F261E!important;
  border-color:#E0D2C7!important;
  box-shadow:0 1px 0 rgba(82,55,44,.06),0 10px 28px rgba(82,55,44,.05)!important;
  backdrop-filter:blur(18px) saturate(1.08);
}
html:not([data-theme="dark"]) :where(.topbar form,.topbar .userbox,.topbar .balt-user-identity){
  background:transparent!important;
  color:#2F261E!important;
}
html:not([data-theme="dark"]) .balt-user-identity strong{color:#211A15!important}
html:not([data-theme="dark"]) .balt-user-identity small{color:#6E6058!important}

/* ---------- Search: visible frame and visible left edge of button ---------- */
html:not([data-theme="dark"]) :where(form.search,.search-form,.global-search,.patient-search,.search-box,.searchbar,.balt-search-form){
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:stretch!important;
  min-height:42px!important;
  background:#FFFDFC!important;
  border:1px solid #CDB6A7!important;
  border-radius:12px!important;
  box-shadow:0 1px 0 rgba(255,255,255,.9),0 5px 16px rgba(82,55,44,.06)!important;
  overflow:hidden!important;
  color:#2F261E!important;
}
html:not([data-theme="dark"]) :where(form.search,.search-form,.global-search,.patient-search,.search-box,.searchbar,.balt-search-form) :where(input[type="search"],input[type="text"],input:not([type])){
  min-width:0!important;
  width:100%!important;
  height:100%!important;
  margin:0!important;
  border:0!important;
  border-radius:0!important;
  background:#FFFDFC!important;
  color:#2F261E!important;
  box-shadow:none!important;
  outline:0!important;
}
html:not([data-theme="dark"]) :where(form.search,.search-form,.global-search,.patient-search,.search-box,.searchbar,.balt-search-form) button{
  align-self:stretch!important;
  min-width:88px!important;
  margin:0!important;
  border:0!important;
  border-left:1px solid #BFA398!important;
  border-radius:0!important;
  background:#9D6258!important;
  color:#FFF!important;
  box-shadow:none!important;
  font-weight:750!important;
}
html:not([data-theme="dark"]) :where(form.search,.search-form,.global-search,.patient-search,.search-box,.searchbar,.balt-search-form) button:hover{
  background:#875149!important;
}
html:not([data-theme="dark"]) :where(form.search,.search-form,.global-search,.patient-search,.search-box,.searchbar,.balt-search-form):focus-within{
  border-color:#9D6258!important;
  box-shadow:0 0 0 3px rgba(157,98,88,.16),0 8px 22px rgba(82,55,44,.08)!important;
}

/* ---------- Surfaces ---------- */
html:not([data-theme="dark"]) :where(
  .card,.panel,.box,.tile,.widget,.surface,.section-card,.content-card,
  .enterprise-panel,.enterprise-card,.hero,.kpi,.kpi-card,.stat-card,
  .workspace-kpis article,.role-module-card,.modal,.modal-content,.drawer,.sheet,
  .popover,.dropdown-menu,.menu-panel,.mobile-card,.enterprise-check,
  .enterprise-actions,.theme-preview,.notice,.callout,.summary-card,.detail-card,
  .filter-card,.form-card,.table-card,.chart-card,.dashboard-card,.patient-card,
  .booking-card,.op-public-card,.public-card,.pay-card,.pro-card,.pro-hero,
  .pro-requirement,.pro-details,.pro-empty,.pro-callout,.pro-table-wrap
){
  background:#FFFDFC!important;
  color:#2F261E!important;
  border-color:#E0D2C7!important;
  box-shadow:var(--balt-shadow-sm)!important;
}
html:not([data-theme="dark"]) :where([class$="-card"],[class*="-card "],[class$="__card"],[class*="__card "]){
  border-color:#E0D2C7!important;
}
html:not([data-theme="dark"]) :where(.hero,.enterprise-hero,.role-workspace-hero,.pro-hero){
  background:linear-gradient(135deg,#FFFDFC 0%,#F8ECE8 100%)!important;
  border-color:#E0D2C7!important;
}
html:not([data-theme="dark"]) :where(.card:hover,.tile:hover,.role-module-card:hover,.dashboard-card:hover){
  border-color:#CDB6A7!important;
}

/* ---------- Typography: never white/yellow on a light canvas ---------- */
html:not([data-theme="dark"]) body :where(h1,h2,h3,h4,h5,h6,legend,summary,.title,.page-title,.section-title,.card-title,.panel-title,.hero-title,.heading,.headline,.modal-title,.drawer-title,.pro-phase-title){
  color:#211A15!important;
  text-shadow:none!important;
}
html:not([data-theme="dark"]) body :where(p,li,dt,dd,label,caption,figcaption,.body-copy,.description,.copy,.text){
  color:#4E423B!important;
  text-shadow:none!important;
}
html:not([data-theme="dark"]) body :where(small,.muted,.help,.hint,.subtitle,.subtle,.meta,.eyebrow,.supporting-text,.secondary-text){
  color:#6E6058!important;
  text-shadow:none!important;
}
html:not([data-theme="dark"]) body :where(strong,b){color:#2F261E}
html:not([data-theme="dark"]) body a:not(.btn):not(.button):not(.badge):not(.pill):not(.chip):not(.tag){
  color:#8C4E45;
}
html:not([data-theme="dark"]) body a:not(.btn):not(.button):hover{color:#6F3A33}
html:not([data-theme="dark"]) hr{border-color:#E0D2C7!important}

/* Common legacy light/gold text colours overridden only in the light theme. */
html:not([data-theme="dark"]) .main :where(
  [style*="color:#fff" i],[style*="color: #fff" i],[style*="color:white" i],[style*="color: white" i],
  [style*="color:#ffffff" i],[style*="color: #ffffff" i],
  [style*="color:#eef5ff" i],[style*="color: #eef5ff" i],
  [style*="color:#d7b56d" i],[style*="color: #d7b56d" i],
  [style*="color:#e5c986" i],[style*="color: #e5c986" i],
  [style*="color:#f4ca73" i],[style*="color: #f4ca73" i]
){
  color:#2F261E!important;
  text-shadow:none!important;
}
html:not([data-theme="dark"]) .main :where(.gold-text,.text-gold,.text-light,.text-white,.white-text,.light-text){
  color:#6E4D2C!important;
  text-shadow:none!important;
}

/* ---------- Forms ---------- */
html:not([data-theme="dark"]) :where(input,select,textarea,.input,.select,.textarea,[contenteditable="true"]){
  background:#FFFDFC!important;
  color:#2F261E!important;
  border:1px solid #CDB6A7!important;
  caret-color:#2F261E!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.8)!important;
}
html:not([data-theme="dark"]) :where(input,select,textarea,[contenteditable="true"]):hover{
  border-color:#B99486!important;
}
html:not([data-theme="dark"]) :where(input,select,textarea,[contenteditable="true"]):focus{
  border-color:#9D6258!important;
  outline:3px solid rgba(157,98,88,.16)!important;
  outline-offset:1px!important;
  box-shadow:none!important;
}
html:not([data-theme="dark"]) :where(input,textarea)::placeholder{color:#83756D!important;opacity:1}
html:not([data-theme="dark"]) :where(option,optgroup){background:#FFFDFC!important;color:#2F261E!important}
html:not([data-theme="dark"]) :where(input,select,textarea):disabled{
  background:#F2EAE5!important;
  color:#796B63!important;
  border-color:#E0D2C7!important;
}
html:not([data-theme="dark"]) fieldset{
  border-color:#E0D2C7!important;
  background:rgba(255,253,252,.45)!important;
}
html:not([data-theme="dark"]) label{color:#4E423B!important}

/* ---------- Buttons ---------- */
html:not([data-theme="dark"]) :where(.btn,.button,button,input[type="submit"],input[type="button"]){
  border:1px solid #CDB6A7!important;
  background:#FFFDFC!important;
  color:#2F261E!important;
  box-shadow:0 2px 8px rgba(82,55,44,.055)!important;
}
html:not([data-theme="dark"]) :where(.btn,.button,button,input[type="submit"],input[type="button"]):hover{
  background:#F8ECE8!important;
  border-color:#B99486!important;
  color:#2F261E!important;
}
html:not([data-theme="dark"]) :where(.btn.primary,.button.primary,button.primary,.btn.gold,.button.gold,button.gold,.booking-btn.gold,.cta-primary){
  background:#9D6258!important;
  color:#FFF!important;
  border-color:#9D6258!important;
}
html:not([data-theme="dark"]) :where(.btn.primary,.button.primary,button.primary,.btn.gold,.button.gold,button.gold,.booking-btn.gold,.cta-primary):hover{
  background:#875149!important;
  color:#FFF!important;
  border-color:#875149!important;
}
html:not([data-theme="dark"]) :where(.btn.secondary,.button.secondary){
  background:#F8ECE8!important;
  color:#7D463F!important;
  border-color:#D9BFB5!important;
}
html:not([data-theme="dark"]) :where(.btn.danger,.button.danger,button.danger){background:#FCEDEF!important;color:#8C3040!important;border-color:#E8BFC5!important}
html:not([data-theme="dark"]) :where(.btn.success,.button.success,button.success){background:#EDF6F0!important;color:#315D3E!important;border-color:#BFD9C8!important}

/* ---------- Tables ---------- */
html:not([data-theme="dark"]) :where(table,.table,.data-table,.pro-table){
  background:#FFFDFC!important;
  color:#2F261E!important;
  border-color:#E0D2C7!important;
}
html:not([data-theme="dark"]) :where(thead,th,.table th,.data-table th,.pro-table th){
  background:#F2EAE5!important;
  color:#2F261E!important;
  border-color:#DCCABE!important;
}
html:not([data-theme="dark"]) :where(tbody,tr,td,.table td,.data-table td,.pro-table td){
  color:#3F342E!important;
  border-color:#E8DDD5!important;
}
html:not([data-theme="dark"]) tbody tr:nth-child(even){background:#FCF8F5!important}
html:not([data-theme="dark"]) tbody tr:hover{background:#F8ECE8!important}

/* ---------- Badges / semantic messages ---------- */
html:not([data-theme="dark"]) :where(.badge,.pill,.chip,.tag,.status-badge,.pro-badge){
  background:#F2EAE5!important;
  color:#51443D!important;
  border-color:#DCCABE!important;
}
html:not([data-theme="dark"]) :where(.success,.ok,.pass,.badge.success,.badge.green,.pro-badge-pass,.pro-decision-go){
  background:#EDF6F0!important;color:#315D3E!important;border-color:#BFD9C8!important;
}
html:not([data-theme="dark"]) :where(.warning,.warn,.badge.warning,.badge.yellow,.pro-badge-warning,.pro-decision-hold){
  background:#FFF5E3!important;color:#7B511A!important;border-color:#E7D1A7!important;
}
html:not([data-theme="dark"]) :where(.danger,.error,.fail,.badge.danger,.badge.red,.pro-badge-fail,.pro-decision-nogo){
  background:#FCEDEF!important;color:#8C3040!important;border-color:#E8BFC5!important;
}
html:not([data-theme="dark"]) :where(.info,.badge.info){background:#F1F3F6!important;color:#4E5967!important;border-color:#D3D8DF!important}
html:not([data-theme="dark"]) :where(.flash,.alert,.notice,.message,.toast){
  background:#FFFDFC!important;
  color:#3F342E!important;
  border-color:#E0D2C7!important;
}
html:not([data-theme="dark"]) :where(.flash.success,.alert-success,.notice.success){background:#EDF6F0!important;color:#315D3E!important;border-color:#BFD9C8!important}
html:not([data-theme="dark"]) :where(.flash.warning,.alert-warning,.notice.warning){background:#FFF5E3!important;color:#7B511A!important;border-color:#E7D1A7!important}
html:not([data-theme="dark"]) :where(.flash.danger,.alert-danger,.notice.danger,.error-box){background:#FCEDEF!important;color:#8C3040!important;border-color:#E8BFC5!important}

/* ---------- Professional Clinical Operations ---------- */
html:not([data-theme="dark"]) :where(.pro-hero,.pro-card,.pro-table-wrap,.pro-requirement,.pro-details,.pro-empty,.pro-subnav a,.pro-filter a,.pro-callout){
  background:#FFFDFC!important;
  color:#2F261E!important;
  border-color:#E0D2C7!important;
  box-shadow:var(--balt-shadow-sm)!important;
}
html:not([data-theme="dark"]) .pro-hero{background:linear-gradient(135deg,#FFFDFC,#F8ECE8)!important}
html:not([data-theme="dark"]) .pro-hero-mark{background:#F0DDD7!important;border-color:#C99D90!important;color:#7D463F!important}
html:not([data-theme="dark"]) .pro-subnav a:hover,
html:not([data-theme="dark"]) .pro-subnav a.active,
html:not([data-theme="dark"]) .pro-filter a.active{
  background:#F0DDD7!important;
  color:#6F3A33!important;
  border-color:#C99D90!important;
}
html:not([data-theme="dark"]) .pro-progress{background:#E9DDD4!important}
html:not([data-theme="dark"]) .pro-progress>span{background:#9D6258!important}
html:not([data-theme="dark"]) .pro-callout{background:#F8ECE8!important}
html:not([data-theme="dark"]) .pro-callout.warning{background:#FFF5E3!important}
html:not([data-theme="dark"]) .pro-callout.danger{background:#FCEDEF!important}
html:not([data-theme="dark"]) .pro-callout.success{background:#EDF6F0!important}

/* ---------- Location / language / theme switches ---------- */
html:not([data-theme="dark"]) .site-context-switch select{
  background:#FFFDFC!important;
  color:#2F261E!important;
  border-color:#CDB6A7!important;
}
html:not([data-theme="dark"]) .site-context-switch label>span{color:#6E6058!important}
html:not([data-theme="dark"]) .balt-theme-switch{
  background:#FAF5F1!important;
  border-color:#DCCABE!important;
}
html:not([data-theme="dark"]) .balt-theme-switch button{
  background:transparent!important;
  color:#6E6058!important;
  border:0!important;
  box-shadow:none!important;
}
html:not([data-theme="dark"]) .balt-theme-switch button.active{
  background:#9D6258!important;
  color:#FFF!important;
}
.balt-locale-switch{
  display:grid!important;
  grid-template-columns:42px 42px!important;
  width:88px!important;
  min-width:88px!important;
  max-width:88px!important;
  flex:0 0 88px!important;
  gap:4px!important;
  overflow:visible!important;
  position:relative!important;
  z-index:12!important;
}
.balt-locale-switch a{
  display:grid!important;
  place-items:center!important;
  width:42px!important;
  min-width:42px!important;
  max-width:42px!important;
  height:36px!important;
  padding:0!important;
  box-sizing:border-box!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  border:1px solid transparent;
  border-radius:9px;
}
html:not([data-theme="dark"]) .balt-locale-switch a{color:#6E6058!important}
html:not([data-theme="dark"]) .balt-locale-switch a.active{
  background:#F0DDD7!important;
  border-color:#D9BFB5!important;
  color:#6F3A33!important;
}

/* ---------- Public patient-facing pages ---------- */
html:not([data-theme="dark"]) :where(.op-public-shell,.public-shell,.consent-public,.booking-shell,.intake-shell,.pretriage-shell,.photo-shell,.guide-error){
  background:#F4EEE9!important;
  color:#2F261E!important;
}
html:not([data-theme="dark"]) :where(.booking-hero,.op-public-hero,.public-hero){
  background:linear-gradient(135deg,#FFFDFC,#F8ECE8)!important;
  color:#2F261E!important;
  border-color:#E0D2C7!important;
}
html:not([data-theme="dark"]) :where(.booking-card,.op-public-card,.public-card,.pay-card){
  background:#FFFDFC!important;
  color:#2F261E!important;
  border-color:#E0D2C7!important;
}

/* ---------- Automatic accessibility classes from JS ---------- */
html:not([data-theme="dark"]) .balt-auto-contrast-dark{color:#2F261E!important;text-shadow:none!important}
html:not([data-theme="dark"]) .balt-auto-contrast-muted{color:#6E6058!important;text-shadow:none!important}
html:not([data-theme="dark"]) .balt-auto-visible-border{
  border-color:#CDB6A7!important;
  box-shadow:0 0 0 1px rgba(205,182,167,.22)!important;
}
html:not([data-theme="dark"]) .balt-auto-surface{
  background:#FFFDFC!important;
  color:#2F261E!important;
  border-color:#E0D2C7!important;
}

/* ---------- Reduced motion, focus and mobile ---------- */
html:not([data-theme="dark"]) :focus-visible{
  outline:3px solid rgba(157,98,88,.36)!important;
  outline-offset:2px!important;
}
*{scrollbar-color:#CDB6A7 #F4EEE9}
@media(max-width:1100px){
  .topbar{grid-template-columns:minmax(180px,280px) minmax(220px,1fr) auto!important}
}
@media(max-width:900px){
  .topbar{grid-template-columns:1fr!important}
  .topbar .userbox{width:100%;justify-content:flex-start!important;flex-wrap:wrap!important}
  .balt-locale-switch{margin-left:0!important}
  html:not([data-theme="dark"]) .shell{background:#F4EEE9!important}
}
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}
@media print{
  html,body{background:#FFF!important;color:#000!important;color-scheme:light}
  .card,.panel,.enterprise-panel,.hero,table,th,td{background:#FFF!important;color:#000!important;border-color:#999!important;box-shadow:none!important}
}

/* Appearance centre. */
.balt-palette-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:14px}
.balt-palette-swatch{display:grid;grid-template-columns:48px minmax(0,1fr);grid-template-rows:auto auto;column-gap:12px;align-items:center;padding:12px;border:1px solid var(--balt-border,#E0D2C7);border-radius:14px;background:var(--balt-panel-2,#FAF5F1)}
.balt-palette-swatch>span{grid-row:1/3;width:48px;height:48px;border-radius:12px;border:1px solid rgba(47,38,30,.12);box-shadow:inset 0 0 0 1px rgba(255,255,255,.55)}
.balt-palette-swatch strong{font-size:13px;text-transform:capitalize;color:var(--balt-text-strong,#211A15)}
.balt-palette-swatch small{color:var(--balt-muted,#6E6058)}

/* ========================================================================== 
   AUTHORITATIVE LIGHT CASCADE
   High-specificity rules intentionally override historical dark-only !important
   declarations from app.css, enterprise_bundle_210.css and module-local styles.
   ========================================================================== */
html:not([data-theme="dark"]) body.balt-visual-system-2402{
  background:#F4EEE9!important;
  color:#2F261E!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(.main,.content,.content-area,.page,.page-wrap,.workspace,.workspace-main){
  background-color:#F4EEE9!important;
  color:#2F261E!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(.sidebar,.side-nav,.app-sidebar,.main-sidebar,.navigation-panel){
  background:linear-gradient(180deg,#FBF5F1 0%,#F7EEE8 100%)!important;
  color:#2F261E!important;
  border-color:#E0D2C7!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(.topbar,.app-topbar,.header-bar,.main-header){
  background:#FFFDFC!important;
  color:#2F261E!important;
  border-color:#E0D2C7!important;
}

/* The topbar patient search has a complete frame and a visible input/button seam. */
html:not([data-theme="dark"]) body.balt-visual-system-2402 .topbar form.search,
html:not([data-theme="dark"]) body.balt-visual-system-2402 .topbar .search,
html:not([data-theme="dark"]) body.balt-visual-system-2402 form.patient-search,
html:not([data-theme="dark"]) body.balt-visual-system-2402 form.global-search,
html:not([data-theme="dark"]) body.balt-visual-system-2402 form.search-form{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  gap:0!important;
  padding:0!important;
  min-height:42px!important;
  border:1px solid #BFA398!important;
  border-radius:12px!important;
  background:#FFFDFC!important;
  overflow:hidden!important;
  box-shadow:0 1px 0 rgba(255,255,255,.95),0 6px 18px rgba(82,55,44,.07)!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 .topbar form.search input,
html:not([data-theme="dark"]) body.balt-visual-system-2402 .topbar .search input,
html:not([data-theme="dark"]) body.balt-visual-system-2402 form.patient-search input,
html:not([data-theme="dark"]) body.balt-visual-system-2402 form.global-search input,
html:not([data-theme="dark"]) body.balt-visual-system-2402 form.search-form input{
  width:100%!important;
  min-width:0!important;
  height:100%!important;
  margin:0!important;
  padding:10px 14px!important;
  border:0!important;
  border-radius:0!important;
  background:#FFFDFC!important;
  color:#2F261E!important;
  outline:0!important;
  box-shadow:none!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 .topbar form.search button,
html:not([data-theme="dark"]) body.balt-visual-system-2402 .topbar .search button,
html:not([data-theme="dark"]) body.balt-visual-system-2402 form.patient-search button,
html:not([data-theme="dark"]) body.balt-visual-system-2402 form.global-search button,
html:not([data-theme="dark"]) body.balt-visual-system-2402 form.search-form button{
  align-self:stretch!important;
  min-width:88px!important;
  margin:0!important;
  padding:9px 16px!important;
  border:0!important;
  border-left:1px solid #7D463F!important;
  border-radius:0!important;
  background:#9D6258!important;
  color:#FFF!important;
  box-shadow:none!important;
  font-weight:750!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 .topbar form.search:focus-within,
html:not([data-theme="dark"]) body.balt-visual-system-2402 .topbar .search:focus-within,
html:not([data-theme="dark"]) body.balt-visual-system-2402 form.patient-search:focus-within,
html:not([data-theme="dark"]) body.balt-visual-system-2402 form.global-search:focus-within,
html:not([data-theme="dark"]) body.balt-visual-system-2402 form.search-form:focus-within{
  border-color:#9D6258!important;
  box-shadow:0 0 0 3px rgba(157,98,88,.18),0 8px 22px rgba(82,55,44,.08)!important;
}

/* Legacy title and copy colours. */
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(
  h1,h2,h3,h4,h5,h6,.page-title h1,.page-title h2,.panel h2,.panel h3,
  .patient-hero h1,.login-card h1,.install-panel h1,.kpi strong,
  .pro-hero h1,.pro-card h2,.pro-card h3,.uni-card h2,.uni-card h3,
  .enterprise-hero h1,.workspace-hero h1,.card-title,.panel-title,.section-title
){
  color:#211A15!important;
  text-shadow:none!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(
  p,li,dt,dd,label,legend,summary,caption,figcaption,.page-title p,.panel p,
  .message-list strong,.message-list p,.uni-list strong,.uni-search-result strong
){
  color:#4E423B!important;
  text-shadow:none!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(
  small,.muted,.help,.hint,.meta,.subtle,.subtitle,.eyebrow,.supporting-text,
  .page-title small,.panel small,.kpi small,.kpi em,.message-list small,
  .uni-list small,.uni-search-result small
){
  color:#6E6058!important;
  text-shadow:none!important;
}

/* Inline legacy white/gold copy on light surfaces, excluding semantic controls. */
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(
  [style*="color:#fff" i],[style*="color: #fff" i],[style*="color:white" i],[style*="color: white" i],
  [style*="color:#ffffff" i],[style*="color: #ffffff" i],
  [style*="color:#eef5ff" i],[style*="color: #eef5ff" i],
  [style*="color:#d7b56d" i],[style*="color: #d7b56d" i],
  [style*="color:#e5c986" i],[style*="color: #e5c986" i],
  [style*="color:#f4ca73" i],[style*="color: #f4ca73" i]
):not(button):not(.btn):not(.button):not(.badge):not(.pill):not(.chip):not(.tag){
  color:#2F261E!important;
  text-shadow:none!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(.gold-text,.text-gold,.text-light,.text-white,.white-text,.light-text):not(.btn):not(.button):not(.badge){
  color:#6E4D2C!important;
  text-shadow:none!important;
}

/* Historical dark-only surfaces. */
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(
  .page-title,.panel,.kpi,.login-card,.install-panel,.patient-hero,
  .uni-card,.uni-list article,.uni-search-result,.uni-table,.uni-pre,
  .pro-hero,.pro-card,.pro-table-wrap,.pro-requirement,.pro-details,.pro-empty,.pro-callout,
  .card,.box,.tile,.widget,.modal,.modal-content,.drawer,.sheet,.popover,.dropdown-menu,
  .booking-card,.op-public-card,.public-card,.pay-card,.notice,.callout
){
  background:#FFFDFC!important;
  color:#2F261E!important;
  border-color:#E0D2C7!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(.uni-table thead th,.pro-table thead th,table thead th){
  background:#F2EAE5!important;
  color:#2F261E!important;
  border-color:#DCCABE!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(.uni-table td,.uni-table th,.pro-table td,.pro-table th,table td,table th){
  color:#3F342E!important;
  border-color:#E8DDD5!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(.notice,.form-grid .notice,.uni-callout){
  background:#F8ECE8!important;
  color:#6E4D2C!important;
  border-color:#D9BFB5!important;
}

/* Inputs and controls need a visible perimeter even under old border:0!important rules. */
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(input,select,textarea,[contenteditable="true"]):not([type="hidden"]){
  background:#FFFDFC!important;
  color:#2F261E!important;
  border:1px solid #CDB6A7!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.85)!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(.btn,.button,button,input[type="submit"],input[type="button"]){
  border:1px solid #CDB6A7!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(
  .btn.primary,.button.primary,button.primary,.btn.gold,.button.gold,button.gold,
  .booking-btn.gold,.cta-primary,.balt-theme-switch button.active
){
  background:#9D6258!important;
  border-color:#9D6258!important;
  color:#FFF!important;
}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(
  .btn.primary,.button.primary,button.primary,.btn.gold,.button.gold,button.gold,
  .booking-btn.gold,.cta-primary,.balt-theme-switch button.active
) :where(span,strong,b,small,svg){
  color:inherit!important;
}

/* Semantic badges keep readable colours instead of being darkened by title guards. */
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(.badge.green,.badge.paid,.badge.confirmed,.badge.done,.badge.ok,.success){color:#315D3E!important}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(.badge.yellow,.badge.payment_pending,.badge.reserved,.badge.open,.badge.warn,.warning){color:#7B511A!important}
html:not([data-theme="dark"]) body.balt-visual-system-2402 :where(.badge.red,.badge.cancelled,.badge.failed,.badge.fail,.badge.danger,.danger){color:#8C3040!important}

/* Fixed geometry of language/theme controls in both languages. */
html body .topbar .userbox .balt-locale-switch{
  display:grid!important;
  grid-template-columns:42px 42px!important;
  width:88px!important;
  min-width:88px!important;
  max-width:88px!important;
  flex:0 0 88px!important;
  gap:4px!important;
  overflow:visible!important;
}
html body .topbar .userbox .balt-locale-switch a{
  width:42px!important;
  min-width:42px!important;
  max-width:42px!important;
  padding:0!important;
}
