/* Runtime Studio Workbench — Phase 8.24D.1 */

.rs-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 0 24px;
  min-height: 60vh;
}

.rs-safety {
  border: 1px solid #b45309;
  background: #fff7ed;
  color: #7c2d12;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

.rs-cap-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rs-cap {
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid #d4d4d8;
  background: #fafafa;
}

.rs-cap-ok { border-color: #86efac; background: #f0fdf4; color: #14532d; }
.rs-cap-missing { border-color: #fde68a; background: #fffbeb; color: #78350f; }
.rs-cap-locked { border-color: #fca5a5; background: #fef2f2; color: #7f1d1d; }

.rs-header {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.rs-title-block h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.rs-title-block p {
  margin: 4px 0 0;
  color: #52525b;
  font-size: 13px;
}

.rs-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rs-badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid #e4e4e7;
  background: #fff;
}

.rs-badge-ok { background: #ecfdf5; border-color: #6ee7b7; }
.rs-badge-warn { background: #fff7ed; border-color: #fdba74; }
.rs-badge-danger { background: #fef2f2; border-color: #fca5a5; }

.rs-page-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid #e4e4e7;
  padding-bottom: 8px;
}

.rs-page-nav a {
  text-decoration: none;
  color: #3f3f46;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
}

.rs-page-nav a[aria-current='page'] {
  background: #18181b;
  color: #fafafa;
  font-weight: 600;
}

.rs-page-nav a:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.rs-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.rs-toolbar select,
.rs-toolbar button {
  font-size: 13px;
}

.rs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.rs-card {
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}

.rs-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.rs-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  font-size: 13px;
}

.rs-card dt { color: #71717a; }
.rs-card dd { margin: 0; word-break: break-all; }

.rs-table-wrap { overflow-x: auto; }
.rs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rs-table th,
.rs-table td {
  border-bottom: 1px solid #e4e4e7;
  text-align: left;
  padding: 8px 6px;
}
.rs-table th { color: #52525b; font-weight: 600; }

.rs-state {
  border: 1px dashed #d4d4d8;
  border-radius: 10px;
  padding: 24px 16px;
  text-align: center;
}
.rs-state h3 { margin: 0 0 8px; }
.rs-error { border-color: #fca5a5; background: #fef2f2; }
.rs-forbidden { border-color: #fca5a5; background: #fff1f2; }
.rs-production-locked { border-color: #fdba74; background: #fff7ed; }
.rs-not-implemented { border-color: #93c5fd; background: #eff6ff; }
.rs-meta { color: #71717a; font-size: 12px; }
.rs-spinner {
  width: 22px;
  height: 22px;
  margin: 0 auto 8px;
  border: 2px solid #d4d4d8;
  border-top-color: #18181b;
  border-radius: 50%;
  animation: rs-spin 0.8s linear infinite;
}
@keyframes rs-spin { to { transform: rotate(360deg); } }

.rs-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 800px) {
  .rs-compare { grid-template-columns: 1fr; }
  .rs-page-nav a { font-size: 12px; padding: 6px 8px; }
}

.rs-mock-sandbox {
  border: 3px solid #dc2626;
  background: #450a0a;
  color: #fecaca;
  padding: 12px 16px;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}
.rs-mock-sandbox small {
  display: block;
  font-weight: 600;
  margin-top: 4px;
  color: #fca5a5;
}

/* Phase 8.24D.2-W — Draft list + Rule Editor */
.rs-banner-info {
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1e3a8a;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rs-draft-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin: 8px 0 12px;
}
.rs-draft-filters label,
.rs-create-draft label,
.rs-editor-main label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #52525b;
}
.rs-draft-filters input,
.rs-draft-filters select,
.rs-create-draft input,
.rs-create-draft select,
.rs-create-draft textarea,
.rs-editor-main input,
.rs-editor-main select,
.rs-editor-main textarea {
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #d4d4d8;
  border-radius: 6px;
  min-width: 120px;
}
.rs-create-draft fieldset,
.rs-rule-card {
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
}
.rs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.rs-pagination { margin-top: 8px; }
.rs-unsaved { color: #b45309; font-weight: 600; font-size: 13px; }
.rs-editor-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.rs-editor-layout {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) minmax(260px, 340px);
  gap: 12px;
  align-items: start;
}
.rs-editor-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rs-panel-nav {
  text-align: left;
  border: 1px solid #e4e4e7;
  background: #fafafa;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}
.rs-panel-nav.is-active {
  background: #18181b;
  color: #fafafa;
  border-color: #18181b;
}
.rs-editor-main {
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  padding: 12px;
  background: #fff;
  min-height: 360px;
}
.rs-editor-aside {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rs-side-panel {
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  font-size: 12px;
}
.rs-side-panel h3 { margin: 0 0 8px; font-size: 13px; }
.rs-side-panel h4 { margin: 10px 0 6px; font-size: 12px; }
.rs-error-list { padding-left: 16px; }
.rs-linkish {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
}
.rs-row-current { background: #f0fdf4; }
.rs-advanced-json textarea { width: 100%; font-family: ui-monospace, monospace; }
.rs-toggle { font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 980px) {
  .rs-editor-layout {
    grid-template-columns: 1fr;
  }
  .rs-editor-nav { flex-direction: row; flex-wrap: wrap; }
}

/* Phase 8.24D.3-W — Batch Evaluation */
.rs-batch-create label,
.rs-batch-create fieldset {
  display: block;
  margin: 8px 0;
}
.rs-batch-create textarea,
.rs-batch-create input[type="text"],
.rs-batch-create input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  max-width: 720px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.rs-batch-create fieldset {
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  padding: 8px 12px;
}
.rs-progress {
  height: 8px;
  background: #e4e4e7;
  border-radius: 999px;
  overflow: hidden;
  margin: 4px 0;
}
.rs-progress-bar {
  height: 100%;
  background: #2563eb;
}
.rs-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.rs-summary-card .rs-metric {
  font-size: 22px;
  font-weight: 700;
  margin: 4px 0 0;
}
.rs-chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.rs-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 40px;
  gap: 6px;
  align-items: center;
  margin: 4px 0;
  font-size: 12px;
}
.rs-bar-label { color: #52525b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-bar-track {
  height: 8px;
  background: #f4f4f5;
  border-radius: 999px;
  overflow: hidden;
}
.rs-bar-fill {
  display: block;
  height: 100%;
  background: #0f766e;
}
.rs-bar-val { text-align: right; color: #71717a; }

/* Phase 8.24D.4-W — Compare Center */
.rs-compare-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  margin-top: 12px;
}
/* Phase 8.24D.5-W — AI Assist right panel */
.rs-compare-layout-assist {
  grid-template-columns: 180px minmax(0, 1fr) minmax(280px, 340px);
  align-items: start;
}
@media (max-width: 1100px) {
  .rs-compare-layout-assist {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .rs-compare-layout { grid-template-columns: 1fr; }
}
.rs-compare-aside {
  position: sticky;
  top: 8px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}
.rs-banner-soft {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fef9c3;
  border: 1px solid #fde047;
  color: #713f12;
  font-size: 12px;
}
.rs-ai-actions {
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.rs-ai-actions button { font-size: 12px; }
.rs-ai-block { margin: 10px 0; }
.rs-ai-block h4 { margin: 0 0 4px; font-size: 12px; }
.rs-ai-block p { margin: 0; font-size: 13px; line-height: 1.45; }
.rs-ai-block ul { margin: 0; padding-left: 18px; font-size: 12px; }
.rs-ai-diff-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 700px) {
  .rs-ai-diff-grid { grid-template-columns: 1fr; }
}
.rs-risk-low { color: #166534; }
.rs-risk-medium { color: #9a3412; }
.rs-risk-high { color: #991b1b; }
.rs-warn { color: #991b1b; }
#rs-ai-patch-json.is-copied { outline: 2px solid #86efac; }
.rs-ai-draft-banner { margin-bottom: 12px; }

/* Phase 8.24D.6-W — Corpus Center */
.rs-corpus-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 900px) {
  .rs-corpus-layout { grid-template-columns: 1fr; }
}
.rs-corpus-toolbar { flex-wrap: wrap; gap: 6px; }
.rs-corpus-side .rs-card { margin-bottom: 10px; }
.rs-cluster-list { list-style: none; margin: 0; padding: 0; }
.rs-cluster-list li {
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  padding: 8px;
  margin: 0 0 6px;
  background: #fff;
}
.rs-cluster-list li.is-hot { border-color: #fdba74; background: #fff7ed; }
.rs-cluster-list li.is-ignored { opacity: 0.6; }
.rs-trend-list { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.rs-trend-list li {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  border-bottom: 1px solid #f4f4f5;
}
.rs-corpus-preview { margin: 8px 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.rs-compare-nav {
  border: 1px solid #e4e4e7;
  border-radius: 10px;
  padding: 10px;
  background: #fafafa;
}
.rs-compare-nav h3 { margin: 0 0 8px; font-size: 13px; }
.rs-compare-nav ul { list-style: none; margin: 0; padding: 0; }
.rs-compare-nav li { margin: 0 0 4px; }
.rs-field-nav {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: center;
  border: 1px solid transparent;
  background: #fff;
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.rs-field-nav.is-active { border-color: #93c5fd; background: #eff6ff; }
.rs-field-nav.is-diff .rs-outcome { font-weight: 700; }
.rs-compare-panes { align-items: start; }
.rs-pane { min-height: 200px; }
.rs-field-block {
  border: 1px solid #e4e4e7;
  border-radius: 8px;
  margin: 0 0 8px;
  overflow: hidden;
}
.rs-field-block.is-focused { border-color: #2563eb; box-shadow: 0 0 0 1px #bfdbfe; }
.rs-field-block.is-diff-highlight { background: #fff7ed; border-color: #fdba74; }
.rs-field-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #fafafa;
}
.rs-field-toggle {
  border: none;
  background: none;
  font: inherit;
  cursor: pointer;
  text-align: left;
  padding: 0;
}
.rs-field-body { padding: 8px; }
.rs-field-pre, .rs-field-code {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}
.rs-summary-dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 4px 10px;
  margin: 0;
  font-size: 13px;
}
.rs-summary-dl dt { color: #71717a; }
.rs-summary-dl dd { margin: 0; word-break: break-all; }
.rs-outcome {
  font-size: 11px;
  text-transform: lowercase;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid #e4e4e7;
  background: #fff;
}
.rs-out-equal { color: #166534; border-color: #86efac; background: #f0fdf4; }
.rs-out-different { color: #9a3412; border-color: #fdba74; background: #fff7ed; }
.rs-out-missing { color: #1e3a8a; border-color: #93c5fd; background: #eff6ff; }
.rs-out-extra { color: #6b21a8; border-color: #d8b4fe; background: #faf5ff; }
.rs-out-unsupported { color: #991b1b; border-color: #fca5a5; background: #fef2f2; }
.rs-compare-toolbar { flex-wrap: wrap; gap: 8px; }

/* Phase 8.24D.7-W — AI Insight Center */
.rs-insight-safety { margin-bottom: 10px; }
.rs-insight-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin: 8px 0 16px;
}
.rs-insight-card header {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.rs-insight-dl {
  display: grid;
  grid-template-columns: minmax(100px, 140px) 1fr;
  gap: 4px 10px;
  margin: 0;
  font-size: 13px;
}
.rs-insight-dl dt { color: #71717a; margin: 0; }
.rs-insight-dl dd { margin: 0; word-break: break-word; }
.rs-score-list { margin: 0; padding-left: 18px; font-size: 13px; }
.rs-bar-list { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.rs-bar-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid #f4f4f5;
}
.rs-metric { font-size: 22px; font-weight: 600; margin: 4px 0; }
.rs-insight-preview { border-left: 3px solid #a1a1aa; }
.rs-insight-run { margin: 12px 0; }
.rs-notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}
.rs-badge-warn { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.rs-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0;
}
@media (max-width: 720px) {
  .rs-insight-card-grid { grid-template-columns: 1fr; }
  .rs-insight-dl { grid-template-columns: 1fr; }
  .rs-filters { display: grid; grid-template-columns: 1fr; }
}

/* Phase 8.25A Rules */
.rs-rules .rs-tabs{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0}
.rs-rules .rs-tab{border:1px solid #d4d4d8;background:#fff;border-radius:8px;padding:6px 10px;cursor:pointer}
.rs-rules .rs-tab.is-active{background:#18181b;color:#fff}
.rs-rules .rs-table{width:100%;border-collapse:collapse}
.rs-rules .rs-table th,.rs-rules .rs-table td{border-bottom:1px solid #e4e4e7;padding:8px;text-align:left;font-size:13px}
.rs-rules .rs-form{display:grid;gap:10px;max-width:640px}
.rs-rules .rs-form label{display:grid;gap:4px;font-size:13px}
.rs-rules .rs-advanced{margin-top:12px}
.rs-rules .rs-banner{padding:8px 10px;border-radius:8px;font-size:13px}
.rs-rules .rs-banner--info{background:#eff6ff;border:1px solid #bfdbfe}
.rs-rules .rs-banner--warn{background:#fffbeb;border:1px solid #fde68a}
@media (max-width:720px){.rs-rules .rs-tabs{flex-direction:column}}

/* Phase 8.30F — Human Language / Operator UX */
.rs-safety-ok { border-color: #6ee7b7; background: #ecfdf5; color: #065f46; }
.rs-safety-warn { border-color: #fdba74; background: #fff7ed; color: #9a3412; }
.rs-safety-bad { border-color: #fca5a5; background: #fef2f2; color: #991b1b; }
.rs-health-ok { border-color: #6ee7b7; }
.rs-health-warn { border-color: #fdba74; }
.rs-health-bad { border-color: #fca5a5; }
.rs-card-hero .rs-hero-title { font-size: 20px; font-weight: 700; margin: 4px 0 10px; }
.rs-op-dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 12px 0; }
.rs-op-dl dt { color: #71717a; font-size: 13px; }
.rs-op-dl dd { margin: 0; font-weight: 600; }
.rs-op-steps { margin: 0; padding-left: 1.2rem; display: grid; gap: 8px; }
.rs-op-steps .rs-link,
button.rs-link {
  background: none; border: none; color: #0f766e; cursor: pointer;
  padding: 0; font: inherit; text-decoration: underline;
}
.rs-tech-details { margin-top: 10px; font-size: 12px; color: #52525b; }
.rs-tech-details summary { cursor: pointer; font-weight: 600; }
.rs-toolbar-operator { align-items: center; gap: 10px; }
.rs-grid-operator { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 960px) {
  .rs-grid-operator { grid-template-columns: 1fr 1fr; }
  .rs-grid-operator > .rs-card-hero { grid-column: 1 / -1; }
}
.rs-advanced-ops { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
