/* Product workspace bar + platform panels */

.product-workspace-bar {
  display: grid;
  grid-template-columns:
    minmax(7.5rem, 9rem)
    minmax(7rem, 8.5rem)
    minmax(12rem, 1.4fr)
    minmax(10rem, 1.2fr)
    minmax(9rem, 1fr)
    auto;
  gap: 0.55rem 0.75rem;
  align-items: end;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  border: 1px solid var(--border, #d8dde6);
  border-radius: var(--radius-sm, 6px);
  background:
    linear-gradient(135deg, rgba(15, 55, 95, 0.05), transparent 55%),
    #fff;
  box-sizing: border-box;
}

.product-workspace-bar > label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0;
  min-width: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #5a6575);
}

.product-workspace-bar input,
.product-workspace-bar select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 2.35rem;
  min-height: 2.35rem;
  max-height: 2.35rem;
  padding: 0.35rem 0.55rem;
  margin: 0;
  border: 1px solid var(--border, #c9d1dc);
  border-radius: var(--radius-sm, 6px);
  background: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
  color: var(--navy, #1a2330);
  line-height: 1.2;
}

.product-workspace-bar input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}

.product-workspace-bar .pw-suggest-wrap {
  position: relative;
  min-width: 0;
}

.product-workspace-bar .pw-search {
  /* override accidental flex growth from earlier rules */
  flex: none;
}

.product-workspace-bar .pw-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
  align-items: center;
  padding-bottom: 0.05rem;
}

.product-workspace-bar .pw-actions .btn {
  height: 2.35rem;
  white-space: nowrap;
}

.product-workspace-status {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 1.1rem;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--navy, #1a2330);
}

.product-workspace-status[data-state="mismatch"] {
  color: #8a3b12;
  font-weight: 600;
}

.product-workspace-status[data-state="ok"] {
  color: #1f5d3a;
}

.product-workspace-status[data-state="blocked"] {
  color: #8a1f1f;
}

.product-workspace-bar.is-stale input#pw-product-name,
.product-workspace-bar.is-stale select#pw-combo {
  opacity: 0.55;
}

.product-workspace-bar.is-stale #pw-product-id {
  border-color: #c48a1a;
  box-shadow: 0 0 0 2px rgba(196, 138, 26, 0.15);
}

.pw-suggest {
  position: absolute;
  top: calc(100% + 0.2rem);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 14rem;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border, #c9d1dc);
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 8px 24px rgba(20, 30, 50, 0.12);
}

.pw-suggest.is-hidden {
  display: none !important;
}

.pw-suggest button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.pw-suggest button:hover,
.pw-suggest button:focus {
  background: rgba(15, 55, 95, 0.08);
  outline: none;
}

@media (max-width: 1100px) {
  .product-workspace-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-workspace-bar .pw-suggest-wrap {
    grid-column: 1 / -1;
  }

  .product-workspace-bar .pw-actions {
    grid-column: 1 / -1;
  }
}

.platform-panel .platform-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.platform-panel .platform-tabs button {
  border: 1px solid var(--border, #c9d1dc);
  background: #fff;
  padding: 0.4rem 0.75rem;
  font: inherit;
  cursor: pointer;
}

.platform-panel .platform-tabs button.is-active {
  background: rgba(15, 55, 95, 0.1);
  border-color: rgba(15, 55, 95, 0.35);
}

.platform-section {
  display: none;
}

.platform-section.is-active {
  display: block;
}

.platform-section > label {
  display: block;
  margin-bottom: 0.75rem;
}

.platform-section > .btn {
  display: inline-block;
  margin-top: 0.75rem;
  margin-bottom: 0.25rem;
}

.sim-help,
.diff-help {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--ok, #008c38) 32%, #d8dde6);
  background: var(--green-soft, #e8f8ef);
  color: var(--navy, #1a2330);
  font-size: 0.9rem;
  line-height: 1.45;
}

.sim-help p,
.diff-help p {
  margin: 0 0 0.45rem;
}

.sim-help p:last-child,
.diff-help p:last-child {
  margin: 0;
}

.sim-facts-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.sim-facts-head label {
  margin: 0;
}

.sim-fill-example {
  border: 0;
  background: none;
  color: var(--navy, #1a2330);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.sim-fill-example:hover {
  color: var(--ok, #008c38);
}

.platform-section textarea#platform-sim-facts {
  width: 100%;
  min-height: 10rem;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 0.85rem;
  line-height: 1.45;
}

.sim-facts-legend {
  margin: 0.45rem 0 0.85rem;
}

.sim-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.25rem 0 0.5rem;
}

.sim-report {
  margin-top: 0.35rem;
}

.sim-level {
  margin: 0 0 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  background: #f4f7fb;
  border: 1px solid var(--border, #d8dde6);
}

.sim-level-label {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #5a6575);
}

.sim-level-value {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy, #1a2330);
}

.sim-level-value.is-empty {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted, #5a6575);
}

.sim-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
  color: var(--navy, #1a2330);
}

.sim-warnings {
  margin: 0 0 0.75rem;
}

.sim-status {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sim-status-fired {
  background: var(--green-soft, #e8f8ef);
  color: var(--ok, #008c38);
}

.sim-status-not-fired {
  background: #eef1f5;
  color: #5a6575;
}

.sim-status-unsupported {
  background: #fff7e8;
  color: #8a3b12;
}

.sim-status-skipped,
.sim-status-unknown {
  background: #eef1f5;
  color: #5a6575;
}

.sim-clauses {
  margin: 0.15rem 0;
}

.sim-clauses summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.sim-clauses ul {
  margin: 0.35rem 0 0.15rem;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--muted, #5a6575);
}

.platform-panel .form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.platform-panel .form-row label {
  flex: 1 1 10rem;
  min-width: 0;
}

.platform-panel textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 6rem;
  font: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border, #c9d1dc);
  border-radius: var(--radius-sm, 6px);
}

.platform-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.platform-table th,
.platform-table td {
  border-bottom: 1px solid var(--border, #e2e7ef);
  padding: 0.45rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

.platform-table caption {
  text-align: left;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.gate-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
  border-radius: 4px;
}

.gate-pass {
  color: #0a7a52;
  background: rgba(10, 140, 90, 0.14);
  border-color: rgba(10, 140, 90, 0.3);
}

.gate-fail {
  color: #b42318;
  background: rgba(190, 40, 40, 0.12);
  border-color: rgba(190, 40, 40, 0.28);
}

.gate-warn {
  color: #9a6700;
  background: rgba(180, 110, 0, 0.14);
  border-color: rgba(180, 110, 0, 0.32);
}

.gate-blocked {
  color: #5a2a8a;
  background: rgba(90, 42, 138, 0.12);
  border-color: rgba(90, 42, 138, 0.28);
}

.gate-skipped {
  color: #5a6575;
  background: #eef1f5;
  border-color: #d5dbe5;
}

.gate-pending {
  color: #9a6700;
  background: #fff7e8;
  border-color: #e6c88a;
}

.gate-running {
  color: #0f375f;
  background: #e8f0fb;
  border-color: #9db7d9;
}

.checklist-note {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--muted, #5a6575);
}

.checklist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.checklist-actions .btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  height: auto;
}

.checklist-step-title {
  font-weight: 600;
}

.checklist-result-details {
  margin-top: 0.45rem;
}

.checklist-result-details > summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f375f;
  text-decoration: underline;
}

.checklist-step-result {
  margin-top: 0.55rem;
}

.diff-section-block {
  margin-bottom: 1.25rem;
}

.diff-section-block h4 {
  margin: 0 0 0.5rem;
}

.platform-run-result {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border, #d8dde6);
  border-radius: var(--radius-sm, 6px);
  background: #fff;
}

.platform-run-result:empty {
  display: none;
  margin: 0;
  padding: 0;
  border: 0;
}

.platform-run-pending { color: #0f375f; margin: 0 0 0.35rem; }
.platform-run-ok { color: #1f5d3a; margin: 0 0 0.35rem; }
.platform-run-fail { color: #8a1f1f; margin: 0 0 0.35rem; }

.platform-json-preview {
  margin: 0.5rem 0 0;
  max-height: 16rem;
  overflow: auto;
  font-size: 0.8rem;
  background: #f5f7fa;
  padding: 0.55rem 0.65rem;
}

.platform-result-scroll {
  margin: 0.65rem 0;
  max-height: 28rem;
  overflow: auto;
  border: 1px solid var(--border, #d8dde6);
  border-radius: 6px;
  background: #fff;
}

.platform-result-table {
  margin: 0;
  font-size: 0.82rem;
}

.platform-result-table thead th {
  position: sticky;
  top: 0;
  background: #f3f6fa;
  z-index: 1;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted, #5a6575);
}

.platform-result-table td code {
  font-size: 0.75rem;
  word-break: break-all;
}

.platform-result-table th.col-wide,
.platform-result-table td.col-wide {
  min-width: 22rem;
  max-width: 40rem;
}

.cell-long-pre {
  margin: 0;
  padding: 0.35rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  background: #f5f7fa;
  border-radius: 4px;
  max-height: 14rem;
  overflow: auto;
}

.platform-raw-details {
  margin: 0.5rem 0;
  font-size: 0.85rem;
}

.platform-raw-details summary {
  cursor: pointer;
  color: var(--muted, #5a6575);
}

.catalog-grid {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.catalog-card {
  border: 1px solid var(--border, #d8dde6);
  border-radius: var(--radius-sm, 6px);
  background: #fff;
  padding: 0.85rem 1rem;
}

.catalog-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.catalog-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  color: var(--navy, #1a2330);
}

.catalog-card-meta {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted, #5a6575);
}

.catalog-card-desc {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--navy, #1a2330);
}

.catalog-card-result:empty {
  display: none;
}

.catalog-card-result:not(:empty) {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border, #e2e7ef);
}

.catalog-params-label {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #5a6575);
}

.param-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.param-chip {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  border: 1px solid currentColor;
  border-radius: 4px;
}

.param-chip-ok { color: #1f5d3a; background: #eaf6ef; }
.param-chip-missing { color: #8a3b12; background: #fff4e8; }
.param-chip-input { color: #0f375f; background: #eef4fb; }
.param-chip-none { color: #5a6575; background: #f3f5f8; }

.catalog-row-params {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.65rem;
}

.catalog-param-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 9rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted, #5a6575);
}

.catalog-param-field input {
  height: 2.2rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border, #c9d1dc);
  border-radius: 6px;
  font: inherit;
  font-weight: 400;
  color: var(--navy, #1a2330);
}

.catalog-param-field input.param-input-missing {
  border-color: #c0392b;
  box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.15);
}

.catalog-warn { color: #8a3b12; }
