/* Workspace frame: tab strip, page, toolbar, page control, empty state. Note content is in workspace-note.css. */

.ws {
  display: flex;
  flex: 1;
  gap: 2px;
  min-width: 0;
  min-height: 0;
}

.ws-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.sheet {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

/* Tabs */
.tabrow {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tabs {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 3px 3px 7px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab-list { display: flex; flex: none; align-items: center; gap: 5px; }
.tab-list:empty { display: none; }

.tab {
  display: flex;
  flex: none;
  align-items: center;
  gap: 2px;
  box-sizing: content-box;
  max-width: 280px;
  height: 30px;
  padding: 0 4px 0 12px;
  border: 1px solid var(--tedge);
  border-bottom-width: 2px;
  border-radius: 2px;
  background: var(--tab);
  color: color-mix(in srgb, var(--fg) 70%, var(--muted));
  font: 400 12px var(--font-ui);
  cursor: pointer;
  user-select: none;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.tab:active { transform: translateY(1px); }
body.tab-dragging,
body.tab-dragging * { cursor: grabbing !important; user-select: none; }

.tab:hover { border-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.tab[aria-selected="true"] {
  border-color: var(--accent);
  background: var(--sel-bg);
  color: var(--fg);
  box-shadow: var(--sel-glow);
}

/* a pinned tab: a 2px accent strip along the top (over the border), and an accent pin */
.tab.pinned { position: relative; }
.tab.pinned::before { position: absolute; top: -1px; right: -1px; left: -1px; height: 2px; background: var(--accent); content: ""; }
.tab.pinned .tab-btn { color: var(--accent); }

.tab-name {
  padding-right: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-btn {
  display: grid;
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  place-items: center;
  border: none;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font: 500 15px/1 var(--font-ui);
  cursor: pointer;
}

/* × and the pin show on the open tab, a pinned one, or on hover */
.tab .tab-btn { display: none; }
.tab[aria-selected="true"] .tab-btn,
.tab.pinned .tab-btn { display: grid; }

@media (hover: hover) {
  .tab:hover .tab-btn { display: grid; }
  .tab-btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--fg); }
}

/* The System's pin, 11px: a filled head and a 1.6 needle */
.tab-btn svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.tab-btn svg .head { fill: currentColor; stroke: none; }

.tab-rename {
  box-sizing: content-box;
  width: 120px;
  padding: 2px 4px;
  border: none;
  border-radius: 3px;
  outline: 1px solid var(--accent);
  background: transparent;
  color: var(--fg);
  font: inherit;
}

.tab-add {
  flex: none;
  height: 30px;
  padding: 0 12px;
  border: 1px dashed var(--tedge);
  border-bottom: 2px solid var(--tedge);
  border-radius: 2px;
  background: none;
  color: var(--muted);
  font: 400 12px var(--font-ui);
  cursor: pointer;
}

.tab-add:hover { border-color: var(--accent); color: var(--accent); }

/* Page */
.page {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--tedge);
  border-radius: 4px;
  background: var(--sheet);
}

.page:focus-within { border-color: var(--accent); }
.page[hidden] { display: none; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  min-height: 43px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--tline);
}

.tool {
  display: grid;
  min-width: 32px;
  height: 30px;
  padding: 0 6px;
  place-items: center;
  /* the ring is a real border, not an inset shadow: Safari drops an edge of an inset shadow when
     the button lands on a fractional pixel */
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font: 400 12px/1 var(--font-ui);
  cursor: pointer;
}

@media (hover: hover) {
  .tool:hover:not(:disabled):not([aria-pressed="true"]) {
    border-color: var(--tedge);
    background: var(--tab);
    color: var(--fg);
  }
}

/* pressed (hovered or not): an accent ring with a 2px bottom; the 1px top padding keeps the face
   where it sits unpressed */
.tool[aria-pressed="true"] {
  padding-top: 1px;
  border-color: var(--accent);
  border-bottom-width: 2px;
  background: var(--sel-bg);
  color: var(--fg);
}

/* Page control */
.pager {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.pager .tool { min-width: 26px; font-size: 14px; }
.pager .tool.pg-more { font-size: 12px; }
.pager .tool:disabled { opacity: .3; cursor: default; }

.pg-box {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pg-in {
  box-sizing: content-box;
  width: 3ch;
  height: 20px;
  padding: 0 4px;
  border: 1px solid var(--tedge);
  border-bottom-width: 2px;
  border-radius: 2px;
  background: var(--tab);
  color: var(--fg);
  font: 500 12px var(--font-ui);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.multi .pg-in { border-color: var(--tline); }
.pg-in:focus { outline: none; border-color: var(--accent); background: var(--sheet); }
.pg-in.bad { border-color: var(--danger); animation: pgshake .28s steps(4); }

@keyframes pgshake {
  25% { transform: translateX(-2px); }
  75% { transform: translateX(2px); }
}

@media (prefers-reduced-motion: reduce) {
  .pg-in.bad { animation: none; }
}

.edwrap {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

/* Nothing open */
.empty {
  display: grid;
  flex: 1;
  min-height: 0;
  padding: 24px;
  place-content: center;
  justify-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--sheet);
  color: var(--muted);
  font-size: 12px;
}

.empty[hidden] { display: none; }

.empty-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 600px;
}
