/* Shared worksheet navigation. These controls belong to the viewport, not a row. */
:root { --sheet-scrollbar-height: 28px; }
.app-body > .compact-header {
  position: sticky; top: 0; left: 0; z-index: 40; flex: none;
}
.program-mode.source-page > .compact-header,
.embedded-page.source-page > .compact-header { display: flex; }
.program-mode.workbook-body .workbook-titlebar > .home-button {
  display: inline-flex; flex: none;
}
.has-sheet-scrollbar .source-home,
.has-sheet-scrollbar .source-native-home { display: none !important; }
.has-sheet-scrollbar.workbook-body .workbook { padding-bottom: var(--sheet-scrollbar-height); }
.has-sheet-scrollbar.workbook-body .worksheet-viewport:has(.worksheet-live-frame) { overflow: hidden; }
.has-sheet-scrollbar.workbook-body .worksheet-scale:has(.worksheet-live-frame) {
  width: 100%; height: 100%; min-height: 0;
}
.has-sheet-scrollbar.workbook-body .worksheet-live-frame {
  display: block; width: 100%; height: 100%; min-height: 0;
}
.sheet-viewport-page {
  display: flex; flex-direction: column; height: 100dvh; min-height: 0; overflow: hidden;
}
.sheet-viewport-page .main-content {
  display: flex; flex-direction: column; flex: 1; min-height: 0;
  width: 100%; max-width: none; margin: 0;
  padding: 0 0 var(--sheet-scrollbar-height);
}
.sheet-viewport-page .source-workspace {
  flex: 1; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain;
}
.sheet-viewport-page .main-content > .source-form-controls,
.sheet-viewport-page .main-content > .source-notice,
.sheet-viewport-page .main-content > .messages { flex: none; }
.sheet-viewport-page .source-form-controls { flex-wrap: wrap; }
.sheet-viewport-page .main-content > .source-support {
  flex: none; max-height: 22dvh; overflow: auto;
}
.sheet-viewport-page .source-support:not([open]) { padding-top: 5px; padding-bottom: 5px; }
.has-sheet-scrollbar:not(.workbook-body):not(.sheet-viewport-page) .main-content {
  padding-bottom: calc(var(--sheet-scrollbar-height) + 36px);
}
.sheet-scroll-main { overflow: auto; }
/* Hide only the native horizontal bar. Keep a stable vertical gutter on the
   right, including narrow worksheets and browsers with classic scrollbars. */
.sheet-scroll-pane {
  overflow-x: hidden !important; overflow-y: scroll !important;
  scrollbar-gutter: stable; scrollbar-width: auto;
  touch-action: pan-y pinch-zoom;
}
.sheet-scroll-pane:has(.worksheet-live-frame) { overflow: hidden !important; scrollbar-gutter: auto; }
.sheet-scroll-pane::-webkit-scrollbar { width: 14px; height: 0; }
.sheet-scroll-pane::-webkit-scrollbar-track { background: #dfe0e0; }
.sheet-scroll-pane::-webkit-scrollbar-thumb { background: #939e9c; border: 2px solid #dfe0e0; border-radius: 7px; }
.sheet-scroll-embedded { --sheet-scrollbar-height: 0px; }
.sheet-scroll-embedded > .sheet-scrollbar { display: none; }
.worksheet-grid td.frozen-column {
  position: sticky; left: var(--row-gutter-width, 0px); z-index: 11;
  box-shadow: 2px 0 0 #8e9ea8;
}
.worksheet-grid td.frozen-column.cell-active { z-index: 12; }
.worksheet-grid thead .frozen-column {
  position: sticky; left: var(--row-gutter-width, 0px); z-index: 18;
  box-shadow: 2px 0 0 #8e9ea8;
}
.worksheet-grid thead .corner, .worksheet-grid thead .row-number { z-index: 24; }
.tracking-table.source-table { border-collapse: separate; border-spacing: 0; }
.tracking-table .tracking-heading { position: sticky; top: 0; z-index: 15; }
.tracking-table .frozen-company { position: sticky; left: 0; z-index: 10; box-shadow: 2px 0 0 #8e9ea8; }
.tracking-table .tracking-heading .frozen-company { z-index: 18; }
.sheet-scrollbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex; align-items: center; gap: 3px;
  height: var(--sheet-scrollbar-height); padding: 3px 5px;
  border-top: 1px solid #85949e; background: #e5ebef; color: #243d4c;
  user-select: none;
}
.sheet-scrollbar[hidden] { display: none; }
.sheet-scrollbar button {
  flex: none; width: 26px; height: 21px; padding: 0; line-height: 17px;
  border: 1px solid #93a4ae; border-radius: 2px; background: #fff; color: #243d4c;
}
.sheet-scrollbar button:disabled { opacity: .4; }
.sheet-scrollbar-track {
  position: relative; flex: 1; min-width: 0; height: 20px;
  border: 1px solid #a3afb8; border-radius: 3px; background: #d0d9df;
  cursor: pointer; touch-action: none;
}
.sheet-scrollbar-thumb {
  position: absolute; top: 1px; bottom: 1px; left: 0;
  min-width: 24px; border: 1px solid #426678; border-radius: 3px;
  background: #7994a3; cursor: grab; touch-action: none;
}
.sheet-scrollbar-track:active .sheet-scrollbar-thumb { cursor: grabbing; }
.sheet-scrollbar-track[aria-disabled="true"] { cursor: default; }
.sheet-scrollbar-track[aria-disabled="true"] .sheet-scrollbar-thumb {
  background: #b6c3cb; border-color: #8ea1ad; cursor: default;
}
.sheet-scrollbar-track:focus-visible { outline: 2px solid #217346; outline-offset: 1px; }
@media print {
  .sheet-scrollbar, .compact-header, .workbook-titlebar { display: none !important; }
  .sheet-viewport-page, .sheet-viewport-page .main-content,
  .sheet-viewport-page .source-workspace { display: block; height: auto; overflow: visible; padding: 0; }
  .worksheet-grid .frozen-column, .tracking-table .frozen-company,
  .tracking-table .tracking-heading { position: static !important; box-shadow: none; }
}
