/* This file owns every primary-header dimension, on every page. */
.topbar.app-header { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; width: 100%; height: 56px; min-height: 56px; padding: 0 20px; gap: 16px; box-sizing: border-box; background: var(--surface, #fff); border: 0; border-bottom: 1px solid var(--line, #dfe4eb); box-shadow: none; color: var(--ink, #293340); font: 500 13px/1.3 "Source Sans Pro", -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
.topbar.app-header .topbar-start { display: flex; flex: 1; flex-wrap: nowrap; align-items: center; gap: 24px; min-width: 0; height: 100%; min-height: 0; padding: 0; }
.topbar.app-header .brand { display: inline-flex; flex: none; align-items: center; gap: 5px; min-width: 0; min-height: 0; margin: 0; color: var(--ink, #293340); font: 400 18px/1.2 ui-rounded, 'SF Pro Rounded', system-ui, sans-serif; letter-spacing: -.35px; text-decoration: none; }
.topbar.app-header .brand img { display: block; width: 49px; height: 30px; object-fit: contain; border: 0; border-radius: 0; background: transparent; }
.topbar.app-header .brand .brand-text { display: block; margin: 0; font: inherit; color: inherit; background: none; opacity: 1; }
.topbar.app-header .main-menu { display: flex; flex: 1; align-items: center; gap: 4px; height: 100%; min-width: 0; margin: 0; overflow-x: auto; scrollbar-width: none; }
.topbar.app-header .main-menu::-webkit-scrollbar { display: none; }
.topbar.app-header .menu-item { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 7px; height: 36px; min-height: 36px; margin: 0; padding: 0 11px; border: 1px solid transparent; border-radius: 7px; background: transparent; box-shadow: none; color: var(--muted, #687585); text-decoration: none; white-space: nowrap; cursor: pointer; font: 500 13px/1 "Source Sans Pro", -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; letter-spacing: 0; }
.topbar.app-header .menu-item.active, .topbar.app-header .menu-item:hover { background: var(--accent-soft, #edf3fb); color: var(--accent, #3972bd); }
.topbar.app-header .menu-icon, .topbar.app-header .topbar-control-icon { display: block; flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.topbar.app-header .topbar-end { display: flex; flex: none; align-items: center; gap: 12px; height: 100%; margin: 0; padding: 0; }
.topbar.app-header .header-context-tools, .topbar.app-header .viewer-actions { display: flex; flex: none; align-items: center; gap: 4px; margin: 0; padding: 0; }
.topbar.app-header .header-context-tools { padding-right: 12px; border-right: 1px solid var(--line, #dfe4eb); }
.topbar.app-header .header-icon, .topbar.app-header .settings, .topbar.app-header .tool.icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; min-height: 32px; margin: 0; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; box-shadow: none; color: var(--muted, #687585); text-decoration: none; cursor: pointer; }
.topbar.app-header .header-icon:hover, .topbar.app-header .settings:hover, .topbar.app-header .tool.icon:hover { background: var(--accent-soft, #edf3fb); color: var(--accent, #3972bd); }
.topbar.app-header .header-account-controls { display: flex; align-items: center; flex: none; margin: 0; padding: 0; }
.topbar.app-header .header-user-menu { position: relative; margin: 0; }
.topbar.app-header .header-profile { display: flex; align-items: center; gap: 7px; min-height: 36px; margin: 0; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: var(--muted, #687585); text-decoration: none; white-space: nowrap; cursor: pointer; list-style: none; font: inherit; }
.topbar.app-header .header-profile::-webkit-details-marker { display: none; }
.topbar.app-header .header-profile.active, .topbar.app-header .header-profile:hover, .topbar.app-header .header-user-menu[open] .header-profile { background: var(--accent-soft, #edf3fb); color: var(--accent, #3972bd); }
.topbar.app-header .header-profile > svg:last-child { width: 12px; height: 12px; }
.topbar.app-header .header-user-dropdown { position: absolute; right: 0; top: calc(100% + 10px); width: 235px; margin: 0; padding: 6px; border: 1px solid var(--line, #dfe4eb); border-radius: 9px; box-shadow: 0 10px 35px #152c4820; background: var(--surface, #fff); color: var(--ink, #293340); }
.topbar.app-header .header-user-identity { display: flex; flex-direction: column; gap: 5px; padding: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line, #dfe4eb); }
.topbar.app-header .header-user-identity strong { overflow: hidden; text-overflow: ellipsis; font-size: 13px; font-weight: 600; }
.topbar.app-header .header-user-identity small { color: var(--muted, #687585); font-size: 11px; }
.topbar.app-header .header-user-dropdown > a, .topbar.app-header .header-user-dropdown > button { display: flex; align-items: center; gap: 9px; width: 100%; height: 36px; min-height: 36px; margin: 0; padding: 0 10px; border: 0; border-radius: 5px; color: var(--ink, #293340); background: transparent; text-decoration: none; white-space: nowrap; font: inherit; cursor: pointer; }
.topbar.app-header .header-user-dropdown > a:hover, .topbar.app-header .header-user-dropdown > button:hover { background: var(--accent-soft, #edf3fb); color: var(--accent, #3972bd); }
.topbar.app-header .header-account-error { margin: 8px; font-size: 12px; line-height: 1.5; color: #b34048; }
.topbar.app-header .header-local { font-size: 12px; color: var(--muted, #687585); white-space: nowrap; }
.topbar.app-header [hidden] { display: none !important; }
.topbar.app-header :is(a, button, summary):focus-visible { outline: 2px solid var(--accent, #3972bd); outline-offset: 2px; }
body[data-page="workspace"]:not(:has(.desktop-shell.has-recording)) .header-tool-menu,
.topbar.app-header .menu-short-label, .topbar.app-header .header-tool-menu > summary { display: none; }
@media (min-width: 761px) and (max-width: 1000px) {
  .topbar.app-header .header-context-tools { gap: 1px; padding-right: 5px; }
  .topbar.app-header .menu-item[data-header-item="accounts"] > span:first-of-type { display: none; }
  .topbar.app-header .menu-item[data-header-item="accounts"] > .menu-short-label { display: block; }
}
@media (max-width: 1050px) {
  .topbar.app-header { gap: 8px; padding: 0 12px; }
  .topbar.app-header .topbar-start { gap: 12px; }
  .topbar.app-header .menu-item { gap: 6px; padding: 0 8px; font-size: 12px; }
  .topbar.app-header .brand .brand-text { display: none; }
}
@media (max-width: 760px) {
  .topbar.app-header { gap: 5px; padding: 0 8px; }
  .topbar.app-header .topbar-start { gap: 5px; }
  .topbar.app-header .brand img { width: 36px; height: 26px; }
  .topbar.app-header .main-menu { gap: 2px; }
  .topbar.app-header .menu-item, .topbar.app-header .header-tool-menu > summary {
    display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px; min-height: 42px;
    padding: 0 5px; font: 500 10px/1 system-ui, sans-serif; color: var(--muted); cursor: pointer;
  }
  .topbar.app-header .menu-item.active { color: var(--accent); }
  .topbar.app-header .menu-item > span:not(.menu-short-label) { display: none; }
  .topbar.app-header .menu-item > .menu-short-label { display: block; }
  .topbar.app-header .header-tool-menu > summary::-webkit-details-marker { display: none; }
  .topbar.app-header .header-tool-menu[open] > summary { color: var(--accent); }
  .topbar.app-header .header-tool-menu { position: relative; }
  .topbar.app-header .header-tool-menu .header-context-tools {
    position: absolute; flex-wrap: wrap; top: calc(100% + 9px); right: 0; width: max-content; max-width: 250px;
    padding: 5px; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 8px;
    box-shadow: 0 8px 24px #152c4820;
  }
  .topbar.app-header .topbar-end { gap: 4px; }
  .topbar.app-header .header-profile { min-height: 42px; padding: 0 5px; }
  .topbar.app-header .header-profile > span { font-size: 11px; }
  .topbar.app-header summary.header-profile { flex-direction: column; justify-content: center; gap: 3px; }
  .topbar.app-header summary.header-profile > svg:last-child { display: none; }
  .topbar.app-header .header-icon, .topbar.app-header .settings, .topbar.app-header .tool.icon { width: 36px; min-height: 36px; }
}
@media (max-width: 700px) {
  body[data-page="workspace"]:has(.desktop-shell:not(.library-hidden)) .header-tool-menu { display: none; }
}
@media print { .topbar.app-header { display: none !important; } }

/* Clinical review controls require write access. */
body[data-review-readonly] :is(#pointClassifications, #confirmSuggestion, #undoReview, #addReviewSegment, #reviewActions, .episode-review-actions, .episode-bounds, #contextEditor, .clinical-settings, #dateButton, [data-timeline-mode="night"], [data-timeline-mode="sport"]) { display: none !important; }
body[data-patient] :is(#libraryPatientCard, #libraryPatientClear, .recording-library .patient-combobox, .recording-library .patients-trash-button, #libraryItems .library-record-actions) { display: none !important; }
body[data-review-readonly] .context-edge { pointer-events: none; }
body[data-review-readonly] .clinical-conclusion textarea { display: none; }
body[data-review-readonly] .clinical-conclusion .printed-conclusion { display: block; white-space: pre-wrap; }
#selfReviewNote { width: 100%; min-height: 8em; padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
