/* Tab Map — every selector is scoped under a .tm- class. */

/* ------------------------------------------------------------------------ */
/* Tokens                                                                    */
/* ------------------------------------------------------------------------ */

.tm-root {
  --tm-font: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  --tm-mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --tm-radius-sm: 4px;
  --tm-radius: 6px;
  --tm-radius-lg: 8px;
  --tm-control-h: 32px;
}

/* The wireframe stage carries its own palette, so the specimen never follows the host theme. */
.tm-root,
.tm-stage[data-wire-theme="light"] {
  --tm-bg: #f7f7f8;
  --tm-surface: #ffffff;
  --tm-surface-2: #f3f4f6;
  --tm-canvas-bg: #eceef2;
  --tm-line: #e4e6ea;
  --tm-line-2: #d2d5db;
  --tm-ink: #16181d;
  --tm-ink-2: #444a55;
  --tm-muted: #646b77;
  --tm-on-accent: #ffffff;

  --tm-accent-solid: #3557d6;
  --tm-accent-text: #2944b3;
  --tm-accent-soft: rgba(53, 87, 214, 0.06);
  --tm-emerald-solid: #1f9d6b;
  --tm-emerald-text: #11704a;
  --tm-emerald-soft: rgba(31, 157, 107, 0.06);
  --tm-amber-solid: #c98a12;
  --tm-amber-text: #855600;
  --tm-amber-soft: rgba(201, 138, 18, 0.06);
  --tm-rose-solid: #d6455d;
  --tm-rose-text: #ad2340;
  --tm-rose-soft: rgba(214, 69, 93, 0.06);
  --tm-badge-hi: #4968da;
  --tm-badge-lo: #2841a1;
  --tm-badge-rose-hi: #d6455d;
  --tm-badge-rose-lo: #a73649;

  color-scheme: light;
}

.tm-root[data-theme="dark"],
.tm-stage[data-wire-theme="dark"] {
  --tm-bg: #0f1115;
  --tm-surface: #15181d;
  --tm-surface-2: #1c2026;
  --tm-canvas-bg: #0b0d10;
  --tm-line: #262a31;
  --tm-line-2: #353a44;
  --tm-ink: #e8eaee;
  --tm-ink-2: #b6bbc4;
  --tm-muted: #8d939e;
  --tm-on-accent: #0f1115;

  --tm-accent-solid: #7c9cff;
  --tm-accent-text: #a3b8ff;
  --tm-accent-soft: rgba(124, 156, 255, 0.06);
  --tm-emerald-solid: #3ccf91;
  --tm-emerald-text: #72dcae;
  --tm-emerald-soft: rgba(60, 207, 145, 0.06);
  --tm-amber-solid: #e6b043;
  --tm-amber-text: #efc672;
  --tm-amber-soft: rgba(230, 176, 67, 0.06);
  --tm-rose-solid: #f2687f;
  --tm-rose-text: #f79aab;
  --tm-rose-soft: rgba(242, 104, 127, 0.06);
  --tm-badge-hi: #8eaaff;
  --tm-badge-lo: #637dcc;
  --tm-badge-rose-hi: #f47a8e;
  --tm-badge-rose-lo: #cb576b;

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  .tm-root:not([data-theme]) {
    --tm-bg: #0f1115;
    --tm-surface: #15181d;
    --tm-surface-2: #1c2026;
    --tm-canvas-bg: #0b0d10;
    --tm-line: #262a31;
    --tm-line-2: #353a44;
    --tm-ink: #e8eaee;
    --tm-ink-2: #b6bbc4;
    --tm-muted: #8d939e;
    --tm-on-accent: #0f1115;
    --tm-accent-solid: #7c9cff;
    --tm-accent-text: #a3b8ff;
    --tm-accent-soft: rgba(124, 156, 255, 0.06);
    --tm-emerald-solid: #3ccf91;
    --tm-emerald-text: #72dcae;
    --tm-amber-solid: #e6b043;
    --tm-amber-text: #efc672;
    --tm-rose-solid: #f2687f;
    --tm-rose-text: #f79aab;
    --tm-badge-hi: #8eaaff;
    --tm-badge-lo: #637dcc;
    --tm-badge-rose-hi: #f47a8e;
    --tm-badge-rose-lo: #cb576b;
    color-scheme: dark;
  }
}

/* ------------------------------------------------------------------------ */
/* Base                                                                      */
/* ------------------------------------------------------------------------ */

.tm-body {
  margin: 0;
  background: var(--tm-bg);
  color: var(--tm-ink);
  font-family: var(--tm-font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.tm-app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

.tm-app *,
.tm-app *::before,
.tm-app *::after {
  box-sizing: border-box;
}

.tm-app [hidden] {
  display: none !important;
}

.tm-app button {
  font: inherit;
  color: inherit;
}

.tm-app :focus {
  outline: none;
}

/* WCAG 2.4.7 (AA), styled to the 2.4.13 (AAA) benchmark: 2px solid ring, 2px offset. */
.tm-app :focus-visible {
  outline: 2px solid var(--tm-accent-solid);
  outline-offset: 2px;
}

.tm-sr,
.tm-w-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.tm-skip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 50;
  padding: 4px 12px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
  color: var(--tm-ink);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
}

.tm-skip:not(:focus) {
  clip: rect(0 0 0 0);
  width: 1px;
  height: 1px;
  overflow: hidden;
  padding: 0;
  border: 0;
}

.tm-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  min-width: 20px;
  padding: 0 4px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius-sm);
  background: var(--tm-surface);
  color: var(--tm-ink-2);
  font-family: var(--tm-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  vertical-align: middle;
}

.tm-code,
.tm-app code {
  font-family: var(--tm-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--tm-ink-2);
}

.tm-tag {
  font-family: var(--tm-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--tm-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tm-micro {
  font-size: 12px;
  font-weight: 500;
  color: var(--tm-muted);
}

/* ------------------------------------------------------------------------ */
/* Controls                                                                  */
/* ------------------------------------------------------------------------ */

.tm-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--tm-control-h);
  padding: 0 12px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.tm-btn:hover {
  background: var(--tm-surface-2);
}

.tm-btn--quiet {
  border-color: var(--tm-line);
  color: var(--tm-ink-2);
}

.tm-btn--quiet:hover {
  color: var(--tm-ink);
}

.tm-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--tm-radius-sm);
  background: transparent;
  color: var(--tm-muted);
  cursor: pointer;
}

.tm-icon-btn:hover {
  color: var(--tm-accent-text);
  border-color: var(--tm-line-2);
}

.tm-icon-btn[aria-disabled="true"] {
  cursor: default;
  color: var(--tm-line-2);
  border-color: transparent;
}

.tm-icon-btn--bordered {
  width: var(--tm-control-h);
  height: var(--tm-control-h);
  border-color: var(--tm-line);
  border-radius: var(--tm-radius);
}

.tm-icon-sun,
.tm-wire-moon {
  display: none;
}

.tm-root[data-theme="dark"] .tm-icon-moon {
  display: none;
}

.tm-root[data-theme="dark"] .tm-icon-sun {
  display: block;
}

#tm-wire-theme[aria-pressed="true"] .tm-wire-sun {
  display: none;
}

#tm-wire-theme[aria-pressed="true"] .tm-wire-moon {
  display: block;
}

.tm-seg {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  background: var(--tm-surface-2);
}

.tm-seg-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--tm-radius-sm);
  background: transparent;
  color: var(--tm-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.tm-seg-btn:hover {
  color: var(--tm-ink);
}

.tm-seg-btn[aria-checked="true"] {
  border-color: var(--tm-line-2);
  background: var(--tm-surface);
  color: var(--tm-ink);
}

.tm-switch.tm-switch--fail[aria-checked="true"] .tm-switch-track {
  border-color: var(--tm-rose-solid);
  background: var(--tm-rose-solid);
}

.tm-switch--fail[aria-checked="true"] .tm-switch-text {
  color: var(--tm-rose-text);
}

.tm-seg-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tm-seg-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--tm-muted);
}

.tm-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--tm-control-h);
  padding: 0 12px 0 8px;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.tm-switch:hover {
  border-color: var(--tm-line-2);
}

.tm-switch-track {
  position: relative;
  width: 24px;
  height: 16px;
  border: 1px solid var(--tm-line-2);
  border-radius: 8px;
  background: var(--tm-surface-2);
}

.tm-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tm-muted);
}

.tm-switch[aria-checked="true"] .tm-switch-track {
  border-color: var(--tm-accent-solid);
  background: var(--tm-accent-solid);
}

.tm-switch[aria-checked="true"] .tm-switch-thumb {
  left: 10px;
  background: var(--tm-on-accent);
}

/* Shortcut hints keep a keycap outline but stay quiet: faint hairline, no fill, muted letter. */
.tm-kbd.tm-switch-hint {
  height: 18px;
  min-width: 18px;
  margin-left: 4px;
  border-color: var(--tm-line);
  background: transparent;
  color: var(--tm-muted);
  font-weight: 400;
}

.tm-switch--sm {
  height: 28px;
  padding: 0 8px 0 4px;
  font-size: 12px;
}

.tm-switch[aria-disabled="true"] {
  cursor: not-allowed;
  color: var(--tm-muted);
}

/* ------------------------------------------------------------------------ */
/* Header                                                                    */
/* ------------------------------------------------------------------------ */

.tm-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 48px;
  border-bottom: 1px solid var(--tm-line);
}

.tm-topbar-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--tm-muted);
}

.tm-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tm-about-link {
  padding: 4px 8px;
  border-radius: var(--tm-radius-sm);
  color: var(--tm-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.tm-about-link:hover,
.tm-about-link:focus-visible {
  color: var(--tm-ink);
}

.tm-hero {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px 0;
}

.tm-h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.tm-tagline {
  margin: 0;
  color: var(--tm-ink-2);
  font-size: 14px;
  white-space: nowrap;
}

.tm-h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

/* ------------------------------------------------------------------------ */
/* Workspace                                                                 */
/* ------------------------------------------------------------------------ */

.tm-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
  gap: 24px;
  align-items: start;
  padding-bottom: 32px;
}

.tm-canvas,
.tm-rail {
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius-lg);
  background: var(--tm-surface);
  min-width: 0;
}

/* The rail steps back from the canvas so the specimen stays the focal point. */
.tm-rail {
  border-color: var(--tm-line);
  background: transparent;
}

.tm-canvas-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--tm-line);
}

.tm-tabs {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding: 2px;
}

.tm-tab {
  position: relative;
  height: var(--tm-control-h);
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--tm-radius);
  background: transparent;
  color: var(--tm-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.tm-tab:hover {
  color: var(--tm-ink);
  background: var(--tm-surface-2);
}

.tm-tab[aria-selected="true"] {
  color: var(--tm-ink);
  border-color: var(--tm-line);
  background: var(--tm-surface-2);
}

.tm-canvas-foot {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px solid var(--tm-line);
  padding: 16px;
}

.tm-canvas-foot .tm-tabs {
  padding: 0;
}

/* One muted sentence under the tabs: the challenge, then its context a step quieter. */
.tm-context {
  margin: -8px 0 0;
  padding: 0 4px;
  font-size: 13px;
  color: var(--tm-ink-2);
}

/* Scenario tabs, with the wireframe theme icon at the row's right edge. */
.tm-canvas-foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.tm-canvas-foot .tm-icon-btn--bordered {
  flex: none;
  border-color: transparent;
}

.tm-canvas-foot .tm-icon-btn--bordered:hover {
  border-color: transparent;
  background: var(--tm-surface-2);
}

.tm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--tm-line);
}

.tm-toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
}

/* View switches are borderless and only tint on hover; secondary options live in Display ▾. */
.tm-toolbar .tm-toolbar-group:first-child {
  gap: 4px;
}

.tm-display {
  position: relative;
}

.tm-display-btn svg {
  color: var(--tm-muted);
}

.tm-display-btn[aria-expanded="true"] {
  background: var(--tm-surface-2);
}

.tm-display-btn[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.tm-display-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  display: grid;
  gap: 4px;
  min-width: 304px;
  padding: 8px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius-lg);
  background: var(--tm-surface);
}

.tm-display-panel[hidden] {
  display: none;
}

/* Menu-style rows: roomy side padding, label left, shortcut hint right. */
.tm-toolbar .tm-display-panel .tm-switch {
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.tm-display-panel .tm-switch-text {
  margin-right: 24px;
}

.tm-display-panel .tm-switch-hint {
  margin-left: auto;
}

.tm-toolbar .tm-toolbar-group:last-child {
  gap: 8px;
}

.tm-toolbar .tm-switch {
  padding: 0 8px;
  border-color: transparent;
  background: transparent;
}

.tm-toolbar .tm-switch:hover {
  border-color: transparent;
  background: var(--tm-surface-2);
}

.tm-stage {
  position: relative;
  height: 672px;
  overflow: auto;
  overflow-anchor: none;
  background: var(--tm-canvas-bg);
  color: var(--tm-ink);
}

.tm-stage:focus-visible {
  outline-offset: -2px;
}

/* Centers the specimen; when the stage is narrower it scrolls from the left edge. */
.tm-stage-inner {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: max-content;
  min-width: 100%;
  padding: 32px;
}

.tm-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

/* ------------------------------------------------------------------------ */
/* Right rail                                                                */
/* ------------------------------------------------------------------------ */

.tm-rail {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
}

/* Fill the canvas row (up to the viewport) whatever the stop count, so the footer never moves. */
@media (min-width: 1181px) {
  .tm-rail {
    align-self: stretch;
    height: 0;
    min-height: min(100%, calc(100vh - 32px));
  }
}

.tm-rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 4px;
}

.tm-rail-head .tm-h2 {
  white-space: nowrap;
}

.tm-rail-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

/* Same type and spacing as a card's second line (`.tm-card-row2` / `.tm-plain`). */
.tm-rail-sum {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--tm-ink-2);
}

.tm-sum-help {
  position: relative;
}

/* Quieter than the drawer `?`: 16px target, 12px muted glyph, no hover border. */
.tm-sum-help {
  display: inline-flex;
}

.tm-sum-help .tm-help {
  width: 16px;
  height: 16px;
  opacity: 1;
  color: var(--tm-muted);
}

.tm-sum-help .tm-help svg {
  width: 12px;
  height: 12px;
}

.tm-sum-help .tm-help:hover,
.tm-sum-help .tm-help[aria-expanded="true"] {
  border-color: transparent;
  color: var(--tm-accent-text);
}

/* Hover, or a click that sets aria-expanded, opens it; the 4px top padding bridges the pointer onto the panel. */
.tm-sum-pop {
  display: none;
  position: absolute;
  top: 100%;
  left: -8px;
  z-index: 30;
  padding-top: 4px;
}

.tm-sum-help:not(.is-dismissed):hover .tm-sum-pop,
.tm-sum-help [aria-expanded="true"] + .tm-sum-pop {
  display: block;
}

.tm-sum-card {
  min-width: 160px;
  padding: 8px 12px 12px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius-lg);
  background: var(--tm-surface);
}

.tm-sum-title {
  margin: 0 0 4px;
  color: var(--tm-muted);
  white-space: nowrap;
}

.tm-sum-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--tm-ink-2);
}

.tm-sum-list li {
  display: grid;
  grid-template-columns: 6px 3ch auto;
  align-items: center;
  gap: 8px;
  height: 24px;
  white-space: nowrap;
}

.tm-sum-list .tm-num {
  font-family: var(--tm-mono);
  font-size: 11px;
  text-align: right;
}

.tm-rail-sum[hidden] {
  display: none;
}

.tm-rail-pos {
  font-variant-numeric: tabular-nums;
}

.tm-rail-pos.is-active {
  color: var(--tm-ink);
}

.tm-sum-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tm-muted);
}

.tm-sum-dot.tm-group--link,
.tm-sum-dot.tm-group--widget { background: var(--tm-accent-solid); }
.tm-sum-dot.tm-group--button { background: var(--tm-emerald-solid); }
.tm-sum-dot.tm-group--menu { background: var(--tm-amber-solid); }

.tm-rail-sum .tm-num {
  font-variant-numeric: tabular-nums;
}

/* Quiet footer: the worst-case comparison is available, never prominent. */
.tm-rail-foot {
  flex: none;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--tm-line);
}

.tm-rail-foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tm-rail-foot-title {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--tm-muted);
}

.tm-rail-foot .tm-switch {
  flex: none;
  white-space: nowrap;
}

.tm-rail-foot-note {
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--tm-muted);
}

.tm-rail-foot-note[hidden] {
  display: none;
}

.tm-rail-foot-note p {
  margin: 0;
}

.tm-rail-foot-note ul {
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  color: var(--tm-ink-2);
}

.tm-rail-foot-note .tm-tag {
  color: var(--tm-rose-text);
}

.tm-copy {
  flex: 0 0 auto;
  height: 28px;
  padding: 0 8px;
  gap: 4px;
  font-size: 12px;
}

.tm-swap {
  display: inline-grid;
}

.tm-swap > span {
  grid-area: 1 / 1;
  text-align: center;
}

.tm-swap-b,
.tm-copy.is-done .tm-swap-a {
  visibility: hidden;
}

.tm-copy.is-done .tm-swap-b {
  visibility: visible;
}

.tm-status {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0 16px 8px;
  min-height: 20px;
}

.tm-status.is-plain {
  min-height: 0;
  padding: 0;
}

.tm-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--tm-muted);
}

.tm-dot--ok { background: var(--tm-emerald-solid); }
.tm-dot--warn { background: var(--tm-amber-solid); }
.tm-dot--fail { background: var(--tm-rose-solid); }

.tm-status .tm-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius-sm);
  color: var(--tm-ink-2);
}

.tm-status--warn .tm-tag {
  border-color: var(--tm-amber-solid);
  color: var(--tm-amber-text);
}

.tm-status--fail .tm-tag {
  border-color: var(--tm-rose-solid);
  color: var(--tm-rose-text);
}

.tm-caption {
  margin: 4px 0 0;
  padding: 0 16px;
  font-size: 12px;
  color: var(--tm-muted);
}

.tm-excluded-bad {
  color: var(--tm-rose-text);
}

.tm-guard {
  margin: 8px 16px 0;
  padding-left: 8px;
  border-left: 2px solid var(--tm-amber-solid);
  color: var(--tm-amber-text);
  font-size: 12px;
}

/* Positioned so the cards' visually hidden labels are clipped here instead of stretching the page. */
.tm-seq-wrap {
  position: relative;
  container-type: inline-size;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin-top: 12px;
  padding: 0 8px 16px;
  border-top: 1px solid var(--tm-line);
  scroll-padding-block: 12px;
}

.tm-seq {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* WCAG 2.4.11 / 2.4.12: tabbing never parks a card under the rail header or the scroller edge. */
.tm-card {
  position: relative;
  border-radius: var(--tm-radius);
  scroll-margin-block: 12px;
}

.tm-card + .tm-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 40px;
  right: 8px;
  border-top: 1px solid var(--tm-line);
}

.tm-card.is-active::before,
.tm-card.is-active + .tm-card::before {
  border-top-color: transparent;
}

.tm-card.is-active {
  background: var(--tm-accent-soft);
}

.tm-card.is-issue.is-active {
  background: var(--tm-rose-soft);
}

.tm-card-main {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px 12px;
  padding: 8px;
  cursor: pointer;
}

.tm-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-inline: auto;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--tm-badge-hi), var(--tm-badge-lo));
  color: var(--tm-on-accent);
  font-family: var(--tm-mono);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tm-badge--wide {
  width: 30px;
}

.tm-badge.is-issue {
  background: linear-gradient(180deg, var(--tm-badge-rose-hi), var(--tm-badge-rose-lo));
}

/* Rail badges rest as quiet hairline outlines; the filled badge returns on hover, focus, selection or the active step. */
.tm-card .tm-badge {
  box-sizing: border-box;
  border: 1px solid var(--tm-line-2);
  background: transparent;
  color: var(--tm-muted);
  font-weight: 500;
}

.tm-card .tm-badge.is-issue {
  border-color: var(--tm-rose-solid);
  color: var(--tm-rose-text);
}

.tm-card:hover .tm-badge,
.tm-card:focus-within .tm-badge,
.tm-card.is-active .tm-badge,
.tm-card.is-selected .tm-badge,
.tm-card.is-open .tm-badge {
  border-color: transparent;
  background: linear-gradient(180deg, var(--tm-badge-hi), var(--tm-badge-lo));
  color: var(--tm-on-accent);
  font-weight: 600;
}

.tm-card:hover .tm-badge.is-issue,
.tm-card:focus-within .tm-badge.is-issue,
.tm-card.is-active .tm-badge.is-issue,
.tm-card.is-selected .tm-badge.is-issue,
.tm-card.is-open .tm-badge.is-issue {
  background: linear-gradient(180deg, var(--tm-badge-rose-hi), var(--tm-badge-rose-lo));
}

.tm-card-label {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tm-card-pattern {
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  padding: 0 4px;
  border: 1px solid currentColor;
  border-radius: var(--tm-radius-sm);
  color: var(--tm-muted);
  white-space: nowrap;
}

.tm-group--link { color: var(--tm-accent-text); }
.tm-group--button { color: var(--tm-emerald-text); }
.tm-group--menu { color: var(--tm-amber-text); }
.tm-group--field { color: var(--tm-muted); }
.tm-group--widget { color: var(--tm-accent-text); }

.tm-plain {
  font-size: 12px;
  color: var(--tm-ink-2);
}

.tm-card-ctrls {
  display: inline-flex;
  gap: 0;
}

.tm-card:hover .tm-icon-btn:not([aria-disabled="true"]),
.tm-card:focus-within .tm-icon-btn:not([aria-disabled="true"]) {
  color: var(--tm-ink-2);
}

.tm-card .tm-icon-btn:not([aria-disabled="true"]):hover,
.tm-card .tm-icon-btn:not([aria-disabled="true"]):focus-visible {
  border-color: var(--tm-line-2);
  color: var(--tm-accent-text);
}

@media (hover: none) {
  .tm-card .tm-icon-btn:not([aria-disabled="true"]) {
    color: var(--tm-ink-2);
  }
}

.tm-chev svg {
  transform: rotate(0deg);
}

.tm-chev[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

/* Resting rows are one line; keys and the short note open for the selected, focused or expanded card. */
.tm-card-row2 {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.tm-card-keys {
  display: inline-flex;
  gap: 4px;
}

.tm-card .tm-kbd {
  border-color: var(--tm-line);
  background: transparent;
  color: var(--tm-muted);
}

.tm-contract {
  font-family: var(--tm-mono);
  font-size: 11px;
  color: var(--tm-muted);
  overflow-wrap: anywhere;
}

.tm-drawer {
  padding: 16px;
  border-top: 1px solid var(--tm-line);
  font-size: 13px;
}

.tm-spec {
  margin: 0;
  display: grid;
  gap: 0;
}

/* One row per spec item, separated by a hairline, with the label a quiet step below the value. */
.tm-spec > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 12px 0;
}

.tm-spec > div + div {
  border-top: 1px solid var(--tm-line);
}

.tm-spec > div:first-child {
  padding-top: 0;
}

.tm-spec > div:last-child {
  padding-bottom: 0;
}

.tm-spec dd {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tm-spec .tm-tag {
  white-space: normal;
}

@container (min-width: 440px) {
  .tm-spec > div {
    grid-template-columns: 152px minmax(0, 1fr);
    gap: 12px;
  }
}

.tm-spec dt {
  color: var(--tm-muted);
  font-size: 12px;
  font-weight: 500;
}

.tm-spec dd {
  margin: 0;
  color: var(--tm-ink);
  line-height: 1.5;
}

.tm-spec ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.tm-spec code {
  font-size: 11px;
  color: var(--tm-ink);
}

.tm-spec-fix {
  color: var(--tm-rose-text);
}

.tm-spec dd .tm-card-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 4px;
}

.tm-spec-text {
  display: block;
}

/* Name, description and tabindex sources: quiet mono micro-tags, rose only for a measured defect. */
.tm-src {
  font-family: var(--tm-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--tm-ink-2);
}

.tm-src.is-issue,
.tm-tag--issue {
  color: var(--tm-rose-text);
}

.tm-src-text {
  color: var(--tm-muted);
}

.tm-spec-line {
  display: block;
  margin-top: 4px;
}

.tm-spec dt {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  white-space: nowrap;
}

/* "?" disclosure: quiet until hovered or focused; the hint opens inline below the row value. */
.tm-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--tm-radius-sm);
  background: transparent;
  color: var(--tm-muted);
  cursor: pointer;
}

.tm-help:hover,
.tm-help[aria-expanded="true"] {
  color: var(--tm-accent-text);
  border-color: var(--tm-line);
}

/* Hidden by opacity only, so it stays in the Tab order and never shifts the row. */
@media (hover: hover) {
  .tm-help {
    opacity: 0;
  }

  .tm-spec > div:hover .tm-help,
  .tm-help:focus-visible,
  .tm-help[aria-expanded="true"] {
    opacity: 1;
  }
}

.tm-help:focus-visible {
  outline: 2px solid var(--tm-accent-solid);
  outline-offset: 2px;
}

.tm-help-text {
  margin: 4px 0 0;
  padding: 4px 8px;
  border-left: 2px solid var(--tm-accent-solid);
  font-size: 12px;
  color: var(--tm-ink-2);
}

.tm-help-text[hidden] {
  display: none;
}

/* Key names in the Keys row render as keycaps. */
.tm-spec-keys code {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 4px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius-sm);
  font-family: var(--tm-mono);
  font-size: 11px;
  color: var(--tm-ink);
  background: transparent;
}

.tm-std-name {
  color: var(--tm-ink-2);
}

/* The WCAG reference sits on its own quiet line under the plain-language meaning. */
.tm-spec li .tm-tag {
  display: block;
  margin-top: 2px;
  color: var(--tm-muted);
}

.tm-drawer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--tm-line);
}

.tm-drawer-note {
  font-size: 12px;
  color: var(--tm-muted);
}

/* ------------------------------------------------------------------------ */
/* About band                                                                */
/* ------------------------------------------------------------------------ */

/* Two-column spec sheet footer: purpose on the left, scannable facts on the right; one hairline, no box. */
.tm-about {
  display: grid;
  grid-template-columns: minmax(0, 42fr) minmax(0, 58fr);
  gap: 32px 48px;
  padding: 24px 0 32px;
  border-top: 1px solid var(--tm-line);
}

.tm-about:focus-visible {
  outline-offset: 4px;
}

.tm-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tm-muted);
}

.tm-about-copy {
  margin: 8px 0 0;
  color: var(--tm-ink-2);
}

.tm-spec-sheet {
  margin: 0;
}

.tm-spec-sheet > div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  padding: 8px 0;
}

.tm-spec-sheet > div + div {
  border-top: 1px solid var(--tm-line);
}

.tm-spec-sheet > div:first-child {
  padding-top: 0;
}

.tm-spec-sheet > div:last-child {
  padding-bottom: 0;
}

.tm-spec-sheet dt {
  min-width: 84px;
  font-size: 12px;
  color: var(--tm-muted);
}

.tm-spec-sheet dd {
  margin: 0;
  font-size: 13px;
  line-height: 20px;
  color: var(--tm-ink-2);
}

.tm-spec-sheet .tm-key-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.tm-key-pair {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.tm-spec-sheet .tm-kbd {
  border-color: var(--tm-line);
  background: transparent;
  color: var(--tm-muted);
}

/* ------------------------------------------------------------------------ */
/* Wireframe specimen (.tm-w-*)                                              */
/* ------------------------------------------------------------------------ */

.tm-wire {
  position: relative;
  isolation: isolate;
  flex: none;
  width: 760px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius-lg);
  background: var(--tm-surface);
  color: var(--tm-ink);
  font-size: 13px;
  line-height: 1.4;
}

.tm-wire a {
  color: inherit;
}

/* Annotate mode: the specimen is a picture; spotlighting comes from stage hit-testing. */
.tm-wire:not(.is-live) * {
  cursor: default;
}

.tm-w-skiprow {
  padding: 8px 16px 0;
}

.tm-w-skip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 24px;
  padding: 0 8px;
  border: 1px dashed var(--tm-line-2);
  border-radius: var(--tm-radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--tm-ink-2);
  text-decoration: none;
}

.tm-w-skip-note {
  font-family: var(--tm-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--tm-muted);
}

.tm-wire.is-live .tm-w-skiprow {
  padding: 0;
  height: 0;
}

.tm-wire.is-live .tm-w-skip {
  position: absolute;
  top: 8px;
  left: 16px;
  z-index: 6;
  border: 1px solid var(--tm-accent-solid);
  background: var(--tm-surface);
  color: var(--tm-ink);
}

.tm-wire.is-live .tm-w-skip-note {
  display: none;
}

.tm-wire.is-live .tm-w-skip:not(:focus) {
  clip: rect(0 0 0 0);
  width: 1px;
  height: 1px;
  overflow: hidden;
  padding: 0;
  border: 0;
}

.tm-w-header {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid var(--tm-line);
}

.tm-w-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.tm-w-logo {
  width: 16px;
  height: 16px;
  border-radius: var(--tm-radius-sm);
  border: 1px solid var(--tm-line-2);
  background: var(--tm-surface-2);
}

.tm-w-nav {
  display: flex;
  gap: 4px;
}

.tm-w-navlink {
  padding: 4px 8px;
  border-radius: var(--tm-radius-sm);
  color: var(--tm-muted) !important;
  text-decoration: none;
  font-weight: 500;
}

.tm-w-navlink[aria-current="page"] {
  color: var(--tm-ink) !important;
  background: var(--tm-surface-2);
}

.tm-w-header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.tm-w-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
  color: var(--tm-ink-2);
  cursor: pointer;
}

.tm-w-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
  color: var(--tm-ink);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.tm-w-btn--sm {
  height: 24px;
}

.tm-w-profile {
  padding-left: 4px;
}

.tm-w-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--tm-surface-2);
  border: 1px solid var(--tm-line);
  font-family: var(--tm-mono);
  font-size: 11px;
  color: var(--tm-muted);
}

.tm-w-menuwrap,
.tm-w-tipwrap {
  position: relative;
  display: inline-flex;
}

.tm-w-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 8;
  min-width: 152px;
  margin: 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
}

.tm-w-toolbar .tm-w-menu {
  left: 0;
  right: auto;
}

.tm-w-menu button {
  display: block;
  width: 100%;
  height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--tm-radius-sm);
  background: transparent;
  text-align: left;
  font-size: 12px;
  cursor: pointer;
}

.tm-w-menu button:hover,
.tm-w-menu button:focus {
  background: var(--tm-accent-soft);
}

.tm-w-tip {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 7;
  width: 200px;
  padding: 4px 8px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius-sm);
  background: var(--tm-surface);
  color: var(--tm-ink-2);
  font-size: 12px;
  display: none;
}

.tm-wire.is-live .tm-w-info:hover + .tm-w-tip,
.tm-wire.is-live .tm-w-info:focus + .tm-w-tip {
  display: block;
}

.tm-wire.is-live .tm-w-info.is-dismissed + .tm-w-tip {
  display: none;
}

.tm-w-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px 0;
  padding: 8px 8px 8px 12px;
  border: 1px solid var(--tm-line);
  border-left: 2px solid var(--tm-amber-solid);
  border-radius: var(--tm-radius);
}

.tm-w-banner-icon {
  display: inline-flex;
  color: var(--tm-amber-solid);
}

.tm-w-banner-text {
  margin: 0;
  font-weight: 500;
}

.tm-w-link {
  color: var(--tm-accent-text) !important;
  font-weight: 500;
  text-underline-offset: 2px;
}

.tm-w-banner-close {
  margin-left: auto;
  border-color: transparent;
}

.tm-w-main {
  padding: 16px;
}

.tm-w-h {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
}

.tm-w-h3 {
  margin: 16px 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.tm-w-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.tm-w-kpi {
  position: relative;
  padding: 12px;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
}

.tm-w-kpi.is-clickable {
  cursor: pointer;
}

.tm-w-kpi-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tm-w-kpi-h {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
}

.tm-w-kpi-title {
  padding: 2px 4px;
  margin-left: -4px;
  border-radius: var(--tm-radius-sm);
  color: var(--tm-ink-2) !important;
  text-decoration: none;
}

.tm-w-kpi-title::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--tm-radius);
}

.tm-w-kpi-tools {
  position: relative;
  z-index: 1;
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
}

.tm-w-kpi-tools .tm-w-icon {
  width: 24px;
  height: 24px;
  border-color: transparent;
  color: var(--tm-muted);
}

.tm-w-metric {
  margin: 8px 0 4px;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.tm-w-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tm-muted);
}

.tm-w-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.tm-w-pill--ok { color: var(--tm-emerald-text); }
.tm-w-pill--warn { color: var(--tm-amber-text); }
.tm-w-pill--fail { color: var(--tm-rose-text); }
.tm-w-pill--neutral { color: var(--tm-muted); }

.tm-w-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}

.tm-w-input {
  width: 220px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
  color: var(--tm-ink);
  font: inherit;
  font-size: 12px;
}

.tm-w-input::placeholder {
  color: var(--tm-muted);
}

.tm-w-toolbar {
  display: inline-flex;
  gap: 4px;
  padding: 2px;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
}

.tm-w-toolbar .tm-w-btn {
  border-color: transparent;
}

.tm-w-grid {
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
}

.tm-w-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.2fr);
  border-top: 1px solid var(--tm-line);
}

.tm-w-row--head {
  border-top: 0;
  background: var(--tm-surface-2);
  border-radius: var(--tm-radius) var(--tm-radius) 0 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--tm-muted);
}

.tm-w-row[aria-selected="true"] {
  background: var(--tm-accent-soft);
}

.tm-w-cell {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 12px;
}

.tm-w-cell--split {
  justify-content: space-between;
  gap: 8px;
}

.tm-w-check {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--tm-accent-solid);
}

.tm-w-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 4px;
  margin-left: -4px;
  border: 0;
  border-radius: var(--tm-radius-sm);
  background: transparent;
  color: var(--tm-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.tm-w-muted {
  color: var(--tm-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tm-w-pager {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 12px;
}

.tm-w-pagelink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--tm-radius-sm);
  color: var(--tm-ink-2) !important;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tm-w-pagelink[aria-current="page"] {
  border-color: var(--tm-line-2);
  color: var(--tm-ink) !important;
}

.tm-w-header-meta {
  margin-left: auto;
}

.tm-w-h--flush,
.tm-w-h3--flush {
  margin: 0;
}

.tm-w-eyebrow {
  margin: 0;
  font-family: var(--tm-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--tm-muted);
}

.tm-w-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--tm-muted);
}

.tm-w-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.tm-w-note {
  margin: 0;
  font-size: 12px;
  color: var(--tm-muted);
}

.tm-w-input--full {
  width: 100%;
}

.tm-w-select {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
  color: var(--tm-ink);
  font: inherit;
  font-size: 12px;
}

.tm-wire .tm-w-btn--primary {
  border-color: var(--tm-accent-text);
  background: var(--tm-accent-text);
  color: var(--tm-on-accent);
}

/* The accent ring is the focus color, so a primary fill uses the darker text step and a live focus ring uses ink. */
.tm-stage[data-wire-theme="dark"] .tm-w-btn--primary {
  border-color: var(--tm-accent-solid);
  background: var(--tm-accent-solid);
  color: var(--tm-bg);
}

.tm-wire .tm-w-btn--danger {
  border-color: var(--tm-rose-solid);
  color: var(--tm-rose-text);
}

.tm-w-status {
  margin: 0;
  font-size: 12px;
  color: var(--tm-muted);
}

.tm-w-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.tm-w-tone--ok { color: var(--tm-emerald-text); }
.tm-w-tone--warn { color: var(--tm-amber-text); }
.tm-w-tone--fail { color: var(--tm-rose-text); }
.tm-w-tone--neutral { color: var(--tm-muted); }

/* Scenario 2 · Master-Detail Triage */
.tm-w-split {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  grid-template-rows: 312px;
  gap: 16px;
}

.tm-w-split > .tm-w-pane {
  grid-row: 1;
  grid-column: 1;
}

.tm-w-split > .tm-w-inspector {
  grid-column: 2;
}

.tm-w-pane {
  min-width: 0;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
}

.tm-w-qscroll {
  height: 100%;
  overflow: auto;
  padding: 8px;
}

/* WCAG 2.4.11 / 2.4.12: keep focused rows clear of the floating toolbar. */
.tm-w-qscroll.is-padded {
  scroll-padding-bottom: 64px;
}

.tm-w-qscroll.is-late {
  padding-bottom: 56px;
}

.tm-w-qfilters {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.tm-w-grow {
  flex: 1 1 auto;
  min-width: 0;
}

.tm-w-queue {
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
}

.tm-w-qrow {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 36px;
  padding-right: 8px;
  border-top: 1px solid var(--tm-line);
  cursor: default;
}

.tm-w-qrow:first-child {
  border-top: 0;
}

.tm-w-qrow[aria-selected="true"] {
  background: var(--tm-accent-soft);
}

.tm-w-qrow[aria-current="true"]::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 2px;
  background: var(--tm-accent-solid);
}

.tm-w-qcell {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.tm-w-qcell--check {
  justify-content: center;
}

.tm-w-qtitle {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tm-w-qkey {
  margin-right: 8px;
  font-family: var(--tm-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--tm-muted);
}

.tm-w-qstatus {
  font-size: 11px;
  font-weight: 500;
}

.tm-w-bulk {
  position: sticky;
  bottom: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
}

.tm-w-bulk--late {
  position: relative;
  bottom: auto;
  grid-area: 1 / 1;
  align-self: end;
  margin: 0 9px 9px;
}

.tm-w-bulk .tm-w-btn {
  height: 28px;
  padding: 0 8px;
  white-space: nowrap;
}

.tm-w-bulk-count {
  margin-right: auto;
  white-space: nowrap;
  font-family: var(--tm-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--tm-ink-2);
}

.tm-w-inspector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

.tm-w-vtabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--tm-line);
}

.tm-w-vtab {
  height: 32px;
  margin-bottom: -1px;
  padding: 0 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--tm-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.tm-w-vtab[aria-selected="true"] {
  border-bottom-color: var(--tm-accent-solid);
  color: var(--tm-ink);
}

.tm-w-tabpanel {
  display: grid;
  gap: 8px;
  padding: 4px 0;
  border-radius: var(--tm-radius-sm);
}

.tm-w-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* Scenario 3 · Workflow Board */
.tm-w-boardbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.tm-w-status--bar {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
}

.tm-w-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.tm-w-lane {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  background: var(--tm-surface-2);
}

.tm-w-lane-h {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 0;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 600;
}

.tm-w-count {
  font-family: var(--tm-mono);
  font-size: 11px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--tm-muted);
}

.tm-w-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tm-w-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
}

.tm-w-card-title {
  justify-self: start;
  padding: 0 2px;
  margin-left: -2px;
  border-radius: var(--tm-radius-sm);
  font-weight: 500;
  text-decoration: none;
}

.tm-w-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
}

.tm-w-lane .tm-w-menu {
  right: 0;
}

.tm-w-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border: 1px dashed var(--tm-line-2);
  border-radius: var(--tm-radius);
  background: transparent;
  color: var(--tm-ink-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.tm-w-lane.is-broken .tm-w-cards { order: 1; }
.tm-w-lane.is-broken .tm-w-add { order: 2; }

.tm-w-card:has(.tm-w-drag) .tm-w-card-title {
  margin-right: 24px;
}

.tm-w-drag {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  color: var(--tm-muted);
  cursor: grab;
}

/* Scenario 4 · Settings & Overlays */
.tm-w-bg {
  position: relative;
}

.tm-w-crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tm-w-crumb-sep {
  color: var(--tm-line-2);
}

.tm-w-slot {
  flex: none;
  height: 34px;
  margin-left: auto;
}

.tm-w-settings {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 16px;
}

.tm-w-tree,
.tm-w-tg {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tm-w-tg {
  padding-left: 16px;
}

.tm-w-ti-row {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px 0 4px;
  border-radius: var(--tm-radius-sm);
  color: var(--tm-ink-2);
  cursor: default;
}

.tm-w-ti-caret {
  display: inline-flex;
  color: var(--tm-muted);
}

.tm-w-ti[aria-expanded="true"] > .tm-w-ti-row .tm-w-ti-caret svg {
  transform: rotate(90deg);
}

.tm-w-ti-pad {
  width: 14px;
}

.tm-w-ti[aria-selected="true"] > .tm-w-ti-row {
  background: var(--tm-accent-soft);
  color: var(--tm-accent-text);
  font-weight: 500;
}

.tm-w-formcol {
  position: relative;
  min-width: 0;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
}

.tm-w-fscroll {
  height: 312px;
  overflow: auto;
  padding: 16px 16px 0;
}

/* WCAG 2.4.11 / 2.4.12: keep focused fields clear of the sticky footer. */
.tm-w-fscroll.is-padded {
  scroll-padding-bottom: 64px;
}

.tm-w-fgrid {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tm-w-fields {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.tm-w-preview {
  display: grid;
  gap: 4px;
  margin: 32px 0 0;
  padding: 12px;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  font-size: 12px;
  color: var(--tm-ink-2);
}

.tm-w-acc {
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
}

.tm-w-acc-h {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
}

.tm-w-acc-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--tm-radius);
  background: transparent;
  color: var(--tm-ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tm-w-acc-caret {
  display: inline-flex;
  color: var(--tm-muted);
}

.tm-w-acc-btn[aria-expanded="true"] .tm-w-acc-caret svg {
  transform: rotate(90deg);
}

.tm-w-acc-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px 8px 12px;
}

.tm-w-radios {
  display: flex;
  gap: 4px;
}

.tm-w-radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--tm-line);
  border-radius: var(--tm-radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.tm-w-radio::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 1px solid var(--tm-line-2);
  border-radius: 50%;
}

.tm-w-radio[aria-checked="true"] {
  border-color: var(--tm-line-2);
}

.tm-w-radio[aria-checked="true"]::before {
  border: 4px solid var(--tm-accent-solid);
}

.tm-w-checkrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.tm-w-sticky {
  position: sticky;
  bottom: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 16px -16px 0;
  padding: 8px 16px;
  border-top: 1px solid var(--tm-line);
  background: var(--tm-surface);
}

.tm-w-sticky--rev {
  flex-direction: row-reverse;
}

.tm-w-drawer {
  position: absolute;
  top: 8px;
  right: 8px;
  bottom: 56px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 224px;
  padding: 12px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius);
  background: var(--tm-surface);
}

.tm-wire.is-landmarks .tm-w-drawer,
.tm-wire.is-landmarks .tm-w-drawer--late {
  position: absolute;
}

/* Portaled to the end of the background, so it is placed against the whole specimen. */
.tm-w-drawer--late {
  top: 82px;
  right: 25px;
  bottom: 81px;
}

.tm-w-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tm-w-drawer-head .tm-w-icon {
  border-color: transparent;
}

.tm-w-drawer-apply {
  align-self: flex-start;
}

.tm-w-scrim {
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: var(--tm-radius-lg);
  background: var(--tm-canvas-bg);
  opacity: 0.72;
}

.tm-w-dialog {
  position: absolute;
  top: 88px;
  left: 50%;
  z-index: 6;
  display: grid;
  gap: 12px;
  width: 344px;
  margin-left: -172px;
  padding: 16px;
  border: 1px solid var(--tm-line-2);
  border-radius: var(--tm-radius-lg);
  background: var(--tm-surface);
}

.tm-w-dlg-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tm-w-dlg-head .tm-w-icon {
  border-color: transparent;
}

.tm-w-dlg-desc {
  margin: 0;
  color: var(--tm-ink-2);
  font-size: 13px;
}

.tm-w-dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Offscreen render used to measure Accessible / Broken / overlay-state deltas. */
.tm-wire.tm-measure {
  position: absolute;
  top: 0;
  left: -10000px;
  pointer-events: none;
}

/* Overlay State control, positioned by the engine over [data-tm-slot]. */
.tm-ostate {
  position: absolute;
  z-index: 7;
  align-items: center;
}

.tm-ostate-label {
  padding: 0 8px 0 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--tm-muted);
}

.tm-ostate .tm-seg-btn {
  padding: 0 8px;
  font-size: 12px;
}

/* Live test focus ring: same 2px / 2px benchmark, also for scripted focus. */
.tm-wire.is-live :focus {
  outline: 2px solid var(--tm-accent-solid);
  outline-offset: 2px;
}

.tm-wire.is-live .tm-w-btn--primary:focus {
  outline-color: var(--tm-ink);
}

.tm-wire.is-live .tm-w-main:focus {
  outline-offset: -2px;
}

.tm-wire.is-live .tm-w-ti:focus {
  outline: none;
}

.tm-wire.is-live .tm-w-ti:focus > .tm-w-ti-row {
  outline: 2px solid var(--tm-accent-solid);
  outline-offset: 0;
}

.tm-wire.is-live .tm-w-qrow:focus,
.tm-wire.is-live .tm-w-tabpanel:focus {
  outline-offset: -2px;
}

/* Landmarks toggle */
.tm-wire.is-landmarks [data-tm-landmark] {
  position: relative;
  outline: 1px dashed var(--tm-accent-solid);
  outline-offset: -1px;
}

.tm-wire.is-landmarks [data-tm-landmark]::before {
  content: attr(data-tm-landmark-label);
  position: absolute;
  top: 2px;
  right: 4px;
  z-index: 4;
  padding: 0 4px;
  background: var(--tm-surface);
  color: var(--tm-accent-text);
  font-family: var(--tm-mono);
  font-size: 11px;
  line-height: 16px;
  pointer-events: none;
}

.tm-wire.is-landmarks .tm-w-banner::before {
  top: -8px;
}

/* Excluded static elements highlight */
.tm-wire.is-excluded [data-tm-excluded] {
  outline: 1px dotted var(--tm-muted);
  outline-offset: 2px;
  border-radius: var(--tm-radius-sm);
}

.tm-wire.is-excluded [data-tm-excluded][tabindex="0"],
.tm-wire.is-excluded [data-tm-excluded][data-tm-hold="0"],
.tm-wire.is-excluded [data-tm-pointer-only] {
  outline: 1px dashed var(--tm-rose-solid);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------------ */
/* Focus Overlay (SVG)                                                       */
/* ------------------------------------------------------------------------ */

.tm-svg.is-hidden > g:not(.tm-cues),
.tm-svg.is-paths-off .tm-paths {
  display: none;
}

.tm-cue {
  fill: var(--tm-muted);
  font-family: var(--tm-mono);
  font-size: 10px;
  paint-order: stroke;
  stroke: var(--tm-surface);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.tm-arrow-head {
  fill: var(--tm-accent-solid);
}

.tm-arrow-head--issue {
  fill: var(--tm-rose-solid);
}

.tm-arrow-head--rest {
  fill: var(--tm-muted);
}

/* Resting connectors are quiet dotted hairlines; only the active stop's outgoing segment is drawn solid. */
.tm-path {
  fill: none;
  stroke: var(--tm-muted);
  stroke-width: 1;
  stroke-linecap: round;
  stroke-dasharray: 0.5 4;
  opacity: 0.45;
}

.tm-path.is-issue {
  stroke: var(--tm-rose-solid);
}

.tm-path.is-active {
  stroke: var(--tm-accent-solid);
  stroke-width: 1.5;
  stroke-dasharray: none;
}

.tm-path.is-issue.is-active {
  stroke: var(--tm-rose-solid);
}

.tm-frame {
  fill: transparent;
  stroke: var(--tm-accent-solid);
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.tm-frame.is-issue {
  stroke: var(--tm-rose-solid);
}

.tm-frame.is-active {
  fill: var(--tm-accent-soft);
}

.tm-frame.is-issue.is-active {
  fill: var(--tm-rose-soft);
}

.tm-spot-halo {
  fill: none;
  stroke: var(--tm-surface);
  stroke-width: 4;
}

.tm-spot-rect {
  fill: var(--tm-accent-soft);
  stroke: var(--tm-accent-solid);
  stroke-width: 1.5;
}

.tm-spot-rect.is-issue {
  fill: var(--tm-rose-soft);
  stroke: var(--tm-rose-solid);
}

.tm-badge-g {
  pointer-events: auto;
  cursor: pointer;
}

.tm-badge-stop--hi { stop-color: var(--tm-badge-hi); }
.tm-badge-stop--lo { stop-color: var(--tm-badge-lo); }
.tm-badge-stop--rose-hi { stop-color: var(--tm-badge-rose-hi); }
.tm-badge-stop--rose-lo { stop-color: var(--tm-badge-rose-lo); }

/* Resting stops are micro-dots; Stop 1, the active stop and the next stop show the full numbered badge. */
.tm-badge-micro {
  fill: var(--tm-accent-solid);
  stroke: var(--tm-surface);
  stroke-width: 1.5;
}

.tm-badge-g.is-issue .tm-badge-micro {
  fill: var(--tm-rose-solid);
}

.tm-badge-full {
  opacity: 0;
}

.tm-badge-g.is-first .tm-badge-full,
.tm-badge-g.is-active .tm-badge-full,
.tm-badge-g.is-next .tm-badge-full,
.tm-svg.is-numbers .tm-badge-full {
  opacity: 1;
}

.tm-badge-g.is-first .tm-badge-micro,
.tm-badge-g.is-active .tm-badge-micro,
.tm-badge-g.is-next .tm-badge-micro,
.tm-svg.is-numbers .tm-badge-micro {
  opacity: 0;
}

.tm-badge-dot {
  fill: url(#tm-badge-accent);
  stroke: var(--tm-surface);
  stroke-width: 1.5;
}

.tm-badge-g.is-issue .tm-badge-dot {
  fill: url(#tm-badge-rose);
}

/* Ring behind the active and next badges; static under reduced motion, a slow pulse otherwise. */
.tm-badge-ring {
  fill: none;
  stroke: var(--tm-accent-solid);
  stroke-width: 1;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
}

.tm-badge-g.is-issue .tm-badge-ring {
  stroke: var(--tm-rose-solid);
}

.tm-badge-g.is-active .tm-badge-ring,
.tm-badge-g.is-next .tm-badge-ring {
  opacity: 0.5;
  transform: scale(1.45);
}

.tm-badge-g.is-next .tm-badge-ring {
  stroke-dasharray: 2 2;
}

.tm-badge-g text {
  fill: var(--tm-on-accent);
  font-family: var(--tm-mono);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.tm-frame.is-pointer {
  stroke-dasharray: 2 2;
}

/* Overlay arcs: focus-trap loops, Esc return arcs, pass-through and scroll-padding markers. */
.tm-arc {
  fill: none;
  stroke: var(--tm-accent-solid);
  stroke-width: 1;
  stroke-linecap: round;
  opacity: 0.8;
}

.tm-arc.is-issue {
  stroke: var(--tm-rose-solid);
}

.tm-arc--return {
  stroke-dasharray: 1 3;
}

.tm-arc--leak,
.tm-arc--pad {
  stroke-dasharray: 4 3;
}

.tm-arc-label {
  fill: var(--tm-accent-text);
  font-family: var(--tm-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  paint-order: stroke;
  stroke: var(--tm-surface);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.tm-arc-label.is-issue {
  fill: var(--tm-rose-text);
}

.tm-svg.has-active .tm-badge-g,
.tm-svg.has-active .tm-arc-g {
  opacity: 0.35;
}

.tm-svg.has-active .tm-path {
  opacity: 0.2;
}

.tm-svg.has-active .tm-path.is-incoming {
  opacity: 0.45;
}

.tm-svg.has-active .tm-badge-g.is-active,
.tm-svg.has-active .tm-badge-g.is-next,
.tm-svg.has-active .tm-path.is-active,
.tm-svg.has-active .tm-arc-g.is-active,
.tm-path.is-active {
  opacity: 1;
}

/* ------------------------------------------------------------------------ */
/* Motion (opt-in only)                                                      */
/* ------------------------------------------------------------------------ */

@media (prefers-reduced-motion: no-preference) {
  .tm-path,
  .tm-arc-g,
  .tm-badge-g,
  .tm-badge-full,
  .tm-badge-micro,
  .tm-frame,
  .tm-card,
  .tm-card .tm-badge,
  .tm-help,
  .tm-chev svg,
  .tm-display-btn svg,
  .tm-switch-thumb,
  .tm-switch-track,
  .tm-icon-btn {
    transition: opacity 120ms ease, fill 120ms ease, background-color 120ms ease,
      border-color 120ms ease, color 120ms ease, transform 160ms ease, left 160ms ease;
  }

  .tm-badge-g.is-active .tm-badge-ring,
  .tm-badge-g.is-next .tm-badge-ring {
    animation: tm-pulse 2s ease-out infinite backwards;
  }

  .tm-badge-g.is-next .tm-badge-ring {
    animation-delay: 600ms;
  }

  @keyframes tm-pulse {
    0% { transform: scale(1); opacity: 0.45; }
    70%, 100% { transform: scale(1.45); opacity: 0; }
  }
}

/* ------------------------------------------------------------------------ */
/* Responsive                                                                */
/* ------------------------------------------------------------------------ */

@media (max-width: 1180px) {
  .tm-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .tm-rail {
    position: static;
    max-height: none;
  }

  .tm-seq-wrap {
    overflow: visible;
  }

}

@media (max-width: 760px) {
  .tm-app {
    padding: 0 16px;
  }

  .tm-tagline {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .tm-about {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .tm-switch-hint {
    display: none;
  }
}
