/* Shared QVis site shell: header navigation, menus, help, user controls, and footer. */

footer {
  background-color: var(--qvis-nav-base);
  border-top: 1px solid var(--qvis-shell-divider);
  color: #afafaf;
  text-align: center !important;
  padding: 1px 0;
  width: 100%;
  position: fixed;
  bottom: 0;
  font-size: 0.6rem;
  line-height: 0.5;
}

/* ======================================== */
/*            Header Navigation             */
/* ======================================== */

.header-bar {
  position: sticky;
  top: 0;
  width: 100%;
  min-height: 36px;
  box-sizing: border-box;
  padding: 4px 24px 0 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--qvis-nav-base);
  border-bottom: 1px solid var(--qvis-shell-divider);
  box-shadow: none;
  z-index: 1000;
}

.header-left {
  min-width: 0;
  display: flex;
  align-self: stretch;
  align-items: center;
  gap: 18px;
}

.header-left .logo {
  font-family: 'Roboto', sans-serif;
  height: 27px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 2px;
  color: var(--qvis-nav-text-main);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.12s ease;
}

.header-left .logo:hover {
  color: #fff;
}

.logo-mark {
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--qvis-nav-text-secondary);
  font-size: 14px;
}

.logo:hover .logo-mark {
  background: var(--qvis-nav-menu-surface);
  color: #fff;
}

.logo-wordmark {
  line-height: 1;
}

.header-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.menu {
  display: flex;
  align-items: center;
  gap: 3px;
}

.header-primary-nav {
  align-self: stretch;
  align-items: flex-end;
}

.menu-btn {
  height: 27px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-top: 0;
  border-radius: 0;
  background: transparent;
  color: var(--qvis-nav-text-secondary);
  font-family: 'Roboto', sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: box-shadow 0.12s ease, color 0.12s ease;
}

.menu-btn:hover {
  background: transparent;
  box-shadow: none;
  color: #fff;
}

.menu-btn.is-active {
  border-radius: 4px 4px 0 0;
  background: var(--qvis-nav-active-surface);
  box-shadow: inset 0 -2px 0 var(--qvis-nav-interactive);
  color: #fff;
}

html.qvis-data-view-page .menu-btn.is-active,
html.qvis-admin-page .menu-btn.is-active {
  box-shadow: inset 0 -2px 0 var(--qvis-page-accent);
}

.menu-btn:focus-visible,
.header-action:focus-visible,
.header-user-toggle:focus-visible,
.header-menu-item:focus-visible {
  outline: 2px solid var(--qvis-nav-focus);
  outline-offset: 1px;
}

.header-action,
.header-user-toggle {
  height: 27px;
  min-width: 27px;
  max-width: none;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  padding: 0 9px;
  border: 0;
  border-top: 0;
  border-radius: 0;
  background: transparent;
  color: var(--qvis-nav-text-secondary);
  font: 500 12px/1 'Roboto', sans-serif;
  list-style: none;
  cursor: pointer;
  transition: box-shadow 0.12s ease, color 0.12s ease;
}

.header-action:hover,
.header-user-toggle:hover {
  background: transparent;
  box-shadow: none;
  color: #fff;
}

.header-menu[open] > summary {
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--qvis-nav-menu-hover-text);
}

.header-action::-webkit-details-marker,
.header-user-toggle::-webkit-details-marker {
  display: none;
}

.header-menu {
  position: relative;
}

.header-menu-chevron {
  font-size: 8px;
  color: #8496b1;
  transition: color 0.12s ease, transform 0.14s ease;
}

.header-menu[open] > summary .header-menu-chevron {
  transform: rotate(180deg);
  color: var(--qvis-nav-menu-hover-text);
}

.header-action:hover .header-menu-chevron,
.header-user-toggle:hover .header-menu-chevron {
  color: #fff;
}

.header-menu-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 238px;
  box-sizing: border-box;
  padding: 6px;
  border: 1px solid var(--qvis-nav-menu-border);
  border-radius: 10px;
  background: var(--qvis-nav-menu-surface);
  color: var(--qvis-nav-text-main);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  z-index: 1010;
}

.header-menu-heading {
  padding: 5px 8px 7px;
  color: var(--qvis-nav-text-label);
  font: 700 10px/1 'Roboto', sans-serif;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.header-menu-item {
  transition: none;
  width: 100%;
  min-height: 39px;
  max-width: none;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 5px 7px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--qvis-nav-menu-text);
  font-family: 'Roboto', sans-serif;
  text-align: left;
  text-decoration: none;
}

.header-menu-item:hover {
  background: var(--qvis-nav-row-hover);
  color: var(--qvis-nav-menu-hover-text);
}

.header-menu-item:hover .header-menu-item-icon {
  color: var(--qvis-nav-menu-hover-text);
}

.header-menu-item:hover .header-external-icon {
  color: var(--qvis-nav-menu-hover-text);
}

.header-connections-popover {
  width: 254px;
  padding: 4px;
  background: var(--qvis-nav-menu-surface);
}

.header-connections-popover .header-menu-item {
  min-height: 38px;
  grid-template-columns: 26px minmax(0, 1fr) 14px;
  gap: 8px;
  padding: 3px 7px;
}

.header-connections-popover .header-menu-item-icon {
  width: 26px;
  height: 26px;
  color: var(--qvis-nav-interactive);
  font-size: 15px;
  transition: none;
}

.header-connections-popover .header-menu-item strong {
  font-size: 11.5px;
}

.header-connections-popover .header-menu-item small {
  margin-top: 1px;
  font-size: 9.5px;
}

.header-connections-popover .header-menu-item strong,
.header-connections-popover .header-menu-item small {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.header-connections-popover .header-menu-item:hover {
  background: var(--qvis-nav-row-hover);
  color: var(--qvis-nav-menu-hover-text);
}

.header-connections-popover .header-menu-item:hover .header-menu-item-icon {
  background: transparent;
  color: var(--qvis-nav-menu-hover-text);
}

.header-connections-popover .header-menu-item:hover .header-external-icon {
  color: var(--qvis-nav-menu-hover-text);
}

.header-menu-item-icon {
  width: 27px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: transparent;
  color: var(--qvis-nav-menu-icon);
  font-size: 11px;
}

.header-menu-item strong,
.header-menu-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-menu-item strong {
  color: inherit;
  font-size: 12px;
  font-weight: 600;
}

.header-menu-item small {
  margin-top: 2px;
  color: var(--qvis-nav-text-secondary);
  font-size: 10px;
  font-weight: 400;
}

.header-external-icon {
  color: var(--qvis-nav-menu-icon);
  font-size: 9px;
}

.header-user-toggle {
  padding: 0 4px 0 1px;
  border-radius: 0;
}

.header-user-menu[open] > .header-user-toggle {
  border-radius: 0;
}

.header-avatar {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 0;
  border-radius: 50%;
  background: var(--qvis-nav-interactive);
  color: #fff;
  font: 700 11px/1 'Roboto', sans-serif;
  letter-spacing: 0.02em;
}

.header-user-toggle:hover .header-avatar {
  filter: brightness(1.12);
  color: #fff;
}

.header-user-menu[open] .header-avatar {
  filter: brightness(1.12);
  color: #fff;
}

.header-user-popover {
  width: 224px;
  background: var(--qvis-nav-menu-surface);
}

.header-user-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 8px;
}

.header-avatar-large {
  width: 29px;
  height: 29px;
  flex-basis: 29px;
  font-size: 11px;
}

.header-user-card > span:last-child {
  min-width: 0;
}

.header-user-card strong,
.header-user-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user-card strong {
  color: var(--qvis-nav-text-main);
  font: 600 12px/1.3 'Roboto', sans-serif;
}

.header-user-card small {
  margin-top: 2px;
  color: var(--qvis-nav-text-secondary);
  font: 400 10px/1.3 'Roboto', sans-serif;
}

.header-menu-divider {
  height: 1px;
  margin: 3px 6px 5px;
  background: #334151;
}

.header-logout {
  grid-template-columns: 28px minmax(0, 1fr) 20px;
  cursor: pointer;
}

.header-logout .header-menu-item-icon {
  font-size: 19.5px;
}

.header-logout-exit-icon {
  justify-self: center;
  color: var(--qvis-nav-menu-icon);
  font-size: 21px;
}

.header-logout:hover {
  background: var(--qvis-nav-row-hover);
  color: var(--qvis-nav-menu-hover-text);
}

.header-logout:hover .header-menu-item-icon {
  background: transparent;
  color: var(--qvis-nav-error);
}

.header-logout:hover .header-logout-exit-icon {
  color: var(--qvis-nav-menu-hover-text);
}

.header-help-toggle {
  width: 27px;
  min-width: 27px;
  max-width: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
}

.header-help-popover {
  --help-resize-grip: #a8b8cc;
  display: flex;
  flex-direction: column;
  width: min(480px, calc(100vw - 14px));
  height: min(680px, calc(100vh - 54px));
  min-width: min(320px, calc(100vw - 14px));
  max-width: calc(100vw - 14px);
  min-height: min(200px, calc(100vh - 54px));
  max-height: calc(100vh - 54px);
  box-sizing: border-box;
  resize: both;
  overflow-x: hidden;
  overflow-y: hidden;
  padding: 8px;
  background: var(--qvis-nav-menu-surface);
  scrollbar-width: thin;
  scrollbar-color: #465b79 transparent;
}

.header-help-popover::-webkit-resizer {
  background: linear-gradient(135deg,
    transparent 0 45%, var(--help-resize-grip) 45% 53%,
    transparent 53% 65%, var(--help-resize-grip) 65% 73%,
    transparent 73%) center / 12px 12px no-repeat;
}

.header-help-popover.is-manually-positioned {
  position: fixed;
  right: auto;
}

.header-help-popover.is-dragging {
  user-select: none;
}

.header-help-heading,
.header-help-page-title {
  display: flex;
  align-items: center;
  gap: 7px;
}

.header-help-heading {
  flex-shrink: 0;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 5px 8px;
  color: var(--qvis-nav-text-main);
  font: 650 13px/1 'Roboto', sans-serif;
  cursor: move;
  touch-action: none;
}

.header-help-heading-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.header-help-heading-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.header-help-heading-title i {
  color: var(--qvis-nav-text-secondary);
}

.header-help-search {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 3px 7px;
  padding: 0 9px;
  border: 1px solid #334151;
  border-radius: 4px;
  background: #111923;
  color: var(--qvis-nav-text-label);
}

.header-help-search:focus-within {
  border-color: var(--qvis-nav-focus);
  box-shadow: 0 0 0 2px rgba(145, 189, 255, 0.12);
  color: var(--qvis-nav-text-secondary);
}

.header-help-search input[type='search'] {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 31px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--qvis-nav-text-main);
  font: 400 11px/1 'Roboto', sans-serif;
}

.header-help-search input[type='search']::placeholder {
  color: #7588a2;
  opacity: 1;
}

.header-help-search input[type='search']::-webkit-search-cancel-button {
  filter: invert(72%) sepia(9%) saturate(635%) hue-rotate(177deg) brightness(88%);
  cursor: pointer;
}

.header-help-page-title {
  padding: 7px 8px;
  border: 1px solid rgba(135, 166, 212, 0.14);
  border-radius: 4px;
  background: var(--qvis-nav-row-hover);
  color: var(--qvis-nav-text-main);
  font: 650 12px/1.1 'Roboto', sans-serif;
}

.header-help-page-title i {
  width: 15px;
  color: var(--qvis-nav-interactive);
  text-align: center;
}

.header-help-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: inherit;
  align-content: start;
  display: grid;
  grid-template-columns: fit-content(40%) minmax(0, 1fr);
  column-gap: 12px;
  color: var(--qvis-nav-text-secondary);
  font: 400 10.5px/1.35 'Roboto', sans-serif;
}

.header-help-section {
  display: grid;
  grid-template-columns: subgrid;
  padding: 9px 7px 5px;
}

.header-help-content > *,
.header-help-section > * {
  grid-column: 1 / -1;
}

.header-help-section + .header-help-section {
  border-top: 1px solid rgba(113, 139, 176, 0.16);
}

.header-help-section-title {
  margin-bottom: 6px;
  color: var(--qvis-nav-text-label);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.07em;
  line-height: 1;
  text-transform: uppercase;
}

.header-help-section p {
  margin: 0;
}

.header-help-section[hidden],
.header-help-gesture-list > div[hidden],
.header-help-no-results[hidden] {
  display: none;
}

.header-help-no-results {
  padding: 18px 8px 20px;
  color: #a3b2c6;
  font-size: 10.5px;
  text-align: center;
}

.header-help-gesture-list {
  margin: 0;
  display: grid;
  grid-template-columns: subgrid;
}

.header-help-gesture-list > div {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  padding: 3px 4px;
  border-radius: 4px;
}

.header-help-gesture-list > div:hover {
  background: var(--qvis-nav-row-hover);
}

.header-help-gesture-list dt,
.header-help-gesture-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.header-help-gesture-list dt {
  color: var(--qvis-nav-text-main);
  font-weight: 550;
}

.header-help-gesture-list dd {
  color: var(--qvis-nav-text-secondary);
}

.header-help-gesture-list kbd {
  display: inline-block;
  min-width: 13px;
  padding: 1px 4px;
  border: 1px solid #4a5d78;
  border-bottom-color: #607797;
  border-radius: 3px;
  background: #21314a;
  color: #e5edf8;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.28);
  font: 600 9px/1.25 'Roboto', sans-serif;
  text-align: center;
}

.header-help-divider {
  height: 1px;
  margin: 5px 4px;
  background: #2c3b51;
}

.header-help-hints-setting {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  width: auto;
  min-height: 25px;
  max-width: none;
  margin: 0;
  padding: 4px 2px 4px 7px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--qvis-nav-text-secondary);
  font: 550 10px/1 'Roboto', sans-serif;
  white-space: nowrap;
  cursor: pointer;
}

.header-help-theme-setting {
  appearance: none;
  width: 25px;
  height: 25px;
  min-width: 25px;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--qvis-nav-text-secondary);
  font-size: 12px;
  cursor: pointer;
}

.header-help-theme-setting:hover,
.header-help-theme-setting:focus-visible {
  background: var(--qvis-nav-row-hover);
  color: var(--qvis-nav-menu-hover-text);
  outline: none;
}

.header-help-hints-setting:hover,
.header-help-hints-setting:focus-visible {
  background: transparent;
  color: #fff;
  outline: none;
}

.header-help-hints-setting:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.header-help-hints-check {
  color: var(--qvis-nav-interactive);
  font-size: 13px;
  opacity: 1;
}

.header-help-hints-setting.is-disabled .header-help-hints-check {
  color: #8496ad;
  opacity: 0.9;
}

.header-help-popover.is-light {
  --help-resize-grip: #5f7085;
  --qvis-nav-menu-surface: #f7f9fc;
  --qvis-nav-row-hover: #e8edf3;
  --qvis-nav-menu-border: #c9d2dd;
  --qvis-nav-menu-text: #405066;
  --qvis-nav-menu-hover-text: #17202c;
  --qvis-nav-menu-icon: #5f7085;
  --qvis-nav-text-main: #17202c;
  --qvis-nav-text-secondary: #405066;
  --qvis-nav-text-label: #5f7085;
  --qvis-nav-interactive: #0078d4;
  --qvis-nav-focus: #185ea8;
  color-scheme: light;
  scrollbar-color: #aeb8c6 transparent;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
}

.header-help-popover.is-light .header-help-search {
  border-color: #c9d2dd;
  background: #fff;
}

.header-help-popover.is-light .header-help-search:focus-within {
  border-color: #0078d4;
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.12);
}

.header-help-popover.is-light .header-help-search input[type='search']::placeholder,
.header-help-popover.is-light .header-help-no-results {
  color: #5f7085;
}

.header-help-popover.is-light .header-help-search input[type='search']::-webkit-search-cancel-button {
  filter: none;
}

.header-help-popover.is-light .header-help-section + .header-help-section {
  border-top-color: rgba(95, 112, 133, 0.2);
}

.header-help-popover.is-light .header-help-gesture-list kbd {
  border-color: #b8c5d4;
  border-bottom-color: #9cabbc;
  background: #e8edf3;
  color: #17202c;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.12);
}

.header-help-popover.is-light .header-help-divider {
  background: #c9d2dd;
}

.header-help-popover.is-light .header-help-hints-setting:hover,
.header-help-popover.is-light .header-help-hints-setting:focus-visible {
  color: #17202c;
}

@media print {
  footer,
  .header-bar,
  .menu {
    display: none !important;
  }
}

/* ======================================== */
/*            Responsive Layout             */
/* ======================================== */

@media (max-width: 768px) {
  .header-bar {
    min-height: 36px;
    padding: 4px 8px 0;
    gap: 8px;
  }

  .header-left {
    flex: 1 1 auto;
    gap: 8px;
    overflow: hidden;
  }

  .header-left .logo {
    flex: 0 0 auto;
    font-size: 15px;
  }

  .menu {
    min-width: 0;
    gap: 1px;
  }

  .menu-btn {
    height: 27px;
    padding: 0 8px;
    font-size: 12px;
  }

  .header-right {
    gap: 2px;
  }

  .header-action,
  .header-user-toggle {
    height: 27px;
    min-width: 27px;
  }

  .header-help-toggle {
    width: 27px;
    min-width: 27px;
  }

  .header-connections-label {
    display: none;
  }

  .header-connections-toggle {
    width: 27px;
    padding: 0;
  }

  .header-connections-toggle .header-menu-chevron {
    display: none;
  }

  .header-avatar {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
  }

  .header-menu-popover {
    position: fixed;
    top: 37px;
    right: 7px;
    max-width: calc(100vw - 14px);
  }

  .header-help-content {
    column-gap: 8px;
  }
}

@media (max-width: 430px) {
  .logo-mark {
    width: 25px;
    height: 25px;
  }

  .header-primary-nav .menu-btn i {
    display: none;
  }

  .header-primary-nav .menu-btn {
    padding: 0 7px;
  }
}

.header-appearance {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 12px;
  padding: 8px 12px;
  color: #dbe5f1;
}
.header-appearance label { margin: 0; font-size: 13px; color: inherit; }
.header-appearance select {
  width: auto; margin: 0; padding: 3px 7px; border: 1px solid #526175;
  border-radius: 4px; background: #263345; color: #e2e8f0; font: inherit;
}
.header-appearance small { grid-column: 1 / -1; color: #f0b5b5; font-size: 11px; }
.header-appearance small:empty { display: none; }
