/* 부품 form — 폼 칸. 묶음: templates/ui/form.html · static/ui/parts/form/form.css · form.md.
   바탕(static/ui/base/ui.css)의 변수 · 단추 클래스에 기댄다. CDN·의존 없음. */
.nx-form { margin: 0; }
.nx-field { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-3); min-width: 0; }
.nx-field > label, .nx-label { font-size: var(--fs-s); color: var(--muted); }
.nx-req { color: var(--bad); margin-left: 2px; }
.nx-input, .nx-select, .nx-textarea { width: 100%; min-height: var(--ctl-h); padding: var(--sp-2) var(--sp-3); font: inherit;
  border: 1px solid var(--line); border-radius: var(--r-1); background: var(--bg); color: var(--fg); min-width: 0; }
.nx-textarea { min-height: 96px; resize: vertical; }
.nx-input:focus, .nx-select:focus, .nx-textarea:focus { outline: 2px solid var(--acc); outline-offset: -1px; }
.nx-input[readonly] { cursor: pointer; }
.nx-help, .nx-field-err { margin: 0; font-size: var(--fs-xs); }
.nx-help { color: var(--muted); }
.nx-field-err { color: var(--bad); }
.nx-field-err:empty { display: none; }
.nx-form-errors { margin-bottom: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-1); background: var(--bad-bg); color: var(--fg); font-size: var(--fs-s); }
.nx-form-errors ul { margin: 0; padding-left: var(--sp-4); }
.nx-field.is-bad .nx-input, .nx-field.is-bad .nx-select, .nx-field.is-bad .nx-textarea,
.nx-input[aria-invalid="true"], .nx-select[aria-invalid="true"], .nx-textarea[aria-invalid="true"] { border-color: var(--bad); }
.nx-check { flex-direction: row; align-items: center; gap: var(--sp-2); }
.nx-check input { width: 18px; height: 18px; accent-color: var(--acc); }
.nx-check > label { color: var(--fg); font-size: var(--fs-m); }
.nx-contents { display: contents; }   /* 격자 안에서 칸 여럿을 묶어 숨기고 보이기 */
.nx-input-group { display: flex; gap: var(--sp-2); }
.nx-input-group .nx-input { flex: 1; }
.nx-input-group .nx-btn { flex: none; min-height: var(--ctl-h); }   /* 칸 오른쪽에 붙는 단추 — 칸과 같은 높이 */
.nx-input-group .nx-select { flex: 0 1 auto; width: auto; max-width: 40%; }   /* 줄 안 고르기 칸은 제 글 폭만 — 입력칸이 남은 폭을 나눈다(🔑 키 항목 · 🔔 알림 규칙) */
.nx-input-group .nx-input { min-width: 0; }
.nx-code { font-family: var(--mono); font-size: var(--fs-xl); letter-spacing: .4em; text-align: center; }

/* 스위치(켜고 끄기) — 길 + 동그라미 + 글. 글은 상태로 고른다(켜짐/꺼짐 — 색만으로 말하지 않는다) */
.nx-switch { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; white-space: nowrap; position: relative; }
.nx-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.nx-switch-track { flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; transition: background .15s; }
.nx-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--fg); transition: transform .15s; }
.nx-switch input:checked + .nx-switch-track { background: var(--acc); }
.nx-switch input:checked + .nx-switch-track::after { transform: translateX(16px); background: #fff; }
.nx-switch input:focus-visible + .nx-switch-track { outline: 2px solid var(--acc); outline-offset: 2px; }
.nx-switch input:disabled + .nx-switch-track { opacity: .5; }
.nx-switch-text::after { content: attr(data-off); color: var(--muted); }
.nx-switch input:checked ~ .nx-switch-text::after { content: attr(data-on); color: var(--fg); }
/* checks — 여러 개 고르기: 테두리 판 안에 묶음 한 줄씩(머리 칸 고정 · 칩은 오른쪽에서만 줄바꿈), 칩을 누르면 켜짐 */
.nx-checks-box { border: 1px solid var(--line); border-radius: var(--r-1); overflow: hidden; }
.nx-checks-group { display: grid; grid-template-columns: 7em 1fr; align-items: start; gap: var(--sp-3);
                   padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--line); }
.nx-checks-group:first-child { border-top: 0; }
.nx-checks-nohead { grid-template-columns: 1fr; }
.nx-checks-head { color: var(--muted); font-size: var(--fs-xs); line-height: 28px; white-space: nowrap; }
.nx-checks-items { display: flex; flex-wrap: wrap; gap: 6px; }
.nx-checks-item { position: relative; display: inline-flex; align-items: center; height: 28px; padding: 0 var(--sp-3);
                  border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--fg);
                  font-size: var(--fs-s); white-space: nowrap; cursor: pointer; user-select: none; }
.nx-checks-item input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.nx-checks-item:hover { border-color: var(--acc); }
.nx-checks-item:has(input:checked) { background: var(--acc-bg); border-color: var(--acc); color: var(--acc); font-weight: 600; }
.nx-checks-item:has(input:checked) span::before { content: "✓ "; }
.nx-checks-item:has(input:focus-visible) { outline: 2px solid var(--acc); outline-offset: 2px; }
@media (max-width: 600px) { .nx-checks-group { grid-template-columns: 1fr; gap: var(--sp-1); } .nx-checks-head { line-height: 1.4; } }
/* pairs — 키-값 줄 목록: 줄마다 키(좁게) · 값(넓게) · 🗑️ */
.nx-pairs-rows { display: flex; flex-direction: column; gap: 6px; }
.nx-pairs-row { display: grid; grid-template-columns: minmax(8em, 2fr) 3fr auto; gap: 6px; align-items: center; }
@media (max-width: 600px) { .nx-pairs-row { grid-template-columns: 1fr auto; } .nx-pairs-row [data-pair-val] { grid-column: 1 / 2; } }
