:root {
  color: #17202a;
  background: #f7f9fb;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

body {
  margin: 0;
}

.studio-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  background: #101820;
  color: #f5f8fb;
  padding: 20px 14px;
}

.brand {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 750;
}

.sidebar a {
  display: block;
  margin: 3px 0;
  padding: 10px 12px;
  border-radius: 6px;
  color: #c8d3df;
  font-size: 14px;
  text-decoration: none;
}

.sidebar a.active,
.sidebar a:focus,
.sidebar a:hover {
  background: #24313f;
  color: #ffffff;
}

.content {
  padding: 24px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  border-bottom: 1px solid #d9e1e8;
  padding-bottom: 14px;
  color: #4c5967;
}

.topbar div {
  display: grid;
  gap: 2px;
}

.page-title h1 {
  margin: 24px 0 6px;
  font-size: 30px;
  line-height: 1.2;
}

.page-title p {
  margin: 0 0 18px;
  color: #667180;
}

.panel,
.state,
.audit-action,
.validation-list {
  border: 1px solid #d9e1e8;
  border-radius: 8px;
  background: #ffffff;
}

.panel {
  overflow: hidden;
  margin-bottom: 14px;
}

.panel-header,
.audit-action {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #d9e1e8;
}

.panel h2,
.state h2 {
  margin: 0;
  font-size: 18px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  padding: 14px;
}

.plugin-authoring-summary,
.wizard-step-sections,
.plugin-authoring-wizard-form {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

.quick-create-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.quick-create-card {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid #dbe4ec;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.quick-create-card header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quick-create-card header span {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: #2f6f8f;
  color: #ffffff;
  font-weight: 800;
}

.quick-create-card h3,
.quick-create-card h4 {
  margin: 0;
}

.quick-choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.quick-choice-card {
  display: grid;
  gap: 6px;
  min-height: 118px;
  border: 1px solid #d6e0e8;
  border-radius: 8px;
  background: #f8fbfc;
  padding: 10px;
  cursor: pointer;
}

.quick-choice-card.selected {
  border-color: #2f6f8f;
  background: #eaf5f7;
}

.quick-choice-card.disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.next-step-bridge {
  display: grid;
  gap: 10px;
  border: 1px solid #cbd7e2;
  border-radius: 8px;
  background: #f7faf8;
  padding: 12px;
}

.wizard-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.wizard-stepper button,
.step-title-button {
  border: 1px solid #cbd7e2;
  border-radius: 6px;
  background: #f8fafc;
  color: #253242;
  cursor: pointer;
  font: inherit;
}

.wizard-stepper button {
  min-height: 36px;
  padding: 7px 10px;
}

.wizard-stepper button.active,
.wizard-stepper button:hover,
.step-title-button:hover {
  border-color: #2f6f8f;
  background: #e7f3f7;
}

.wizard-step-section {
  border: 1px solid #dbe4ec;
  border-radius: 8px;
  background: #fbfcfd;
  overflow: hidden;
}

.wizard-step-section.active {
  border-color: #2f6f8f;
  background: #ffffff;
}

.wizard-step-section summary {
  list-style: none;
}

.wizard-step-section summary::-webkit-details-marker {
  display: none;
}

.step-title-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
}

.step-title-button span {
  color: #5d6976;
  font-size: 12px;
  font-weight: 700;
}

.wizard-step-body {
  display: grid;
  gap: 12px;
  border-top: 1px solid #e3eaf1;
  padding: 14px;
}

.wizard-step-actions {
  border-top: 1px dashed #d3dee8;
  padding-top: 10px;
}

.runtimepack-preview {
  display: grid;
  gap: 12px;
  border: 1px solid #dbe4ec;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.runtimepack-preview h3,
.runtimepack-preview h4 {
  margin: 0;
}

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

.panel-body {
  padding: 14px;
}

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

.metric-grid article,
.assistant-card-grid article,
.assistant-review-card,
.status-list,
.kv {
  border: 1px solid #e4eaf0;
  border-radius: 6px;
  background: #fbfcfd;
  padding: 12px;
}

.assistant-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.assistant-card-grid h4,
.assistant-review-card h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.assistant-review-card {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.status-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.kv {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 8px 12px;
}

.kv dt {
  color: #5d6976;
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 13px;
}

.data-table th,
.data-table td {
  border: 1px solid #dce5ed;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #f3f6f9;
  color: #364554;
  font-weight: 700;
}

[data-testid="hard-negative-collection-backlog"],
[data-testid="hard-negative-model-eval-backlog"] {
  overflow-x: auto;
}

[data-testid="hard-negative-collection-backlog-table"],
[data-testid="hard-negative-model-eval-backlog-table"] {
  min-width: 1040px;
}

.muted-row {
  color: #697786;
  background: #f7f9fb;
}

.closed-task-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid #c8d3df;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef3f7;
  color: #405060;
  font-size: 12px;
  font-weight: 700;
}

.history-thumb {
  width: 96px;
  max-height: 72px;
  object-fit: contain;
  border: 1px solid #d7e0e8;
  border-radius: 4px;
  background: #ffffff;
}

.legend-grid,
.toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.legend-grid span,
.toggle-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e4eaf0;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fbfcfd;
}

.toggle-grid label {
  align-items: flex-start;
  flex-direction: column;
}

.toggle-grid input {
  min-height: auto;
}

.toggle-grid small {
  color: #6d7a86;
}

.legend-line {
  width: 38px;
  border-top: 3px solid #2f8f5b;
}

.legend-line.truth {
  border-color: #246eb9;
}

.legend-line.candidate {
  border-color: #c49a20;
  border-top-style: dashed;
}

.legend-line.forbidden {
  border-color: #bc3b3b;
}

.legend-line.revoked {
  border-color: #8b98a5;
}

.legend-line.smoke {
  border-color: #7c4fc2;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: #394857;
  font-size: 13px;
}

input,
select,
button {
  min-height: 36px;
  border: 1px solid #c7d2de;
  border-radius: 6px;
  background: #ffffff;
  color: #17202a;
  font: inherit;
}

input,
select {
  padding: 0 10px;
}

button {
  padding: 0 12px;
  cursor: pointer;
}

button:hover:not(:disabled),
button:focus:not(:disabled) {
  border-color: #2f6fae;
  background: #eef6ff;
}

button:disabled {
  cursor: not-allowed;
  background: #eef3f7;
  color: #6d7a86;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.button-row.vertical {
  align-items: flex-start;
  flex-direction: column;
}

.compact-actions {
  align-items: stretch;
  flex-direction: column;
  min-width: 180px;
}

.compact-actions button,
.compact-actions select {
  width: 100%;
}

.row-feedback {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  border: 1px solid #d7e0e8;
  border-radius: 6px;
  padding: 8px;
  font-size: 12px;
}

.row-feedback small {
  color: #6d7a86;
}

.hard-negative-preview-modal {
  display: grid;
  gap: 12px;
  border: 1px solid #b8c7d6;
  border-radius: 8px;
  margin: 14px 0;
  padding: 12px;
  background: #f8fafc;
}

.hard-negative-preview-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hard-negative-preview-modal-body {
  display: grid;
  grid-template-columns: minmax(240px, 420px) minmax(260px, 1fr);
  gap: 12px;
  align-items: start;
}

.hard-negative-preview-modal-figure {
  margin: 0;
}

.hard-negative-preview-modal-figure img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  border: 1px solid #d7e0e8;
  border-radius: 6px;
  background: #ffffff;
}

.safe-note {
  border-left: 4px solid #2f6fae;
  margin: 12px 0 0;
  padding: 8px 10px;
  background: #f1f7fd;
  color: #394857;
}

.status-banner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #d7e0e8;
  border-radius: 6px;
  background: #f8fafc;
  color: #263847;
  font-weight: 600;
}

.status-banner small {
  color: #6d7a86;
  font-weight: 500;
}

.status-success {
  border-color: #91d7a5;
  background: #f0fbf3;
  color: #17623a;
}

.status-warning {
  border-color: #efcf7a;
  background: #fff9e8;
  color: #805b13;
}

.status-danger {
  border-color: #efaaa8;
  background: #fff1f1;
  color: #8c2523;
}

.detail-card {
  min-width: 0;
  border: 1px solid #e4eaf0;
  border-radius: 6px;
  padding: 12px;
  background: #fbfcfd;
}

.detail-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #394857;
}

pre {
  overflow: auto;
  margin: 0;
  max-height: 280px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.badge-ok {
  background: #e6f7ee;
  color: #176a3a;
}

.badge-warn {
  background: #fff6df;
  color: #8a5a00;
}

.badge-danger {
  background: #fdebec;
  color: #9d1c24;
}

.badge-neutral {
  background: #eef3f7;
  color: #425365;
}

.state {
  padding: 24px;
}

.state-loading {
  color: #315d88;
}

.state-error,
.state-denied {
  color: #9d1c24;
}

.validation-list {
  margin: 0 0 14px;
  padding: 12px 18px 12px 32px;
  color: #4c5967;
}

.visual-workbench {
  display: grid;
  grid-template-columns: 220px minmax(320px, 1fr) 280px;
  gap: 14px;
  padding: 14px;
}

.tool-rail,
.contract-summary {
  display: grid;
  align-content: start;
  gap: 10px;
}

.tool-rail button,
.tool-rail select {
  min-height: 36px;
  border: 1px solid #c7d2de;
  border-radius: 6px;
  background: #ffffff;
  color: #17202a;
}

.tool-rail label {
  display: grid;
  gap: 5px;
  font-size: 13px;
}

.check-row {
  grid-template-columns: 18px 1fr;
  align-items: center;
}

.canvas-stage {
  min-height: 380px;
  border: 1px solid #c7d2de;
  border-radius: 8px;
  background: #20242a;
  padding: 16px;
}

.source-frame {
  position: relative;
  overflow: hidden;
  min-height: 340px;
  width: 100%;
  border: 1px solid #607080;
  touch-action: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    #2e343b;
  background-size: 40px 40px;
}

.uploaded-source-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #111820;
}

.fixture-source-note {
  position: absolute;
  right: 10px;
  bottom: 10px;
  max-width: min(340px, calc(100% - 20px));
  border: 1px solid #607080;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  padding: 8px 10px;
  color: #394857;
  font-size: 12px;
}

.authored-region {
  position: absolute;
  border: 2px solid #4ad4a8;
  background: rgba(74, 212, 168, 0.14);
  cursor: move;
  min-width: 10px;
  min-height: 10px;
}

.authored-region.selected {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.92),
    0 0 0 4px rgba(74, 212, 168, 0.18);
}

.hidden-overlay {
  display: none;
}

.canvas-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.canvas-overlay-box {
  position: absolute;
  min-width: 10px;
  min-height: 10px;
  border: 2px solid #246eb9;
  background: rgba(36, 110, 185, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.86);
  pointer-events: none;
}

.canvas-overlay-box span {
  display: inline-block;
  margin: 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  padding: 3px 6px;
  color: #17202a;
  font-size: 11px;
}

.overlay-weak,
.overlay-visualContract,
.overlay-historical {
  border-color: #c49a20;
  border-style: dashed;
  background: rgba(196, 154, 32, 0.12);
}

.overlay-forbidden {
  border-color: #bc3b3b;
  background: rgba(188, 59, 59, 0.14);
}

.overlay-revoked {
  border-color: #8b98a5;
  background: rgba(139, 152, 165, 0.14);
}

.overlay-smoke {
  border-color: #7c4fc2;
  background: rgba(124, 79, 194, 0.14);
}

.authored-region i {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #0d8b6f;
  cursor: nwse-resize;
}

.dynamic-region {
  position: absolute;
  left: 58%;
  top: 28%;
  width: 12%;
  height: 18%;
  border: 2px dashed #ffd166;
  background: rgba(255, 209, 102, 0.12);
}

.authored-region span,
.dynamic-region span {
  display: inline-block;
  margin: 6px;
  border-radius: 4px;
  background: #ffffff;
  padding: 3px 6px;
  color: #17202a;
  font-size: 12px;
}

.crop-preview,
.source-preview {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.crop-preview img,
.source-preview img {
  display: block;
  max-width: 100%;
  border: 1px solid #c7d2de;
  border-radius: 6px;
  background: #111820;
}

.crop-preview figcaption,
.source-preview figcaption {
  color: #5d6976;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.source-preview-frame {
  position: relative;
  display: block;
  max-width: 100%;
  width: min(100%, 960px);
}

.source-preview-frame img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.source-preview-rect {
  position: absolute;
  border: 2px solid #0d8b6f;
  background: rgba(13, 139, 111, 0.16);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.84);
  pointer-events: none;
}

.contract-summary dl {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 8px;
  margin: 0;
  font-size: 13px;
}

.contract-summary dt {
  color: #5d6976;
}

.contract-summary dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .studio-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .content {
    padding: 16px;
  }

  .visual-workbench {
    grid-template-columns: 1fr;
  }

  .hard-negative-preview-modal-body {
    grid-template-columns: 1fr;
  }

  .kv {
    grid-template-columns: 1fr;
  }
}
