/* Isthafa content manager: a calm table of every field in the deck. */
body.mg-body { overflow: auto; min-height: 100dvh; background: var(--bg); }
.mg-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0.85rem var(--gutter);
  border-bottom: 1px solid var(--line);
  background: oklch(12% 0.022 252 / 0.9);
  backdrop-filter: blur(14px);
}
.mg-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.mg-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 0.85rem; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text-muted); font-size: var(--text-sm); font-weight: 600; cursor: pointer; text-decoration: none;
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
}
.mg-btn:hover { color: var(--text); border-color: var(--lagoon); text-decoration: none; }
.mg-btn:focus-visible { outline: 2px solid var(--lagoon); outline-offset: 2px; }
.mg-btn.primary { background: var(--lagoon); color: var(--bg); border-color: var(--lagoon); }
.mg-btn.primary:hover { background: color-mix(in oklab, var(--lagoon) 85%, white); }
.mg-btn.unlocked { color: var(--lagoon); border-color: color-mix(in oklab, var(--lagoon) 50%, transparent); }
.mg-top .hud-status { margin-right: 0.5rem; }

.mg-banner {
  margin: 0; padding: 0.7rem var(--gutter);
  background: color-mix(in oklab, var(--coral) 14%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--coral) 40%, transparent);
  color: var(--text); font-size: var(--text-sm);
}

.mg-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 320px;
  gap: 0; align-items: start;
}
.mg-nav, .mg-history { position: sticky; top: 4.2rem; max-height: calc(100dvh - 4.2rem); overflow: auto; padding: 1.25rem; }
.mg-nav { border-right: 1px solid var(--line); }
.mg-history { border-left: 1px solid var(--line); }
.mg-main { padding: 1.25rem clamp(1rem, 3vw, 2.5rem) 4rem; }
@media (max-width: 1100px) {
  .mg-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .mg-history { grid-column: 1 / -1; position: static; max-height: none; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .mg-layout { grid-template-columns: 1fr; }
  .mg-nav { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
}

#mg-search {
  width: 100%; padding: 0.6rem 0.75rem; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: var(--text-sm);
}
#mg-search:focus-visible { outline: 2px solid var(--lagoon); outline-offset: 1px; }
.mg-toggle { display: flex; align-items: center; gap: 0.5rem; margin: 0.75rem 0 1rem; font-size: var(--text-sm); color: var(--text-muted); cursor: pointer; }
.mg-toggle input { accent-color: var(--lagoon); }
#mg-slide-nav a {
  display: grid; grid-template-columns: 1.8rem minmax(0, 1fr) auto; gap: 0.4rem; align-items: baseline;
  padding: 0.4rem 0.5rem; border-radius: 8px; color: var(--text-muted); font-size: var(--text-sm); text-decoration: none;
}
#mg-slide-nav a:hover { background: var(--surface-strong); color: var(--text); }
#mg-slide-nav a i { font-style: normal; font-size: var(--text-xs); color: var(--text-dim); font-variant-numeric: tabular-nums; }
#mg-slide-nav a .count { font-size: var(--text-xs); color: var(--text-dim); font-variant-numeric: tabular-nums; }
#mg-slide-nav a .count.mod { color: var(--sand); }
.mg-help { margin-top: 1.25rem; line-height: 1.5; }
.mg-help code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; color: var(--text-muted); }

.mg-slide { margin-bottom: 2.25rem; scroll-margin-top: 4.5rem; }
.mg-slide-head { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.mg-slide-head .h2 { font-size: var(--text-h3); }
.mg-slide-head .n { font-size: var(--text-xs); letter-spacing: 0.14em; color: var(--lagoon); font-weight: 700; }
.mg-slide-head a { font-size: var(--text-xs); letter-spacing: 0.08em; text-transform: uppercase; margin-left: auto; }

.mg-row {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.35rem;
  padding: 0.75rem 0.85rem; border-radius: 12px; border: 1px solid transparent;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.mg-row:hover { background: var(--surface); }
.mg-row.is-modified { border-color: color-mix(in oklab, var(--sand) 35%, transparent); background: color-mix(in oklab, var(--sand) 5%, transparent); }
.mg-row.is-hidden { display: none; }
.mg-meta { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-size: var(--text-xs); color: var(--text-dim); }
.mg-meta .mg-label { color: var(--text-muted); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.mg-meta code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.95em; opacity: 0.8; }
.mg-badge { padding: 0.1rem 0.5rem; border-radius: 999px; background: color-mix(in oklab, var(--sand) 18%, transparent); color: var(--sand); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.mg-row:not(.is-modified) .mg-badge { display: none; }
.mg-input {
  width: 100%; resize: none; overflow: hidden;
  padding: 0.55rem 0.7rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: var(--text-base); line-height: 1.45;
}
.mg-input:focus-visible { outline: 2px solid var(--lagoon); outline-offset: 1px; border-color: transparent; }
.mg-input.series { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-sm); }
.mg-foot { display: flex; align-items: center; gap: 0.75rem; font-size: var(--text-xs); color: var(--text-dim); min-height: 1.4em; }
.mg-default { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-row:not(.is-modified) .mg-default, .mg-row:not(.is-modified) .mg-reset { display: none; }
.mg-reset { color: var(--sand); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: var(--text-xs); }
.mg-reset:hover { text-decoration: underline; }
.mg-loading, .mg-empty { color: var(--text-dim); padding: 2rem 0; }

#mg-history-list { display: grid; gap: 0.6rem; margin-top: 0.75rem; }
#mg-history-list li { padding: 0.6rem 0.7rem; border-radius: 10px; border: 1px solid var(--line); font-size: var(--text-xs); color: var(--text-muted); }
#mg-history-list .when { color: var(--text-dim); }
#mg-history-list .key { display: block; color: var(--text); font-weight: 700; margin: 0.15rem 0; }
#mg-history-list .diff { display: grid; gap: 0.15rem; }
#mg-history-list .old { color: var(--coral); text-decoration: line-through; opacity: 0.8; }
#mg-history-list .new { color: var(--lagoon); }
#mg-history-list .restore { margin-top: 0.4rem; color: var(--sand); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
#mg-history-list .restore:hover { text-decoration: underline; }
