/* Configure-specific styles. Layers on top of assets/tokens.css + components.css + site.css. */

.configure { padding-top: var(--space-6, 24px); padding-bottom: var(--space-8, 48px); }
/* The sticky site header can otherwise cover a focused/scrolled-to control near the top of the page. */
.configure :is(button, a, input, select, textarea, summary, [tabindex]) { scroll-margin-top: 88px; }
.configure-top h1 { margin: 0 0 4px; }
.configure-tagline { color: var(--color-text-secondary); max-width: 46rem; margin: 0 0 12px; }
.configure-modebar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }

code { font: 0.88em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--color-neutral-bg); padding: 1px 5px; border-radius: 4px; }

/* templates */
.template-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 12px; }
@media (min-width: 46rem) { .template-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.template-card { text-align: left; cursor: pointer; border: 1px solid var(--color-border); }
.template-card h3 { margin: 0 0 6px; }
.template-card p { margin: 0; color: var(--color-text-secondary); }

/* wizard layout */
.wizard-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 62rem) {
  .wizard-body { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .wizard-side .sticky { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
}
.wizard-main { min-width: 0; }
.wizard-side { min-width: 0; }
.wizard-step { min-width: 0; }
.wizard-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; }
.example-box { background: var(--color-neutral-bg); border-left: 3px solid var(--color-accent); padding: 10px 14px; border-radius: 6px; margin: 10px 0 16px; font-size: 0.92rem; }

.stepper { margin-bottom: 20px; }
.stepper li button:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

/* fields (reuse tokens, no bespoke colours) */
.field { margin: 0 0 14px; min-width: 0; }
.hint { color: var(--color-text-secondary); font-size: 0.88rem; margin: 4px 0 0; }
.empty { color: var(--color-text-secondary); }
.err { color: var(--color-danger-text); font-size: 0.9rem; font-weight: 600; margin: 4px 0 0; }
.err:empty { display: none; }
.check-row-field { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* language playlist rows */
.rows { list-style: none; margin: 0 0 12px; padding: 0; }
.row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; align-items: end; margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--color-border); }
.row .field { margin-bottom: 8px; }
@media (min-width: 40rem) { .row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; } .row .field { margin-bottom: 0; } .row .err { grid-column: 1 / -1; } }

/* rules */
.rules { list-style: none; margin: 0; padding: 0; }
.rule { padding: 16px; margin-bottom: 14px; }
.rule.dragging { opacity: 0.5; }
.rule-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rule-head h3 { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; min-width: 10rem; flex: 1 1 10rem; }
.rule-tools { display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.rule.is-collapsed .rule-head { margin-bottom: 0; }
.drag-handle { cursor: grab; }
.drag-handle:active { cursor: grabbing; }
.reorder-help kbd { font: 0.85em ui-monospace, monospace; background: var(--color-neutral-bg); border: 1px solid var(--color-border); border-radius: 4px; padding: 0 4px; }

.conds { border: 1px dashed var(--color-border); border-radius: 10px; padding: 8px 12px 12px; margin: 4px 0 0; min-width: 0; }
.cond { margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--color-border); }
.cond-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cond-head label { margin: 0; }
.add-cond { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 8px; }
@media (min-width: 40rem) { .add-cond { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; } .add-cond label { margin: 0; } }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; padding: 0; }
.chips:empty { display: none; }

/* any_of OR-groups (design/proposals/more-conditions.md) and unless (reuses .conds/.cond above as-is) */
.any-of-editor { min-width: 0; }
.any-of-branches { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.any-of-branch { padding: 10px 12px; }
.any-of-branch-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.any-of-branch-head strong { font-size: 0.9rem; }
.any-of-branch-conds { border-left: 2px solid var(--color-border); padding-left: 10px; margin: 0 0 8px; }
.cond-nested { margin: 0 0 10px; padding-bottom: 8px; }
.unless-conds { border-style: solid; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--color-neutral-bg); border: 1px solid var(--color-border); border-radius: 999px; padding: 2px 4px 2px 12px; max-width: 100%; }
.chip span { overflow-wrap: anywhere; }
.chip.bad { border-color: var(--color-danger); color: var(--color-danger-text); }
.chip-x { min-width: 32px; min-height: 32px; border: 0; background: transparent; color: inherit; font-size: 1.2rem; line-height: 1; border-radius: 999px; cursor: pointer; }
.chip-x:hover { background: var(--color-hover); }
.chip-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }

/* notices */
.notice { display: none; margin: 8px 0; padding: 8px 12px; border-radius: 8px; background: var(--color-success-bg); border: 1px solid var(--color-border); }
.notice.show { display: block; }
.notice.bad { background: var(--color-danger-bg); color: var(--color-danger-text); }
.notice.warn { background: var(--color-warning-bg); color: var(--color-warning-text); }
.notice ul { margin: 6px 0 0; }
.notice p { margin: 0; }
.notice .btn { margin-left: 8px; }

/* output */
.summary { border: 2px solid var(--color-danger); background: var(--color-danger-bg); border-radius: 10px; padding: 8px 14px; margin: 8px 0; }
.summary h3 { margin: 0 0 4px; font-size: 1rem; color: var(--color-danger-text); }
.summary ul { margin: 0; padding-left: 1.1rem; }
.summary a { color: var(--color-text); }
.status { margin: 6px 0; font-size: 0.92rem; }
.status.ok { color: var(--color-success-text); font-weight: 600; }
.status.bad { color: var(--color-danger-text); font-weight: 600; }
.yaml { margin: 8px 0; padding: 12px; background: var(--color-neutral-bg); border: 1px solid var(--color-border); border-radius: 10px; overflow: auto; max-height: 28rem; font-size: 0.85rem; line-height: 1.5; tab-size: 2; }
.yaml code { background: none; padding: 0; white-space: pre; font-size: inherit; }
.yaml.stale { opacity: 0.75; border-style: dashed; }
.code-head { font-weight: 600; font-size: 0.85rem; color: var(--color-text-secondary); margin-bottom: 4px; }
.yaml-edit { font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; min-height: 20rem; }
.plain-summary { list-style: none; margin: 0 0 12px; padding: 0; font-size: 0.92rem; }
.plain-summary li { padding: 4px 0; border-bottom: 1px solid var(--color-border); }

/* versions + compare */
.versions-list { list-style: none; margin: 0; padding: 0; }
.version-card { padding: 12px; margin-bottom: 10px; }
.version-meta { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.input-inline { margin-bottom: 8px; }
.diff-line { white-space: pre-wrap; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }
.diff-added { background: var(--color-success-bg); color: var(--color-success-text); }
.diff-removed { background: var(--color-danger-bg); color: var(--color-danger-text); }
.dialog-wide { max-width: 60rem; width: 100%; }

.import[open] summary { margin-bottom: 8px; }
#import-drop.drag-over textarea { outline: 2px dashed var(--color-accent); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* Schedule panel */
#sched-panel { margin-top: var(--space-4); }
#sched-panel fieldset { border: 0; padding: 0; margin: 0 0 var(--space-4); min-width: 0; }
.sched-days { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
#sched-panel select:disabled, #sched-panel input:disabled + span { opacity: .55; }

/* No-token ("by hand") alternative inside the connect dialogs */
.manual-save, .manual-run { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }

/* Phone: the step list is one tidy row of four (number over a short label) instead of wrapping 3 + 1; rule
   action buttons wrap inside the card instead of pushing the page wider; the live preview below the form is
   dropped (the Review step already shows the same YAML and plain-English summary). */
@media (max-width: 45.99rem) {
  .stepper { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
  .stepper li { flex-direction: column; gap: var(--space-1); text-align: center; font-size: var(--text-xs); line-height: 1.25; }
  .stepper li button { text-align: center; }
  .rule-tools { flex: 1 1 100%; flex-shrink: 1; }
  .wizard-side { display: none; }
}
