/*
 * Workbench — page-specific layout only (Lane A). Shared chrome (topbar, wrap,
 * lede, card, spinner, banner) comes from board.css (READ-ONLY); every colour
 * and spacing value here is a theme.css token. Scoped under #s-workbench so the
 * screen lifts into the quotebench shell as an `s-` section without a restyle.
 *
 * Emphasis vocabulary: the two hero lanes carry the state colours — needs_human
 * in the blocked pair (--gap-ink: it is ON you), waiting in the attention pair
 * (--look: the round is in flight). Pipeline lanes stay neutral; done/dead
 * collapse to quiet count chips.
 */

/* ── controls row: intake card + kind filter ─────────────────────────── */
#s-workbench .controls {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  margin-bottom: var(--gap);
}
#s-workbench .intake-title {
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 10px;
}
#s-workbench .intake-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: end;
}
@media (min-width: 860px) {
  #s-workbench .intake-grid {
    grid-template-columns: 2fr 1fr 1fr auto;
  }
}
#s-workbench .filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
#s-workbench .filter-row label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
}

/* ── form controls ───────────────────────────────────────────────────── */
#s-workbench .field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#s-workbench .field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2);
}
#s-workbench input[type="text"],
#s-workbench input[type="file"],
#s-workbench select {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  min-height: 44px;
  max-width: 100%;
}
#s-workbench .field-err {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gap-ink);
}
#s-workbench .field-err:empty {
  display: none;
}

/* Buttons: 44px touch targets; primary rides the brand pair. */
#s-workbench button {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  min-height: 44px;
  cursor: pointer;
}
#s-workbench button:hover {
  background: var(--line-2);
}
#s-workbench button:disabled {
  opacity: 0.55;
  cursor: default;
}
#s-workbench button.primary {
  color: var(--brand-ink);
  background: var(--brand);
  border-color: var(--brand);
}

/* ── lanes + panel layout ────────────────────────────────────────────── */
#s-workbench .workbench-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}
@media (min-width: 940px) {
  #s-workbench .workbench-body {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  #s-workbench .panel {
    width: 380px;
    position: sticky;
    top: var(--gap);
    max-height: calc(100vh - 2 * var(--gap));
    overflow-y: auto;
  }
}
/* Narrow screens: the panel becomes a bottom sheet over the lanes. */
@media (max-width: 939px) {
  #s-workbench .panel {
    position: fixed;
    inset: auto 0 0 0;
    max-height: 82vh;
    overflow-y: auto;
    z-index: 10;
    border-radius: var(--r) var(--r) 0 0;
    box-shadow: 0 -6px 24px rgba(16, 24, 40, 0.2);
  }
}

#s-workbench .lanes {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  align-items: start;
}
@media (min-width: 700px) {
  #s-workbench .lanes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #s-workbench .lane.hero {
    grid-column: 1 / -1;
  }
}

/* ── lane chrome ─────────────────────────────────────────────────────── */
#s-workbench .lane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 12px;
}
#s-workbench .lane-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
#s-workbench .lane-name {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}
#s-workbench .lane-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  min-width: 22px;
  text-align: center;
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--ink-2);
  background: var(--paper-2);
}
#s-workbench .lane-hint {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--ink-3);
}
#s-workbench .lane-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
#s-workbench .lane-empty {
  margin: 10px 0 0;
  color: var(--ink-3);
  font-size: 0.85rem;
}

/* Hero emphasis: the two lanes an estimator works from. */
#s-workbench .lane.hero {
  border-left-width: 5px;
}
#s-workbench .lane.hero .lane-name {
  font-size: 1.1rem;
}
#s-workbench .lane.hero[data-status="needs_human"] {
  border-left-color: var(--gap-ink);
}
#s-workbench .lane.hero[data-status="needs_human"] .lane-count {
  color: var(--gap-ink);
  background: var(--gap-bg);
}
#s-workbench .lane.hero[data-status="waiting"] {
  border-left-color: var(--look);
}
#s-workbench .lane.hero[data-status="waiting"] .lane-count {
  color: var(--look);
  background: var(--look-bg);
}

/* Settled lanes (done/dead): a quiet chip row; the name toggles the body. */
#s-workbench .lane.settled {
  background: var(--paper-2);
  box-shadow: none;
  padding: 8px 12px;
}
#s-workbench .lane-toggle {
  min-height: 44px;
  padding: 4px 8px;
  border: 0;
  background: none;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-2);
}
#s-workbench .lane-toggle[aria-expanded="true"] {
  color: var(--ink);
}

/* ── work-item cards ─────────────────────────────────────────────────── */
#s-workbench .wi-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}
#s-workbench .wi-card.open {
  border-color: var(--brand);
  background: var(--brand-soft);
}
#s-workbench .wi-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
#s-workbench .wi-title {
  min-height: 44px;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
#s-workbench .wi-title:hover {
  color: var(--brand-ink);
  text-decoration: underline;
}
#s-workbench .chip.kind {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--neutral);
  background: var(--paper-2);
  border: 1px solid var(--line);
}
#s-workbench .wi-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--ink-2);
}
#s-workbench .wi-stamp {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-3);
}
#s-workbench .wi-tender {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--brand-ink);
}

/* ── detail panel ────────────────────────────────────────────────────── */
#s-workbench .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: var(--gap);
}
#s-workbench .panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
#s-workbench .panel-title {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 800;
  margin: 0;
}
#s-workbench .panel-ref {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-3);
}
#s-workbench .panel-close {
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
}
#s-workbench .panel-section {
  border-top: 1px solid var(--line-2);
  margin-top: 12px;
  padding-top: 10px;
}
#s-workbench .panel-section h3 {
  font-family: var(--display);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  margin: 0 0 8px;
}
#s-workbench .panel-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
#s-workbench .wi-fields {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 10px 0 0;
  font-size: 0.85rem;
}
#s-workbench .wi-fields dt {
  color: var(--ink-3);
}
#s-workbench .wi-fields dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}
#s-workbench .move-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#s-workbench .terminal-note {
  margin: 0;
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-3);
}
#s-workbench .hint {
  margin: 0 0 8px;
  font-size: 0.8rem;
  color: var(--ink-2);
}
#s-workbench .slot:empty {
  display: none;
}
#s-workbench .slot {
  margin-top: 8px;
}
#s-workbench .err-msg {
  margin: 0;
}
#s-workbench .err-details {
  margin: 6px 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  overflow-x: auto;
  color: var(--gap-ink);
}

/* Import result + artifacts + status log. */
#s-workbench .import-summary {
  margin: 0;
  font-weight: 600;
  color: var(--ready);
}
#s-workbench .import-unpriced-head {
  margin: 6px 0 2px;
  font-size: 0.82rem;
  color: var(--look);
}
#s-workbench .import-unpriced {
  margin: 0;
  padding-left: 20px;
  font-family: var(--mono);
  font-size: 0.78rem;
}
#s-workbench .artifacts,
#s-workbench .status-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#s-workbench .artifact,
#s-workbench .log-entry {
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--paper);
  padding: 6px 8px;
  font-size: 0.82rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}
#s-workbench .a-name {
  font-weight: 600;
}
#s-workbench .a-link {
  flex-basis: 100%;
  font-family: var(--mono);
  font-size: 0.74rem;
  overflow-wrap: anywhere;
}
#s-workbench .log-status {
  font-family: var(--mono);
  font-weight: 600;
}
/* An allocation is not a transition, and the history must not read as though it
   were (s103). Brand amber on its soft tint separates the two row types at a
   glance, so a run of "received / received / received" can never be mistaken for
   a stuck status. */
#s-workbench .log-allocation {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--brand-soft);
  color: var(--brand-ink);
}
#s-workbench .log-stamp {
  margin-left: auto;
  font-size: 0.74rem;
  color: var(--ink-3);
}
#s-workbench .log-note {
  flex-basis: 100%;
  margin: 0;
  color: var(--ink-2);
}
