/* HTML Analyzer — core (workspace / editor / sidebar) · chrome в tools-shell.css */

.mg-ha__workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 320px);
  gap: 20px;
  margin-top: 28px;
  align-items: start;
}

.mg-ha__editor {
  min-width: 0;
  padding: 20px;
  background: var(--mg-cream);
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius-ui);
  overflow: hidden;
}

.mg-ha__editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.mg-ha__label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mg-ha__textbtn {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--mg-blue-link);
  cursor: pointer;
}

.mg-ha__textbtn:hover {
  color: var(--mg-blue-hover);
}

.mg-ha__textbtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mg-ha__code {
  position: relative;
  min-width: 0;
  max-width: 100%;
  height: 320px;
  min-height: 320px;
  resize: vertical;
  overflow: hidden;
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius);
  background: var(--mg-white);
}

.mg-ha__code:focus-within {
  outline: 2px solid var(--mg-blue-link);
  outline-offset: 1px;
}

.mg-ha__code-highlight,
.mg-ha__textarea {
  box-sizing: border-box;
  margin: 0;
  padding: 12px 14px;
  border: 0;
  border-radius: var(--mg-radius);
  font-family: var(--mg-tool-mono);
  font-size: 13px;
  line-height: 1.45;
  tab-size: 2;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.mg-ha__code-highlight {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  background: transparent;
}

.mg-ha__code-highlight code {
  display: block;
  font: inherit;
  white-space: inherit;
  word-break: inherit;
  overflow-wrap: inherit;
}

.mg-ha__textarea {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  max-width: 100%;
  height: 100%;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--mg-black);
  overflow: auto;
}

.mg-ha__textarea::placeholder {
  color: var(--mg-muted);
  opacity: 0.85;
}

.mg-ha__textarea::selection {
  color: transparent;
  background: rgba(0, 98, 173, 0.22);
}

.mg-ha__code-highlight .token.comment,
.mg-ha__code-highlight .token.prolog,
.mg-ha__code-highlight .token.doctype {
  color: #6a737d;
}

.mg-ha__code-highlight .token.tag,
.mg-ha__code-highlight .token.punctuation {
  color: #22863a;
}

.mg-ha__code-highlight .token.attr-name {
  color: #6f42c1;
}

.mg-ha__code-highlight .token.attr-value,
.mg-ha__code-highlight .token.string {
  color: #032f62;
}

.mg-ha__code-highlight .token.entity,
.mg-ha__code-highlight .token.url {
  color: #005cc5;
}

.mg-ha__sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

.mg-ha__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 24px;
  background: var(--mg-cream);
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius-ui);
}

.mg-ha__checks {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.mg-ha__checks-label {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mg-muted);
}

.mg-ha__check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.mg-ha__check-row .mg-ha__toggle {
  flex: 1 1 auto;
}

.mg-ha__tip-wrap {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  z-index: 2;
}

.mg-ha__tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--mg-border);
  border-radius: 50%;
  background: var(--mg-white);
  color: var(--mg-muted);
  font: 700 11px/1 inherit;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.mg-ha__tip:hover,
.mg-ha__tip:focus-visible,
.mg-ha__tip[aria-expanded="true"] {
  color: var(--mg-blue-link, #0062ad);
  border-color: var(--mg-blue-link, #0062ad);
  outline: none;
}

.mg-ha__tip-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  width: min(280px, 72vw);
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--mg-border);
  border-radius: 8px;
  background: var(--mg-white);
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.12);
  color: var(--mg-black);
  font: 600 12px/1.45 inherit;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
}

.mg-ha__tip-panel[hidden] {
  display: none !important;
}

.mg-ha__tip-panel::after {
  content: "";
  position: absolute;
  bottom: 100%;
  right: 8px;
  border: 6px solid transparent;
  border-bottom-color: var(--mg-white);
  filter: drop-shadow(0 -1px 0 var(--mg-border));
}

.mg-ha__tip-list {
  margin: 6px 0 0;
  padding: 0 0 0 1.1em;
}

.mg-ha__tip-list li + li {
  margin-top: 4px;
}

.mg-ha__toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  min-width: 0;
}

.mg-ha__toggle-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.mg-ha__toggle-ui {
  flex: 0 0 40px;
  width: 40px;
  height: 22px;
  margin-top: 0;
  border-radius: 999px;
  background: #d8dde3;
  position: relative;
  transition: background 0.15s ease;
  pointer-events: none;
}

.mg-ha__toggle-ui::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--mg-white);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease;
}

.mg-ha__toggle-input:checked + .mg-ha__toggle-ui {
  background: #000;
}

.mg-ha__toggle-input:checked + .mg-ha__toggle-ui::after {
  transform: translateX(18px);
}

.mg-ha__toggle-input:focus-visible + .mg-ha__toggle-ui {
  outline: 2px solid var(--mg-blue-link);
  outline-offset: 2px;
}

.mg-ha__toggle-text {
  position: relative;
  z-index: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: normal;
}

.mg-ha__check-extra {
  margin: -4px 0 4px 50px;
  min-width: 0;
}

.mg-ha__check-extra[hidden] {
  display: none !important;
}

.mg-ha__check-extra .mg-ha__ua select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.mg-ha__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  margin-top: 8px;
}

.mg-ha__submit-spinner {
  display: none;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  border: 2px solid rgb(255 255 255 / 35%);
  border-top-color: #fff;
  border-radius: 50%;
  flex-shrink: 0;
}

.mg-ha__actions.is-loading .mg-ha__submit-spinner,
.mg-ha__form.is-loading .mg-ha__submit-spinner {
  display: inline-block;
  animation: mg-ha-spin 0.7s linear infinite;
}

#mg-ha-results {
  scroll-margin-top: 88px;
}

.mg-ha__actions.is-loading .mg-ha__checks {
  opacity: 0.55;
  pointer-events: none;
}

.mg-ha__warn {
  margin: 0;
  padding: 12px;
  font-size: 14px;
  background: #fff8e6;
  border: 1px solid #e8d48a;
  border-radius: var(--mg-radius);
}

.mg-ha__preview-modes {
  display: inline-flex;
  padding: 2px;
  background: #e8f5e9;
  border-radius: 999px;
  border: 1px solid #b7dfbf;
}

.mg-ha__preview-mode {
  appearance: none;
  border: 0;
  background: transparent;
  color: #2e7d32;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.mg-ha__preview-mode.is-active {
  background: #2f9e44;
  color: #fff;
}

.mg-ha__fix-card {
  position: relative;
  padding: 14px 14px 12px;
  border: 1px solid #9fd4a8;
  border-radius: var(--mg-radius);
  background: #f3fbf5;
  margin-bottom: 8px;
  list-style: none;
}

.mg-ha__fix-badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #1b5e20;
  background: #d8f3dc;
  border-radius: 999px;
}

.mg-ha__fix-arrow {
  display: inline-block;
  margin: 0 8px;
  color: #2e7d32;
  font-weight: 600;
}

.mg-ha__fix-note {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--mg-muted);
}

.mg-ha__ua {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mg-muted);
}

.mg-ha__ua select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius);
  font: inherit;
  font-size: 14px;
  text-transform: none;
  letter-spacing: normal;
}

.mg-ha__metric {
  padding: 16px;
  background: var(--mg-white);
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius-ui);
}

.mg-ha__metric-label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mg-muted);
}

.mg-ha__metric-value {
  margin: 6px 0 0;
  font-size: 20px;
  font-weight: 700;
}

.mg-ha__metric-hint {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 500;
  color: var(--mg-muted);
  letter-spacing: -0.01em;
}

.mg-ha__dual {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.mg-ha__dual-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mg-muted);
}

.mg-ha__chain {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}

.mg-ha__chain-step.is-ok {
  color: #2f6b47;
}

.mg-ha__chain-step.is-bad {
  color: #a32828;
}

.mg-ha__chain li {
  margin-bottom: 4px;
  word-break: break-all;
}

.mg-ha__import {
  margin: 12px 0 0;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  background: #f3fbf5;
  border: 1px solid #9fd4a8;
  border-radius: var(--mg-radius);
  max-width: 48ch;
}

.mg-ha__ai-result {
  margin-top: 16px;
  padding: 16px;
  background: var(--mg-white);
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius-ui);
  display: grid;
  gap: 14px;
}

.mg-ha__ai-label {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mg-muted);
}

.mg-ha__ai-block--sep {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--mg-border);
}

.mg-ha__input {
  flex: 1 1 240px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--mg-border);
  border-radius: var(--mg-radius);
  background: var(--mg-white);
  font: inherit;
  font-size: 16px;
}

.mg-ha__input:focus {
  outline: 2px solid var(--mg-blue-link);
  outline-offset: 1px;
}

.mg-ha__optional {
  font-weight: 500;
  color: var(--mg-muted);
}

.mg-ha__form.is-loading .mg-ha__submit,
.mg-ha__actions.is-loading .mg-ha__submit {
  opacity: 0.92;
  pointer-events: none;
  cursor: wait;
}

.mg-ha__quota-wrap {
  padding-bottom: 28px;
}

.mg-ha__quota {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #b0b8c0;
  font-weight: 400;
}

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