.mnb-mtg-section {
  padding: 24px 0 44px;
}

.mnb-mtg-workspace {
  display: grid;
  gap: 24px;
}

.mnb-mtg-head,
.mnb-mtg-panel-head,
.mnb-mtg-code-head,
.mnb-mtg-history > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.mnb-mtg-head {
  position: relative;
  padding: 0 0 18px;
}

.mnb-mtg-head::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 72px;
  height: 2px;
  background: linear-gradient(90deg, var(--orange), color-mix(in srgb, var(--orange) 26%, transparent));
}

.mnb-mtg-head h2,
.mnb-mtg-panel-head h3,
.mnb-mtg-code-head h3 {
  margin: 5px 0 0;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.018em;
}

.mnb-mtg-head h2 {
  font-size: clamp(1.48rem, 2vw, 1.9rem);
}

.mnb-mtg-panel-head h3,
.mnb-mtg-code-head h3 {
  font-size: 1.08rem;
}

.mnb-mtg-head p,
.mnb-mtg-panel-head p,
.mnb-mtg-code-head p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: .91rem;
  line-height: 1.55;
  max-width: 780px;
}

.mnb-mtg-head-actions,
.mnb-mtg-editor-actions,
.mnb-mtg-code-actions,
.mnb-mtg-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mnb-mtg-head-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.mnb-mtg-btn,
.mnb-mtg-link-btn {
  appearance: none;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: .84rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.mnb-mtg-btn:hover,
.mnb-mtg-link-btn:hover {
  border-color: color-mix(in srgb, var(--blue) 40%, var(--line));
  background: color-mix(in srgb, var(--blue) 4%, var(--surface));
}

.mnb-mtg-btn.is-quiet {
  background: transparent;
}

.mnb-mtg-btn.is-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.mnb-mtg-btn.is-primary:hover {
  background: var(--blue-2);
  border-color: var(--blue-2);
}

.mnb-mtg-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mnb-mtg-btn b {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 10%, transparent);
  display: inline-grid;
  place-items: center;
  font-size: .72rem;
  font-weight: 600;
}

/* History is deliberately flat: no nested card shell. */
.mnb-mtg-history {
  padding: 16px 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.mnb-mtg-history > header strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

.mnb-mtg-history > header span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .82rem;
}

.mnb-mtg-history > header button,
.mnb-mtg-history-item button {
  border: 0;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: .79rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}

.mnb-mtg-history > header button:hover,
.mnb-mtg-history-item button:hover {
  color: var(--blue);
}

.mnb-mtg-history-search {
  margin-top: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  padding: 0 10px;
}

.mnb-mtg-history-search svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
}

.mnb-mtg-history-search input {
  width: 100%;
  min-height: 40px;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 400;
  line-height: 1.3;
}

.mnb-mtg-history-list {
  display: grid;
  margin-top: 8px;
}

.mnb-mtg-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.mnb-mtg-history-item:last-child {
  border-bottom: 0;
}

.mnb-mtg-history-item strong,
.mnb-mtg-history-item small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mnb-mtg-history-item strong {
  color: var(--ink);
  font-size: .87rem;
  font-weight: 550;
}

.mnb-mtg-history-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: .76rem;
}

.mnb-mtg-history-item-actions {
  display: flex;
  gap: 4px;
}

.mnb-mtg-history-empty {
  padding: 17px 4px 2px;
  color: var(--muted);
  text-align: center;
  font-size: .84rem;
}

/* One continuous editor + output workbench, not a set of cards. */
.mnb-mtg-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(390px, .88fr);
  gap: clamp(28px, 3vw, 46px);
  align-items: start;
}

.mnb-mtg-editor,
.mnb-mtg-preview-panel,
.mnb-mtg-checks-panel,
.mnb-mtg-code-panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.mnb-mtg-editor {
  min-width: 0;
  display: grid;
  gap: 18px;
  padding: 0;
}

.mnb-mtg-panel-head {
  padding-bottom: 2px;
}

.mnb-mtg-panel-head.is-compact {
  padding: 0;
}

.mnb-mtg-local-pill,
.mnb-mtg-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.mnb-mtg-local-pill {
  color: var(--muted);
}

.mnb-mtg-local-pill::before,
.mnb-mtg-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #93a4bd;
}

.mnb-mtg-status {
  color: var(--orange);
}

.mnb-mtg-status::before {
  background: currentColor;
}

.mnb-mtg-status.is-good {
  color: var(--green);
}

.mnb-mtg-status.is-error {
  color: #d24141;
}

.mnb-mtg-field-stack,
.mnb-mtg-disclosure-body {
  display: grid;
  gap: 14px;
}

.mnb-mtg-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mnb-mtg-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.mnb-mtg-field.is-wide {
  grid-column: 1 / -1;
}

.mnb-mtg-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: .84rem;
}

.mnb-mtg-label b {
  font-weight: 600;
}

.mnb-mtg-label small {
  color: var(--muted);
  font-size: .73rem;
  font-weight: 400;
  text-align: right;
}

.mnb-mtg-label em {
  color: var(--text);
  font-style: normal;
  font-weight: 600;
}

.mnb-mtg-field input,
.mnb-mtg-field textarea,
.mnb-mtg-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: .91rem;
  font-weight: 400;
  line-height: 1.45;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.mnb-mtg-field input,
.mnb-mtg-field select {
  min-height: 43px;
  padding: 0 12px;
}

.mnb-mtg-field textarea {
  min-height: 108px;
  padding: 11px 12px;
  resize: vertical;
}

.mnb-mtg-field input:hover,
.mnb-mtg-field textarea:hover,
.mnb-mtg-field select:hover {
  border-color: color-mix(in srgb, var(--text) 20%, var(--line));
}

.mnb-mtg-field input:focus,
.mnb-mtg-field textarea:focus,
.mnb-mtg-field select:focus {
  border-color: color-mix(in srgb, var(--blue) 72%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 9%, transparent);
  background: var(--surface);
}

.mnb-mtg-field input.is-invalid {
  border-color: #d24141;
}

.mnb-mtg-meter {
  height: 3px;
  overflow: hidden;
  background: color-mix(in srgb, var(--line) 70%, transparent);
}

.mnb-mtg-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width .15s ease, background .15s ease;
}

.mnb-mtg-meter span.is-review {
  background: var(--orange);
}

.mnb-mtg-meter span.is-error {
  background: #d24141;
}

/* Expandable sections use simple editorial dividers rather than boxes. */
.mnb-mtg-disclosure {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 2px 0 0;
}

.mnb-mtg-disclosure summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  color: var(--text);
}

.mnb-mtg-disclosure summary::-webkit-details-marker {
  display: none;
}

.mnb-mtg-disclosure summary > span {
  display: grid;
  grid-template-columns: 21px auto;
  column-gap: 9px;
  align-items: center;
}

.mnb-mtg-disclosure summary > span svg {
  grid-row: 1 / 3;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.7;
}

.mnb-mtg-disclosure summary b {
  font-size: .9rem;
  font-weight: 600;
}

.mnb-mtg-disclosure summary small {
  color: var(--muted);
  font-size: .75rem;
}

.mnb-mtg-disclosure summary > svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  transition: transform .15s ease;
}

.mnb-mtg-disclosure[open] summary > svg {
  transform: rotate(180deg);
}

.mnb-mtg-disclosure-body {
  padding: 3px 0 15px 29px;
}

.mnb-mtg-check {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--text);
  font-size: .8rem;
  cursor: pointer;
}

.mnb-mtg-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mnb-mtg-check > span {
  position: relative;
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
}

.mnb-mtg-check input:checked + span {
  border-color: var(--blue);
  background: var(--blue);
}

.mnb-mtg-check input:checked + span::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 7px;
  height: 4px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}

.mnb-mtg-check b {
  font-weight: 500;
}

.mnb-mtg-check small {
  margin-left: 2px;
  color: var(--muted);
  font-size: .73rem;
}

.mnb-mtg-check.is-warning {
  padding: 1px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

.mnb-mtg-check.is-warning > span {
  border-color: color-mix(in srgb, var(--orange) 55%, var(--line));
}

.mnb-mtg-subtitle {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.mnb-mtg-robots-advanced {
  display: grid;
  gap: 11px;
  padding: 4px 0 3px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.mnb-mtg-editor-actions {
  padding-top: 2px;
}

.mnb-mtg-output {
  position: sticky;
  top: 16px;
  min-width: 0;
  display: grid;
  gap: 0;
}

.mnb-mtg-preview-panel,
.mnb-mtg-checks-panel {
  padding: 0 0 22px;
}

.mnb-mtg-checks-panel,
.mnb-mtg-code-panel {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

/* Underline tabs match the current panel instead of pill/card tabs. */
.mnb-mtg-preview-tabs {
  display: flex;
  gap: 24px;
  width: 100%;
  margin-top: 14px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.mnb-mtg-preview-tabs button {
  position: relative;
  min-height: 37px;
  padding: 0 1px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: .82rem;
  font-weight: 550;
  line-height: 1;
  cursor: pointer;
}

.mnb-mtg-preview-tabs button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: transparent;
}

.mnb-mtg-preview-tabs button.is-active {
  color: var(--blue);
  background: transparent;
  box-shadow: none;
}

.mnb-mtg-preview-tabs button.is-active::after {
  background: var(--blue);
}

.mnb-mtg-preview-view {
  margin-top: 14px;
}

/* The actual visual previews can remain bounded; the surrounding tool stays flat. */
.mnb-mtg-serp {
  padding: 18px 2px 17px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: #202124;
}

.mnb-mtg-serp-site {
  display: grid;
  gap: 2px;
}

.mnb-mtg-serp-site span {
  color: var(--text);
  font: 500 .82rem Arial, sans-serif;
}

.mnb-mtg-serp-site small {
  color: var(--muted);
  font: 400 .75rem Arial, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mnb-mtg-serp-title {
  margin-top: 8px;
  color: #1a0dab;
  font: 400 1.25rem/1.25 Arial, sans-serif;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mnb-mtg-serp-description {
  margin-top: 5px;
  color: var(--muted);
  font: 400 .87rem/1.45 Arial, sans-serif;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mnb-mtg-social-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mnb-mtg-social-image {
  aspect-ratio: 1.91 / 1;
  display: grid;
  place-items: center;
  background: var(--soft);
  background-size: cover;
  background-position: center;
  color: var(--muted);
  font-size: .8rem;
}

.mnb-mtg-social-copy {
  padding: 12px 13px;
}

.mnb-mtg-social-copy small {
  display: block;
  color: var(--muted);
  font-size: .74rem;
  text-transform: lowercase;
}

.mnb-mtg-social-copy strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 600;
}

.mnb-mtg-social-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mnb-mtg-checks-panel .mnb-mtg-panel-head > span:last-child {
  color: var(--muted);
  font-size: .77rem;
  font-weight: 550;
}

.mnb-mtg-check-list {
  display: grid;
  margin-top: 11px;
}

.mnb-mtg-check-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
}

.mnb-mtg-check-item:last-child {
  border-bottom: 0;
}

.mnb-mtg-check-item > span {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--green) 11%, transparent);
  color: var(--green);
  font-size: .7rem;
  font-weight: 650;
}

.mnb-mtg-check-item.is-review > span {
  background: color-mix(in srgb, var(--orange) 12%, transparent);
  color: var(--orange);
}

.mnb-mtg-check-item.is-error > span {
  background: color-mix(in srgb, #d24141 11%, transparent);
  color: #d24141;
}

.mnb-mtg-check-item strong {
  display: block;
  color: var(--text);
  font-size: .81rem;
  font-weight: 600;
}

.mnb-mtg-check-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: .74rem;
  line-height: 1.42;
}

.mnb-mtg-code-panel {
  overflow: visible;
}

.mnb-mtg-code-head {
  align-items: flex-end;
  padding: 0 0 12px;
  border: 0;
}

.mnb-mtg-code-actions {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.mnb-mtg-code-actions .mnb-mtg-btn {
  min-height: 35px;
  padding-inline: 10px;
  font-size: .79rem;
}

.mnb-mtg-code {
  min-height: 220px;
  max-height: 430px;
  margin: 0;
  overflow: auto;
  padding: 17px 18px;
  border: 0;
  border-radius: 8px;
  background: #0f172a;
  color: #dbeafe;
  font: 400 .79rem/1.66 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.mnb-mtg-code-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 1px 0;
  border: 0;
  color: var(--muted);
  font-size: .76rem;
}

.mnb-mtg-link-btn {
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--blue);
}

@media (max-width: 1180px) {
  .mnb-mtg-layout {
    grid-template-columns: minmax(0, 1fr) minmax(360px, .82fr);
    gap: 28px;
  }
}

@media (max-width: 1080px) {
  .mnb-mtg-layout {
    grid-template-columns: 1fr;
  }

  .mnb-mtg-output {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 26px;
    row-gap: 0;
  }

  .mnb-mtg-code-panel {
    grid-column: 1 / -1;
  }

  .mnb-mtg-checks-panel {
    border-top: 0;
    padding-top: 0;
  }
}

@media (max-width: 760px) {
  .mnb-mtg-section {
    padding: 20px 0 36px;
  }

  .mnb-mtg-head,
  .mnb-mtg-panel-head,
  .mnb-mtg-code-head,
  .mnb-mtg-history > header {
    flex-direction: column;
    align-items: stretch;
  }

  .mnb-mtg-head-actions,
  .mnb-mtg-code-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .mnb-mtg-head-actions .mnb-mtg-btn,
  .mnb-mtg-code-actions .mnb-mtg-btn {
    flex: 1 1 auto;
  }

  .mnb-mtg-field-grid,
  .mnb-mtg-output {
    grid-template-columns: 1fr;
  }

  .mnb-mtg-checks-panel {
    border-top: 1px solid var(--line);
    padding-top: 20px;
  }

  .mnb-mtg-code-panel {
    grid-column: auto;
  }

  .mnb-mtg-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .mnb-mtg-label small {
    text-align: left;
  }

  .mnb-mtg-history-item {
    grid-template-columns: 1fr;
  }

  .mnb-mtg-history-item-actions {
    justify-content: flex-end;
  }

  .mnb-mtg-editor-actions .mnb-mtg-btn {
    flex: 1 1 140px;
  }

  .mnb-mtg-disclosure-body {
    padding-left: 0;
  }

  .mnb-mtg-preview-tabs {
    gap: 22px;
  }

  .mnb-mtg-code {
    font-size: .73rem;
  }
}

@media (max-width: 520px) {
  .mnb-mtg-head-actions,
  .mnb-mtg-editor-actions,
  .mnb-mtg-code-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .mnb-mtg-head-actions .mnb-mtg-btn:first-child,
  .mnb-mtg-editor-actions .mnb-mtg-btn:first-child,
  .mnb-mtg-code-actions .mnb-mtg-btn:last-child {
    grid-column: 1 / -1;
  }

  .mnb-mtg-btn {
    width: 100%;
  }
}

@media (prefers-color-scheme: dark) {
  .mnb-mtg-code {
    background: #0b1220;
  }

  .mnb-mtg-serp-title {
    color: #8ab4f8;
  }
}
