/* HTML Analyzer — extras (final HTML / ask AI / UTM / dark preview) */

.mg-ha__final {
  margin-top: 20px;
  padding: 16px;
  background: #f3fbf5;
  border: 1px solid #9fd4a8;
  border-radius: var(--mg-radius-ui);
  box-shadow: inset 3px 0 0 #2f9e44;
}

.mg-ha__final .mg-ha__panel-head {
  margin-bottom: 8px;
}

.mg-ha__final .mg-ha__panel-head h3 {
  margin: 0;
  font-size: 18px;
  color: #1b5e20;
}

.mg-ha__final .mg-ha__panel-note {
  margin: 0 0 10px;
  color: #2e7d32;
}

.mg-ha__final-minify {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 12px 14px;
  background: rgb(255 255 255 / 55%);
  border: 1px solid #b7dfbf;
  border-radius: var(--mg-radius-ui);
}

.mg-ha__final-minify .mg-ha__toggle--compact {
  align-items: center;
  gap: 8px;
  margin: 0;
}

.mg-ha__final-minify .mg-ha__toggle--compact .mg-ha__toggle-ui {
  flex-basis: 36px;
  width: 36px;
  height: 20px;
}

.mg-ha__final-minify .mg-ha__toggle--compact .mg-ha__toggle-ui::after {
  width: 16px;
  height: 16px;
}

.mg-ha__final-minify .mg-ha__toggle--compact .mg-ha__toggle-input:checked + .mg-ha__toggle-ui::after {
  transform: translateX(16px);
}

.mg-ha__final-minify .mg-ha__toggle-text {
  font-size: 14px;
  font-weight: 600;
  color: #1b5e20;
  white-space: normal;
}

.mg-ha__final-size {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: #1b5e20;
}

.mg-ha__final-minify-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #2e7d32;
}

.mg-ha__final-minify-hint.is-warn {
  color: #8a5a00;
}

.mg-ha__final-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.mg-ha__final-sources li {
  margin: 0;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #1b5e20;
  background: #d8f3dc;
  border-radius: 999px;
}

.mg-ha__final .mg-ha__pre-wrap {
  margin-top: 0;
  height: 100%;
}

.mg-ha__final .mg-ha__pre {
  max-height: none;
  height: 420px;
  overflow: auto;
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  background: var(--mg-white);
  border-color: #9fd4a8;
}

.mg-ha__final-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.mg-ha__final-code,
.mg-ha__final-preview {
  min-width: 0;
}

.mg-ha__final-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgb(255 255 255 / 65%);
  border: 1px solid #b7dfbf;
  border-radius: var(--mg-radius-ui);
}

.mg-ha__final-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mg-ha__final-preview-label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1b5e20;
}

.mg-ha__final-preview-stage {
  flex: 1;
  min-height: 420px;
  display: flex;
  justify-content: center;
  align-items: stretch;
  overflow: auto;
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #f7f7f7;
  border: 1px solid #cfe8d3;
  border-radius: var(--mg-radius);
  padding: 10px;
}

.mg-ha__final-preview-frame {
  display: block;
  width: 100%;
  max-width: 640px;
  height: 100%;
  min-height: 400px;
  border: 1px solid #d0d5dd;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 4px 18px rgb(0 0 0 / 8%);
  transition: max-width 0.2s ease;
}

.mg-ha__final-preview-stage[data-mode="mobile"] .mg-ha__final-preview-frame {
  max-width: 375px;
}

.mg-ha__final .mg-ha__copy-icon {
  position: static;
}

@media (max-width: 900px) {
.mg-ha__final-split {
    grid-template-columns: 1fr;
  }

.mg-ha__final .mg-ha__pre,
  .mg-ha__final-preview-stage {
    height: 320px;
    min-height: 320px;
  }
}

.mg-ha__ask-card {
  padding: 16px;
  background: #f7f8fa;
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius-ui);
}

.mg-ha__ask-card .mg-ha__chat {
  background: var(--mg-white);
}

.mg-ha__chat-text h1,
.mg-ha__chat-text h2,
.mg-ha__chat-text h3,
.mg-ha__chat-text h4,
.mg-ha__chat-text p,
.mg-ha__chat-text ul,
.mg-ha__chat-text ol {
  margin: 0.5em 0;
}

.mg-ha__chat-text ul,
.mg-ha__chat-text ol {
  padding-left: 1.25em;
}

.mg-ha__chat-text code {
  font-family: var(--mg-tool-mono);
  font-size: 0.9em;
  padding: 0.05em 0.3em;
  background: #f2f4f7;
  border-radius: 3px;
}

.mg-ha__chat {
  max-height: 360px;
  overflow: auto;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--mg-white);
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius-ui);
}

.mg-ha__chat-msg {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--mg-radius);
}

.mg-ha__chat-msg--user {
  background: var(--mg-cream);
}

.mg-ha__chat-msg--assistant {
  background: #f5f9fc;
  border: 1px solid #d6e6f2;
}

.mg-ha__chat-role {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mg-muted);
}

.mg-ha__chat-text {
  font-size: 14px;
  line-height: 1.5;
}

.mg-ha__chat-form {
  max-width: 720px;
}

.mg-ha__chat-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.mg-ha__utm-builder {
  margin: 0 0 24px;
  padding: 16px;
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius-ui);
  background: var(--mg-white);
}

.mg-ha__utm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

.mg-ha__utm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.mg-ha__utm-field .mg-ha__input {
  flex: none;
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  font-size: 14px;
}

.mg-ha__utm-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 16px;
}

.mg-ha__utm-actions .mg2-btn {
  flex: 0 0 auto;
}

.mg-ha__utm-hint {
  margin: 0;
  flex: 1 1 200px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--mg-muted);
}

.mg-ha__utm-check-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.mg-ha__utm-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
}

.mg-ha__utm-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: #eef1f5;
  color: #334155;
}

.mg-ha__utm-pill.is-ok {
  background: #d9f2e3;
  color: #1f7a45;
}

.mg-ha__utm-pill.is-warn {
  background: #ffe9c7;
  color: #8a5a00;
}

.mg-ha__utm-pill.is-error {
  background: #fde2e2;
  color: #a32020;
}

.mg-ha__utm-meta {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--mg-muted);
}

.mg-ha__utm-issues {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.45;
  color: #334155;
}

.mg-ha__utm-issues li + li {
  margin-top: 4px;
}

.mg-ha__chat-form.is-loading .mg-ha__chat-row button {
  opacity: 0.6;
  pointer-events: none;
}

@media (max-width: 900px) {
.mg-ha__utm-grid {
    grid-template-columns: 1fr;
  }
}

/* Превью тёмной темы (тогл внутри HTML Analyzer) */

.mg-ha__dark-clients {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius);
  background: var(--mg-white);
}

.mg-ha__dark-clients .mg-ha__label {
  margin-bottom: 10px;
}

.mg-ha__dark-radio {
  display: flex;
  gap: 10px;
  margin: 0 0 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.mg-ha__dark-radio:last-of-type {
  margin-bottom: 0;
}

.mg-ha__dark-radio input {
  margin-top: 3px;
  flex: 0 0 auto;
}

.mg-ha__dark-radio strong {
  font-weight: 700;
}

.mg-ha__dark-meta {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--mg-muted);
}

.mg-ha__dark-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.mg-ha__dark-frame-wrap {
  margin: 0;
}

.mg-ha__dark-frame-cap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mg-muted);
}

.mg-ha__dark-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius);
  background: var(--mg-white);
  color: var(--mg-black);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mg-ha__dark-badge--dark {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #f2eeeb;
}

.mg-ha__dark-stage {
  height: min(56vh, 480px);
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius);
  background: #fff;
  overflow: hidden;
}

.mg-ha__dark-stage--dark {
  background: #111;
  border-color: #333;
}

.mg-ha__dark-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.mg-ha__dark-notes {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mg-ha__dark-notes li {
  padding: 10px 14px;
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius);
  background: var(--mg-white);
  font-size: 14px;
  line-height: 1.4;
}

.mg-ha__dark-notes li.is-warn {
  border-color: #c45c26;
}

@media (max-width: 900px) {
.mg-ha__dark-grid {
    grid-template-columns: 1fr;
  }

.mg-ha__dark-stage {
    height: 360px;
  }
}
