/* Unified business workbench. Mobile-first; all rules are scoped to the new shell. */

.workbench-ui {
  --workbench-purple: #6d56a5;
  --workbench-purple-soft: #f0ecf8;
  --workbench-orange: #ad631d;
  --workbench-orange-soft: #fff1e2;
  --workbench-cyan: #176f82;
  --workbench-cyan-soft: #e8f5f7;
}

.workbench-ui .page-shell {
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
}

.workbench-ui .page-heading {
  align-items: flex-start;
}

.workbench-ui .page-heading p {
  max-width: 760px;
}

.workbench-hero {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
  padding: 1.15rem;
  overflow: hidden;
  border: 1px solid #c9d9e6;
  border-radius: 18px;
  background:
    radial-gradient(circle at 90% 5%, rgba(55, 164, 155, 0.18), transparent 35%),
    linear-gradient(135deg, #f8fbfe, #edf6fa);
  box-shadow: 0 7px 20px rgba(22, 58, 95, 0.07);
  gap: 1rem;
}

.workbench-hero h1 {
  max-width: 780px;
}

.workbench-hero p {
  max-width: 800px;
  margin: 0;
  color: var(--ink-soft);
}

.workbench-hero-actions,
.bid-form-actions,
.proposal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.module-grid {
  display: grid;
  margin-bottom: 1rem;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}

.module-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 104px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(22, 58, 95, 0.045);
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.85rem;
}

.module-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  border-radius: 15px 15px 0 0;
  background: var(--blue);
  content: "";
}

.module-card:hover,
.module-card:focus-visible {
  transform: translateY(-2px);
  border-color: #a8c2d6;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.module-bid::before { background: var(--teal); }
.module-task::before { background: var(--workbench-orange); }
.module-assistant::before { background: var(--workbench-purple); }

.module-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 1rem;
  font-weight: 850;
}

.module-bid .module-icon { background: var(--teal-soft); color: var(--teal); }
.module-task .module-icon { background: var(--workbench-orange-soft); color: var(--workbench-orange); }
.module-assistant .module-icon { background: var(--workbench-purple-soft); color: var(--workbench-purple); }

.module-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem;
}

.module-copy strong {
  font-size: 1.03rem;
}

.module-copy > span {
  color: var(--ink-soft);
  font-size: 0.77rem;
}

.module-arrow {
  color: var(--ink-faint);
  font-size: 1.2rem;
}

.module-metric {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
}

.module-metric strong {
  color: var(--navy);
  font-size: 1.5rem;
  line-height: 1;
}

.module-metric small {
  margin-top: 0.25rem;
  color: var(--ink-faint);
  font-size: 0.67rem;
}

.module-disabled {
  opacity: 0.68;
}

.module-disabled::before {
  background: var(--line-strong);
}

.workbench-metrics,
.task-summary-grid {
  display: grid;
  margin-bottom: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.workbench-metrics a,
.task-summary-grid > div {
  display: flex;
  min-width: 0;
  min-height: 78px;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink-soft);
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 3px 10px rgba(22, 58, 95, 0.035);
}

.workbench-metrics span,
.task-summary-grid span {
  font-size: 0.74rem;
  font-weight: 700;
}

.workbench-metrics strong,
.task-summary-grid strong {
  color: var(--navy);
  font-size: 1.45rem;
  line-height: 1;
}

.summary-active { border-left: 4px solid var(--blue) !important; }
.summary-waiting { border-left: 4px solid var(--amber) !important; }
.summary-failed { border-left: 4px solid var(--red) !important; }

.workbench-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.workbench-panel,
.project-section {
  min-width: 0;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(22, 58, 95, 0.035);
}

.compact-task-list,
.recent-bid-list,
.record-list,
.requirement-list,
.finding-list,
.gate-list,
.version-list,
.artifact-list {
  display: grid;
  gap: 0.55rem;
}

.compact-task,
.recent-bid {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  gap: 0.65rem;
}

.compact-task:hover,
.recent-bid:hover {
  border-color: #a9c2d5;
  background: #f8fbfd;
}

.compact-task-copy,
.recent-bid > span:first-child {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.compact-task-copy strong,
.recent-bid strong {
  overflow: hidden;
  font-size: 0.84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-task-copy small,
.recent-bid small {
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-source-mark {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--blue);
}

.source-ocr { background: var(--teal); }
.source-large_upload { background: var(--workbench-orange); }
.source-work_task { background: var(--workbench-purple); }

.task-state,
.bid-phase,
.bid-lifecycle,
.requirement-status,
.version-state,
.artifact-state,
.operational-retry-note {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.18rem 0.52rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--slate-soft);
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 750;
  white-space: nowrap;
}

.state-queued,
.state-initiated,
.state-leased,
.state-running,
.state-uploading,
.state-hashing,
.state-scanning,
.state-retry_wait {
  border-color: #acd0e8;
  background: var(--blue-soft);
  color: #185b8e;
}

.state-waiting_input,
.state-waiting_approval,
.state-quarantined {
  border-color: #edcf91;
  background: var(--amber-soft);
  color: var(--amber);
}

.state-complete,
.state-succeeded,
.state-accepted,
.requirement-satisfied,
.version-released,
.artifact-released {
  border-color: #acd7be;
  background: var(--green-soft);
  color: var(--green);
}

.state-failed,
.state-rejected,
.badge-danger,
.version-checkpoint_conflict {
  border-color: #eab8b5;
  background: var(--red-soft);
  color: var(--red);
}

.state-cancelled,
.state-expired,
.gate-invalid,
.artifact-historical {
  opacity: 0.7;
}

.boundary-note,
.assistant-boundary {
  display: flex;
  align-items: flex-start;
  margin-top: 1rem;
  padding: 0.85rem;
  border: 1px solid #cad6e0;
  border-radius: 11px;
  background: #f7f9fb;
  color: var(--ink-soft);
  font-size: 0.78rem;
  gap: 0.55rem;
}

.boundary-note strong {
  flex: 0 0 auto;
  color: var(--ink);
}

.breadcrumb {
  display: flex;
  align-items: center;
  margin-bottom: 0.8rem;
  color: var(--ink-faint);
  font-size: 0.76rem;
  gap: 0.45rem;
}

.workbench-filter {
  display: grid;
  margin-bottom: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  grid-template-columns: 1fr;
  align-items: end;
  gap: 0.65rem;
}

.workbench-filter label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  gap: 0.28rem;
}

.workbench-filter input,
.workbench-filter select {
  min-height: 40px;
}

.bid-sales-workbench .bid-workbench-heading {
  align-items: flex-start;
  margin-bottom: 0.85rem;
}

.bid-workbench-primary-action {
  width: 100%;
}

.bid-workbench-primary-action .button {
  width: 100%;
  justify-content: center;
}

.bid-automation-notice {
  margin-bottom: 1.2rem;
}

.bid-flow-section,
.bid-attention-section,
.bid-project-ledger {
  margin-bottom: 1.5rem;
  scroll-margin-top: 6rem;
}

.bid-flow-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}

.bid-flow-card {
  display: grid;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(22, 58, 95, 0.05);
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.75rem;
}

.bid-flow-card:hover,
.bid-flow-card:focus-visible,
.bid-flow-card[aria-current="true"] {
  border-color: #82aeca;
  box-shadow: 0 9px 24px rgba(22, 58, 95, 0.1);
  transform: translateY(-1px);
}

.bid-flow-card[aria-current="true"] {
  outline: 3px solid rgba(24, 100, 171, 0.13);
}

.bid-flow-icon {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.92rem;
  font-weight: 850;
  place-items: center;
}

.flow-production .bid-flow-icon {
  background: #e8f5f2;
  color: var(--teal);
}

.flow-review .bid-flow-icon {
  background: #f1ecfb;
  color: var(--workbench-purple);
}

.bid-flow-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem;
}

.bid-flow-copy strong {
  color: var(--navy);
  font-size: 1.05rem;
}

.bid-flow-copy > span {
  color: var(--ink-soft);
  font-size: 0.75rem;
  line-height: 1.55;
}

.bid-flow-count {
  display: flex;
  align-items: flex-end;
  color: var(--navy);
  flex-direction: column;
}

.bid-flow-count strong {
  font-size: 1.35rem;
  line-height: 1;
}

.bid-flow-count small {
  margin-top: 0.2rem;
  color: var(--ink-faint);
  font-size: 0.62rem;
  white-space: nowrap;
}

.bid-flow-status,
.bid-flow-secondary {
  grid-column: 2 / -1;
  font-size: 0.7rem;
}

.bid-flow-status {
  color: var(--blue);
  font-weight: 750;
}

.bid-flow-secondary {
  min-height: 1em;
  color: var(--ink-faint);
}

.bid-attention-list {
  display: grid;
  gap: 0.65rem;
}

.bid-attention-item {
  display: flex;
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 12px;
  background: #fff;
  flex-direction: column;
  gap: 0.8rem;
}

.bid-attention-item.attention-input { border-left-color: var(--workbench-orange); }
.bid-attention-item.attention-task { border-left-color: var(--workbench-purple); }

.bid-attention-main {
  min-width: 0;
}

.attention-state {
  display: inline-flex;
  margin-bottom: 0.4rem;
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.64rem;
  font-weight: 800;
}

.bid-attention-main h3,
.bid-attention-main p {
  margin: 0;
}

.bid-attention-main h3 {
  color: var(--navy);
  font-size: 0.96rem;
}

.bid-attention-main p {
  margin-top: 0.28rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.55;
}

.bid-attention-main small {
  display: block;
  margin-top: 0.45rem;
  color: var(--ink-faint);
  font-size: 0.66rem;
}

.bid-attention-actions {
  display: flex;
  align-items: stretch;
  min-width: 0;
  flex-direction: column;
  gap: 0.45rem;
}

.bid-attention-actions form,
.bid-attention-actions .button {
  width: 100%;
}

.bid-attention-actions .button {
  justify-content: center;
}

.attention-unavailable {
  max-width: 260px;
  color: var(--ink-faint);
  font-size: 0.68rem;
  line-height: 1.45;
}

.bid-attention-empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fbfcfd;
}

.bid-advanced-filters {
  margin-bottom: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.bid-advanced-filters > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.7rem 0.85rem;
  color: var(--navy);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
  justify-content: space-between;
}

.bid-advanced-filters > summary span {
  color: var(--blue);
  font-size: 0.65rem;
}

.bid-advanced-filters .workbench-filter {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
}

.ledger-actions {
  display: flex;
  margin-top: 0.9rem;
  justify-content: center;
}

.bid-project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.bid-project-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(22, 58, 95, 0.04);
}

.bid-project-card:hover {
  border-color: #a8c2d6;
  box-shadow: var(--shadow);
}

.bid-review-search {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.bid-review-card {
  padding: 1.25rem;
}

.bid-review-card h2 {
  margin: 0 0 1rem;
  font-size: 1.08rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.bid-review-card h2 a {
  color: var(--ink);
}

.bid-review-answers {
  display: grid;
  gap: 0.9rem;
  margin: 0;
}

.bid-review-answers > div {
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}

.bid-review-answers > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.bid-review-answers dt {
  margin-bottom: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.bid-review-answers dd {
  margin: 0;
  font-weight: 700;
  line-height: 1.55;
}

.bid-review-answers p {
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 400;
  line-height: 1.65;
}

.bid-review-card .bid-opinion-card {
  margin: 1rem 0 0;
}

.bid-project-main {
  display: block;
  padding: 1rem;
  color: var(--ink);
}

.bid-project-topline,
.bid-project-meta,
.bid-project-foot,
.task-card-head,
.task-card-foot,
.conversation-head,
.assistant-thread-head,
.artifact-item,
.record-row,
.version-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.bid-project-no {
  color: var(--teal);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.bid-project-main h2,
.bid-project-main h3 {
  margin: 0.75rem 0 0.2rem;
  font-size: 1.08rem;
}

.bid-project-main > p {
  margin-bottom: 0.8rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.bid-state-triad,
.project-state-grid,
.project-facts,
.task-meta,
.action-proposal dl,
.version-item dl {
  display: grid;
  margin: 0;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.bid-state-triad > div,
.project-facts > div,
.task-meta > div,
.action-proposal dl > div,
.version-item dl > div {
  min-width: 0;
  padding: 0.55rem;
  border-radius: 8px;
  background: #f5f8fa;
}

.bid-state-triad dt,
.bid-state-triad dd,
.project-facts dt,
.project-facts dd,
.task-meta dt,
.task-meta dd,
.action-proposal dt,
.action-proposal dd,
.version-item dt,
.version-item dd {
  margin: 0;
}

.bid-state-triad dt,
.project-facts dt,
.task-meta dt,
.action-proposal dt,
.version-item dt {
  color: var(--ink-faint);
  font-size: 0.65rem;
}

.bid-state-triad dd,
.project-facts dd,
.task-meta dd,
.action-proposal dd,
.version-item dd {
  margin-top: 0.1rem;
  overflow-wrap: anywhere;
  font-size: 0.76rem;
  font-weight: 700;
}

.bid-project-meta {
  align-items: flex-start;
  margin-top: 0.75rem;
  color: var(--ink-faint);
  font-size: 0.68rem;
  flex-direction: column;
}

.bid-project-foot {
  justify-content: flex-start;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--line);
  background: #fafbfd;
  color: var(--ink-soft);
  font-size: 0.68rem;
  flex-wrap: wrap;
}

.bid-updated { margin-left: auto; color: var(--ink-faint); }
.risk-count.has-risk { color: var(--red); font-weight: 800; }

.bid-create-form {
  max-width: 900px;
}

.bid-form-grid {
  grid-template-columns: 1fr;
}

.bid-form-actions {
  justify-content: flex-end;
}

.project-tabs {
  position: sticky;
  z-index: 15;
  top: 126px;
  display: flex;
  margin: 0 0 1rem;
  padding: 0.3rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 5px 15px rgba(22, 58, 95, 0.06);
  scrollbar-width: thin;
  backdrop-filter: blur(8px);
  gap: 0.2rem;
}

.project-tabs a {
  flex: 0 0 auto;
  padding: 0.5rem 0.68rem;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 750;
  white-space: nowrap;
}

.project-tabs a:hover,
.project-tabs a[aria-current="location"] {
  background: var(--navy);
  color: #fff;
}

.project-section {
  scroll-margin-top: 190px;
}

.project-section .section-heading p {
  margin: 0.18rem 0 0;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.project-state-grid {
  margin-bottom: 0.8rem;
}

.project-state-grid > div {
  min-width: 0;
  padding: 0.8rem;
  border-left: 4px solid var(--blue);
  border-radius: 9px;
  background: #f5f8fb;
}

.project-state-grid > div:nth-child(2) { border-color: var(--teal); }
.project-state-grid > div:nth-child(3) { border-color: var(--workbench-purple); }

.project-state-grid dt,
.project-state-grid dd {
  margin: 0;
}

.project-state-grid dt {
  color: var(--ink-faint);
  font-size: 0.68rem;
  font-weight: 700;
}

.project-state-grid dd {
  margin: 0.18rem 0;
  color: var(--navy);
  font-size: 0.96rem;
  font-weight: 800;
}

.project-state-grid small {
  color: var(--ink-soft);
  font-size: 0.67rem;
}

.project-summary {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-left: 3px solid #9eb7ca;
  background: #f8fafc;
}

.project-summary strong { font-size: 0.75rem; }
.project-summary p { margin: 0.25rem 0 0; color: var(--ink-soft); white-space: pre-wrap; }

.gate-board {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--line-strong);
}

.inline-create-panel {
  margin-bottom: 0.8rem;
  border: 1px dashed #a8bfd1;
  border-radius: 10px;
  background: #f8fbfd;
}

.inline-create-panel > summary {
  padding: 0.7rem 0.8rem;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.inline-create-panel[open] > summary {
  border-bottom: 1px solid var(--line);
}

.inline-create-form {
  display: grid;
  padding: 0.8rem;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}

.inline-form-actions {
  display: flex;
  justify-content: flex-end;
}

.gate-item,
.requirement-item,
.finding-item {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  gap: 0.65rem;
}

.gate-status {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 850;
}

.gate-invalid .gate-status {
  background: var(--slate-soft);
  color: var(--ink-faint);
}

.gate-item > div,
.requirement-item > div,
.finding-item > div {
  min-width: 0;
  flex: 1;
}

.gate-item p,
.requirement-item p,
.finding-item p {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  white-space: pre-wrap;
}

.gate-item small,
.requirement-item small,
.finding-item small {
  display: block;
  margin-top: 0.3rem;
  color: var(--ink-faint);
  font-size: 0.67rem;
}

.requirement-status,
.finding-severity {
  flex: 0 0 auto;
}

.requirement-open {
  border-color: #edcf91;
  background: var(--amber-soft);
  color: var(--amber);
}

.finding-severity {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 850;
}

.severity-red { border-left: 4px solid var(--red); }
.severity-red .finding-severity { background: var(--red); }
.severity-amber { border-left: 4px solid #d99426; }
.severity-amber .finding-severity { background: #d99426; }
.severity-green { border-left: 4px solid var(--green); }
.severity-green .finding-severity { background: var(--green); }
.finding-closed { opacity: 0.72; }

.record-row,
.artifact-item,
.version-item {
  align-items: flex-start;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  flex-direction: column;
}

.record-row > div,
.artifact-item > div,
.version-item > div:first-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.record-row small,
.artifact-item small,
.version-item small {
  color: var(--ink-faint);
  font-size: 0.67rem;
  overflow-wrap: anywhere;
}

.version-item dl {
  width: 100%;
}

.artifact-unavailable {
  color: var(--ink-faint);
  font-size: 0.7rem;
}

.task-card-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.task-card {
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-left: 4px solid #9bb3c6;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(22, 58, 95, 0.035);
}

.task-card.state-group-active { border-left-color: var(--blue); }
.task-card.state-group-waiting { border-left-color: #d58a18; }
.task-card.state-group-succeeded { border-left-color: var(--green); }
.task-card.state-group-failed,
.task-card.state-group-blocked { border-left-color: var(--red); }

.task-card-head {
  align-items: flex-start;
}

.task-card-head > div {
  min-width: 0;
}

.task-card h2,
.task-card h3 {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.task-card h2 a { color: var(--ink); }

.task-card-head p {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 0.75rem;
}

.task-source {
  display: inline-flex;
  align-items: center;
  color: var(--ink-faint);
  font-size: 0.67rem;
  font-weight: 750;
  gap: 0.35rem;
}

.task-progress {
  display: grid;
  margin: 0.8rem 0;
  padding: 0.65rem;
  border-radius: 9px;
  background: #f5f8fa;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.task-progress progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 99px;
  background: #dbe4eb;
  accent-color: var(--blue);
}

.task-progress progress::-webkit-progress-bar { background: #dbe4eb; border-radius: 99px; }
.task-progress progress::-webkit-progress-value { background: var(--blue); border-radius: 99px; }

.task-progress > span,
.progress-unknown {
  display: flex;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 0.73rem;
  flex-direction: column;
}

.task-progress small { color: var(--ink-faint); }

.task-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.task-error {
  margin-top: 0.75rem;
  padding: 0.65rem;
  border: 1px solid #e9c0bd;
  border-radius: 8px;
  background: #fff8f8;
}

.task-error summary {
  color: var(--red);
  font-size: 0.74rem;
  font-weight: 750;
  cursor: pointer;
}

.task-error p {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.7rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-card-foot {
  align-items: flex-end;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}

.operational-retry-note {
  border-color: #edcf91;
  background: var(--amber-soft);
  color: var(--amber);
}

.assistant-boundary {
  margin: 0 0 1rem;
  border-color: #d3c8e7;
  background: #f9f7fc;
}

.assistant-boundary > span {
  color: var(--workbench-purple);
  font-size: 1.05rem;
}

.assistant-boundary p { margin: 0; }
.assistant-boundary strong { color: var(--ink); margin-right: 0.3rem; }

.assistant-shell {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--shadow);
  grid-template-columns: 1fr;
}

.assistant-threads {
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
  background: #f7f9fb;
}

.assistant-thread-head h2,
.conversation-head h2 {
  margin: 0;
  font-size: 1rem;
}

.assistant-threads nav {
  display: flex;
  margin-top: 0.65rem;
  padding-bottom: 0.15rem;
  overflow-x: auto;
  gap: 0.45rem;
}

.assistant-threads nav a {
  display: flex;
  min-width: 150px;
  max-width: 210px;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  flex-direction: column;
}

.assistant-threads nav a[aria-current="page"] {
  border-color: #a99bc6;
  background: var(--workbench-purple-soft);
}

.assistant-threads nav strong {
  overflow: hidden;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-threads nav small,
.assistant-no-threads {
  color: var(--ink-faint);
  font-size: 0.65rem;
}

.assistant-no-threads { margin: 0.7rem 0 0; }

.assistant-conversation {
  display: flex;
  min-width: 0;
  min-height: 620px;
  flex-direction: column;
}

.conversation-head {
  padding: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.thread-version {
  color: var(--ink-faint);
  font-size: 0.7rem;
}

.message-stream {
  display: flex;
  min-height: 320px;
  padding: 0.85rem;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.8rem;
}

.assistant-message {
  display: flex;
  align-items: flex-start;
  max-width: 94%;
  gap: 0.55rem;
}

.message-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: var(--workbench-purple-soft);
  color: var(--workbench-purple);
  font-size: 0.7rem;
  font-weight: 850;
}

.message-user .message-avatar {
  background: var(--blue-soft);
  color: var(--blue);
}

.message-system_receipt .message-avatar {
  background: var(--green-soft);
  color: var(--green);
}

.message-bubble {
  min-width: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 4px 12px 12px;
  background: #fff;
}

.message-user .message-bubble {
  border-color: #b8d2e5;
  border-radius: 12px 4px 12px 12px;
  background: #f0f7fc;
}

.message-system_receipt .message-bubble {
  border-color: #b8dbc6;
  background: #f3faf6;
}

.message-bubble header {
  display: flex;
  align-items: center;
  margin-bottom: 0.25rem;
  gap: 0.55rem;
}

.message-bubble header strong { font-size: 0.72rem; }
.message-bubble time { color: var(--ink-faint); font-size: 0.61rem; }
.message-bubble p { margin: 0; font-size: 0.82rem; white-space: pre-wrap; overflow-wrap: anywhere; }

.assistant-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 2rem 1rem;
  color: var(--ink-soft);
  text-align: center;
  flex-direction: column;
}

.assistant-empty > span {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 0.7rem;
  place-items: center;
  border-radius: 15px;
  background: var(--workbench-purple-soft);
  color: var(--workbench-purple);
  font-size: 1.35rem;
}

.assistant-empty h3 { margin-bottom: 0.35rem; }
.assistant-empty p { max-width: 560px; margin: 0; font-size: 0.78rem; }

.action-proposal {
  margin: 0 0.85rem 0.85rem;
  padding: 0.85rem;
  border: 1px solid #d9c891;
  border-left: 4px solid #c98b1d;
  border-radius: 11px;
  background: #fffbf1;
}

.action-proposal header h3 { margin: 0.2rem 0 0; }
.proposal-label { color: var(--amber); font-size: 0.68rem; font-weight: 850; letter-spacing: 0.05em; }
.action-proposal > p { margin: 0.55rem 0; color: var(--ink-soft); font-size: 0.78rem; }
.action-proposal dl { grid-template-columns: 1fr; }

.proposal-meta {
  display: flex;
  margin-top: 0.65rem;
  color: var(--ink-faint);
  font-size: 0.65rem;
  flex-direction: column;
  gap: 0.2rem;
}

.proposal-warning {
  margin-top: 0.65rem;
  padding: 0.55rem;
  border-radius: 8px;
  background: #fff4d9;
  color: #79500e;
  font-size: 0.7rem;
}

.proposal-actions {
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.assistant-compose {
  position: sticky;
  bottom: calc(3.55rem + env(safe-area-inset-bottom));
  display: grid;
  padding: 0.8rem;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 0.55rem;
  backdrop-filter: blur(8px);
}

.assistant-compose textarea {
  min-height: 48px;
  max-height: 180px;
}

.assistant-compose > small {
  color: var(--ink-faint);
  font-size: 0.64rem;
  grid-column: 1 / -1;
}

.module-dock {
  position: fixed;
  z-index: 45;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  padding: 0.35rem 0.45rem calc(0.35rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -6px 20px rgba(13, 41, 68, 0.09);
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  backdrop-filter: blur(10px);
}

.module-dock a {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 0.35rem 0.2rem;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 0.64rem;
  font-weight: 700;
  text-align: center;
  flex-direction: column;
  gap: 0.1rem;
}

.module-dock a[aria-current="page"] {
  background: var(--blue-soft);
  color: var(--blue);
}

.module-dock a > span:first-child {
  font-size: 0.82rem;
  font-weight: 850;
}

body.app-body {
  padding-bottom: calc(3.7rem + env(safe-area-inset-bottom));
}

@media (min-width: 600px) {
  .module-grid,
  .bid-project-grid,
  .task-card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-metrics,
  .task-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .workbench-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bid-workbench-primary-action {
    width: auto;
  }

  .bid-workbench-primary-action .button {
    width: auto;
  }

  .bid-attention-item {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  .bid-attention-main {
    flex: 1 1 auto;
  }

  .bid-attention-actions {
    align-items: flex-end;
    flex: 0 0 min(260px, 36%);
  }

  .filter-search {
    grid-column: 1 / -1;
  }

  .bid-state-triad,
  .project-state-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .project-facts,
  .version-item dl,
  .action-proposal dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bid-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inline-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inline-create-form .field-wide,
  .inline-form-actions {
    grid-column: 1 / -1;
  }

  .bid-form-grid .field-wide {
    grid-column: 1 / -1;
  }

  .record-row,
  .artifact-item {
    align-items: center;
    flex-direction: row;
  }

  .record-row > div,
  .artifact-item > div {
    flex: 1 1 auto;
  }
}

@media (min-width: 800px) {
  body.app-body {
    padding-bottom: 0;
  }

  .workbench-ui .page-shell {
    padding-bottom: 3.5rem;
  }

  .project-tabs {
    top: 66px;
  }

  .project-section {
    scroll-margin-top: 125px;
  }

  .assistant-compose {
    bottom: 0;
  }

  .workbench-hero {
    padding: 1.45rem;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }

  .module-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .bid-flow-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bid-flow-card {
    min-height: 190px;
    align-content: start;
  }

  .module-card {
    min-height: 165px;
    grid-template-columns: 1fr auto;
    align-content: start;
  }

  .module-icon {
    grid-column: 1;
  }

  .module-copy {
    align-self: end;
    grid-column: 1 / -1;
  }

  .module-arrow,
  .module-metric {
    align-self: center;
    grid-row: 1;
    grid-column: 2;
  }

  .workbench-columns {
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  }

  .workbench-filter {
    grid-template-columns: minmax(220px, 1.4fr) repeat(2, minmax(150px, 0.7fr)) auto auto;
  }

  .task-filter {
    grid-template-columns: repeat(3, minmax(160px, 1fr)) auto auto;
  }

  .filter-search {
    grid-column: auto;
  }

  .project-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .task-progress {
    grid-template-columns: minmax(160px, 1fr) minmax(140px, auto);
    align-items: center;
  }

  .task-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .assistant-shell {
    min-height: 680px;
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .assistant-threads {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .assistant-threads nav {
    overflow: visible;
    flex-direction: column;
  }

  .assistant-threads nav a {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .assistant-message {
    max-width: 78%;
  }

  .module-dock {
    display: none;
  }
}

@media (min-width: 1080px) {
  .bid-project-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .task-card-list:not(.compact-project-tasks) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-project-tasks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.deep-link-focus {
  outline: 3px solid var(--accent, #1864ab);
  outline-offset: 3px;
  scroll-margin-top: 7rem;
}

tr.deep-link-focus > * {
  background: #eef6ff;
}

.audit-evidence code,
.requirement-evidence dd {
  overflow-wrap: anywhere;
}
/* Opinion downloads belong to the original question or submitted file. */
.bid-opinion-card { background:#faf8f4; border:1px solid #dfd4bf; border-left:4px solid #a17b36; border-radius:10px; padding:16px; margin:12px 0; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px; }
.bid-opinion-card strong,.bid-opinion-card small,.bid-question-file>small { display:block; }
.bid-opinion-card small { color:#59687a; font-size:13px; margin-top:5px; }
.bid-opinion-actions { display:flex; flex-wrap:wrap; gap:8px; }
.bid-opinion-progress { flex-basis:100%; margin:0; color:#59687a; font-size:13px; }
.bid-opinion-progress:empty { display:none; }
.bid-opinion-preview { max-width:900px; margin:24px auto; }
.bid-opinion-preview img { display:block; width:100%; height:auto; margin-bottom:24px; box-shadow:0 4px 22px #17273820; }
.bid-upload-question { white-space:pre-wrap; overflow-wrap:anywhere; }
.bid-question-file { margin-top:14px; }
.bid-question-file>small { color:#59687a; margin-top:5px; }
.assistant-message[id^="question-"] { scroll-margin-top:100px; }
.assistant-message .bid-opinion-card { text-align:left; }
