/* ──────────────────────────────────────────────────────────────────────
   Settings — engine configs · prefs · pages · stores · destinations
   tone: typographic-forward, no card chrome, single clay accent on the
   primary "New / Add / Save" buttons. YAML view reuses the approvals
   payload syntax-tint vocabulary (.key, .str, .num, .punc, .gutter).
   ────────────────────────────────────────────────────────────────────── */
.st-hdr {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 28px 32px 18px;
  border-bottom: 1px solid var(--rule-soft);
}
.st-hdr .pg-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 4px;
}
.st-hdr .pg-stats {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
}
.st-hdr .pg-stats .num { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.st-hdr .pg-stats .sep { color: var(--ink-4); margin: 0 6px; }
.st-hdr .lede {
  display: block;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--ink-3);
  max-width: 620px;
  line-height: 1.55;
}
.st-hdr .right { display: flex; gap: 6px; }

/* sticky sub-nav */
.st-subnav {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  display: flex;
  gap: 4px;
  padding: 14px 32px 12px;
  border-bottom: 1px solid var(--rule-soft);
  overflow-x: auto;
}
.st-subnav .jump {
  font-family: var(--mono);
  font-size: 11.5px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-3);
  padding: 4px 12px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color 140ms ease, background 140ms ease;
}
.st-subnav .jump:hover { color: var(--ink); background: var(--paper-2); }
.st-subnav .jump.on {
  color: var(--ink);
  background: var(--paper-2);
}
.st-subnav .jump .ct {
  font-size: 10.5px;
  color: var(--ink-4);
}
.st-subnav .jump.on .ct { color: var(--ink-3); }

/* section */
.st-section {
  padding: 32px 32px 8px;
  border-bottom: 1px solid var(--rule-soft);
}
.st-section:last-of-type { border-bottom: none; }
.st-section-hdr {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.st-section-hdr .title-block {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.st-section-hdr h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--ink);
}
.st-section-hdr .label {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-4);
}
.st-section-hdr .right { display: flex; gap: 6px; }
.st-section .lede {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.55;
  margin: 0 0 18px;
  max-width: 620px;
}
.st-section .lede code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
}

/* item — engine config / page / store / destination */
.st-item {
  padding: 14px 0 16px;
  border-top: 1px solid var(--rule-soft);
}
.st-item:first-of-type { border-top: none; padding-top: 4px; }
.st-item-hdr {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}
.st-item .nm {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.012em;
  font-family: var(--mono);
}
.st-item .nm a {
  color: var(--steel);
  text-decoration: none;
}
.st-item .nm a:hover { color: var(--ink); text-decoration: underline; }
.st-item .kind {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-4);
}
.st-item .kind.claude { color: var(--steel); }
.st-item .kind.codex { color: var(--plum); }
.st-item .kind.opencode { color: var(--moss); }
.st-item .kind.telegram { color: var(--steel); }
.st-item .state {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.st-item .state .dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ink-4);
}
.st-item .state.enabled { color: var(--moss); }
.st-item .state.enabled .dot { background: var(--moss); }
.st-item .state.disabled .dot { background: var(--ink-4); }
.st-item .badge-usage {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  margin-left: auto;
}
.st-item .badge-usage .num { color: var(--ink-2); font-weight: 600; }

.st-item .meta {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  margin: 4px 0 0;
  line-height: 1.6;
}
.st-item .meta .num { color: var(--ink-2); font-weight: 600; }
.st-item .meta .who { color: var(--plum); }
.st-item .meta .sep { color: var(--ink-4); margin: 0 7px; }
.st-item .meta .lbl { color: var(--ink-4); }
.st-item .meta .val { color: var(--ink-2); }
.st-item .meta .list-name { color: var(--ink-2); }

.st-item .actions {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: auto;
  opacity: 0;
  transition: opacity 150ms ease;
}
.st-item:hover .actions { opacity: 1; }
.st-item.editing .actions { opacity: 1; }
.st-item .actions button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-3);
  font-family: inherit;
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 140ms ease;
}
.st-item .actions button:hover {
  color: var(--ink);
  background: var(--paper-card);
  border-color: var(--rule-soft);
}
.st-item .actions button.del:hover {
  color: var(--brick);
}
.st-item .actions button.icon-only { padding: 4px 5px; }

/* expand/edit body for engine configs */
.st-item .body {
  margin-top: 10px;
}
.st-item .body .show-yaml {
  background: transparent;
  border: none;
  color: var(--steel);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.st-item .body .show-yaml:hover { color: var(--ink); text-decoration: underline; }
.st-item .body .show-yaml .chev { font-size: 9px; }

.st-yaml {
  margin-top: 10px;
  background: var(--paper-2);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-2);
  white-space: pre;
  overflow-x: auto;
}
.st-yaml .gutter {
  color: var(--ink-4);
  user-select: none;
  display: inline-block;
  width: 24px;
  text-align: right;
  margin-right: 12px;
}
.st-yaml .key { color: var(--steel); }
.st-yaml .str { color: var(--moss); }
.st-yaml .num { color: var(--clay); }
.st-yaml .bool { color: var(--plum); }
.st-yaml .punc { color: var(--ink-3); }
.st-yaml .sect { color: var(--ink); font-weight: 600; }
.st-yaml .comment { color: var(--ink-4); font-style: italic; }

.st-edit {
  margin-top: 10px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--paper-card);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink);
  white-space: pre;
  min-height: 240px;
  outline: none;
  overflow-x: auto;
}
.st-edit-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.st-edit-bar .hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
}
.st-edit-bar .spacer { flex: 1; }
.st-edit-bar kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  padding: 0 5px;
  border-radius: 2px;
  color: var(--ink-3);
}

.st-newconfig {
  margin-top: 18px;
}
.st-newconfig .name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.st-newconfig .name-row label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.st-section .section-foot {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
  padding-top: 10px;
}
.st-section .section-foot .ghost-link {
  background: transparent;
  border: none;
  color: var(--ink-3);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px 0;
}
.st-section .section-foot .ghost-link:hover { color: var(--ink); text-decoration: underline; }

/* preferences — typographic form */
.st-pref {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--rule-soft);
}
.st-pref:first-of-type { border-top: none; padding-top: 4px; }
.st-pref .lbl {
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 500;
  min-width: 200px;
}
.st-pref .lbl .sub {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 400;
  margin-top: 2px;
}
.st-pref .ctrl {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.st-pref .radio {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.st-pref .radio .dot {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--rule-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.st-pref .radio.on .dot {
  border-color: var(--ink);
}
.st-pref .radio.on .dot::after {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink);
}
.st-pref .check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.st-pref .check .box {
  width: 13px; height: 13px;
  border-radius: 2px;
  border: 1.5px solid var(--rule-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--paper-card);
}
.st-pref .check.on .box {
  background: var(--ink);
  border-color: var(--ink);
}

/* destination add form (inline) */
.st-addform {
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  background: var(--paper-card);
}
.st-addform .ttl {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}
.st-addform .field {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.st-addform .field label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.st-addform .field input {
  font-family: var(--mono);
  font-size: 13px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 5px 0;
  color: var(--ink);
  outline: none;
  width: 100%;
}
.st-addform .field input:focus {
  border-bottom-color: var(--ink);
}
.st-addform .field input::placeholder { color: var(--ink-4); }
.st-addform .help {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.55;
  margin: 8px 0 14px;
}
.st-addform .help code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
}
.st-addform .actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* empty state */
.st-empty {
  font-size: 12.5px;
  color: var(--ink-3);
  padding: 12px 0 4px;
  font-style: italic;
  line-height: 1.55;
}
.st-empty code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  font-style: normal;
}

/* ──────────────────────────────────────────────────────────────────────
   Edit engine — full-page editor (route: #/edit-engine/:name)
   ────────────────────────────────────────────────────────────────────── */

.ee-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--paper-card);
  overflow: hidden;
}
.ee-hdr {
  padding: 18px 28px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--rule-soft);
}
.ee-hdr .back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-weight: 500;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 3px;
  background: transparent;
  border: 0;
}
.ee-hdr .back:hover { color: var(--ink); background: var(--paper-2); }
.ee-hdr .title-block { min-width: 0; }
.ee-hdr .super {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 4px;
}
.ee-hdr .super .crumb-arrow { color: var(--ink-4); margin: 0 6px; }
.ee-hdr .title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.024em;
  line-height: 1.05;
  color: var(--ink);
  margin: 0 0 4px;
}
.ee-hdr .api-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.ee-hdr .right { display: flex; align-items: center; gap: 6px; }

.ee-body {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 22px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ee-loading, .ee-error {
  padding: 40px 4px;
  color: var(--ink-3);
  font-style: italic;
}
.ee-error { color: var(--brick); }
.ee-error code { font-family: var(--mono); font-size: 12px; color: var(--brick); }

.ee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 18px;
}

.ee-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.ee-field label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-3);
}

.ee-advanced {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.ee-advanced label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-3);
}
.ee-advanced .help {
  font-size: 12px;
  color: var(--ink-3);
  margin: 0 0 4px;
}
.ee-advanced textarea {
  flex: 1;
  min-height: 360px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
}
.ee-advanced [data-parse-err] {
  display: none;
  color: var(--brick);
  font-size: 12px;
  margin-top: 4px;
}
.ee-advanced [data-parse-err].shown { display: block; }

.ee-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-3);
  font-size: 11.5px;
}
.ee-foot kbd {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid var(--rule-soft);
}

