/* Workbench kit (docs/design/workbench-ia.md). Uses the Appendix G.1 tokens from design-tokens.css; nothing here sets a new palette
 * except the target mark, which needs a teal that the shared palette does not carry. Squares for status, no zebra, no color alone. */
:root { --wb-target: #0A7C7A; --wb-edge: 4px; --wb-touch: 40px; }

/* Page header: title, purpose, freshness, Help and at most one primary button, then path tabs. */
.wb-page-header { margin: 0 0 18px; }
.wb-title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.wb-title-row h1 { margin: 0; color: var(--navy); font: 700 26px/1.2 var(--font-display); }
.wb-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wb-purpose { margin: 6px 0 0; color: var(--ink); max-width: 72ch; }
.wb-freshness { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.wb-tabs { display: flex; flex-wrap: nowrap; gap: 4px; margin-top: 14px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.wb-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 14px; margin-bottom: -1px; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; }
.wb-tab:hover { color: var(--navy); background: var(--tint); }
.wb-tab[aria-current="page"] { color: var(--navy); border-bottom-color: var(--blue); }
.wb-tab-count { min-width: 20px; padding: 0 6px; border-radius: 2px; background: var(--track); color: var(--ink); font-size: 12px; font-weight: 600; line-height: 20px; text-align: center; }

/* Marks: an 8px square plus a word. Source and target differ in color and in word. */
.wb-status, .wb-type { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); white-space: nowrap; }
.wb-status { max-width: 100%; }
.wb-mark, .wb-type-mark { flex: 0 0 8px; width: 8px; height: 8px; background: var(--dot-neutral); }
.wb-status[data-tone="good"] .wb-mark { background: var(--good); }
.wb-status[data-tone="warn"] .wb-mark { background: var(--warn-dot); }
.wb-status[data-tone="bad"] .wb-mark { background: var(--bad); }
.wb-status[data-tone="busy"] .wb-mark { background: var(--blue); }
/* Not started and not required: a hollow square, so "nothing yet" never reads as a filled state. */
.wb-status[data-tone="hollow"] .wb-mark { background: transparent; box-shadow: inset 0 0 0 1.5px var(--icon); }
.wb-type { font-weight: 600; }
.wb-type[data-type="source"] .wb-type-mark { background: var(--navy); }
.wb-type[data-type="target"] .wb-type-mark { background: var(--wb-target); }

/* Data table: scrolls sideways inside its own wrapper, never the page. No zebra; rows are separated by hairlines. */
.wb-table { min-width: 0; max-width: 100%; }
.wb-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.wb-table-grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.wb-table-grid th, .wb-table-grid td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.wb-table-grid thead th { background: var(--page); color: var(--navy); font-weight: 600; white-space: nowrap; }
.wb-table-grid .wb-col-number { text-align: right; }
.wb-table-grid .wb-select { width: 44px; padding-right: 4px; }
.wb-table-grid .wb-select input { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.wb-table-grid .wb-row-open { white-space: nowrap; }
.wb-sort { min-height: 32px; padding: 4px 6px; margin: -4px -6px; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; }
.wb-sort:hover { background: var(--tint); }
th[aria-sort="ascending"] .wb-sort::after { content: " \2191"; }
th[aria-sort="descending"] .wb-sort::after { content: " \2193"; }
.wb-filter-row td { padding: 4px 8px; background: var(--white); }
.wb-filter-row input { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.wb-row:hover { background: var(--tint); }
.wb-row:last-child td { border-bottom: 0; }
/* The colored left edge: attention rows sort first and carry it. */
.wb-attention-bad > td:first-child { box-shadow: inset var(--wb-edge) 0 0 var(--bad); }
.wb-attention-warn > td:first-child { box-shadow: inset var(--wb-edge) 0 0 var(--warn-dot); }
.wb-row-open { min-height: 32px; padding: 2px 4px; margin: -2px -4px; border: 0; background: transparent; color: var(--blue); font: inherit; font-weight: 600; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.wb-row-open:hover { color: var(--blue-hover); }
.wb-empty { padding: 24px 12px; color: var(--muted); text-align: center; }
.wb-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.wb-pager-text { margin: 0 auto 0 0; color: var(--muted); font-size: 13px; }

/* Action bar: always visible above the table. A disabled verb states its reason in text, not in a tooltip. */
.wb-action-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.wb-selection-count { margin: 0; color: var(--navy); font-weight: 600; }
.wb-verbs { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 12px; }
.wb-verb { display: inline-flex; flex-direction: column; gap: 2px; max-width: 260px; }
.wb-verb-hint { color: var(--muted); font-size: 12.5px; }
/* Verb groups: one menu button each; the menu opens under its button and is only in the page while open. */
.wb-verb-group { position: relative; }
.wb-menu-button { min-height: var(--wb-touch); }
.wb-menu-button::after { content: ""; display: inline-block; margin-left: 8px; vertical-align: 2px; border: 4px solid transparent; border-top-color: currentColor; border-bottom-width: 0; }
.wb-menu-button[aria-expanded="true"]::after { transform: rotate(180deg); }
.wb-menu { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; display: flex; flex-direction: column; gap: 2px; min-width: 240px; max-width: min(320px, calc(100vw - 32px)); padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); box-shadow: 0 8px 24px rgba(10, 30, 60, 0.18); }
.wb-menu[hidden] { display: none; }
.wb-menu-entry { display: flex; flex-direction: column; gap: 2px; }
.wb-menu-item { width: 100%; min-height: var(--wb-touch); justify-content: flex-start; text-align: left; border-color: transparent; background: transparent; }
.wb-menu-item:hover:not(:disabled), .wb-menu-item:focus-visible { background: var(--surface, #eef2f7); }
.wb-menu-entry .wb-verb-hint { padding: 0 10px 6px; }
.wb-view-toggle { display: inline-flex; }
.wb-view-toggle .wb-toggle { border-radius: 0; }
.wb-view-toggle .wb-toggle:first-child { border-radius: 8px 0 0 8px; }
.wb-view-toggle .wb-toggle:last-child { border-radius: 0 8px 8px 0; margin-left: -1px; }
.wb-view-toggle .wb-toggle[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--white); }

/* Drawer: a right-side panel that owns its scrolling. */
.wb-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; display: flex; flex-direction: column; width: min(480px, 100vw); background: var(--white); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(15, 36, 64, .12); }
.wb-drawer[hidden] { display: none; }
.wb-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.wb-drawer-title { margin: 0; color: var(--navy); font: 700 18px/1.3 var(--font-display); overflow-wrap: anywhere; }
.wb-drawer-tabs { display: flex; gap: 4px; padding: 8px 16px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.wb-drawer-tab { border-radius: 8px 8px 0 0; }
.wb-drawer-tab[aria-pressed="true"] { background: var(--tint); border-color: var(--chip-on-line); }
.wb-drawer-body { flex: 1; min-height: 0; padding: 16px; overflow-y: auto; }
.wb-guide-description { margin-top: 0; }
.wb-guide-steps { padding-left: 20px; }

/* Run log: one line per item, announced politely. */
.wb-run-log { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.wb-run-log h3 { margin: 0 0 8px; color: var(--navy); font-size: 15px; }
.wb-run-list { margin: 0; padding: 0; list-style: none; }
.wb-run-line { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 2px 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.wb-run-label { overflow-wrap: anywhere; }
.wb-run-reason { grid-column: 2; color: var(--bad); font-size: 13px; overflow-wrap: anywhere; }
.wb-run-summary { margin: 10px 0 0; color: var(--navy); font-weight: 600; }

/* Sidebar attention count: a square red count on the nav link. */
.nav-group > a .nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 2px; background: var(--bad); color: var(--white); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.nav-group > a .nav-count[hidden] { display: none; }

/* Tablets and phones: 40px touch targets, and the layout holds at 375px. */
@media (max-width: 1023px) {
  .wb-sort, .wb-row-open { min-height: var(--wb-touch); }
  .wb-pager button, .wb-action-bar button, .wb-title-row button, .wb-drawer button, .wb-view-toggle button { min-height: var(--wb-touch); }
  .wb-filter-row input { min-height: var(--wb-touch); }
  .wb-table-grid .wb-select { width: 48px; }
  .wb-table-grid .wb-select input { width: 24px; height: 24px; min-height: 24px; }
  .wb-tab { min-height: var(--wb-touch); }
}
@media (max-width: 599px) {
  /* A long status sentence wraps instead of pushing the page sideways (REL-01). */
  .wb-status { white-space: normal; align-items: flex-start; }
  .wb-status .wb-mark { margin-top: 6px; }
  .wb-title-row h1 { font-size: 22px; }
  .wb-header-actions { width: 100%; }
  .wb-header-actions button { flex: 1 1 auto; }
  .wb-action-bar { align-items: stretch; }
  .wb-verbs, .wb-verb { width: 100%; max-width: none; }
  .wb-verb button { width: 100%; }
  .wb-menu { left: 0; right: 0; min-width: 0; max-width: none; }
  .wb-table-grid { font-size: 13.5px; }
  .wb-table-grid th, .wb-table-grid td { padding: 8px; }
  .wb-pager { justify-content: space-between; }
  .wb-run-line { grid-template-columns: minmax(0, 1fr); }
  .wb-run-reason { grid-column: 1; }
}

/* A read-only value (a release ID, a derived name) is plainly not a field: muted fill, no field border, default cursor. It stays focusable and selectable so it can be copied. */
input[readonly], textarea[readonly] { background: var(--track); border-color: transparent; color: var(--ink); cursor: default; }
input[readonly]:focus-visible, textarea[readonly]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* A clamped cell stays on one line and ends in an ellipsis; its title holds the full text. */
.wb-table-grid td.wb-clamp { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Status word with a muted second line (RXCON-57): the word says who acts, the detail says what exactly; at most two lines, the full text is the tooltip ---- */
.wb-status:has(.wb-status-detail) { display: inline-grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; row-gap: 2px; align-items: center; white-space: normal; max-width: 36ch; }
.wb-status-detail { grid-column: 2; color: var(--muted); font-size: 12px; line-height: 1.3; overflow-wrap: anywhere; }
.wb-status-word { font-weight: 600; overflow-wrap: anywhere; }
.mon-security .wb-table-grid td { vertical-align: top; }
.mon-next { overflow-wrap: anywhere; max-width: 46ch; min-width: 24ch; }

/* ---- RXCON-58 WP1: tables show their important columns, scroll reachably and say so ---- */
.wb-table-grid [hidden] { display: none; }
/* The scroll region: reachable by keyboard (tabindex), edge shadows say there is more, and the select and open columns stay while it scrolls. */
.wb-table-wrap { background:
  linear-gradient(to right, var(--white) 30%, rgba(255, 255, 255, 0)) left center / 28px 100% no-repeat local,
  linear-gradient(to left, var(--white) 30%, rgba(255, 255, 255, 0)) right center / 28px 100% no-repeat local,
  radial-gradient(farthest-side at 0 50%, rgba(15, 36, 64, .22), rgba(15, 36, 64, 0)) left center / 10px 100% no-repeat scroll,
  radial-gradient(farthest-side at 100% 50%, rgba(15, 36, 64, .22), rgba(15, 36, 64, 0)) right center / 10px 100% no-repeat scroll,
  var(--white); }
.wb-table-wrap:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
/* A status with a detail line keeps a readable width; when it cannot, the table is "wider than its room" and the fit hides a lower priority column instead of squeezing it. */
.wb-table-grid td:has(.wb-status) { min-width: 16ch; }
.wb-table-grid td:has(.wb-status-detail) { min-width: 24ch; }
.wb-table-grid .wb-sticky { position: sticky; left: 0; z-index: 1; background: var(--white); }
.wb-table-grid thead .wb-sticky { background: var(--page); z-index: 2; }
.wb-table-grid.wb-has-select .wb-sticky:not(.wb-select) { left: 48px; box-shadow: 1px 0 0 var(--line); }
.wb-row:hover .wb-sticky { background: var(--tint); }
/* A row checkbox is a 24px box inside a larger hit area (GLB-12). */
.wb-table-grid .wb-select { width: 48px; }
.wb-table-grid .wb-select input { width: 22px; min-height: 22px; height: 22px; }
@media (pointer: coarse) { .wb-table-grid .wb-select input { width: 28px; min-height: 28px; height: 28px; } .wb-table-grid .wb-select { width: 56px; } .wb-table-grid.wb-has-select .wb-sticky:not(.wb-select) { left: 56px; } }
/* Columns control: one line above the table. */
.wb-table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0 0 8px; position: relative; }
.wb-table-tools[hidden] { display: none; }
.wb-columns-button { min-height: 36px; }
.wb-columns-note { color: var(--muted); font-size: 13px; }
.wb-columns-panel { position: absolute; z-index: 15; top: calc(100% + 4px); left: 0; display: grid; gap: 2px; min-width: 240px; max-width: min(360px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); box-shadow: 0 8px 24px rgba(10, 30, 60, .18); }
.wb-columns-item { display: flex; align-items: center; gap: 10px; min-height: 36px; margin: 0; font-weight: 500; }
.wb-columns-item input { width: 20px; min-height: 20px; height: 20px; margin: 0; accent-color: var(--blue); }
.wb-columns-reset { margin-top: 6px; }
/* Empty state: one sentence and at most one action, no table chrome around it (EMP-01). */
.wb-table[data-empty="true"] .wb-table-wrap { border-style: dashed; }
.wb-table[data-empty="true"] .wb-table-grid tbody tr:hover { background: transparent; }
.wb-empty-state { display: grid; justify-items: center; gap: 12px; padding: 16px 8px; }
.wb-empty-text { margin: 0; color: var(--muted); max-width: 56ch; }

/* The Related slot: from 1700 px it sits beside the table; below that it is a one-line strip above it so it never squeezes the columns (GLB-07). */
@media (min-width: 1200px) and (max-width: 1699px) {
  .wb-with-related.wb-slot { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
  .wb-with-related.wb-slot > .wb-main { order: 2; }
  .wb-with-related.wb-slot > .wb-related-host { order: 1; position: static; }
  .wb-with-related.wb-slot .wb-related-toggle { display: flex; }
  .wb-with-related.wb-slot .wb-related[data-open="false"] .wb-related-list { display: none; }
  .wb-with-related.wb-slot .wb-related-title { display: none; }
  .wb-with-related.wb-slot .wb-related[data-open="false"] .wb-related-scope { display: none; }
}
@media (min-width: 1700px) {
  .wb-with-related.wb-slot { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: 20px; }
}
