/* ── Config editor (Ordering + Agent config) ────────────────────────── */
/* A form for the selected scope's config fragment, with a read-only Resolved
   panel beside it. Shared by the Ordering and Agent config views (each edits
   its own namespace). Reuses the card look and CSS variables from
   base/customizations. */

.cfg-target {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  color: var(--purple-lite);
}

/* Form + Resolved panel side by side; stack on narrow content. */
.cfg-layout {
  display: grid; gap: 1.25rem;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 60rem) {
  .cfg-layout { grid-template-columns: 1fr; }
}

.cfg-form {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.15rem 1.25rem 1.25rem;
  display: flex; flex-direction: column; gap: 1rem;
}

.cfg-field { display: flex; flex-direction: column; gap: .35rem; }
.cfg-field label { font-size: .8rem; color: var(--muted); }

.cfg-form input[type="text"],
.cfg-form input[type="number"],
.cfg-form textarea,
.cfg-form select {
  font-size: .88rem; padding: .5rem .6rem; border-radius: .5rem;
  background: #161619; color: var(--text); border: 1px solid var(--border);
  width: 100%; font-family: inherit;
}
.cfg-form textarea { resize: vertical; min-height: 2.5rem; line-height: 1.45; }
.cfg-form input:focus, .cfg-form textarea:focus, .cfg-form select:focus {
  outline: 2px solid var(--purple); outline-offset: 1px;
}
.cfg-form ::placeholder { color: var(--dim); }

/* Check-in group. */
.cfg-fieldset {
  border: 1px solid #3a3a42; border-radius: .6rem;
  padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: 1rem;
  margin: 0;
}
.cfg-fieldset legend {
  font-size: .82rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--purple-lite); padding: 0 .45rem;
}
.cfg-row { display: flex; gap: 1rem; }
.cfg-row .cfg-field { flex: 1 1 0; }

.cfg-actions { display: flex; align-items: center; gap: .9rem; }
.cfg-save {
  background: var(--purple); border-color: var(--purple);
  color: #fff; font-weight: 600;
}
.cfg-save:hover:not(:disabled) { background: var(--purple-lite); border-color: var(--purple-lite); }
.cfg-status { font-size: .82rem; }
.cfg-status.cfg-error { color: #f87171; }

/* Resolved (effective) panel. */
.cfg-resolved {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.15rem 1.25rem 1.25rem;
  position: sticky; top: 4.5rem;
}
.cfg-resolved p { margin: .2rem 0 .8rem; }
.cfg-pre {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: .78rem; line-height: 1.5; color: var(--text);
  max-height: 60vh; overflow: auto;
}

/* ── Menu Config: alias tables ──────────────────────────────────────── */
/* A short helper line under a fieldset legend. */
.cfg-hint { margin: -.3rem 0 .2rem; font-size: .78rem; }

.mc-aliases { display: flex; flex-direction: column; gap: .6rem; }

/* One alias row: name | values (grows) | remove. Wraps on narrow widths. */
.mc-alias {
  display: grid; gap: .5rem; align-items: start;
  grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr) auto;
}
@media (max-width: 40rem) {
  .mc-alias { grid-template-columns: 1fr auto; }
  .mc-alias .mc-alias-values { grid-column: 1 / -1; }
}
.mc-alias-name {
  font-size: .88rem; padding: .5rem .6rem; border-radius: .5rem;
  background: #161619; color: var(--text); border: 1px solid var(--border);
  font-family: inherit;
}
.mc-alias-name:focus { outline: 2px solid var(--purple); outline-offset: 1px; }

/* Item-to-item upsell rows: two comboboxes (from → to) + remove, each flexing to
   share the width, with a per-row "won't transfer" hint below (.mc-upsell-hint). */
.mc-upsell-row { display: flex; align-items: center; gap: .5rem; }
.mc-upsell-row .combo { flex: 1 1 0; }
.mc-upsell-row .combo input { min-width: 0; width: 100%; }
.mc-arrow { color: var(--dim); flex: 0 0 auto; }
.mc-upsell-hint { margin: .1rem 0 .2rem; }
/* Two classes so it beats .dim's muted color. Flags a mapping whose source has
   no modifiers to carry over. */
.mc-upsell-hint.mc-upsell-warn { color: #f87171; font-weight: 700; }

.mc-remove {
  align-self: stretch; min-width: 2rem; padding: 0 .55rem;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: .5rem;
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.mc-remove:hover { color: #f87171; border-color: #f87171; }

.mc-add {
  align-self: flex-start; margin-top: .2rem;
  background: transparent; color: var(--purple-lite);
  border: 1px dashed var(--border); border-radius: .5rem;
  padding: .4rem .7rem; font-size: .82rem; cursor: pointer;
}
.mc-add:hover { border-color: var(--purple); color: var(--purple); }

/* ── Chip multi-select ──────────────────────────────────────────────── */
/* A field-like box of chips followed by a search input; the dropdown reuses
   the shared ``.combo-menu`` look. */
.chipsel { position: relative; }
.chipsel-box {
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: center;
  min-height: 2.4rem; padding: .3rem .4rem; border-radius: .5rem;
  background: #161619; border: 1px solid var(--border); cursor: text;
}
.chipsel-box:focus-within { outline: 2px solid var(--purple); outline-offset: 1px; }
.chipsel.disabled { opacity: .5; }
.chipsel-input {
  flex: 1 1 6rem; min-width: 6rem; border: 0; background: transparent;
  color: var(--text); font: inherit; font-size: .85rem; padding: .2rem .1rem;
}
.chipsel-input:focus { outline: none; }

.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .2rem .2rem .5rem; border-radius: 1rem;
  background: #26262b; color: var(--text); font-size: .8rem;
  border: 1px solid var(--border-soft);
}
.chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.15rem; height: 1.15rem; padding: 0; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: .95rem;
  line-height: 1; cursor: pointer;
}
.chip-x:hover { color: #fff; background: #3a3a41; }
