/* Mark palette, folder tabs (W-A3, Jeff picked A on 10-27, "a little smaller still"). gn-mark-compact.js sets
   html[data-gn-mark="tabs"]. Placement only: every tile, icon, card and control keeps its kit paint. The Stamp
   (Overlays) takeover keeps its own card, so these rules step aside in stamps mode.
   Width: six 44 px swatches across the settings card set it (290 px with the sheet and card edges); every tap
   target stays 44 px. */

/* Icon-only tiles. The name stays as the button's accessible name and title. */
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-tool-grid .tool-button {
  grid-template-columns: 1fr;
  place-items: center;
  height: 44px;
  min-height: 44px;
  padding: 0;
}
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-tool-grid .tool-button::after { content: none; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-tool-grid .tool-button svg { width: 22px; height: 22px; }
/* The Markup / Shapes split is replaced by the folders: every tile sits in one grid. */
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-category-tabs { display: none; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar :is(.annotation-category-row, .annotation-category-row[hidden], .annotation-singletons) { display: contents !important; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-palette-title { display: none; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-scope-stack { margin-right: 0; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-scope-stack .gn-k-sub { display: none; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-scope-toggle button { padding: 0 6px; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar :is(.ink-subtool-row, .lasso-palette, .layer-palette, .history-palette) {
  grid-column: 1 / -1;
  grid-row: 3;
}
/* The settings card keeps every control; at this width the label column narrows so nothing runs off the card. */
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .ink-subtool-row { grid-template-columns: minmax(0, 1fr); }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .tool-settings { min-width: 0; grid-template-columns: minmax(0, 1fr); }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .tool-settings > * { min-width: 0; max-width: 100%; box-sizing: border-box; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-range-control { grid-template-columns: 84px minmax(0, 1fr) 34px; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-utilities { grid-row: 4; gap: 6px; padding-top: 0; }

/* One column, 290 wide: header, folder tabs + tools, settings card, undo row. */
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar.annotation-rail {
  width: min(290px, calc(100vw - 16px));
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: 44px auto auto auto;
  gap: 6px;
  padding: 10px;
}
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-session-actions { grid-column: 1; grid-row: 1; gap: 4px; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-scope-stack { grid-column: 2; grid-row: 1; justify-self: center; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar #annotationHandle { grid-column: 3; grid-row: 1; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-tool-grid {
  grid-column: 1 / -1;
  grid-row: 2;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0 6px;
}
/* Folder tabs across, the shrink button at the end of the row. */
html[data-gn-mark="tabs"] #annotationToolbar .gn-mark-folders {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 4px;
  align-items: end;
  margin-bottom: 6px;
  padding: 0;
  border-bottom: 1px solid rgba(96, 76, 46, .18);
}
html[data-gn-mark="tabs"] #annotationToolbar .gn-mark-folders::before { content: none; }
html[data-gn-mark="tabs"] #annotationToolbar .gn-mark-folder-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; min-width: 0; }
/* File-folder tabs: rounded on top only; the open folder reads as raised by its fill, so every tab keeps 44 px. */
html[data-gn-mark="tabs"] #annotationToolbar .gn-mark-folder {
  min-height: 44px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 2px;
  border-radius: 10px 10px 0 0;
  margin-bottom: -1px;
}
html[data-gn-mark="tabs"] #annotationToolbar .gn-mark-folder .gn-k-label { font-size: 12px; overflow: hidden; text-overflow: clip; }
html[data-gn-mark="tabs"] #annotationToolbar .gn-mark-collapse {
  flex: none; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; margin-bottom: 2px; }
html[data-gn-mark="tabs"] #annotationToolbar .gn-mark-collapse svg { width: 20px; height: 20px; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .annotation-tool-grid .tool-button[data-mark-folder] { display: none; }
html[data-gn-mark="tabs"] #annotationToolbar[data-mark-folder="draw"] .annotation-tool-grid .tool-button[data-mark-folder="draw"],
html[data-gn-mark="tabs"] #annotationToolbar[data-mark-folder="shapes"] .annotation-tool-grid .tool-button[data-mark-folder="shapes"],
html[data-gn-mark="tabs"] #annotationToolbar[data-mark-folder="notate"] .annotation-tool-grid .tool-button[data-mark-folder="notate"],
html[data-gn-mark="tabs"] #annotationToolbar[data-mark-folder="page"] .annotation-tool-grid .tool-button[data-mark-folder="page"] { display: grid !important; }
/* The shrink button belongs to the folder palette only; the stamp takeover has its own card. */
html[data-gn-mark="tabs"] body.stamps-mode #annotationToolbar .gn-mark-folders { display: none; }

/* Collapsed: the palette steps out of the way (it keeps its spot) and the chip stands in for it. */
html[data-gn-mark-collapsed="on"] body.annotation-mode #annotationToolbar { visibility: hidden !important; pointer-events: none !important; }
.gn-mark-chip {
  position: fixed;
  z-index: 2147482000;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: linear-gradient(180deg, #F6F1E6 0%, #EFE8DA 100%);
  box-shadow: 0 10px 24px -10px rgba(60, 40, 10, .45), 0 0 0 1px rgba(96, 76, 46, .16), inset 0 0 0 3px var(--gn-chip-ink, #2A2318);
  color: var(--gn-chip-ink, #2A2318);
  cursor: grab;
}
.gn-mark-chip[hidden] { display: none; }
.gn-mark-chip.dragging { cursor: grabbing; box-shadow: 0 16px 30px -12px rgba(60, 40, 10, .55), 0 0 0 1px rgba(96, 76, 46, .16), inset 0 0 0 3px var(--gn-chip-ink, #2A2318); }
.gn-mark-chip-tool { display: grid; place-items: center; width: 26px; height: 26px; }
.gn-mark-chip-tool svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
/* Light inks (pastels, yellow) still read: the icon keeps a dark edge. */
.gn-mark-chip-tool svg { filter: drop-shadow(0 0 .6px rgba(42, 35, 24, .9)); }
.gn-mark-chip-expand {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #2A2318;
  color: #F6F1E6;
  box-shadow: 0 0 0 2px #F6F1E6;
}
.gn-mark-chip-expand svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Colours in the narrow card: the palette grid is six 44 px swatches, which reaches into the card's own padding. */
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .tool-settings > .gn-colour-palettes { max-width: none; margin-inline: -6px; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .gn-shared-colour-control { width: 100%; grid-template-columns: 80px 46px minmax(0, 1fr); }
/* The highlighter's 18 pastels: six across, three down. */
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .highlighter-swatches { display: grid !important; grid-template-columns: repeat(6, 44px) !important; justify-content: center; gap: 0 !important; max-width: none; margin-inline: -6px; }
html[data-gn-mark="tabs"] body.annotation-mode:not(.stamps-mode) #annotationToolbar .gn-colour-picker-panel { padding-inline: 6px; }
