/* OpenSquilla Web UI — Setup view.
   Read as a precision instrument: a calibrated stepper rail, panels as
   spec sheets with hairline ornaments, tier rows that look like a real
   sheet of measurements. Orange is reserved for active/primary signals. */

.setup {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  width: 100%;
  max-width: 1320px;
  min-width: 0;
  margin: 0 auto;
}

.setup [hidden] {
  display: none !important;
}

/* Top hairline rail — a tuned scan line introducing the surface. */
.setup::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    color-mix(in srgb, var(--accent) 70%, transparent) 8%,
    color-mix(in srgb, var(--accent) 30%, transparent) 24%,
    transparent 48%);
  opacity: 0.85;
  pointer-events: none;
}

/* ─── Header ─────────────────────────────────────────────────────────── */

.setup__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) 0 var(--sp-2);
  position: relative;
}

.setup__kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.setup__kicker::before {
  content: "";
  width: 18px; height: 1px;
  background: currentColor;
  display: inline-block;
  opacity: 0.7;
}

.setup__head h2,
.setup-panel h3,
.setup-mini h4,
.setup-runtime h4 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.025em;
}

.setup__head h2 {
  font-size: var(--fs-display);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: var(--lh-display);
  font-feature-settings: "ss01", "cv11";
}

/* Right-side aside — exit link + status chip. */
.setup__head-aside {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  flex-shrink: 0;
  flex-wrap: wrap;
  max-width: min(620px, 50vw);
}

/* Exit-setup link — ghost button, mono uppercase, leading arrow.
   Clear escape hatch from the wizard at any step. */
.setup__exit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color var(--transition),
    border-color var(--transition),
    background var(--transition),
    transform 160ms var(--ease-press);
}
.setup__exit > span:first-child {
  display: inline-block;
  transition: transform 200ms var(--ease-press);
  font-size: 14px;
  line-height: 1;
}
.setup__exit:hover {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.setup__exit:hover > span:first-child { transform: translateX(-3px); }
.setup__exit:active { transform: translateY(1px); }
.setup__exit:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* Status chip — sits at top right. Uses tabular numerals if it shows counts. */
.setup__status {
  min-width: 132px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-muted);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  position: relative;
  font-variant-numeric: tabular-nums;
}
.setup__status::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 8px;
  background: currentColor;
  vertical-align: 1px;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}
.setup__status.is-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.setup__status.is-warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 50%, var(--border));
  animation: setup-status-pulse 2s ease-in-out infinite;
}

.setup-reasons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup-reasons li {
  min-height: 24px;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-surface));
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes setup-status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 30%, transparent); }
  50%      { box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 10%, transparent); }
}

.setup-error {
  border: 1px solid var(--danger);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius-md);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--danger) 10%, transparent), transparent 40%),
    var(--bg-surface);
  color: var(--danger);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: 500;
}

.setup-warning {
  border: 1px solid color-mix(in srgb, var(--warn) 50%, var(--border));
  border-left: 3px solid var(--warn);
  border-radius: var(--radius-md);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--warn) 10%, transparent), transparent 42%),
    var(--bg-surface);
  color: var(--text);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.45;
}

.setup-warning__command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: var(--sp-2);
  align-items: stretch;
  margin-top: var(--sp-3);
}

.setup-warning__command code {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid color-mix(in srgb, var(--warn) 35%, var(--border));
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  padding: 9px 10px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.35;
  white-space: nowrap;
}

.setup-mini__env-command {
  margin-top: 0;
}

/* ─── Stepper — connected rail with calibrated marks ─────────────────── */

.setup-stepper {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-surface);
  position: relative;
}
/* The rail beneath the stepper — a tuned baseline that runs full width. */
.setup-stepper::after {
  content: "";
  position: absolute;
  left: 14px; right: 14px; bottom: 0;
  height: 2px;
  background: var(--border);
}

.setup-stepper__item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  border: 0;
  background: var(--bg-surface);
  color: var(--text-muted);
  font: inherit;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color var(--transition),
    background var(--transition);
  position: relative;
  overflow: hidden;
  text-align: left;
}
/* Each step gets a ground-tick at the rail — quiet, until active. */
.setup-stepper__item::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 2px;
  background: transparent;
  transition: background 220ms var(--ease-press), width 220ms var(--ease-press);
  z-index: 1;
}
.setup-stepper__item:not(:last-child)::before {
  content: "";
  position: absolute;
  right: 0; top: 14px; bottom: 14px;
  width: 1px;
  background: var(--border);
}

.setup-stepper__num {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

.setup-stepper__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-stepper__state {
  grid-column: 2;
  min-width: 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.setup-stepper__state.is-ok { color: var(--ok); }
.setup-stepper__state.is-warn { color: var(--warn); }

.setup-stepper__item:hover {
  background: color-mix(in srgb, var(--accent) 4%, var(--bg-surface));
  color: var(--text);
}
.setup-stepper__item:hover .setup-stepper__num {
  border-color: var(--border-strong);
}

.setup-stepper__item.is-active {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-surface));
  color: var(--text);
}
.setup-stepper__item.is-active::after {
  background: var(--accent);
  width: 56px;
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 70%, transparent);
}
.setup-stepper__item.is-active .setup-stepper__num {
  border-color: var(--accent);
  color: var(--accent-foreground);
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* ─── Panel — spec-sheet surface ─────────────────────────────────────── */

.setup-panel {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
  padding: var(--sp-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  position: relative;
  overflow: hidden;
}
/* Top accent thread on the panel — like a header strip on a tech datasheet. */
.setup-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    var(--accent) 0%,
    color-mix(in srgb, var(--accent) 30%, transparent) 30%,
    transparent 60%);
  opacity: 0.85;
}
/* Bottom-right corner mark. */
.setup-panel::after {
  content: "";
  position: absolute;
  right: 14px; bottom: 14px;
  width: 12px; height: 12px;
  border-right: 1px solid var(--border-strong);
  border-bottom: 1px solid var(--border-strong);
  pointer-events: none;
  opacity: 0.8;
}

.setup-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  min-width: 0;
  padding-bottom: var(--sp-3);
  border-bottom: 1px dashed var(--border);
}

.setup-panel__head h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.setup-panel__head p,
.setup-muted {
  margin: 0;
  color: var(--text-dim);
  font-size: var(--fs-sm);
  line-height: 1.55;
}

.setup-form,
.setup-provider-fields,
.setup-channel-fields,
.setup-mini {
  display: grid;
  align-content: start;
  gap: var(--sp-3);
  min-width: 0;
}

.setup-provider-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-width: 0;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-surface) 84%, var(--bg));
  color: var(--text);
}

.setup-provider-meta span,
.setup-provider-meta strong {
  min-width: 0;
  font-size: var(--fs-xs);
  line-height: 1.35;
}

.setup-provider-meta span {
  color: var(--text-dim);
}

.setup-provider-meta strong {
  font-weight: 750;
  text-align: right;
  overflow-wrap: anywhere;
}

.setup-provider-meta__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--text-muted) 24%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-surface) 70%, var(--bg));
  color: var(--text-muted);
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.setup-provider-meta__badge.is-ready {
  border-color: color-mix(in srgb, var(--ok) 48%, var(--border));
  background: color-mix(in srgb, var(--ok) 10%, var(--bg-surface));
  color: var(--ok);
}

.setup-provider-meta__badge.is-direct {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-surface));
  color: var(--accent);
}

.setup-provider-meta__badge.is-neutral {
  border-color: color-mix(in srgb, var(--text-muted) 24%, var(--border));
  background: color-mix(in srgb, var(--bg-surface) 70%, var(--bg));
  color: var(--text-muted);
}

.setup-mini h4 {
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 2px;
}

.setup-mini__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-width: 0;
}

.setup-mini__advanced {
  display: block;
  min-width: 0;
  padding-top: var(--sp-2);
  border-top: 1px dashed var(--border);
}

.setup-mini__advanced > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-surface) 82%, var(--bg));
  color: var(--text-muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  list-style: none;
  text-transform: uppercase;
  transition:
    border-color var(--transition),
    background var(--transition),
    color var(--transition);
}

.setup-mini__advanced > summary::-webkit-details-marker { display: none; }
.setup-mini__advanced > summary::after {
  content: "+";
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0;
}
details.setup-mini__advanced[open] > summary {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  color: var(--text);
}
details.setup-mini__advanced[open] > summary::after { content: "-"; }
.setup-mini__advanced > summary:hover {
  border-color: var(--border-strong);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-surface));
  color: var(--text);
}
.setup-mini__advanced > summary:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.setup-mini__advanced-body {
  display: grid;
  gap: var(--sp-3);
  min-width: 0;
  padding-top: var(--sp-3);
}

.setup-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.setup-badge.is-ok {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
  color: var(--ok);
}
.setup-badge.is-warn {
  border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
  color: var(--warn);
}
.setup-badge.is-muted {
  color: var(--text-dim);
}

.setup-need-list {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 2px 0;
}

.setup-need-list > span {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.setup-need-list ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup-need-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.setup-need-list li::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: 0.45em;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.setup-form label,
.setup-mini label,
.setup-router-toolbar label,
.setup-check {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.setup-form label.is-disabled,
.setup-mini label.is-disabled {
  color: var(--text-dim);
}

.setup-form label.is-disabled input,
.setup-mini label.is-disabled input {
  opacity: 0.72;
}

.setup-form input,
.setup-form select,
.setup-mini input,
.setup-mini select,
.setup-router-toolbar select,
.setup-tier-table input,
.setup-tier-table select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  transition:
    border-color var(--transition),
    background var(--transition),
    box-shadow var(--transition);
}

.setup-field-desc {
  display: block;
  margin-top: -2px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.35;
  text-transform: none;
}

.setup-form input:hover,
.setup-form select:hover,
.setup-mini input:hover,
.setup-mini select:hover,
.setup-router-toolbar select:hover {
  border-color: var(--border-strong);
}

.setup-form input:focus,
.setup-form select:focus,
.setup-mini input:focus,
.setup-mini select:focus,
.setup-router-toolbar select:focus,
.setup-tier-table input:focus,
.setup-tier-table select:focus,
.setup-stepper__item:focus-visible,
.setup-btn:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.setup-check {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.setup-check:hover { border-color: var(--border-strong); }
.setup-check input { width: 16px; min-height: 16px; accent-color: var(--accent); }
.setup-check span {
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
}

.setup-router-toolbar,
.setup-extras,
.setup-channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--sp-4);
}

/* ─── Tier table — reads as a real spec sheet ────────────────────────── */

.setup-tier-table {
  display: grid;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--border);
}

.setup-tier-table__row {
  display: grid;
  grid-template-columns: 90px minmax(130px, 1fr) minmax(220px, 1.8fr) 130px 80px;
  gap: 1px;
  min-width: 760px;
  background: var(--border);
}
.setup-tier-table__row + .setup-tier-table__row { border-top: 0; }
.setup-tier-table__row:not(.is-head):hover > * {
  background-color: color-mix(in srgb, var(--accent) 4%, var(--bg-surface));
}

.setup-tier-table__row > * {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background-color: var(--bg-surface);
  transition: background-color var(--transition);
}

.setup-tier-table__row > span {
  display: flex;
  align-items: center;
  padding: 0 12px;
  min-height: 42px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.setup-tier-table__row.is-head > span {
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: var(--bg);
  font-size: 10px;
}

.setup-tier-table__row > input,
.setup-tier-table__row > select {
  border-radius: 0;
  border: 0;
  min-height: 42px;
  background: var(--bg-surface);
}
.setup-tier-table__row > input:focus,
.setup-tier-table__row > select:focus {
  background: color-mix(in srgb, var(--accent) 5%, var(--bg-surface));
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* ─── Runtime status block ───────────────────────────────────────────── */

.setup-runtime {
  display: grid;
  align-content: start;
  gap: var(--sp-2);
  min-width: 0;
}

.setup-runtime h4 {
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 2px;
}

.setup-runtime__row,
.setup-summary > div {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: var(--fs-sm);
  position: relative;
  transition: border-color var(--transition);
}
.setup-runtime__row::before {
  content: "";
  position: absolute;
  left: -1px; top: 8px; bottom: 8px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--border-strong);
}

.setup-runtime__row.is-ok::before { background: var(--ok); }
.setup-runtime__row.is-warn::before { background: var(--warn); }
.setup-runtime__row.is-ok strong { color: var(--ok); font-variant-numeric: tabular-nums; }
.setup-runtime__row.is-warn strong { color: var(--warn); font-variant-numeric: tabular-nums; }

.setup-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}

.setup-summary > div {
  grid-template-columns: minmax(110px, .6fr) minmax(0, 1fr);
}
.setup-summary > div:hover { border-color: var(--border-strong); }

.setup-summary strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0;
}

.setup-readiness {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--sp-2);
}

.setup-readiness__group {
  display: grid;
  align-content: start;
  gap: var(--sp-2);
  min-width: 0;
}

.setup-readiness__group h4 {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.setup-readiness__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: var(--fs-xs);
}

.setup-readiness__row strong,
.setup-readiness__row small {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.setup-readiness__row small { color: var(--text-muted); }
.setup-readiness__row.is-ok strong { color: var(--ok); }
.setup-readiness__row.is-warn strong { color: var(--warn); }
.setup-readiness__row.is-muted strong { color: var(--text-muted); }

.setup-readiness__action {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition:
    border-color var(--transition),
    background var(--transition),
    transform 160ms var(--ease-press);
}

.setup-readiness__action:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
}

.setup-readiness__action:active {
  transform: translateY(1px);
}

.setup-readiness__action:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.setup-readiness__detail {
  grid-column: 1 / -1;
  min-width: 0;
  color: var(--text-muted);
  font-style: normal;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.setup-cli {
  display: grid;
  gap: 12px;
}

.setup-cli__group {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.setup-cli__group + .setup-cli__group {
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.setup-cli__group-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-width: 0;
}

.setup-cli__group-head h4 {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.setup-cli__row {
  align-items: stretch;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(116px, 0.34fr) minmax(0, 1fr) 34px;
}

.setup-cli__label {
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  display: inline-flex;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  justify-content: center;
  letter-spacing: 0;
  min-height: 38px;
  padding: 0 10px;
  text-align: center;
  text-transform: uppercase;
}

.setup-cli code {
  display: block;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-left: 2px solid color-mix(in srgb, var(--accent) 50%, var(--border));
  border-radius: var(--radius-sm);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
  font-variant-ligatures: none;
}
.setup-cli code::before {
  content: "$ ";
  color: var(--accent);
  font-weight: 700;
}

.setup-cli__copy {
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  height: 100%;
  justify-content: center;
  min-height: 38px;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  width: 34px;
}

.setup-cli__copy:hover {
  background: var(--bg-panel);
  border-color: var(--accent);
  color: var(--text);
}

.setup-cli__copy svg {
  height: 14px;
  width: 14px;
}

.setup-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding-top: var(--sp-2);
}

/* ─── Buttons — pressure-press feel ──────────────────────────────────── */

.setup-btn {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition:
    transform 160ms var(--ease-press),
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
  position: relative;
}

.setup-btn:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
  transform: translateY(-1px);
}
.setup-btn:active {
  transform: translateY(0);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
}

.setup-btn--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-foreground);
  font-weight: 700;
  box-shadow:
    0 1px 0 0 color-mix(in srgb, #fff 16%, transparent) inset,
    0 8px 24px -10px color-mix(in srgb, var(--accent) 60%, transparent);
}

.setup-btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow:
    0 1px 0 0 color-mix(in srgb, #fff 20%, transparent) inset,
    0 12px 32px -10px color-mix(in srgb, var(--accent) 70%, transparent);
}
.setup-btn--primary:active {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  box-shadow:
    0 1px 0 0 rgba(0,0,0,0.18) inset,
    0 2px 8px -4px color-mix(in srgb, var(--accent) 40%, transparent);
}

.setup-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
  box-shadow: none;
}

.setup-btn:disabled:hover,
.setup-btn:disabled:active {
  border-color: var(--border);
  background: var(--bg);
  transform: none;
}

.setup-btn--primary:disabled:hover,
.setup-btn--primary:disabled:active {
  border-color: var(--accent);
  background: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .setup-btn,
  .setup-stepper__item,
  .setup-stepper__item::after,
  .setup-stepper__item span {
    transition: none;
  }
  .setup-btn:hover,
  .setup-btn:active {
    transform: none;
  }
  .setup__status.is-warn { animation: none; }
}

@media (max-width: 840px) {
  .setup__head,
  .setup-panel__head {
    align-items: flex-start;
    flex-direction: column;
  }

  .setup__head-aside {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    max-width: none;
  }

  .setup-reasons {
    width: 100%;
    justify-content: flex-start;
  }

  .setup-stepper,
  .setup-router-toolbar,
  .setup-extras,
  .setup-channel-grid,
  .setup-summary,
  .setup-readiness {
    grid-template-columns: 1fr;
  }

  .setup-stepper__item {
    justify-content: flex-start;
  }
  .setup-stepper__item:not(:last-child)::before {
    display: none;
  }
  .setup-stepper::after { display: none; }

  .setup-readiness__row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .setup-readiness__row strong {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .setup-readiness__row small {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }

  .setup-readiness__action {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }
}

@media (max-width: 560px) {
  .setup-panel {
    padding: var(--sp-4);
  }

  .setup__head h2 {
    font-size: var(--fs-xl);
  }

  .setup-actions {
    justify-content: stretch;
  }

  .setup-btn {
    flex: 1 1 150px;
  }

  .setup-cli__row {
    grid-template-columns: minmax(0, 1fr) 34px;
  }

  .setup-cli__label {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}
