@layer components {
  .yaml-form { display: flex; flex-direction: column; height: 100%; }
  .yaml-form > .flash { margin: 1.2rem 1.4rem 0; }
  .yaml-form > .code { flex: 1; min-height: 0; }
  .yaml-actions { display: flex; align-items: center; gap: 1.2rem; padding: .7rem 1.4rem; border-top: 1px solid var(--line); }
  .yaml-actions .hint { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .code-keys { display: flex; align-items: center; gap: .4rem; font-size: 1.2rem; color: var(--ink-3); white-space: nowrap; }
  .code-keys kbd + * { margin-right: .6rem; }

  /* The YAML editor: a transparent textarea over a highlighted copy, with the same metrics line for line. */
  .code { --code-line: 21px; --code-pad-y: 12px; --code-pad-x: 16px; display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
  .code.is-compact { height: 48rem; border: 1px solid var(--line-strong); border-radius: var(--r-control); overflow: hidden; }
  .code-bar { display: flex; align-items: center; gap: 1rem; min-height: 4rem; padding: .4rem 1rem .4rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--surface); }
  .code-outline { display: flex; align-items: center; gap: .5rem; }
  .code-outline .icon { width: 1.5rem; height: 1.5rem; color: var(--ink-3); }
  .code-outline .field { min-height: 2.9rem; padding-block: .1rem; font-family: var(--mono); font-size: 1.2rem; }
  .code-next { font-size: 1.25rem; }
  .code-issue-dot { width: .8rem; height: .8rem; border-radius: 50%; background: var(--warning); }
  .code-issue-dot.is-error { background: var(--error); }
  .code-dirty { display: inline-flex; align-items: center; gap: .5rem; padding: .1rem .8rem; border-radius: 999px; background: var(--live-soft); color: var(--live-ink); font-size: 1.15rem; font-weight: 600; }
  .code-dirty::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--live); }
  .code-position { margin-left: auto; font-family: var(--mono); font-size: 1.15rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
  .code-frame { position: relative; flex: 1; display: flex; min-height: 0; background: var(--code-bg); }
  .code-gutter { flex: none; width: 5.6rem; overflow: hidden; padding-top: var(--code-pad-y); border-right: 1px solid var(--line); background: var(--surface-2); user-select: none; }
  .code-number { display: block; height: var(--code-line); padding-right: 1rem; font-family: var(--mono); font-size: 11.5px; line-height: var(--code-line); text-align: right; color: var(--code-muted); font-variant-numeric: tabular-nums; }
  .code-number.is-current { color: var(--ink); font-weight: 600; }
  .code-number.has-warning, .code-number.has-error { position: relative; color: var(--ink); cursor: help; }
  .code-number.has-warning::before, .code-number.has-error::before { content: ""; position: absolute; left: .8rem; top: 50%; width: .8rem; height: .8rem; margin-top: -.4rem; border-radius: 50%; background: var(--warning); }
  .code-number.has-error::before { background: var(--error); }
  .code-body { position: relative; flex: 1; min-width: 0; overflow: hidden; }
  .code-highlight, .code .code-input { font-family: var(--mono); font-size: 13px; line-height: var(--code-line); tab-size: 2; letter-spacing: 0; font-variant-ligatures: none; }
  .code-highlight { position: absolute; left: 0; top: 0; min-width: 100%; width: max-content; margin: 0; padding: var(--code-pad-y) var(--code-pad-x); color: var(--code-ink); pointer-events: none; will-change: transform; }
  .code-line { display: block; height: var(--code-line); white-space: pre; }
  .code-line.is-current { margin: 0 calc(-1 * var(--code-pad-x)); padding: 0 var(--code-pad-x); background: rgb(var(--focus-rgb) / .06); }
  .code .code-input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: var(--code-pad-y) var(--code-pad-x); border: 0; border-radius: 0; outline: 0; background: transparent; color: transparent; caret-color: var(--ink); white-space: pre; overflow: auto; resize: none; box-shadow: none; }
  .code .code-input::selection { background: rgb(var(--focus-rgb) / .22); color: transparent; }
  .code .code-input:focus { box-shadow: none; }
  .code-frame:focus-within { box-shadow: inset 0 0 0 2px rgb(var(--focus-rgb) / .25); }
  .tok-top { color: var(--ink); font-weight: 600; }
  .tok-screen { color: var(--ink); font-weight: 600; background: rgb(var(--ink-rgb) / .06); border-radius: 3px; box-shadow: 0 0 0 2px rgb(var(--ink-rgb) / .06); }
  .tok-key { color: var(--tok-key); }
  .tok-punct { color: var(--tok-punct); }
  .tok-str { color: var(--tok-str); }
  .tok-plain { color: var(--code-ink); }
  .tok-num, .tok-bool { color: var(--tok-num); }
  .tok-comment { color: var(--ink-3); font-style: italic; }
  .tok-escape { color: var(--tok-num); }
  .tok-var { color: var(--input-ink); background: var(--input-soft); border-radius: 3px; }
  .tok-ref { color: var(--tok-ref); text-decoration: underline dotted color-mix(in srgb, var(--tok-ref) 50%, transparent); text-underline-offset: 3px; }
  .tok-expr { color: var(--tok-expr); }
  .tok-kind { font-weight: 600; border-radius: 3px; }
  .tok-kind.is-menu { color: var(--menu-ink); background: var(--menu-soft); }
  .tok-kind.is-input { color: var(--input-ink); background: var(--input-soft); }
  .tok-kind.is-router { color: var(--router-ink); background: var(--router-soft); }
  .tok-kind.is-end { color: var(--ok-ink); background: var(--end-soft); }
}
