/* The application frame stays in the viewport; its content panes scroll. */
html:has(.workspace), body:has(.workspace) { height: 100%; overflow: hidden; overscroll-behavior: none; }
#app:has(.workspace) { height: 100vh; height: 100dvh; overflow: hidden; }
.workspace { height: 100%; min-height: 0; overflow: hidden; }
.workspace-body { flex: 1 1 0; min-height: 0; overflow: hidden; }
.workspace-main { height: 100%; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.workspace-main:has(.research-workspace), .workspace-main:has(.directory-workspace) { display: flex; flex-direction: column; overflow: hidden; }
.research-workspace { flex: 1; height: 100%; min-height: 0; grid-template-rows: minmax(0,1fr); overflow: hidden; }
.research-main { min-height: 0; overflow: hidden; }
.research-title, .research-controls, .alphabet-controls, .research-table-footer { flex-shrink: 0; }
.research-table-wrap { flex: 1 1 0; min-height: 0; max-height: none; overscroll-behavior: contain; }
.research-insights { min-height: 0; overflow: hidden; }
.insight-content { overflow-y: auto; overscroll-behavior: contain; }
.directory-workspace { flex: 1; height: 100%; min-height: 0; overflow: hidden; }
.navigation { min-height: 0; bottom: 12px; }
.navigation nav { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.nav-bottom { flex-shrink: 0; }
.dialog { overscroll-behavior: contain; }
.research-table-wrap:focus-visible { outline: 1px solid var(--cyan); outline-offset: -1px; }
@media (max-width:700px) {
  .workspace-body { display: flex; flex-direction: column; }
  .navigation { flex: 0 0 auto; bottom: auto; }
  .navigation nav { overflow-y: hidden; }
  .workspace-main { flex: 1 1 0; height: auto; }
  .research-workspace { display: flex; flex-direction: column; }
  .research-main { flex: 1 1 0; }
  .research-insights { flex: 0 0 auto; max-height: 220px; max-height: min(35dvh,220px); min-height: 46px; }
  .insights-collapsed .research-insights { flex: 0 0 46px; }
}

/* Details open in a modal; the table uses the full content width. */
.research-workspace, .insights-collapsed .research-workspace { grid-template-columns: minmax(0,1fr); }
.categories-table tbody tr { cursor: pointer; }
.category-reference { display: block; padding: 0; border: 0; background: transparent; text-align: left; font-size: inherit; color: inherit; }
.category-reference:hover { color: var(--cyan); text-decoration: underline; }
.category-reference small { display: block; }
.dialog-backdrop:has(.research-detail) { align-items: center; justify-content: center; padding: 24px; }
.research-detail { width: 720px; max-width: 100%; max-height: calc(100dvh - 48px); border: 1px solid #53617b; border-radius: 8px; }
.research-detail .insight-panel { padding-inline: 0; }
@media (max-width:700px) {
  .dialog-backdrop:has(.research-detail) { padding: 10px; }
  .research-detail { max-height: calc(100dvh - 20px); padding: 14px; }
  .research-detail > .panel-heading { top: -14px; }
  .research-detail .company-fields { grid-template-columns: 1fr; gap: 4px; }
  .research-detail .company-fields dd { margin-bottom: 12px; }
}

/* Single masthead, right-aligned alphabet and compact category filter. */
.workspace-header { height: 46px; gap: 12px; }
.brand { flex-shrink: 0; gap: 6px; }
.workspace-header .brand { width: 166px; max-width: calc(var(--content-start,196px) - 30px); min-width: 0; }
.brand-mark { width: 20px; height: 24px; color: #85c6cf; }
.brand-name { position: relative; display: block; width: max-content; padding-bottom: 11px; font-size: 16px; line-height: 18px; letter-spacing: .1px; white-space: nowrap; }
.brand-name > span { position: absolute; left: 0; top: 19px; width: 100%; margin-top: 0; font-size: 7.5px; line-height: 9px; letter-spacing: 0; white-space: nowrap; text-align-last: justify; }
.header-search { margin-left: 0; max-width: none; min-width: 100px; }
.header-totals { display: flex; align-items: center; gap: 16px; color: #aebbd0; font-size: 12px; flex-shrink: 0; white-space: nowrap; }
.category-toolbar { display: flex; justify-content: flex-end; align-items: center; gap: 14px; min-width: 0; flex-shrink: 0; margin-bottom: 8px; position: relative; z-index: 3; }
.category-toolbar .alphabet-controls { padding: 0; flex: 0 1 auto; min-width: 0; }
.category-toolbar .research-count { margin-left: 9px; margin-right: 0; white-space: nowrap; }
.category-filter { flex-shrink: 0; position: relative; margin-right: auto; }
.category-filter summary { color: #fff; display: flex; align-items: center; justify-content: center; list-style: none; cursor: pointer; }
.category-filter summary::-webkit-details-marker { display: none; }
.category-filter[open] summary, .category-filter .filter-active { color: #fff; border-color: #62b5d4; }
.filter-menu { position: absolute; top: calc(100% + 6px); left: 0; right: auto; width: 205px; padding: 5px; border: 1px solid #53617b; border-radius: 6px; background: #293247; box-shadow: 0 8px 24px #0007; }
.filter-menu button { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent; padding: 9px; text-align: left; font-size: 13px; border-radius: 3px; }
.filter-menu button:hover, .filter-menu button:focus-visible { background: #35465e; }
.filter-menu button[aria-pressed="true"] { color: #8bd6e0; }
.navigation .nav-bottom { display: flex; flex-direction: column; align-items: stretch; gap: 3px; }
.nav-bottom strong { margin: 0; }
.account-logout { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; margin-top: 7px; padding: 4px 0; border: 0; background: transparent; color: #b8c8dc; font-size: 13px; }
.account-logout:hover { color: var(--cyan); }
.account-logout .icon { width: 15px; height: 15px; }
@media (max-width:1000px) and (min-width:701px) {
  .header-totals { flex-direction: column; align-items: flex-end; gap: 3px; }
}
@media (max-width:700px) {
  .workspace-header { height: auto; display: grid; grid-template-columns: minmax(0,1fr); gap: 7px; padding: 9px 10px; }
  .workspace-header .brand-name > span { display: block; }
  .workspace-header .brand-name { font-size: 16px; }
  .workspace-header .header-search { width: 100%; }
  .header-totals { flex-wrap: wrap; justify-content: flex-end; gap: 10px; font-size: 11px; }
  .category-toolbar { gap: 10px; }
  .navigation .nav-bottom, .navigation .nav-bottom:has(select) { flex-direction: row; align-items: center; flex-wrap: wrap; padding: 5px 10px; gap: 8px; }
  .nav-bottom .eyebrow { display: none; }
  .nav-bottom .account-logout { margin: 0 0 0 auto; }
  .nav-bottom select { width: auto; }
}

/* All four main directories share the same compact toolbar. */
.category-toolbar { min-height: 28px; }
.category-toolbar .research-count strong { color: #c8d4e5; font-weight: 500; }
.filter-menu { width: 275px; max-width: calc(100vw - 24px); max-height: min(520px,calc(100dvh - 160px)); overflow-y: auto; }
.filter-menu .compact-select { display: flex; flex-direction: column; align-items: stretch; gap: 5px; padding: 8px 9px; }
.filter-menu .compact-select > span { display: block; }
.filter-menu .compact-select select { width: 100%; max-width: 100%; min-height: 30px; border-radius: 4px; padding: 4px 8px; box-shadow: none; }
.workspace-main:has(.directory-workspace) { padding-top: 11px; padding-right: 12px; padding-bottom: 0; }
@media (max-width:700px) {
  .category-toolbar .research-count { font-size: 12px; }
  .workspace-main:has(.directory-workspace) { padding: 6px 10px 0; }
}

/* Plain navigation with a separate, collapsible administration group. */
.main-navigation, .admin-items { display: flex; flex-direction: column; gap: 4px; }
.navigation .nav-pill { border: 0; border-radius: 0; background: transparent; box-shadow: none; min-height: 32px; }
.navigation .nav-pill:hover { background: #29354a; box-shadow: none; transform: none; }
.navigation .nav-pill.active { background: #253448; box-shadow: inset 2px 0 #68bfd6; }
.admin-navigation { margin-top: 22px; padding-top: 10px; border-top: 1px solid #354158; }
.admin-navigation > summary { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; color: #9faec3; font-size: 12px; letter-spacing: .6px; cursor: pointer; list-style: none; }
.admin-navigation > summary::-webkit-details-marker { display: none; }
.admin-navigation > summary:hover { color: #e2edf5; background: #263145; }
.admin-navigation > summary .icon { width: 13px; height: 13px; transition: transform .15s; }
.admin-navigation[open] > summary .icon { transform: rotate(90deg); }
.admin-navigation.admin-active > summary { color: #acd2df; }
.admin-items { padding-top: 4px; }
.category-toolbar .research-count { min-width: 0; max-width: 50%; overflow: hidden; text-overflow: ellipsis; }
@media(max-width:700px) {
  .main-navigation, .admin-items { flex-direction: row; }
  .admin-navigation { margin: 0; padding: 0; border: 0; }
  .navigation nav { align-items: flex-start; }
  .admin-items { padding: 0; }
}

@media(max-width:700px) { .category-filter { position: static; } .category-filter .filter-menu { left: 0; right: auto; } }

.workspace-main:has(.dashboard-page) { padding-top: 12px; padding-right: 12px; padding-bottom: 12px; }
