/* Genexts Model Helper. Builds on design.css (.gd variables, buttons, side panel); calm & minimal, one teal accent. */
.mh { position: relative; }
.mh .gd-side.mh-side { width: 360px; }
.mh-main { flex: 1; min-width: 0; overflow-y: auto; padding: 24px clamp(16px, 4vw, 48px) 48px; }
.mh-main > * { max-width: 860px; margin-left: auto; margin-right: auto; }
.mh-attach { cursor: pointer; }
.mh-attach.disabled { opacity: .45; pointer-events: none; }
.mh-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mh-file-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; max-width: 100%; }
.mh-file-chip button { border: 0; background: transparent; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.mh-file-chip button:hover { background: var(--soft); color: var(--text); }
.mh details { margin-top: 10px; }
.mh-side-actions { margin-top: auto; }
.gd-spin.sm { width: 12px; height: 12px; display: inline-block; }

.mh-toggle { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; user-select: none; }
.mh-toggle small { color: var(--muted); }
.mh-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.mh-toggle span { width: 34px; height: 20px; border-radius: 999px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.mh-toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.mh-toggle input:checked + span { background: var(--accent); }
.mh-toggle input:checked + span::after { transform: translateX(14px); }
.mh-toggle input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

.mh-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.mh-head > div { flex: 1; }
.mh-head h2 { margin: 0 0 4px; font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.mh-head p { margin: 0; color: var(--muted); }

.mh-steps { list-style: none; margin: 0 auto; padding: 0; position: relative; }
.mh-steps::before { content: ""; position: absolute; left: 15px; top: 16px; bottom: 16px; width: 1px; background: var(--line); }
.mh-step { display: flex; gap: 14px; margin-bottom: 12px; position: relative; }
.mh-num { width: 31px; height: 31px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted); z-index: 1; }
.mh-step.running .mh-num { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.mh-step.done .mh-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.mh[data-theme="dark"] .mh-step.done .mh-num { color: #062420; }
.mh-step.error .mh-num { border-color: var(--danger); color: var(--danger); }
.mh-step.skipped .mh-step-body, .mh-step.waiting .mh-step-body { opacity: .7; }
.mh-step-body { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.mh-step.running .mh-step-body { border-color: var(--accent); }
.mh-step-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mh-role { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.mh-model { width: auto !important; max-width: 220px; height: 30px; padding: 0 8px !important; font-size: 13px !important; }
.mh-model-tag { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.mh-model-tag.free { background: var(--soft); color: var(--muted); }
.mh-rm { margin-left: auto; width: 28px !important; height: 28px !important; color: var(--muted); }
.mh-task { color: var(--muted); font-size: 13px; margin-top: 4px; }
.mh-st { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.mh-st.ok { color: var(--accent); }
.mh-st.bad { color: var(--danger); }
.mh-verdict { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 6px; }
.mh-verdict.ok { background: var(--accent-soft); color: var(--accent); }
.mh-verdict.bad { background: rgba(217,119,6,.12); color: #b45309; }
.mh[data-theme="dark"] .mh-verdict.bad { color: #fbbf24; }
.mh-note { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: #b45309; background: rgba(217,119,6,.08); border-radius: 8px; padding: 6px 10px; margin-top: 8px; }
.mh[data-theme="dark"] .mh-note { color: #fbbf24; }
.mh-err { color: var(--danger); font-size: 13px; margin-top: 8px; }
.mh-err.big { padding: 12px 14px; border: 1px solid var(--danger); border-radius: 10px; }
.mh-tools { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--muted); }
.mh-tools > div { display: flex; align-items: center; gap: 6px; }
.mh-tools a { color: inherit; }
.mh-tools a:hover { color: var(--accent); }

.mh-out { margin-top: 10px; max-height: 260px; overflow: hidden; position: relative; border-top: 1px solid var(--line); padding-top: 10px; }
.mh-out::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 48px; background: linear-gradient(transparent, var(--panel)); pointer-events: none; }
.mh-step.running .mh-out { max-height: 320px; display: flex; flex-direction: column-reverse; overflow: hidden; }
.mh-out.open { max-height: none; }
.mh-out.open::after { display: none; }
.mh-out-actions { display: flex; gap: 4px; margin-top: 4px; }
.mh-md { line-height: 1.6; font-size: 13.5px; overflow-wrap: anywhere; }
.mh-md h3, .mh-md h4 { margin: 8px 0 4px; font-size: 14.5px; }
.mh-md .li { position: relative; padding-left: 18px; margin: 2px 0; }
.mh-md .li::before { content: ""; position: absolute; left: 6px; top: .65em; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
.mh-md .li.n { padding-left: 22px; }
.mh-md .li.n::before { display: none; }
.mh-md .li.n i { position: absolute; left: 0; font-style: normal; color: var(--muted); }
.mh-md code { background: var(--soft); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
.mh-md pre, .mh-filev pre { background: var(--soft); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-size: 12.5px; line-height: 1.5; margin: 6px 0; }
.mh-md pre code, .mh-filev pre code { background: none; padding: 0; }
.mh-md a { color: var(--accent); }
.mh-verdict-line { display: inline-block; font-weight: 700; margin-top: 4px; }

.mh-main > .mh-add, .mh-main > .mh-card, .mh-main > .mh-run, .mh-main > .mh-err.big { max-width: 815px; margin-left: calc(max(0px, (100% - 860px) / 2) + 45px); }
.mh-add { margin-top: 4px; margin-bottom: 16px; }
.mh-add select { width: 100%; }
.mh-run { height: 40px; padding: 0 18px; font-weight: 600; }

.mh-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.mh-card.push { border-color: var(--accent); }
.mh-card.ok { border-color: var(--accent); background: var(--accent-soft); }
.mh-card p { margin: 0; }
.mh-card .gd-btn.primary { align-self: flex-start; text-decoration: none; }
.mh-card-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mh-card-top b { display: inline-flex; align-items: center; gap: 6px; }
.mh-card-top > span { color: var(--muted); font-size: 12.5px; }
.mh-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mh-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.mh-grid label.wide { grid-column: 1 / -1; }
.mh-push-files { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.mh-push-files label { display: inline-flex; gap: 6px; align-items: center; }
.mh-filev { border-top: 1px solid var(--line); padding-top: 8px; margin: 0 !important; }
.mh-filev summary { cursor: pointer; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.mh-filev summary small { color: var(--muted); font-family: inherit; margin-left: 6px; }

.mh-empty { min-height: 70%; display: grid; place-items: center; text-align: center; }
.mh-empty h2 { margin: 0 0 6px; font-size: 22px; font-weight: 650; }
.mh-empty p { color: var(--muted); margin: 0 0 18px; }
.mh-team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin-bottom: 16px; text-align: left; }
.mh-member { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.mh-member span { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; }
.mh-member b { font-weight: 600; }

.mh-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.25); z-index: 40; }
.mh-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: var(--panel); border-left: 1px solid var(--line); z-index: 41; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.mh-team-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.mh-team-row span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mh-team-row small { color: var(--muted); font-size: 12px; }
.mh-team-row select { width: 200px !important; flex: none; }
.mh-toggle small { display: block; }
.mh-drawer-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: auto; }
.mh-toast { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--panel); padding: 10px 14px; border-radius: 10px; font-size: 13px; z-index: 60; box-shadow: 0 6px 24px rgba(0,0,0,.2); max-width: 90%; }

@media (max-width: 900px) {
  .mh .gd-body { flex-direction: column; overflow-y: auto; }
  .mh .gd-side.mh-side { width: 100%; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .mh-main { overflow: visible; padding: 16px; }
  .mh-main > .mh-card, .mh-main > .mh-run, .mh-main > .mh-add, .mh-main > .mh-err.big { margin-left: 0; max-width: none; }
  .mh-grid { grid-template-columns: 1fr; }
}

/* inside the Genexts app (#helper-view); .gd-host comes from design.css */
#helper-root { flex: 1; min-height: 0; }
