.mg-body { background: #0f1326; }
.mg { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.mg.is-collapsed { grid-template-columns: 68px minmax(0, 1fr); }
.mg-side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 12px; background: var(--night); border-right: 1px solid var(--line); }
.mg-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 6px 18px; margin-bottom: 8px; border-bottom: 1px solid var(--line2); }
.mg-brand .logo { font-size: 21px; gap: 10px; }
.mg-brand .logo-mark { width: 16px; height: 16px; }
.mg-brand .logo-mark::after { inset: 4px; }
.mg-collapse { width: 30px; height: 30px; flex: none; background: transparent; border: 1px solid var(--line2); color: var(--silver); font-size: 18px; line-height: 1; }
.mg-tabs { display: flex; flex-direction: column; gap: 2px; }
.mg-tab, .mg-back { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 10px; height: 42px; padding: 0 10px; background: transparent; border: 0; border-left: 2px solid transparent; color: var(--pearl); text-align: left; font-size: 14px; text-decoration: none; }
.mg-tab:hover, .mg-back:hover { background: rgba(255,255,255,.04); }
.mg-tab.is-on { background: rgba(201,169,106,.12); border-left-color: var(--gold); color: var(--gold2); }
.mg-tab b { font-weight: 500; font-size: 12px; color: var(--silver); font-variant-numeric: tabular-nums; }
.mg-ico { color: var(--gold); text-align: center; font-size: 13px; }
.mg-tl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-back { margin-top: auto; color: var(--silver); }
.mg.is-collapsed .mg-tl, .mg.is-collapsed .mg-tab b, .mg.is-collapsed .logo-txt { display: none; }
.mg.is-collapsed .mg-tab, .mg.is-collapsed .mg-back { grid-template-columns: 1fr; justify-items: center; padding: 0; }
.mg.is-collapsed .mg-brand { flex-direction: column; padding-inline: 0; }
.mg.is-collapsed .mg-collapse { transform: rotate(180deg); }

.mg-main { padding: 26px 28px 60px; min-width: 0; }
.mg-top { display: flex; align-items: center; gap: 18px; padding-bottom: 20px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.mg-top h1 { font-size: 38px; white-space: nowrap; }
.mg-status { margin-left: auto; font-size: 13px; color: var(--silver); white-space: nowrap; }
.mg-status.is-ok { color: #8fc9a3; }
.mg-status.is-err { color: #e79aa6; }
.mg-lock { margin: 0 0 16px; padding: 12px 16px; background: rgba(142,43,58,.25); border: 1px solid rgba(231,154,166,.4); color: #f1c7cd; font-size: 14px; }
.mg-note { margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--line); background: rgba(201,169,106,.07); color: var(--gold2); font-size: 14px; }

.mg-head, .mrow { display: grid; align-items: center; gap: 10px; }
.mg-head { padding: 0 12px 8px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--silver); white-space: nowrap; }
.mg-head span { overflow: hidden; text-overflow: ellipsis; }
.mrow { padding: 8px 12px; background: var(--night); border: 1px solid var(--line2); margin-bottom: 6px; }
.mrow:hover { border-color: var(--line); }
.r { text-align: right; }
.c { text-align: center; justify-self: center; }
.mrow input:not([type=checkbox]), .mrow select, .mrow textarea { width: 100%; min-width: 0; height: 38px; padding: 0 10px; background: #0f1326; border: 1px solid transparent; color: var(--pearl); font: 14px/1.3 var(--sans); border-radius: 0; text-overflow: ellipsis; }
.mrow textarea { height: auto; min-height: 38px; padding: 9px 10px; resize: none; field-sizing: content; }
.mrow input:focus, .mrow select:focus, .mrow textarea:focus { outline: none; border-color: var(--gold); }
.mrow input.r { text-align: right; font-variant-numeric: tabular-nums; }
.mrow input[type=checkbox], .mg-check input { width: 18px; height: 18px; accent-color: var(--gold); }
.mg-thumb { width: 48px; height: 48px; background: var(--pearl); overflow: hidden; }
.mg-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mg-thumb.sm { width: 32px; height: 32px; flex: none; }
.mg-acts { display: flex; justify-content: flex-end; gap: 6px; }
.mg-acts button, .mg-addopt { height: 32px; padding: 0 12px; background: transparent; border: 1px solid var(--line2); color: var(--silver); font-size: 12px; white-space: nowrap; }
.mg-acts button:hover, .mg-addopt:hover { border-color: var(--gold); color: var(--gold2); }
.mg-del.is-sure { background: var(--garnet); border-color: var(--garnet); color: #fff; }

.mg-prod { grid-template-columns: 48px minmax(140px, 1.2fr) 116px 104px minmax(150px, 1.6fr) 86px 70px 56px 60px 136px; }
.ml { display: contents; }
.ml > span { display: none; }
.mg-opt { grid-template-columns: minmax(130px, 1fr) 110px 90px minmax(130px, 1fr) 70px 90px; }
.mg-ship { grid-template-columns: minmax(180px, 2fr) 100px 110px 90px 90px 64px 90px; }
.mg-code { grid-template-columns: minmax(140px, 1.3fr) 80px 90px 100px 200px 90px 76px 64px 90px; }
.mg-faq { grid-template-columns: minmax(200px, 1.2fr) minmax(260px, 2.4fr) 130px 76px 90px; align-items: start; }
.mg-group { margin-bottom: 26px; }
.mg-gtitle { display: flex; align-items: center; gap: 12px; padding: 0 0 10px; }
.mg-gtitle b { font-family: var(--disp); font-weight: 400; font-size: 22px; white-space: nowrap; }
.mg-gtitle .muted { font-size: 13px; white-space: nowrap; }
.mg-addopt { margin-left: auto; }
.mg-hint { margin: 14px 0 0; font-size: 13px; color: var(--silver); }
.mg-empty { padding: 18px 12px; color: var(--silver); }
.mg-card { max-width: 720px; padding: 30px; background: var(--night); border: 1px solid var(--line); }
.mg-card h2 { font-size: 32px; margin-bottom: 14px; }
.mg-card p { color: #d6d2cb; }
.mg-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 24px 0 0; padding: 0; list-style: none; }
.mg-steps li { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line2); font-size: 14px; }
.mg-steps b { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border: 1px solid var(--gold); color: var(--gold2); font-weight: 500; }

.mg-mbox { display: block; width: min(720px, 100% - 40px); padding: 34px 34px 28px; }
.mg-mbox h3 { font-size: 34px; margin: 0 40px 22px 0; }
.mg-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.mg-f { display: flex; flex-direction: column; gap: 6px; }
.mg-f.wide { grid-column: 1 / -1; }
.mg-f > span { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); }
.mg-f input, .mg-f select, .mg-f textarea { height: 46px; padding: 0 12px; border: 1px solid #c9c1b0; background: #fff; color: var(--ink); font: 15px var(--sans); border-radius: 0; }
.mg-f textarea { height: auto; padding: 10px 12px; resize: vertical; }
.mg-check { flex-direction: row; align-items: center; gap: 10px; grid-column: 1 / -1; }
.mg-check span { font-size: 14px; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 400; }
.mg-fnote { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--ink2); }
.mg-fbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding-top: 8px; border-top: 1px solid var(--pearl2); }
.mg-fmsg { margin: 0 auto 0 0; font-size: 14px; color: var(--garnet); }

/* smaller laptops: the menu folds to icons so rows fit */
@media (min-width: 1081px) and (max-width: 1380px) {
  .mg { grid-template-columns: 68px minmax(0, 1fr); }
  .mg .mg-tl, .mg .mg-tab b, .mg .logo-txt, .mg .mg-collapse { display: none; }
  .mg .mg-tab, .mg .mg-back { grid-template-columns: 1fr; justify-items: center; padding: 0; }
  .mg .mg-brand { flex-direction: column; padding-inline: 0; }
}

/* narrower screens: each row becomes a 2-column card */
@media (max-width: 1080px) {
  .mg, .mg.is-collapsed { grid-template-columns: minmax(0, 1fr); }
  .mg-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .mg-brand { border: 0; margin: 0; padding: 0 10px 0 0; }
  .mg-collapse, .mg-back { display: none; }
  .mg-tabs { flex-direction: row; overflow-x: auto; scrollbar-width: none; flex: 1 1 100%; }
  .mg-tab { grid-template-columns: auto auto; flex: none; border-left: 0; border-bottom: 2px solid transparent; height: 40px; }
  .mg-tl { overflow: visible; }
  .ml { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
  .ml > span { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--silver); white-space: nowrap; }
  .ml.wide { grid-column: 1 / -1; }
  .mg-tab .mg-ico { display: none; }
  .mg-tab.is-on { border-bottom-color: var(--gold); }
  .mg.is-collapsed .mg-tl, .mg.is-collapsed .mg-tab b, .mg.is-collapsed .logo-txt { display: initial; }
  .mg-main { padding: 18px 16px 50px; }
  .mg-head { display: none; }
  .mrow { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; grid-auto-flow: row dense; padding: 12px; }
  .mrow > * { grid-column: auto; }
  .mrow .mg-acts { grid-column: 1 / -1; }
  .mrow label.c { justify-self: start; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--silver); }
  .mrow label.c::after { content: attr(data-l); }
  .mg-thumb { grid-column: 1 / -1; }
  .mg-top h1 { font-size: 30px; }
  .mg-steps { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .mg-form { grid-template-columns: minmax(0, 1fr); }
  .mg-mbox { padding: 26px 20px 22px; }
  .mg-top { flex-wrap: wrap; }
  .mg-status { order: 3; flex-basis: 100%; margin: 0; }
  .mg-gtitle { flex-wrap: wrap; }
}
