/* Configuration Page archetype — TRANSITIONAL stylesheet.
 *
 * This file mirrors the canonical CSS from
 * new-design-system/design-system/archetypes/configuration-page/reference.html
 * (and the two new components: state-select, inline-add-row), extracted
 * verbatim so the AM /campaign-tools/configure page renders correctly
 * before the canon CSS lands at new-design-system/design-system/.
 *
 * REPLACE-ME: when the design-system PR commits the archetype CSS +
 * components/state-select/*.css + components/inline-add-row/*.css into
 * new-design-system/design-system/, delete THIS file and link the canon
 * stylesheets instead. No view changes needed — class names are already
 * the canonical names.
 *
 * Source of truth: file transfers/export-config-page/archetypes/
 *                  configuration-page/reference.html (2026-06-05).
 */

/* ---- the configuration-page column (Compact Detail lineage: 880px) ---- */
/* The global app-frame container (.shell) is `display: flex; flex-direction: column`.
 * Without `width: 100%`, this column shrinks to content because `align-items: stretch`
 * doesn't expand flex items past their natural width when `max-width` is set.
 * `width: 100%` makes it fill the cross-axis up to the 880px cap; `margin: 0 auto`
 * then centers it. */
.config-page {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 28px 64px;
  box-sizing: border-box;
}

.page-head {
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.head-prefix {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-faint);
  font-weight: 700;
}
.head-name {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 6px 0 0;
  color: var(--fg);
}
/* Optional explanatory line under the H1 — one sentence on what's
 * being edited here. Sub-paragraph to keep the head compact. */
.page-head-sub {
  margin: 10px 0 0;
  max-width: 640px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--fg-muted);
}

/* ---- flash messages — Compact Detail neutral treatment ---- */
.config-flash {
  margin: 16px 0 0;
  padding: 9px 14px;
  border-radius: var(--r-input);
  font-size: 13px;
  line-height: 1.45;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
}
.config-flash-notice { border-color: var(--color-success-border); background: var(--color-success-bg); color: var(--color-success-text); }
.config-flash-alert  { border-color: var(--color-danger-border, var(--border));
                       background: var(--color-danger-bg, var(--surface-2));
                       color: var(--color-danger-text, var(--fg)); }

/* ---- editable-list panel ---- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  margin-top: 24px;
}
.panel-head {
  display: flex;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

/* inline add-row: trigger + revealed form */
.panel-add-trigger {
  margin-left: auto;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--color-blue-700);
  font-weight: 500;
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
.panel-add-trigger:hover { text-decoration: underline; }

.panel-add-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.panel-add-input {
  flex: 1;
  font: inherit;
  font-size: 13px;
  border: 1px solid var(--color-blue-600);
  border-radius: var(--r-input);
  padding: 7px 10px;
  color: var(--fg);
  box-shadow: 0 0 0 3px var(--color-blue-50);
}
.panel-add-input:focus { outline: none; }
.panel-add-input::placeholder { color: var(--fg-faint); }

/* initial-state toggle — a switch sized 34×19, knob 15×15.
 * Native checkbox is visually hidden; the visual track / knob reflect
 * its :checked state via :has() selectors. */
.add-toggle {
  width: 34px;
  height: 19px;
  border-radius: 10px;
  background: var(--fg);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s;
}
.add-toggle .add-toggle-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.add-toggle .knob {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  transition: right 0.15s, left 0.15s, background-color 0.15s;
}
.add-toggle:has(.add-toggle-input:not(:checked)) {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
}
.add-toggle:has(.add-toggle-input:not(:checked)) .knob {
  right: auto;
  left: 2px;
  background: var(--fg-faint);
}

.add-cancel {
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-input);
  padding: 6px 12px;
  cursor: pointer;
}
.add-cancel:hover { background: var(--surface-2); }

.panel-add-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  background: var(--fg);
  border: 1px solid var(--fg);
  border-radius: var(--r-input);
  padding: 6px 13px;
  cursor: pointer;
}

.panel-body--empty {
  padding: 13px 14px;
  font-size: 13px;
  font-style: italic;
  color: var(--fg-faint);
}

/* ---- row ---- */
.row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-faint);
}
.row:last-child { border-bottom: none; }
.row.is-dragging { opacity: 0.5; background: var(--surface-2); }

.row-drag {
  background: none;
  border: 0;
  padding: 0;
  color: var(--fg-faint);
  cursor: grab;
  font-size: 12px;
  line-height: 1;
  user-select: none;
}
.row-drag:active { cursor: grabbing; }

.row-content {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg);
  border: 1px solid transparent;
  border-radius: var(--r-input);
  padding: 2px 5px;
  margin: -2px -5px;
}
.row-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---- state-select (canon: components/state-select) ---- */
.state-select-form { margin: 0; }
.state-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-success-text);
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  border-radius: var(--r-input);
  padding: 3px 9px;
  cursor: pointer;
  line-height: 1.3;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Reserve room for the native ▾ disclosure; the SVG below paints it. */
  padding-right: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='6' viewBox='0 0 8 6'%3E%3Cpath d='M0 0l4 6 4-6' fill='%2316a34a' fill-opacity='.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.state-select:focus-visible {
  outline: 2px solid var(--color-blue-700);
  outline-offset: 1px;
}
.state-select--inactive {
  color: var(--fg-faint);
  background-color: var(--surface-2);
  border-color: var(--border);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='6' viewBox='0 0 8 6'%3E%3Cpath d='M0 0l4 6 4-6' fill='%2394a3b8'/%3E%3C/svg%3E");
}
