/* The tab strip stays below the scrollable grid. */
.grid-work { min-height: 0; isolation: isolate; }
#grid-viewport { min-height: 0; }
.sheet-bar {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: .4rem;
  min-width: 0;
  padding: .3rem .5rem;
  background: var(--bg);
}
.sheet-bar > button { flex: none; }
.grid-status { flex: 0 0 auto; }
.sheet-tabs { display: flex; align-items: center; gap: .3rem; flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; }
.sheet-bar :is(.sheet-tab, .sheet-control) {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  font: 600 13px/1.3 var(--font-b, Inter, sans-serif);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.sheet-bar :is(.sheet-tab, .sheet-control):hover:not(:disabled) { background: var(--tint); border-color: var(--line-strong); }
.sheet-bar .sheet-tab[aria-current=true] { background: var(--lilac); color: var(--acc); }
.sheet-bar :is(.sheet-tab, .sheet-control):focus-visible { outline: 2px solid var(--acc); outline-offset: -2px; }
.sheet-bar .sheet-control:disabled { opacity: .4; cursor: default; }
#sheet-management { width: min(680px, 94vw); max-height: 80vh; overflow: auto; }
.sheet-management-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding-block: .45rem; }
.sheet-management-row input:first-child { flex: 1 1 9rem; min-width: 0; }
#sheet-feedback:empty { display: none; }
@media (max-width: 560px) {
  .sheet-bar { gap: .25rem; padding-inline: .4rem; }
}
#grid-templates { padding: .75rem 1rem 1rem; }
#grid-templates h3 { margin: 0 0 .5rem; font-size: 1rem; }
.grid-template-list { display: flex; gap: .4rem; flex-wrap: wrap; }
@media print { .sheet-bar { display: none !important; } }

/* The browser pins the headings on the scroll axes, including during touch scrolling. */
.grid-canvas { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
#cell-layer { position: absolute; inset: 0; }
.column-heads, .row-heads, .grid-corner {
  grid-area: 1 / 1;
  align-self: start;
  justify-self: start;
  position: sticky;
}
.column-heads { top: 0; left: auto; width: 100%; }
.row-heads { top: auto; left: 0; height: 100%; }
.grid-corner { top: 0; left: 0; }
.column-heads .grid-edge-add, .row-heads .grid-edge-add { pointer-events: auto; }
