.mg-view {
  --mg-line: var(--line, #dbe2e7);
  --mg-muted: var(--muted, #5b6b72);
  --mg-surface: #f5f8f8;
  min-width: 0;
}
.mg-view [hidden] {
  display: none !important;
}
.mg-view .mg-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 25px;
}
.mg-head h1 {
  margin: 0 0 8px;
}
.mg-head p,
.mg-section-title p,
.mg-help,
.mg-empty p,
.mg-view .field small {
  color: var(--mg-muted);
  margin: 0;
  line-height: 1.6;
}
.mg-actions,
.mg-row-actions,
.mg-form-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.mg-view .btn {
  text-decoration: none;
}
.mg-panel {
  padding: clamp(18px, 2vw, 30px);
  margin-bottom: 18px;
  min-width: 0;
}
.mg-view h2 {
  font-size: 1.1rem;
  margin: 0;
}
.mg-view h3 {
  font-size: 1rem;
  margin: 0;
}
.mg-section-title {
  margin-bottom: 20px;
}
.mg-section-title p {
  margin-top: 5px;
  font-size: 0.9rem;
}
.mg-empty {
  text-align: center;
  padding: 28px 12px;
}
.mg-empty p {
  margin: 6px auto 0;
}
.mg-empty-action {
  display: flex;
  justify-content: center;
  padding: 0 12px 20px;
}
.mg-context,
.mg-list-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 18px;
  flex-wrap: wrap;
  gap: 12px;
}
.mg-context {
  align-items: flex-end;
}
.mg-count {
  display: inline-block;
  color: var(--mg-muted);
  padding: 0.15em 0.55em;
  font-size: 0.78rem;
  background: var(--mg-surface);
  border-radius: 5px;
}
.mg-table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 0.9rem;
}
.mg-view .table-wrap {
  width: 100%;
  overflow: auto;
}
.mg-table th,
.mg-table td {
  border-bottom: 1px solid var(--mg-line);
  padding: 13px 12px;
  vertical-align: middle;
}
.mg-table th {
  background: var(--mg-surface);
  color: var(--mg-muted);
  font-weight: 600;
  white-space: nowrap;
}
.mg-table td {
  line-height: 1.45;
}
.mg-table tr:last-child td {
  border-bottom: 0;
}
.mg-table .btn {
  white-space: nowrap;
  font-size: 0.83rem;
  min-height: 32px;
  padding: 5px 9px;
}
.mg-nowrap,
.mg-figure {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.mg-table-title {
  font-weight: 650;
  text-decoration: none;
  color: inherit;
}
.mg-table-title:hover {
  text-decoration: underline;
}
.mg-desc {
  display: block;
  margin-top: 4px;
  font-size: 0.81rem;
  color: var(--mg-muted);
  max-width: 38ch;
  overflow-wrap: anywhere;
}
.mg-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}
.mg-template {
  display: flex;
  flex-direction: column;
}
.mg-template-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 20px;
}
.mg-template-editor .mg-inline-note {
  margin: 18px 0;
}
.mg-template-editor .mg-actions {
  justify-content: flex-start;
}
.mg-rule-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}
.mg-rule-list > div {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mg-letter {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  font-size: 0.85rem;
  font-family: 'Manrope', sans-serif;
  border-radius: 7px;
  font-weight: 780;
}
.mg-a {
  background: #e4efff;
  color: #285caa;
}
.mg-b {
  background: #eee8fa;
  color: #6d49a0;
}
.mg-c {
  background: #fff0df;
  color: #95530d;
}
.mg-grid,
.mg-param-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.mg-param-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}
.mg-wide {
  grid-column: 1 / -1;
}
.mg-view .field {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  font-size: 0.9rem;
}
.mg-view .field > span {
  font-weight: 600;
}
.mg-view input:not([type='checkbox']),
.mg-view select,
.mg-view textarea {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--mg-line);
  padding: 10px 12px;
  background-color: #fff;
  font: inherit;
  color: inherit;
}
.mg-view input[type='file'] {
  font-size: 0.875rem;
  padding: 8px;
}
.mg-view input:disabled {
  background: #f3f5f6;
}
.mg-view textarea {
  resize: vertical;
}
.mg-view input:focus-visible,
.mg-view select:focus-visible,
.mg-view textarea:focus-visible,
.mg-segment:focus-visible {
  outline: 2px solid #4475a8;
  outline-offset: 2px;
}
.mg-view .field small {
  font-size: 0.8rem;
}
.mg-spaced {
  margin-top: 18px;
}
.mg-param {
  padding: 14px 11px 12px;
  background: var(--mg-surface);
  border-radius: 9px;
}
.mg-param > span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
}
.mg-estimate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px solid var(--mg-line);
  padding: 16px 18px;
  border-radius: 10px;
  margin-top: 16px;
}
.mg-estimate strong {
  display: block;
  margin-top: 2px;
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
}
.mg-estimate small,
.mg-estimate p {
  font-size: 0.87rem;
  color: var(--mg-muted);
  line-height: 1.6;
}
.mg-estimate p {
  margin: 0;
}
.mg-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.mg-indent {
  margin: 12px 0 0;
}
.mg-view input[type='checkbox'] {
  width: 16px;
  height: 16px;
}
.mg-qr {
  width: 90px;
  height: 90px;
  object-fit: contain;
}
.mg-form-end {
  display: flex;
  justify-content: flex-end;
  margin: 16px 0;
}
.mg-form-end .btn,
.mg-case-form > button {
  min-width: 110px;
}
.mg-copy,
.mg-commit-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 15px;
}
.mg-copy > div:first-child {
  flex: 1 1 240px;
}
.mg-copy .mg-section-title {
  margin: 0;
}
.mg-view .mg-select-project,
.mg-work-select {
  min-width: min(100%, 250px);
}
.mg-work-select {
  max-width: 520px;
  margin-bottom: 16px;
}
.mg-segments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.mg-segment {
  padding: 8px 13px;
  font: inherit;
  font-size: 0.9rem;
  background: #fff;
  border: 1px solid var(--mg-line);
  border-radius: 7px;
  cursor: pointer;
  color: inherit;
}
.mg-segment.active,
.mg-row-filter [aria-pressed="true"] {
  color: #164f48;
  background: #e9f4ee;
  border-color: #a9cbbc;
  font-weight: 650;
}
.mg-row-filter {
  margin-block: 0 10px;
}
.mg-drop:has(input:disabled),
.mg-drop input:disabled {
  cursor: progress;
}
.mg-help {
  margin: 12px 0;
  font-size: 0.9rem;
}
.mg-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px dashed #adbfc7;
  border-radius: 10px;
  background: var(--mg-surface);
  padding: 22px;
  cursor: pointer;
}
.mg-drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.mg-drop:focus-within {
  outline: 2px solid #4475a8;
}
.mg-drop strong,
.mg-drop small {
  pointer-events: none;
  overflow-wrap: anywhere;
}
.mg-drop small {
  color: var(--mg-muted);
}
.mg-drop.dragover,
.mg-drop.has-file {
  border-color: #489571;
  background: #f1f8f3;
}
.mg-upload-icon {
  font: 700 1.5rem/1.2 sans-serif;
  color: #477768;
}
.mg-form-foot {
  margin-top: 14px;
  justify-content: space-between;
}
.mg-preview,
.mg-batch-drawer,
.mg-edit-source {
  border-top: 1px solid var(--mg-line);
  padding-top: 18px;
  margin-top: 20px;
}
.mg-status {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.78rem;
  padding: 4px 7px;
  border-radius: 5px;
  font-weight: 600;
}
.mg-status.green {
  color: #256548;
  background: #ebf6ef;
}
.mg-status.red {
  color: #963748;
  background: #fceef0;
}
.mg-status.amber {
  color: #865019;
  background: #fff1de;
}
.mg-status.neutral {
  color: #536675;
  background: #edf2f5;
}
.mg-raw {
  display: inline-block;
  margin: 1px 8px 1px 0;
  overflow-wrap: anywhere;
}
.mg-raw > span {
  font-size: 0.76rem;
  color: var(--mg-muted);
}
.mg-raw-cell {
  min-width: 160px;
  max-width: 480px;
}
.mg-show-more,
.mg-commit-form,
.mg-case-form > button,
.mg-edit-source .mg-actions {
  margin-top: 15px;
}
.mg-inline-note,
.mg-error {
  line-height: 1.5;
  color: #8b3042;
}
.mg-error {
  margin: 12px 0;
  background: #fff3f4;
  border: 1px solid #ebc1ca;
  padding: 12px 15px;
  border-radius: 8px;
}
.mg-edit-source .mg-grid {
  margin-top: 14px;
}
.mg-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
@media (max-width: 700px) {
  .mg-view .mg-head {
    align-items: flex-start;
  }
  .mg-grid,
  .mg-param-grid {
    grid-template-columns: 1fr;
  }
  .mg-param-grid {
    gap: 8px;
  }
  .mg-template-grid {
    grid-template-columns: 1fr;
  }
  .mg-view .mg-panel {
    padding: 16px;
  }
  .mg-view .mg-search,
  .mg-context .mg-select-project {
    width: 100%;
  }
  .mg-table {
    min-width: 500px;
  }
  .mg-head h1 {
    font-size: 1.65rem;
  }
}
.mg-source-link {
  border: 0;
  background: transparent;
  color: #285e70;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  font: inherit;
  text-align: left;
}
.mg-view .field > .mg-file-picker {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid var(--mg-line);
  border-radius: 8px;
  overflow: hidden;
  font-weight: 400;
  color: var(--mg-muted);
}
.mg-file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.mg-file-picker:focus-within {
  outline: 2px solid #4475a8;
  outline-offset: 2px;
}
.mg-picker-action {
  padding: 5px 10px;
  color: #2c574b;
  background: #eaf3ee;
  border-radius: 5px;
  font-weight: 600;
}

.mg-published-cases {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,290px),1fr));gap:14px;margin-top:16px}
.mg-case-item {min-width:0;border:1px solid var(--line);border-radius:12px;padding:15px;background:var(--paper)}
.mg-case-who,.mg-case-actions,.mg-link-results{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.mg-case-who h3{font-size:19px}
.mg-case-sum {color:var(--brand);font-weight:700;font-size:14px}
.mg-case-content {display:flex;align-items:center;gap:12px;margin:12px 0}
.mg-case-content>div{min-width:0}
.mg-case-content strong, .mg-case-content a {display:block}
.mg-case-content video,.mg-case-content img {width:100px;max-width:40%;aspect-ratio:3/4;background:#18251d;object-fit:contain;border-radius:7px}
.mg-case-content a {margin-top:6px;font-size:13px}
.mg-case-actions small,.mg-link-results{font-size:13px;color:var(--muted)}
.mg-link-results {justify-content:flex-start;margin:6px 0 14px}
.mg-channel-warning{border-radius:8px;background:#fff1ce;color:#664a13;padding:8px 11px;font-size:14px;margin:8px 0 12px}
.mg-link-cover{width:95px;max-height:132px;object-fit:contain;margin-top:7px;border-radius:8px}
