:root {
  --layout-gap: 16px;
  --section-gap: 24px;
  --control-height: 44px;
}

.ws-panel {
  min-width: 0;
  background: #f8fafc;
  border: 1px solid #dbe4ef;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: var(--section-gap);
  color: #203957;
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.ws-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.ws-panel details { border-top: 1px solid #dbe4ef; padding: 16px 0; }
.ws-panel details:last-child { padding-bottom: 0; }
.ws-panel summary, .ws-trace summary { cursor: pointer; font-weight: 600; line-height: 1.8; }
.ws-panel details[open] > summary { margin-bottom: 16px; }
.ws-row, .ws-actions { display: flex; flex-wrap: wrap; gap: 12px var(--layout-gap); align-items: end; margin: 16px 0; }
.ws-row > * { min-width: 0; max-width: 100%; }
.ws-row > label { flex: 1 1 220px; align-self: stretch; justify-content: space-between; }
.ws-panel label { display: flex; flex-direction: column; gap: 8px; }
.ws-panel input:not([type=checkbox]), .ws-panel select, .ws-panel textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: var(--control-height);
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #203957;
  font: inherit;
  line-height: 1.6;
  box-sizing: border-box;
}
.ws-panel textarea { resize: vertical; line-height: 1.7; }
.ws-panel button, .ws-panel .ws-file {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: var(--control-height);
  max-width: 100%;
  padding: 10px 16px;
  border: 1px solid #bccde1;
  border-radius: 7px;
  background: #fff;
  color: #23496e;
  font: inherit;
  line-height: 1.6;
  text-align: center;
  cursor: pointer;
}
.ws-panel [hidden] { display: none !important; }
.ws-panel button:hover, .ws-panel .ws-file:hover { background: #eaf2ff; }
.ws-panel button:disabled { opacity: .5; cursor: not-allowed; }
.ws-panel .ws-file input { display: none; }
.ws-row > select { flex: 1 1 100%; }
.ws-note, #ws-status { color: #536779; font-size: 12px; margin: 12px 0; line-height: 1.8; }
.ws-error { color: #b91c1c !important; }
.ws-scroll { max-width: 100%; max-height: 300px; overflow: auto; border: 1px solid #dbe4ef; border-radius: 8px; margin: 12px 0; }
.ws-panel table { min-width: 560px; width: 100%; border-collapse: collapse; table-layout: fixed; }
.ws-panel th, .ws-panel td { padding: 12px; border-bottom: 1px solid #dbe4ef; }
.ws-panel td { overflow-wrap: anywhere; }
.ws-panel th:first-child { width: 44%; }
#ws-participants { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; margin-top: 20px; }
.ws-panel label.ws-participant { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; margin: 0; }
#ws-participants .ws-participant { padding: 12px; border: 1px solid #dbe4ef; border-radius: 8px; background: #fff; }
.ws-participant input { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 3px; accent-color: #2e6da4; }
.ws-participant-text { min-width: 0; overflow-wrap: anywhere; }
.ws-participant-text small { display: block; color: #64748b; margin-top: 4px; font-size: 12px; font-variant-numeric: tabular-nums; }
.ws-stale-note { background: #fff5df; color: #854d0e; padding: 14px 16px; margin-bottom: 16px; border: 1px solid #facc15; border-radius: 8px; font-size: 13px; line-height: 1.7; }
.ws-stale > table, .ws-stale > .table-wrap { opacity: .65; }
.ws-snapshot { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 12px 0; border-bottom: 1px solid #dbe4ef; }
.ws-snapshot:last-child { border-bottom: 0; }
.ws-snapshot span { overflow-wrap: anywhere; }
.ws-scenario { padding: 16px; border: 1px solid #dbe4ef; border-radius: 10px; margin: 16px 0; background: #fff; }
.ws-scenario .ws-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px; margin-top: 0; }
.ws-scenario .ws-row > span { grid-column: 1 / -1; color: #64748b; font-size: 12px; }
.ws-scenario > label + label { margin-top: 16px; }
.ws-scenario .ws-actions { margin-bottom: 0; }
#ws-search > .ws-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
#ws-search > details { margin-top: 20px; }
#ws-search .ws-actions { align-items: center; }
.ws-trace { min-width: 0; padding: 16px 20px; margin: 16px 0; background: #eff6ff; border-radius: 10px; color: #203957; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.ws-trace p { margin-top: 12px; }
.ws-controls { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; align-items: end; gap: 16px; margin: 8px 0 0; padding: 20px; background: #f1f5f9; border-radius: 10px; color: #203957; font-size: 13px; line-height: 1.7; }
.ws-controls label { display: flex; flex-direction: column; gap: 8px; min-width: 0; align-self: stretch; justify-content: space-between; }
.ws-controls input, .ws-controls select { display: block; width: 100%; min-width: 0; min-height: var(--control-height); padding: 10px 12px; background: #fff; border: 1px solid #cbd5e1; border-radius: 7px; font: inherit; box-sizing: border-box; }
.ws-controls button { min-height: var(--control-height); padding: 10px 16px; cursor: pointer; border: 1px solid #cbd5e1; border-radius: 7px; background: #fff; color: #203957; font: inherit; }
.ws-controls p { grid-column: 1 / -1; font-size: 12px; }
.summary-grid > .ws-trace { grid-column: 1 / -1; margin: 0; }
.table-wrap { max-height: 650px; }
.table-wrap thead th { position: sticky; top: 0; z-index: 1; }
.table-wrap td:nth-child(3) { font-variant-numeric: tabular-nums; }

.ws-param-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 20px; align-items: stretch; }
.ws-param { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ws-param label { flex: 1; display: block; font-size: 13px; color: #536779; line-height: 1.6; }
.ws-param input, .ws-param select, .ws-param textarea { width: 100%; min-width: 0; min-height: var(--control-height); box-sizing: border-box; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 7px; font: inherit; line-height: 1.6; background: #fff; color: #203957; }
.ws-param textarea { resize: vertical; line-height: 1.7; font-variant-numeric: tabular-nums; }
.ws-param-wide { grid-column: 1 / -1; }
.ws-rule-hint { line-height: 1.8; margin-top: 20px; }
.ws-scale { padding: 16px 20px; margin: 16px 0; background: #eff6ff; border: 1px solid #c9ddf5; border-radius: 10px; color: #23496e; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.ws-scale p { margin: 10px 0 0; }
.ws-scale-check { background: #fff8e8; border-color: #e8c87a; color: #79520d; }
.ws-contribution-unit { font-size: 12px; opacity: .8; white-space: nowrap; }
.ws-score-contribution { display: block; font-size: 12px; line-height: 1.7; margin-top: 8px; overflow-wrap: anywhere; }
.summary-card.summary-benchmark .value { font-size: 18px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1100px) {
  #ws-search > .ws-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .ws-panel { padding: 16px; margin-bottom: 20px; }
  .ws-row { align-items: stretch; }
  .ws-row > label { flex-basis: 100%; }
  .ws-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .ws-panel .ws-actions > * { min-width: 0; width: 100%; }
  .ws-panel .ws-actions > .ws-participant { grid-column: 1 / -1; }
  .ws-panel .ws-actions > #ws-add-scenario { grid-column: 1 / -1; }
  .ws-snapshot { grid-template-columns: minmax(0, 1fr); }
  .ws-scenario .ws-row { grid-template-columns: minmax(0, 1fr); }
  .ws-controls { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .ws-trace, .ws-scale { padding: 16px; }
  .ws-param-grid { gap: 16px; }
}
@media (max-width: 480px) {
  .summary-grid { grid-template-columns: minmax(0, 1fr); }
}
