@media screen {
  .apple-layout {
    --sidebar-width: 244px;
    padding-left: var(--sidebar-width);
    padding-top: 76px;
    min-height: 100vh;
  }
  .apple-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    z-index: 35;
    background: #eceff4;
    border-right: 1px solid #dce0e7;
    display: flex;
    flex-direction: column;
    padding: 22px 14px;
  }
  .apple-sidebar .brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 0 14px 30px;
  }
  .apple-sidebar .brand img {
    width: 132px;
    mix-blend-mode: multiply;
  }
  .apple-sidebar .brand strong {
    font-size: 22px;
    letter-spacing: -0.6px;
  }
  .apple-sidebar nav {
    display: grid;
    gap: 7px;
    width: 100%;
  }
  .apple-sidebar nav button {
    display: flex;
    align-items: center;
    gap: 13px;
    text-align: left;
    padding: 13px 14px;
    border-color: transparent !important;
    background: transparent !important;
    box-shadow: none;
    width: 100%;
    font-size: 14px;
  }
  .apple-sidebar nav button.active {
    background: #dce9fb !important;
    color: #0058b0 !important;
  }
  .apple-sidebar svg {
    width: 21px;
    height: 21px;
    flex-shrink: 0;
  }
  .apple-sidebar .release {
    margin-top: auto;
    display: grid;
    gap: 7px;
    padding: 20px 14px 0;
    border: 0;
    font-size: 12px;
  }
  .apple-topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: 76px;
    padding: 14px 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    background: #fafafcf5;
    border-bottom: 1px solid #dce0e7;
    z-index: 30;
  }
  .apple-search {
    width: min(440px, 55%);
    position: relative;
  }
  .search-label {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f2f6;
    border: 1px solid #dce0e7;
    border-radius: 10px;
    padding-left: 14px;
  }
  .search-label span {
    font-size: 25px;
  }
  .search-label input {
    background: transparent !important;
    border: 0;
    padding: 9px 10px 9px 0;
  }
  #toolSearchResults {
    position: absolute;
    top: calc(100% + 8px);
    width: 100%;
    max-height: 60vh;
    overflow: auto;
    background: white;
    border: 1px solid #dce0e7;
    box-shadow: 0 12px 35px #17223820;
    border-radius: 12px;
    padding: 7px;
  }
  #toolSearchResults button {
    display: grid;
    text-align: left;
    width: 100%;
    gap: 4px;
    margin: 3px 0;
  }
  #toolSearchResults p {
    padding: 12px;
    margin: 0;
  }
  .account-menu {
    margin-left: auto;
    position: relative;
  }
  .account-menu summary {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    list-style: none;
    padding: 3px;
    font-weight: 400;
  }
  .account-menu summary::-webkit-details-marker {
    display: none;
  }
  .avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #e2e7ef;
    color: #35445a;
    font-size: 13px;
    font-weight: 600;
  }
  .account-text {
    display: grid;
    gap: 1px;
    font-size: 13px;
  }
  .account-text small {
    font-size: 11px;
  }
  .account-dropdown {
    position: absolute;
    right: 0;
    top: 55px;
    width: 190px;
    padding: 8px;
    background: white;
    border: 1px solid #dce0e7;
    border-radius: 12px;
    box-shadow: 0 12px 35px #17223820;
  }
  .account-dropdown button {
    width: 100%;
    margin: 3px 0;
    text-align: left;
  }
  .apple-layout main {
    max-width: 1600px;
    padding: 24px 30px 40px;
  }
  .apple-breadcrumb {
    font-size: 13px;
    color: #626773;
    margin-bottom: 24px;
  }
  .apple-layout .hero h1 {
    font-size: clamp(24px, 2.5vw, 34px);
    letter-spacing: -0.04em;
  }
  .apple-layout .editor {
    min-height: 660px;
    height: calc(100vh - 245px);
    border-radius: 14px;
  }
  .apple-layout .editor-heading h1 {
    font-size: 26px;
  }
  .apple-layout .module {
    box-shadow: 0 2px 8px #14253804;
  }
  .apple-layout .module h3 {
    font-size: 19px;
  }
  .apple-layout .menu-toggle,
  .sidebar-backdrop {
    display: none;
  }
  @media (max-width: 1050px) {
    .apple-layout {
      --sidebar-width: 210px;
    }
    .apple-topbar {
      padding: 14px 20px;
    }
    .apple-layout main {
      padding: 22px 20px;
    }
  }
  @media (max-width: 760px) {
    .apple-layout {
      padding-left: 0;
      padding-top: 68px;
    }
    .apple-sidebar {
      width: 250px;
      transform: translateX(-100%);
      visibility: hidden;
    }
    .sidebar-open .apple-sidebar {
      transform: none;
      visibility: visible;
    }
    .apple-topbar {
      left: 0;
      height: 68px;
      padding: 10px 14px;
      gap: 10px;
    }
    .apple-layout .menu-toggle {
      display: block;
      padding: 6px 11px;
      min-height: 42px;
    }
    .apple-search {
      width: auto;
      flex: 1;
      min-width: 0;
    }
    .account-text {
      display: none;
    }
    .account-menu {
      margin-left: 0;
    }
    .account-menu summary {
      gap: 3px;
    }
    .avatar {
      width: 32px;
      height: 32px;
    }
    .apple-layout main {
      padding: 18px 14px 35px;
    }
    .apple-breadcrumb {
      margin-bottom: 18px;
      font-size: 12px;
    }
    .sidebar-backdrop:not([hidden]) {
      display: block;
      position: fixed;
      inset: 68px 0 0;
      width: 100%;
      height: calc(100% - 68px);
      z-index: 32;
      border: 0 !important;
      border-radius: 0 !important;
      background: #17223866 !important;
    }
    #toolSearchResults {
      width: min(310px, calc(100vw - 80px));
    }
  }
}
@media print {
  .apple-sidebar,
  .apple-topbar,
  .sidebar-backdrop,
  .apple-breadcrumb {
    display: none !important;
  }
  .apple-layout {
    padding: 0;
  }
}
.unit-import {
  border: 1px solid #cbd8eb;
  border-radius: 12px;
  padding: 16px;
  background: #f6f9ff;
}
.unit-import p {
  font-size: 13px;
}
.unit-drop {
  padding: 22px;
  border: 2px dashed #8eafd7;
  border-radius: 10px;
  background: white;
  text-align: center;
  cursor: pointer;
}
.unit-drop.dragging {
  background: #e3efff;
  border-color: #0066cc;
}
.unit-source-row {
  display: flex;
  align-items: end;
  gap: 8px;
  margin: 14px 0;
}
.unit-source-row label {
  flex: 1;
  min-width: 0;
}
.unit-candidates {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}
.unit-candidate {
  padding: 12px;
  background: white;
  border: 1px solid #dce0e7;
  border-radius: 8px;
}
.unit-candidate > span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.unit-candidate blockquote {
  font-size: 12px;
  margin: 0;
  border-left: 3px solid #8eafd7;
  padding-left: 9px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.unit-import pre {
  max-height: 280px;
  overflow: auto;
  font-size: 12px;
}
@media (max-width: 600px) {
  .unit-source-row {
    align-items: stretch;
    flex-direction: column;
  }
}
@media screen {
  .apple-sidebar {
    overflow-y: auto;
  }
  .app-sidebar-actions {
    margin: 20px 0;
    padding: 20px 10px 0;
    border-top: 1px solid #cbd2dd;
  }
  .app-actions-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 10px;
    color: #626773;
    margin-bottom: 5px;
  }
  .app-sidebar-actions h2 {
    font-size: 15px;
    margin-bottom: 14px;
  }
  .app-action-buttons,
  .app-sidebar-actions .editor-actions {
    display: grid;
    gap: 7px;
  }
  .app-sidebar-actions button {
    width: 100%;
    text-align: left;
    font-size: 12px;
    padding: 9px 10px;
    min-height: 38px;
  }
  .app-sidebar-actions .protocol-meta {
    font-size: 12px;
    margin-top: 12px;
  }
  .app-sidebar-actions .cols {
    grid-template-columns: 1fr;
  }
  .app-sidebar-actions .toolbar {
    display: grid;
  }
  .active-app-header {
    display: flex;
    align-items: center;
    gap: 13px;
    background: white;
    padding: 16px 20px;
    border: 1px solid #dce0e7;
    border-radius: 12px;
    margin-bottom: 16px;
  }
  .active-app-header h1 {
    font-size: 20px;
    margin: 0 0 4px;
  }
  .active-app-header p {
    font-size: 11px;
    color: #626773;
    margin: 0;
  }
  .active-app-header .active-project-name {
    font-size: 13px;
    color: #26354a;
    margin-top: 6px;
  }
  .active-app-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #0066cc;
    color: white;
    font-weight: 700;
    flex-shrink: 0;
  }
  .app-workspace > .editor-controls:empty,
  .app-workspace > .card > .toolbar:empty {
    display: none;
  }
  .apple-layout .app-workspace .editor {
    height: calc(100vh - 220px);
    margin-top: 0;
  }
  .app-workspace > .card:has(#startProjectForm[hidden]) {
    margin: 0;
    padding: 0;
  }
  @media (max-width: 760px) {
    .active-app-header {
      padding: 12px;
      flex-wrap: wrap;
    }
    .active-app-header h1 {
      font-size: 18px;
    }
    .app-sidebar-actions button {
      min-height: 44px;
    }
  }
}

/* Shared company lookup in the central registry. */
.company-lookup {
  padding: 18px;
  margin: 12px 0 20px;
  border: 1px solid #dce3eb;
  border-radius: 16px;
  background: #f5f8fc;
}
.company-lookup h3 {
  margin: 0 0 6px;
}
.company-lookup > p,
.company-lookup-status {
  color: #536174;
  font-size: 13px;
  line-height: 1.5;
}
.company-lookup > label {
  display: block;
  max-width: 360px;
}
.company-lookup-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.company-lookup-status,
.company-choices {
  flex-basis: 100%;
  margin: 4px 0 0;
}
.company-choices:empty {
  display: none;
}
@media (max-width: 600px) {
  .company-lookup-actions button {
    width: 100%;
  }
}

[hidden] {
  display: none !important;
}
.registry-layout {
  display: grid;
  gap: 20px;
  min-width: 0;
}
.registry-layout #recordFields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: start;
}
.registry-layout .filters {
  margin-top: 0;
}
#protocolResults .protocol-table td,
#recordList .protocol-table td {
  padding: 5px 8px;
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
}
#protocolResults .protocol-table th,
#recordList .protocol-table th {
  padding: 5px 8px;
  font-size: 12px;
}
#protocolResults .protocol-table button,
#recordList .protocol-table button {
  min-height: 25px;
  padding: 3px 8px;
  font-size: 12px;
  border-radius: 5px;
}
#protocolResults .protocol-table .row {
  gap: 4px;
  flex-wrap: nowrap;
}
.open-app-tabs {
  position: fixed;
  inset: 0 0 auto;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  background: #e9e9ee;
  padding: 4px 8px;
  z-index: 1000;
  border-bottom: 1px solid #d2d2da;
}
.open-app-tabs button {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
  white-space: nowrap;
  background: transparent;
  border: 0;
}
.workspace-tab {
  display: flex;
  border-radius: 8px;
  background: #dedee5;
}
.workspace-tab.selected,
.open-app-tabs > .selected {
  background: white;
  box-shadow: 0 1px 4px #0001;
}
.has-open-apps {
  padding-top: 42px;
}
.has-open-apps > #app .apple-sidebar {
  top: 42px;
}
.open-app-host {
  position: fixed;
  inset: 42px 0 0;
  z-index: 100;
  background: #f5f5f7;
}
.open-app-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.image-editor-preview {
  display: block;
  max-width: 220px;
  max-height: 100px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #ddd;
  margin: 8px 0;
}
.crop-dialog {
  width: min(620px, 95vw);
}
.crop-dialog canvas {
  display: block;
  max-width: 100%;
  width: 100%;
  touch-action: none;
  border: 1px solid #bbb;
}
.crop-dialog .crop-fields {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.backup-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.has-open-apps > #app .apple-topbar {
  top: 42px;
}
/* Compact identity for the OVK workspace. */
@media screen {
  .apple-layout main.ovk-workspace {
    padding-top: 10px;
  }
  .ovk-workspace .apple-breadcrumb {
    margin-bottom: 6px;
    font-size: 11px;
  }
  .ovk-workspace .active-app-header {
    padding: 8px 12px;
    gap: 10px;
    margin-bottom: 8px;
    border-radius: 9px;
  }
  .ovk-workspace .active-app-header h1 {
    font-size: 15px;
    margin: 0;
  }
  .ovk-workspace .active-app-header > div {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    min-width: 0;
  }
  .ovk-workspace .active-app-header p {
    font-size: 10px;
  }
  .ovk-workspace .active-app-header .active-project-name {
    margin: 0;
    font-size: 12px;
  }
  .ovk-workspace .active-app-mark {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 11px;
  }
  .ovk-workspace #saveStatus {
    margin-left: auto;
    font-size: 11px;
    white-space: nowrap;
  }
  .apple-layout .ovk-workspace > .editor {
    height: calc(100vh - 170px);
  }
  .ovk-menu-group {
    margin: 0 0 6px;
    padding: 8px 0;
    border-bottom: 1px solid #dce0e7;
  }
  .ovk-menu-group summary {
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 2px;
  }
  .ovk-primary-tools,
  .ovk-more-tools > div {
    display: grid;
    gap: 5px;
    margin-top: 6px;
  }
  .ovk-more-tools {
    margin-top: 7px;
  }
  @media (max-width: 760px) {
    .ovk-workspace .active-app-header {
      align-items: flex-start;
    }
    .ovk-workspace .active-app-header > div {
      flex-direction: column;
      gap: 2px;
    }
    .ovk-workspace #saveStatus {
      margin-left: 36px;
    }
  }
}
