.tbtn.reasoning-studio-btn {
  background: linear-gradient(135deg, #5b21b6, #0f766e) !important;
  border-color: #99f6e4 !important;
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(91, 33, 182, 0.28) !important;
}

.mwb-more-tools {
  position: relative;
}

.mwb-more-tools > summary {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line, #cdd8e3);
  border-radius: 10px;
  background: #fff;
  color: #12355b;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.mwb-more-tools > summary::-webkit-details-marker {
  display: none;
}

.mwb-more-tools[open] > summary,
.mwb-more-tools > summary:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 2px;
}

.mwb-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 12000;
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 7px;
  width: min(380px, 90vw);
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
}

.mwb-more-menu .tbtn {
  justify-content: flex-start;
  min-height: 42px;
}

.mwr-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.mwr-overlay {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.76);
  backdrop-filter: blur(5px);
}

.mwr-overlay.is-open {
  display: grid;
}

.mwr-dialog {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(1040px, 96vw);
  max-height: 94vh;
  overflow: hidden;
  border: 2px solid #99f6e4;
  border-radius: 24px;
  background: #f8fafc;
  color: #0f172a;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.36);
  font-family: "Atkinson Hyperlegible", "Nunito", system-ui, sans-serif;
}

.mwr-head,
.mwr-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: #fff;
}

.mwr-head {
  border-bottom: 1px solid #dbe5ee;
}

.mwr-foot {
  border-top: 1px solid #dbe5ee;
}

.mwr-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mwr-title-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: linear-gradient(135deg, #5b21b6, #0f766e);
  color: #fff;
  font-size: 1.25rem;
}

.mwr-title h2,
.mwr-title p {
  margin: 0;
}

.mwr-title h2 {
  font-size: 1.2rem;
}

.mwr-title p,
.mwr-muted,
.mwr-help {
  color: #526174;
  font-size: 0.86rem;
}

.mwr-icon-btn {
  min-width: 42px;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
  font-size: 1rem;
}

.mwr-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 10px 18px;
  background: #eef2ff;
}

.mwr-step {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #526174;
  font-weight: 800;
}

.mwr-step.is-current {
  background: #fff;
  color: #5b21b6;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
}

.mwr-step.is-done::before {
  content: "✓ ";
  color: #0f766e;
}

.mwr-body {
  overflow: auto;
  padding: 20px;
}

.mwr-panel {
  max-width: 900px;
  margin: 0 auto;
}

.mwr-panel h3 {
  margin: 0 0 6px;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.mwr-grid,
.mwr-reps,
.mwr-evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mwr-card {
  padding: 16px;
  border: 1px solid #d8e2ec;
  border-radius: 16px;
  background: #fff;
}

.mwr-card h4,
.mwr-card p {
  margin-top: 0;
}

.mwr-label {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  color: #25364a;
  font-weight: 800;
}

.mwr-label small {
  color: #64748b;
  font-weight: 600;
}

.mwr-input,
.mwr-select,
.mwr-textarea {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  border: 2px solid #b8c7d6;
  border-radius: 11px;
  background: #fff;
  color: #0f172a;
  font: 700 1rem/1.45 inherit;
}

.mwr-input,
.mwr-select {
  padding: 9px 11px;
}

.mwr-textarea {
  min-height: 132px;
  padding: 11px;
  resize: vertical;
}

.mwr-input:focus,
.mwr-select:focus,
.mwr-textarea:focus,
.mwr-btn:focus-visible,
.mwr-icon-btn:focus-visible,
.mwr-rep:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 2px;
  border-color: #5b21b6;
}

.mwr-reps {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 16px 0;
}

.mwr-rep {
  min-height: 86px;
  padding: 10px;
  border: 2px solid #cbd5e1;
  border-radius: 14px;
  background: #fff;
  color: #1e293b;
  cursor: pointer;
  font-weight: 800;
}

.mwr-rep[aria-pressed="true"] {
  border-color: #0f766e;
  background: #ecfdf5;
  color: #115e59;
}

.mwr-signal {
  margin: 14px 0;
  padding: 14px;
  border-left: 5px solid #7c3aed;
  border-radius: 12px;
  background: #f5f3ff;
}

.mwr-signal[data-state="connected-reasoning-visible"] {
  border-color: #0f766e;
  background: #ecfdf5;
}

.mwr-signal strong,
.mwr-signal span,
.mwr-signal small {
  display: block;
}

.mwr-signal span {
  margin: 6px 0;
}

.mwr-stem {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 800;
}

.mwr-linked-table {
  width: 100%;
  margin: 12px 0;
  border-collapse: collapse;
  background: #fff;
}

.mwr-linked-table caption {
  padding: 6px;
  color: #475569;
  font-weight: 800;
  text-align: left;
}

.mwr-linked-table th,
.mwr-linked-table td {
  padding: 9px;
  border: 1px solid #94a3b8;
  text-align: center;
}

.mwr-linked-table th {
  background: #ecfdf5;
  color: #115e59;
}

.mwr-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.mwr-btn {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid #aebdcc;
  border-radius: 11px;
  background: #fff;
  color: #1e293b;
  cursor: pointer;
  font-weight: 900;
}

.mwr-btn.primary {
  border-color: #5b21b6;
  background: #5b21b6;
  color: #fff;
}

.mwr-btn.success {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

.mwr-btn:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.mwr-progress {
  width: min(260px, 34vw);
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: #dbe5ee;
}

.mwr-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5b21b6, #0f766e);
  transition: width 0.2s ease;
}

.mwr-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin: 3px;
  padding: 3px 9px;
  border-radius: 99px;
  background: #e2e8f0;
  color: #334155;
  font-size: 0.78rem;
  font-weight: 800;
}

.mwr-compare {
  white-space: pre-wrap;
  line-height: 1.55;
}

.mwr-session-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.mwr-session {
  padding: 12px;
  border: 1px solid #d8e2ec;
  border-radius: 12px;
  background: #fff;
}

.mwr-session summary {
  cursor: pointer;
  font-weight: 900;
}

.mwr-live {
  min-height: 1.2em;
}

@media (max-width: 760px) {
  .mwr-overlay {
    padding: 0;
  }
  .mwr-dialog {
    width: 100vw;
    max-height: 100dvh;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  .mwr-steps {
    overflow-x: auto;
    grid-template-columns: repeat(5, minmax(105px, 1fr));
  }
  .mwr-grid,
  .mwr-evidence-grid {
    grid-template-columns: 1fr;
  }
  .mwr-reps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mwr-body {
    padding: 16px;
  }
  .mwr-head,
  .mwr-foot {
    padding: 11px 14px;
  }
  .mwb-more-menu {
    position: fixed;
    top: 72px;
    right: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mwr-progress > span {
    transition: none;
  }
}

@media print {
  .mwr-overlay,
  .mwb-more-tools {
    display: none !important;
  }
}
