/* Final semantic layer. Explicit app selection outranks legacy palettes AND OS dark mode.
   Always change background + foreground together. Decorative hero is a separate dark surface. */
@media screen {
:root[data-cv-theme] body{--ink:var(--cv-ink);--muted:var(--cv-muted);--teal:var(--cv-accent);--line:var(--cv-line);color:var(--cv-ink);background-color:var(--cv-bg)}
:root[data-cv-theme] #main-content{color:var(--cv-ink)}
:root[data-cv-theme] #main-content :is(.card,.product-widget,.dashboard-panel,.dashboard-tools,.company-panel,.list-scroll,.quick-panel,.metric,.cv-card,.verified-device-gallery,form){background:var(--cv-surface);color:var(--cv-ink);border-color:var(--cv-line)}
:root[data-cv-theme] #main-content :is(.product-widget h2,.dashboard-panel h2,.radiology-patient-context,.radiology-ribbon,.radiology-layout,.radiology-actions,.product-ribbon,.dental-patient-strip,.dental-flow span,.company-desk-filter,.company-state-tabs a,.company-kpis>div,.company-followup-links a,.product-shortcuts,.cv-page){background:var(--cv-soft);color:var(--cv-ink);border-color:var(--cv-line)}
:root[data-cv-theme] #main-content :is(.product-action,.product-link-list a,.company-entry-links a,.company-help a,.profile-chip,.list-pager a,.data-list summary){color:var(--cv-ink)}
:root[data-cv-theme] #main-content :is(.product-action span,.product-help,.muted,.dashboard-kicker,.dashboard-note p,.dashboard-limits,.radiology-patient-context p,.radiology-ribbon>span,.radiology-actions>span,.radiology-empty,.dental-patient-strip p,.company-help){color:var(--cv-muted)}
:root[data-cv-theme] #main-content nav a,:root[data-cv-theme] #main-content .radiology-actions .product-action,:root[data-cv-theme] .list-pager a{background:var(--cv-soft);color:var(--cv-ink);border-color:var(--cv-line)}
:root[data-cv-theme] #main-content nav a[aria-current=page]{background:var(--cv-accent);color:var(--cv-on-accent)}
:root[data-cv-theme] #main-content :is(th,caption){background:var(--cv-soft);color:var(--cv-ink);border-color:var(--cv-line)}
:root[data-cv-theme] #main-content tbody tr{background:var(--cv-surface);color:var(--cv-ink)}
:root[data-cv-theme] #main-content tbody tr:nth-child(even),:root[data-cv-theme] #main-content tbody tr:hover{background:var(--cv-soft);color:var(--cv-ink)}
:root[data-cv-theme] #main-content td{border-color:var(--cv-line)}
:root[data-cv-theme] #main-content td a{color:var(--cv-ink);text-decoration:underline}
:root[data-cv-theme] #workspace-nav{background:var(--cv-surface);color:var(--cv-ink);border-color:var(--cv-line)}
:root[data-cv-theme] #workspace-nav :is(a,summary,.muted){color:var(--cv-ink)}
:root[data-cv-theme] #workspace-nav a:hover{background:var(--cv-soft);color:var(--cv-ink)}
:root[data-cv-theme] #main-content :is(input,select,textarea){color:var(--cv-ink);background:var(--cv-surface);border-color:var(--cv-line)}
:root[data-cv-theme] #main-content input::placeholder,:root[data-cv-theme] #main-content textarea::placeholder{color:var(--cv-muted);opacity:1}
:root[data-cv-theme] #main-content :is(button,.button){color:var(--cv-on-accent);background:var(--cv-accent)}
:root[data-cv-theme] #main-content .cv-page{border-top-color:var(--cv-accent)}
:root[data-cv-theme] #main-content .cv-day{color:var(--cv-ink)}
:root[data-cv-theme] .cv-face{fill:var(--cv-soft);stroke:var(--cv-muted)}
:root[data-cv-theme] .cv-numeral{fill:var(--cv-ink)}
:root[data-cv-theme] .cv-hand{stroke:var(--cv-ink)}
:root[data-cv-theme] .cv-second{stroke:var(--cv-accent)}
/* Text on the illustration remains white intentionally, regardless of page theme. */
:root[data-cv-theme] #main-content .workspace-visual-copy h2{color:#fff}
:root[data-cv-theme] #main-content .workspace-visual-copy :is(p,.workspace-visual-eyebrow){color:#e2eaf6}
}
@media screen{
 :root[data-cv-theme] #workspace-nav nav a[aria-current=page]{background:var(--cv-accent);color:var(--cv-on-accent)}
 :root[data-cv-theme] #workspace-nav .nav-search-label,:root[data-cv-theme] #workspace-nav #nav-no-results{color:var(--cv-muted)}
}
/* Mobile shell repair. Works without JS/data-cv-theme; never hides navigation links. */
@media screen{
html body #workspace-nav{background:var(--cv-surface,#ffffff);color:var(--cv-ink,#162b3d);border-color:var(--cv-line,#74879a)}
html body #workspace-nav :is(nav,.nav-group,.nav-group[open],summary,a,.muted,.nav-search-label),
html body #workspace-nav #nav-no-results{color:var(--cv-ink,#162b3d)}
html body #workspace-nav :is(.nav-group,summary){background:var(--cv-surface,#ffffff)}
html body #workspace-nav :is(a:hover,summary:hover){background:var(--cv-soft,#eaf0f5);color:var(--cv-ink,#162b3d)}
html body #workspace-nav a[aria-current=page]{background:var(--cv-accent,#175aab);color:var(--cv-on-accent,#ffffff)}
html body #workspace-nav :is(input,select){background:var(--cv-surface,#ffffff);color:var(--cv-ink,#162b3d);border:1px solid var(--cv-line,#74879a)}
html body #workspace-nav :is(a,summary,input):focus-visible{outline:3px solid var(--cv-accent,#175aab);outline-offset:2px}
}
@media screen and (max-width:900px){
html body aside#workspace-nav{position:relative;width:auto;max-height:180px;overflow:auto;margin:6px 12px;padding:12px;border:1px solid var(--cv-line,#74879a);border-radius:10px}
html body #main-content>header{margin-bottom:10px;gap:8px;flex-wrap:wrap}
html body #main-content>.notice{padding:8px 10px;margin-block:8px;font-size:12px;line-height:1.65}
html body #main-content .workspace-visual-shell{margin-block:8px}
html body #main-content .clinic-interior>nav{display:flex;flex-flow:row nowrap;overflow-x:auto;max-width:100%;gap:6px;padding-bottom:8px;overscroll-behavior-inline:contain}
html body #main-content .clinic-interior>nav a{flex:0 0 auto;white-space:nowrap;min-height:44px;font-size:12px}
}

@media screen {
 /* The nested navigation rules have to preserve the accent pair in both themes. */
 html[data-cv-theme] body #workspace-nav nav a[aria-current="page"][href],
 html[data-cv-theme] body .company-topnav nav a[aria-current="page"][href] {
   background: var(--cv-accent);
   color: var(--cv-on-accent);
 }
 html[data-cv-theme] body #main-content .dental-patient-strip .product-action {
   background: var(--cv-surface);
   color: var(--cv-ink);
   border: 1px solid var(--cv-line);
 }
 html[data-cv-theme] body #main-content .workspace-design-icon {
   background: var(--cv-soft);
   color: var(--cv-ink);
 }
}
