.mg-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.mg-nav {
  display: flex;
  flex-direction: column;
  padding: 8px;
  border: 1px solid #dce6df;
  border-radius: 16px;
  background: #fff;
  position: sticky;
  top: 16px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}
.mg-nav button {
  flex-shrink: 0;
  text-align: left;
  padding: 12px 14px;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #3e5045;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.mg-nav button.active {
  background: #e8f4ec;
  color: #166534;
  font-weight: 700;
}
.mg-nav button:hover {
  background: #f0f5f2;
}
.mg-content {
  min-width: 0;
}
.mg-card {
  margin-bottom: 20px;
}
.mg-card h2 {
  font-size: 20px;
  margin: 0 0 12px;
}
.mg-form {
  max-width: 760px;
}
.mg-check {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
}
.mg-check input {
  width: 18px;
  height: 18px;
  accent-color: #15803d;
  flex-shrink: 0;
}
.mg-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}
.mg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.mg-stack {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}
.mg-record,
.mg-team {
  border: 1px solid #dce6df;
  border-radius: 12px;
  padding: 16px;
}
.mg-row {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  flex-wrap: wrap;
}
.mg-row p {
  margin: 4px 0;
}
.mg-save {
  border-top: 1px solid #dce6df;
  margin-top: 12px;
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  position: relative;
}
.mg-result {
  font-size: 13px;
  color: #166534;
  max-width: 70%;
}
.mg-notice {
  padding: 14px;
  background: #eef6f0;
  border-radius: 10px;
  line-height: 1.6;
}
.mg-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.mg-metrics > div {
  padding: 18px;
  border: 1px solid #dce6df;
  border-radius: 12px;
  display: grid;
  gap: 10px;
}
.mg-metrics span {
  font-size: 13px;
  color: #596b60;
}
.mg-metrics strong {
  font-size: 26px;
}
.mg-secret {
  display: block;
  padding: 16px;
  background: #F5F9FF;
  font-size: 18px;
  overflow-wrap: anywhere;
  margin: 16px 0;
}
.mg-integration-list {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}
.mg-card small {
  color: #596b60;
  font-size: 12px;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid #15803d;
  outline-offset: 3px;
}
.mg-card input,
.mg-card select,
.mg-card textarea {
  max-width: 100%;
  min-width: 0;
}
.mg-content form {
  min-width: 0;
}
.mg-attribute .field {
  margin: 0;
}
.mg-attribute .mg-options {
  margin-top: 12px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14221a;
  --surface: #1d2d23;
  --text: #ecf3ee;
  --muted: #b5c5b9;
  --line: #3a5042;
}
[data-theme="dark"] body,
[data-theme="dark"] .content {
  background: #14221a;
  color: #ecf3ee;
}
[data-theme="dark"] .sidebar,
[data-theme="dark"] .surface,
[data-theme="dark"] .mg-nav,
[data-theme="dark"] .mail-card {
  background: #1d2d23;
  color: #ecf3ee;
  border-color: #3a5042;
}
[data-theme="dark"] .hint,
[data-theme="dark"] .sub,
[data-theme="dark"] .mg-card small,
[data-theme="dark"] .mg-metrics span {
  color: #b5c5b9;
}
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: #14221a;
  color: #ecf3ee;
  border-color: #526b5c;
}
[data-theme="dark"] .mg-nav button {
  color: #ecf3ee;
}
[data-theme="dark"] .mg-nav button.active,
[data-theme="dark"] .mg-nav button:hover,
[data-theme="dark"] .mg-notice,
[data-theme="dark"] .mg-secret {
  background: #2b4634;
  color: #eff7f1;
}
[data-theme="dark"] .mg-result {
  color: #86efac;
}
[data-theme="dark"] .cc,
[data-theme="dark"] .cc-sidebar,
[data-theme="dark"] .cc-item,
[data-theme="dark"] .cc-dialog,
[data-theme="dark"] .cc-profile,
[data-theme="dark"] .side-nav button {
  background: #1d2d23;
  color: #ecf3ee;
}
[data-theme="dark"] .field label {
  color: #ecf3ee;
}
@media (max-width: 900px) {
  .mg-layout {
    grid-template-columns: 1fr;
  }
  .mg-nav {
    position: static;
    max-height: none;
    flex-direction: row;
    overflow: auto;
    border-radius: 12px;
    gap: 4px;
  }
  .mg-nav button {
    white-space: nowrap;
    flex-shrink: 0;
  }
  .mg-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 520px) {
  .mg-grid {
    grid-template-columns: 1fr;
  }
  .mg-card {
    padding: 16px;
  }
  .mg-metrics {
    gap: 8px;
  }
  .mg-metrics > div {
    padding: 12px;
  }
  .mg-metrics strong {
    font-size: 22px;
  }
  .mg-save {
    align-items: stretch;
    flex-direction: column;
  }
  .mg-result {
    max-width: 100%;
  }
}
.mg-module-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.mg-module {
  display: grid;
  gap: 8px;
  text-align: left;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface, #fff);
  cursor: pointer;
}
.mg-module strong {
  font-size: 16px;
}
.mg-module span {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.mg-module small {
  color: #23724a;
}
.mg-module:hover,
.mg-module.active {
  border-color: var(--signal);
  background: #edf6ef;
}
.mg-module:focus-visible {
  outline: 3px solid var(--signal);
  outline-offset: 3px;
}
#mgModuleEditor {
  scroll-margin-top: 24px;
}
[data-theme="dark"] .mg-module {
  background: #1d2d23;
  color: #ecf3ee;
}
[data-theme="dark"] .mg-module.active {
  border-color: #86efac;
}
[data-theme="dark"] .mg-module small {
  color: #86efac;
}
@media (max-width: 640px) {
  .mg-module-list {
    grid-template-columns: 1fr;
  }
}
