/* Shared visual branding. Workspace geometry and ECG rendering stay in their own styles. */
:root {
  --brand-nav-ink: #667284;
  --brand-nav-active: #3269b2;
  --brand-nav-soft: #edf3fb;
  --brand-wordmark: linear-gradient(#72767c, #30343b);
}
:root:not([data-theme="dark"]) body:has(.topbar) {
  --ink: #293340;
  --muted: #687585;
  --accent: #3972bd;
  --accent-soft: #edf3fb;
  --line: #dfe4eb;
  background: #f6f7fa;
}
body:has(.topbar), body:has(.topbar) :is(button, input, select, textarea) {
  font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root:not([data-theme="dark"]) .topbar {
  background: linear-gradient(110deg, #fff, #f8faff);
  border-bottom-color: #dce3ec;
  color: #354052;
  box-shadow: 0 2px 10px #20385405;
}
.topbar .brand, .report-brand {
  gap: 5px;
  font-family: ui-rounded, "SF Pro Rounded", "Arial Rounded MT", system-ui, sans-serif;
  font-weight: 400;
  letter-spacing: -.35px;
}
.topbar .brand { min-width: max-content; min-height: 33px; font-size: 18px; }
.topbar .brand img, .report-brand img {
  flex: none;
  width: 49px;
  height: 30px;
  object-fit: contain;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.topbar .brand .brand-text, .report-brand .brand-text {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.2;
  opacity: 1;
  background: var(--brand-wordmark);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}
/* Expanded panels do not imply a selected navigation destination. */
.main-menu .menu-item, .main-menu .record-menu > summary,
.main-menu .record-menu[open] > summary, .main-menu .menu-item[aria-expanded="true"] {
  height: 38px;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--brand-nav-ink);
  font: 500 14px/1 "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
.main-menu .menu-item:hover, .main-menu .record-menu > summary:hover,
.main-menu .menu-item.active, .main-menu .menu-item.active[aria-expanded="true"] {
  background: var(--brand-nav-soft);
  border-color: transparent;
  border-radius: 8px;
  color: var(--brand-nav-active);
}
.main-menu .menu-icon, .topbar .topbar-control-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.topbar .settings, .topbar .viewer-actions .tool.icon {
  border-color: transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--brand-nav-ink);
}
.topbar .settings:hover, .topbar .viewer-actions .tool.icon:hover {
  border-color: transparent;
  background: var(--brand-nav-soft);
  color: var(--brand-nav-active);
}
.topbar :is(.menu-item, .brand, .settings, .viewer-actions .tool.icon, summary):focus-visible {
  outline: 2px solid var(--brand-nav-active);
  outline-offset: 2px;
}
.library-import { background: #3972bd; border-color: #3972bd; font-weight: 500; }
.library-import:hover { background: #3269b2; border-color: #3269b2; }
body:has(.topbar) :is(.panel, .supplementary) { border-color: var(--line); border-radius: 6px; }
body:has(.topbar) :is(.record-context > strong, .side-head-row h2, .detail-title h2, .overview-head h3) { font-weight: 500; }
.library-record { border-radius: 5px; }
:root:not([data-theme="dark"]) .library-record.active:not(.patient-library-record) { background: #f0f4fb; box-shadow: inset 3px 0 #5a80ba; }
:root:not([data-theme="dark"]) .event-row.active { background: #edf3fb; box-shadow: inset 2px 0 #5a80ba; }
:root[data-theme="dark"] {
  --brand-nav-ink: #b8c5d4;
  --brand-nav-active: #a7cbfa;
  --brand-nav-soft: #263d56;
  --brand-wordmark: linear-gradient(#e0e4e9, #acb8c7);
}
/* theme.css groups these controls with #themeSelect; match that specificity. */
:root[data-theme="dark"] .topbar :is(#settings, #shortcutsButton, #fullscreen) {
  border-color: transparent;
  background: transparent;
  color: var(--brand-nav-ink);
}
:root[data-theme="dark"] .topbar :is(#settings, #shortcutsButton, #fullscreen):hover {
  background: var(--brand-nav-soft);
  color: var(--brand-nav-active);
}
@media (max-width: 700px) {
  .topbar .brand .brand-text { display: none; }
  .topbar .brand { gap: 0; }
  .main-menu .menu-item, .main-menu .record-menu > summary {
    height: 34px;
    padding: 0 10px;
    gap: 6px;
    font-size: 11px;
  }
}

/* Dark workspace gutters and collapse handles must use dark surfaces too. */
:root[data-theme="dark"] body:has(.topbar) { background: #101a2b; }
:root[data-theme="dark"] .panel-collapse-toggle {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--muted);
}
:root[data-theme="dark"] .panel-collapse-toggle:hover {
  background: var(--brand-nav-soft);
  border-color: var(--brand-nav-active);
  color: var(--brand-nav-active);
}
:root[data-theme="dark"] .review-counter {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--muted);
}
/* Document masthead shares the brand; clinical data and pagination keep their styles. */
.clinical-heading {
  min-height: 64px;
  border-bottom-color: #dfe4eb;
  color: #293340;
}
.clinical-heading .clinical-logo {
  width: 64px;
  height: 40px;
  border-radius: 0;
  background: transparent;
  object-fit: contain;
}
.clinical-brand-line {
  color: #687585;
  font: 600 10px/1.4 "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: .12em;
}
.clinical-heading h1 {
  font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 500;
  letter-spacing: -.025em;
}
.clinical-heading .report-document-mark { color: #3972bd; }
@media (max-width: 760px) {
  .clinical-heading .clinical-logo { width: 49px; height: 30px; }
}
@media print {
  .clinical-heading { min-height: 16mm; }
  .clinical-heading .clinical-logo { width: 16mm; height: 10mm; }
  .clinical-brand-line { font-size: 8pt; }
}
