/* Tiansight 侍天 — CSS components on the published foundation (guide §5, §7).
   Requires tokens.css and base.css. Prefix: .ts-  No raw hex here: every color is a token. */

/* ── Layout ───────────────────────────────────────────────── */
.ts-container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.ts-section { padding-block: var(--section-gap); scroll-margin-top: 72px; }
.ts-section + .ts-section { border-top: 1px solid var(--line); }
.ts-grid {
  display: grid;
  grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  gap: var(--space-6);
}
.ts-grid > * { grid-column: span var(--span, 12); }
@media (max-width: 900px) { .ts-grid > * { grid-column: span var(--span-md, 12); } }
@media (max-width: 640px) { .ts-grid > * { grid-column: span 12; } }
.ts-stack > * + * { margin-top: var(--space-4); }
.ts-center { text-align: center; }

/* ── Heading pair: CN heading + UPPERCASE EN caption ───────── */
.ts-heading { display: flex; flex-direction: column; gap: var(--space-2); }
.ts-heading .ts-caption { order: -1; }
.ts-heading .ts-sub {
  color: var(--text-muted);
  font-weight: var(--weight-aux);
  max-width: var(--measure-cn);
}

/* ── Display lockup / tagline (cover pattern, guide §7) ───── */
.ts-lockup {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--space-5);
  position: relative;
}
.ts-display {
  font-family: var(--font-cn);
  font-size: var(--text-display);
  font-weight: var(--weight-title);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  margin-inline-end: calc(-1 * var(--tracking-display)); /* optical centre with tracking */
  color: var(--text);
}
.ts-tagline {
  font-family: var(--font-cn);
  font-size: var(--text-body);
  font-weight: var(--weight-body);
  letter-spacing: var(--tracking-tagline);
  margin-inline-end: calc(-1 * var(--tracking-tagline));
  color: var(--text-tagline);
}
.ts-lockup > hr, .ts-divider {
  width: 72px; margin: 0; border-top: 1px solid var(--rule);
}

/* ── Rules & framing: hairlines, double rules, corner ticks ── */
.ts-rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }
.ts-rule-double { border: 0; border-top: 3px double var(--rule); margin: 0; }
.ts-frame {
  position: relative;
  border: 1px solid var(--card-border);
  padding: var(--card-pad-lg);
  background: var(--paper);
}
.ts-frame::before, .ts-frame::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none;
  border-color: var(--gold); border-style: solid;
}
.ts-frame::before { top: 6px; left: 6px; border-width: 1px 0 0 1px; }
.ts-frame::after { bottom: 6px; right: 6px; border-width: 0 1px 1px 0; }
.ts-frame-double { outline: 1px solid var(--card-border); outline-offset: 4px; }

/* ── Compass-ring watermark (concentric circles + crosshair) ─ */
.ts-compass {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0;
}
.ts-compass svg {
  position: absolute; width: var(--compass-size, 560px); height: var(--compass-size, 560px);
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: var(--watermark);
}
.ts-compass ~ * { position: relative; z-index: 1; }

/* ── Card ─────────────────────────────────────────────────── */
.ts-card {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--card-pad);
  color: var(--text);
}
.ts-card > .ts-caption { margin-bottom: var(--space-2); }
.ts-card-title {
  font-size: 1.25rem; /* 18–20px */
  font-weight: var(--weight-title);
  line-height: var(--leading-h3);
  margin: 0 0 var(--space-3);
}
.ts-card p:last-child { margin-bottom: 0; }
.ts-card[data-index]::after {   /* 天干 index: 壹 貳 叁 … top-right, vermillion */
  content: attr(data-index);
  position: absolute; top: var(--space-4); right: var(--space-4);
  font-family: var(--font-cn); font-size: var(--text-small); font-weight: var(--weight-title);
  color: var(--seal); line-height: 1;
}
.ts-card-field { background: var(--ink-primary); border-color: var(--card-border); }
.ts-card-charcoal { background: var(--charcoal); color: var(--text-on-charcoal); border-color: var(--gold); }
.ts-card-charcoal .ts-card-title, .ts-card-charcoal h3 { color: var(--text-on-charcoal); }
.ts-card-charcoal .ts-caption { color: var(--text-on-charcoal-key); }
.ts-card-charcoal .ts-muted { color: var(--gold-hi); }
.ts-card-charcoal[data-index]::after { color: var(--gold-hi); }
.ts-card-interactive { transition: border-color var(--dur-base) var(--ease); cursor: pointer; }
.ts-card-interactive:hover { border-color: var(--gold); }
.ts-card-interactive:active { transform: translateY(1px); }

/* ── Token / table row: hairline top, swatch, mono hex, usage ─ */
.ts-token-row {
  display: grid;
  grid-template-columns: var(--swatch) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.6fr);
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3) 0;
  border-top: 1px solid var(--line);
}
.ts-token-row:last-child { border-bottom: 1px solid var(--line); }
.ts-swatch {
  width: var(--swatch); height: var(--swatch);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--swatch-color, var(--ink-primary));
}
.ts-token-row .ts-token-name { font-size: var(--text-small); font-weight: var(--weight-body); line-height: var(--leading-caption); }
.ts-token-row .ts-token-name small { display: block; color: var(--text-muted); }
.ts-token-row .ts-hex { color: var(--gold-hi); }
.ts-token-row .ts-hex[data-small] { color: var(--gold-deep); }
.ts-token-row .ts-usage { font-size: var(--text-small); color: var(--text-muted); line-height: var(--leading-caption); }
@media (max-width: 640px) {
  .ts-token-row { grid-template-columns: var(--swatch) 1fr; }
  .ts-token-row .ts-usage { grid-column: 2; }
}

/* ── Badges ───────────────────────────────────────────────── */
.ts-badge {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  line-height: var(--leading-mono);
  letter-spacing: 0;
  white-space: nowrap;
  border-radius: var(--radius);
  background: var(--ink-primary);
  color: var(--charcoal);
  border: 1px solid transparent;
}
.ts-badge-outline {                    /* status: pill, gold border, bright-gold text */
  background: transparent;
  color: var(--gold-hi);
  border-color: var(--gold);
  border-radius: var(--radius-pill);
}
.ts-badge-seal { background: var(--seal); color: var(--paper); }

/* ── ✓ / ✕ list ───────────────────────────────────────────── */
.ts-check-list { list-style: none; margin: 0; padding: 0; }
.ts-check-list li {
  position: relative; padding-left: 1.6em; margin-bottom: var(--space-2);
}
.ts-check-list li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  font-family: var(--font-en); font-weight: var(--weight-strong);
  color: var(--positive);
}
.ts-check-list li[data-no]::before, .ts-check-list li.no::before {
  content: "✕"; color: var(--negative);
}

/* ── Buttons: ink field carries the key action ─────────────── */
.ts-button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px;
  padding: 10px 24px;
  font-family: var(--font-cn);
  font-size: var(--text-small);
  font-weight: var(--weight-medium);
  line-height: 1.2;
  letter-spacing: 0.06em;
  color: var(--charcoal);
  background: var(--ink-primary);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.ts-button:hover { border-color: var(--gold); background: var(--paper); color: var(--charcoal); }
.ts-button:active { transform: translateY(1px); }                     /* stamp press */
.ts-button-secondary { background: transparent; border-color: var(--gold); color: var(--gold); }
.ts-button-secondary:hover { background: var(--ink-primary); color: var(--gold-hover); border-color: var(--gold-hover); }
.ts-button-secondary:active { color: var(--gold-press); border-color: var(--gold-press); }
.ts-button-quiet { background: transparent; border-color: transparent; color: var(--gold); padding-inline: var(--space-3); }
.ts-button-quiet:hover { background: transparent; border-color: transparent; color: var(--gold-hover); }
.ts-button-quiet:active { color: var(--gold-press); }
.ts-button-charcoal { background: var(--charcoal); border-color: var(--charcoal); color: var(--surface); }
.ts-button-charcoal:hover { background: var(--charcoal); border-color: var(--gold); color: var(--gold-hi); }
.ts-button-lg { min-height: 52px; padding: 14px 32px; font-size: var(--text-body); }
.ts-button-sm { min-height: 36px; padding: 6px 16px; font-size: var(--text-caption); }
.ts-button[disabled], .ts-button[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.ts-button .ts-latin { font-size: var(--text-caption); letter-spacing: var(--tracking-caps-tight); text-transform: uppercase; }

/* ── Form fields: ink field, hairline, 2px ────────────────── */
.ts-field { display: flex; flex-direction: column; gap: var(--space-2); }
.ts-label {
  font-size: var(--text-small); font-weight: var(--weight-medium); color: var(--text);
}
.ts-input, .ts-select, .ts-textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  font: inherit;
  font-size: var(--text-small);
  color: var(--charcoal);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color var(--dur-fast) var(--ease);
}
.ts-input::placeholder, .ts-textarea::placeholder { color: var(--text-muted); font-weight: var(--weight-aux); }
.ts-input:hover, .ts-select:hover, .ts-textarea:hover { border-color: var(--gold); }
.ts-input:focus, .ts-select:focus, .ts-textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--gold); }
.ts-input[aria-invalid="true"] { border-color: var(--seal); }
.ts-hint { font-size: var(--text-caption); color: var(--text-muted); }
.ts-error { font-size: var(--text-caption); color: var(--seal); }

/* ── Stat: key number in mono, label as caption ───────────── */
.ts-stat { display: flex; flex-direction: column; gap: var(--space-1); }
.ts-stat .ts-value {
  font-family: var(--font-mono);
  font-size: 2.5rem;                 /* 40px: bright gold is legible only at display sizes */
  font-weight: var(--weight-medium);
  line-height: 1.1;
  color: var(--text-key);
  font-variant-numeric: tabular-nums;
}
.ts-stat .ts-value small { font-family: var(--font-cn); font-size: var(--text-body); color: var(--text); margin-left: 0.25em; font-weight: var(--weight-body); }
.ts-stat .ts-value.ts-charcoal { color: var(--charcoal); }
.ts-stat .ts-boundary { font-size: var(--text-small); color: var(--text-muted); font-weight: var(--weight-aux); }

/* ── Quote: editorial, hairline, seal mark ────────────────── */
.ts-quote {
  margin: 0; padding: var(--space-5) 0 var(--space-5) var(--space-6);
  border-left: 1px solid var(--gold);
  font-size: 1.25rem; line-height: 1.6; color: var(--text);
}
.ts-quote footer { margin-top: var(--space-3); font-size: var(--text-small); color: var(--text-muted); }

/* ── Step marker: Chinese numeral in a hairline circle ─────── */
.ts-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex: none;
  border: 1px solid var(--gold); border-radius: 50%;
  font-family: var(--font-cn); font-size: var(--text-small); font-weight: var(--weight-title);
  color: var(--gold);
}
.ts-step[aria-current="step"] { background: var(--ink-primary); color: var(--charcoal); border-color: var(--charcoal); }

/* ── Seal stamp: vermillion square containing 侍 / 侍天 ─────── */
.ts-seal-stamp {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--stamp-size, 56px); height: var(--stamp-size, 56px);
  background: var(--seal); color: var(--surface);
  font-family: var(--font-cn); font-weight: var(--weight-title);
  font-size: calc(var(--stamp-size, 56px) * 0.5); line-height: 1;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 3px var(--seal);
  letter-spacing: 0.04em;
}
.ts-seal-stamp[data-two] { flex-direction: column; font-size: calc(var(--stamp-size, 56px) * 0.36); line-height: 1.05; }

/* ── Mark: the published logo with its clear-space rule ───── */
.ts-mark { display: inline-block; height: var(--mark-size, 40px); width: auto; }
.ts-mark img { height: 100%; width: auto; }
.ts-mark-clear { box-sizing: content-box; padding: calc(var(--mark-size, 40px) * 0.5); }   /* ≥ one ring radius */
.ts-lockup-row { display: inline-flex; align-items: center; gap: var(--space-4); }
.ts-lockup-row .ts-wordmark {
  display: flex; flex-direction: column; gap: 2px;
}
.ts-lockup-row .ts-wordmark { justify-content: center; }
.ts-lockup-row .ts-wordmark .ts-caption { font-size: var(--text-small); color: var(--charcoal); }
.ts-lockup-row .ts-wordmark b { /* deprecated v0.7: the mark already reads 侍天, never repeat it beside the mark */ font-family: var(--font-cn); font-size: 1.25rem; font-weight: var(--weight-title); letter-spacing: var(--tracking-display); line-height: 1; }
.ts-lockup-row .ts-alliance { border-left: 1px solid var(--gold); padding-left: var(--space-4); margin-left: var(--space-2); }

/* ── Navigation: hairline, gold rules, active = bright gold rule ─ */
.ts-nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); align-items: center; }
.ts-nav a {
  border-bottom: 1px solid transparent; padding-block: var(--space-2);
  color: var(--text); font-size: var(--text-small);
}
.ts-nav a:hover { border-bottom-color: var(--gold-hover); color: var(--gold-hover); }
.ts-nav a[aria-current="page"] { border-bottom-color: var(--gold-hi); color: var(--charcoal); }
.ts-header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

/* ── Ledger table variants ────────────────────────────────── */
.ts-table-ledger td:first-child { color: var(--text-muted); font-size: var(--text-small); }
.ts-table-ledger tr[data-total] td { border-top: 1px solid var(--gold); font-weight: var(--weight-title); }

/* ── Chart chrome: hairline axes, ink-muted ticks ─────────── */
.ts-chart { position: relative; }
.ts-chart svg { overflow: visible; }
.ts-chart polyline, .ts-chart path.line,
.ts-chart polyline.series-1, .ts-chart polyline.series-2, .ts-chart polyline.series-3, .ts-chart polyline.benchmark { fill: none; }
.ts-chart .axis { stroke: var(--chart-grid); }
.ts-chart .axis-base { stroke: var(--line-strong); }
.ts-chart .tick {
  font-family: var(--font-mono); font-size: 11px; fill: var(--chart-axis);
}
.ts-chart .series-1 { stroke: var(--chart-1); fill: var(--chart-1); }
.ts-chart .series-2 { stroke: var(--chart-2); fill: var(--chart-2); }
.ts-chart .series-3 { stroke: var(--chart-3); fill: var(--chart-3); }
.ts-chart .benchmark { stroke: var(--chart-benchmark); stroke-dasharray: 3 4; fill: none; }
.ts-chart .label { font-family: var(--font-cn); font-size: var(--text-caption); fill: var(--text); }
.ts-chart .source { font-size: var(--text-caption); color: var(--text-muted); margin-top: var(--space-2); }

/* ── Reveal motion: fade + ≤ 12px rise, once ─────────────── */
@keyframes ts-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.ts-reveal { animation: ts-rise var(--dur-reveal) var(--ease-out) both; }

/* ── Do / Don't specimen helper ───────────────────────────── */
.ts-verdict { display: flex; flex-direction: column; gap: var(--space-3); }
.ts-verdict > .ts-caption { display: flex; align-items: center; gap: var(--space-2); }
.ts-verdict[data-no] > .ts-caption { color: var(--seal); }

/* ── Icons: circles and lines, stroke 1.5, currentColor (brand/icons.svg) ── */
.ts-icon {
  display: inline-block; width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.3em;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: miter;
}
.ts-icon-sm { width: 1em; height: 1em; vertical-align: -0.15em; }
.ts-icon-lg { width: 1.75em; height: 1.75em; }
.ts-button .ts-icon { width: 1.1em; height: 1.1em; vertical-align: -0.2em; }

/* ── Charcoal ground: one scope class inverts every component for an opener, closer or one card ── */
.ts-ground-charcoal, .ts-card-charcoal {
  background: var(--charcoal); color: var(--text-on-charcoal);
}
.ts-ground-charcoal h1, .ts-ground-charcoal h2, .ts-ground-charcoal h3, .ts-ground-charcoal h4,
.ts-card-charcoal h1, .ts-card-charcoal h2, .ts-card-charcoal h3, .ts-card-charcoal h4, .ts-card-charcoal .ts-card-title { color: var(--text-on-charcoal); }
.ts-ground-charcoal .ts-caption, .ts-ground-charcoal .ts-eyebrow, .ts-ground-charcoal .ts-muted, .ts-ground-charcoal .ts-tagline,
.ts-card-charcoal .ts-caption, .ts-card-charcoal .ts-muted, .ts-card-charcoal[data-index]::after { color: var(--gold-hi); }
.ts-ground-charcoal a { color: var(--gold-hi); border-bottom-color: var(--gold); }
.ts-ground-charcoal a:hover { color: var(--surface); }
.ts-ground-charcoal hr, .ts-ground-charcoal .ts-rule, .ts-ground-charcoal .ts-divider { border-top-color: var(--gold); }
.ts-ground-charcoal .ts-card { background: var(--charcoal); border-color: var(--gold); color: var(--text-on-charcoal); }
.ts-ground-charcoal .ts-card-field { background: var(--ink-primary); color: var(--charcoal); }
.ts-ground-charcoal .ts-card-field .ts-caption { color: var(--gold-deep); }
.ts-ground-charcoal .ts-badge { background: var(--ink-primary); color: var(--charcoal); }
.ts-ground-charcoal .ts-badge-outline { background: transparent; color: var(--gold-hi); border-color: var(--gold); }
.ts-ground-charcoal .ts-button { background: var(--ink-primary); color: var(--charcoal); border-color: var(--gold); }
.ts-ground-charcoal .ts-button:hover { background: var(--surface); }
.ts-ground-charcoal .ts-button-secondary { background: transparent; color: var(--gold-hi); border-color: var(--gold); }
.ts-ground-charcoal .ts-button-secondary:hover { background: var(--charcoal); color: var(--surface); }
.ts-ground-charcoal .ts-button-quiet { background: transparent; border-color: transparent; color: var(--gold-hi); }
.ts-ground-charcoal .ts-check-list li::before { color: var(--gold-hi); }
.ts-ground-charcoal .ts-check-list li[data-no]::before { color: var(--seal); }
.ts-ground-charcoal .ts-step { border-color: var(--gold); color: var(--gold-hi); }
.ts-ground-charcoal .ts-stat .ts-value { color: var(--gold-hi); }
.ts-ground-charcoal .ts-stat .ts-value small, .ts-ground-charcoal .ts-stat .ts-boundary { color: var(--surface); }
.ts-ground-charcoal th, .ts-ground-charcoal td { border-color: var(--gold); }
.ts-ground-charcoal th { color: var(--gold-hi); }
.ts-ground-charcoal .ts-compass svg { color: var(--gold); opacity: 0.35; }
.ts-ground-charcoal .ts-seal-stamp { box-shadow: inset 0 0 0 2px var(--charcoal), inset 0 0 0 3px var(--seal); }
.ts-ground-charcoal .ts-mark { display: inline-grid; place-items: center; background: var(--ink-primary); border-radius: var(--radius); padding: 10%; }
.ts-ground-charcoal ::selection { background: var(--gold-hi); color: var(--charcoal); }

/* ── Accessibility helpers ────────────────────────────────── */
.ts-visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ts-skip { position: absolute; left: var(--space-4); top: -100px; z-index: calc(var(--z-modal) + 1); background: var(--charcoal); color: var(--gold-hi); padding: var(--space-2) var(--space-4); border: 1px solid var(--gold); border-radius: var(--radius); font-size: var(--text-small); }
.ts-skip:focus { top: var(--space-4); outline: 2px solid var(--gold-hi); }

/* ── Tag: removable chip, square ──────────────────────────── */
.ts-tag { display: inline-flex; align-items: center; gap: var(--space-2); padding: 2px 10px; font-size: var(--text-small); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper); color: var(--text); }
.ts-tag[aria-pressed="true"], .ts-tag.on { background: var(--ink-primary); border-color: var(--gold); }
.ts-tag button { all: unset; cursor: pointer; line-height: 1; color: var(--text-muted); }
.ts-tag button:hover, .ts-tag button:focus-visible { color: var(--seal); }

/* ── Notice: inline message, hairline, no icon slop ───────── */
.ts-notice { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--line-strong); border-left: 3px solid var(--gold); background: var(--paper); border-radius: var(--radius); font-size: var(--text-small); }
.ts-notice .ts-icon { color: var(--gold); margin-top: 2px; }
.ts-notice b { display: block; font-weight: var(--weight-title); }
.ts-notice-warn { border-left-color: var(--seal); } .ts-notice-warn .ts-icon { color: var(--seal); }
.ts-notice-key { border-left-color: var(--gold-hi); background: var(--ink-primary); }

/* ── Disclosure: native details, hairline rule ────────────── */
.ts-disclosure { border-top: 1px solid var(--line); }
.ts-disclosure:last-of-type { border-bottom: 1px solid var(--line); }
.ts-disclosure summary { list-style: none; cursor: pointer; padding: var(--space-4) 0; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); font-weight: var(--weight-title); }
.ts-disclosure summary::-webkit-details-marker { display: none; }
.ts-disclosure summary .ts-icon { color: var(--gold); transition: transform var(--dur-base) var(--ease); }
.ts-disclosure[open] summary .ts-icon { transform: rotate(180deg); }
.ts-disclosure summary:hover { color: var(--gold); }
.ts-disclosure summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ts-disclosure .body { padding: 0 0 var(--space-5); color: var(--text); }
.ts-disclosure .body p { max-width: var(--measure-cn); }

/* ── Tabs ─────────────────────────────────────────────────── */
.ts-tabs { display: flex; gap: var(--space-2); flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.ts-tabs [role="tab"] { font: inherit; font-size: var(--text-small); padding: var(--space-2) var(--space-4); background: transparent; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--text-muted); cursor: pointer; }
.ts-tabs [role="tab"]:hover { color: var(--text); }
.ts-tabs [role="tab"][aria-selected="true"] { color: var(--charcoal); border-bottom-color: var(--gold-hi); font-weight: var(--weight-title); }
.ts-tabs [role="tab"]:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.ts-tabs-pill { border-bottom: 0; }
.ts-tabs-pill [role="tab"] { border: 1px solid var(--gold); border-radius: var(--radius-pill); color: var(--gold); padding: 6px 14px; margin: 0; }
.ts-tabs-pill [role="tab"][aria-selected="true"] { background: var(--charcoal); color: var(--gold-hi); border-color: var(--charcoal); }
[role="tabpanel"][hidden] { display: none; }

/* ── Tooltip: pure CSS, charcoal, mono ────────────────────── */
.ts-tip { position: relative; }
.ts-tip::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); background: var(--charcoal); color: var(--surface); font-family: var(--font-mono); font-size: 12px; line-height: 1.4; padding: 5px 9px; border: 1px solid var(--gold); border-radius: var(--radius); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity var(--dur-fast) var(--ease); z-index: var(--z-overlay); }
.ts-tip:hover::after, .ts-tip:focus-visible::after { opacity: 1; }

/* ── Breadcrumb ───────────────────────────────────────────── */
.ts-breadcrumb { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; list-style: none; margin: 0; padding: 0; font-size: var(--text-small); }
.ts-breadcrumb li + li::before { content: "·"; color: var(--gold); margin-right: var(--space-2); }
.ts-breadcrumb a { border: 0; color: var(--text-muted); }
.ts-breadcrumb a:hover { color: var(--gold); }
.ts-breadcrumb [aria-current="page"] { color: var(--text); }

/* ── Pagination ───────────────────────────────────────────── */
.ts-pagination { display: flex; gap: var(--space-1); align-items: center; list-style: none; margin: 0; padding: 0; font-family: var(--font-mono); font-size: var(--text-small); }
.ts-pagination a, .ts-pagination span { display: inline-flex; min-width: 36px; height: 36px; align-items: center; justify-content: center; padding: 0 var(--space-2); border: 1px solid transparent; border-radius: var(--radius); color: var(--text-muted); }
.ts-pagination a:hover { border-color: var(--gold); color: var(--gold); }
.ts-pagination [aria-current="page"] { background: var(--ink-primary); border-color: var(--gold); color: var(--charcoal); }

/* ── Progress: hairline track, ink fill, gold marker ──────── */
.ts-progress { display: flex; flex-direction: column; gap: var(--space-1); }
.ts-progress .track { position: relative; height: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ts-progress .fill { height: 100%; background: var(--charcoal); transition: width var(--dur-base) var(--ease); }
.ts-progress .fill.key { background: var(--gold-hi); }
.ts-progress .meta { display: flex; justify-content: space-between; font-size: var(--text-caption); color: var(--text-muted); font-family: var(--font-mono); }

/* ── Dialog: native <dialog>, paper panel, corner ticks ───── */
.ts-dialog { border: 1px solid var(--card-border); border-radius: var(--radius); background: var(--paper); color: var(--text); padding: var(--card-pad-lg); max-width: min(560px, calc(100vw - 2 * var(--gutter))); box-shadow: none; }
.ts-dialog::backdrop { background: var(--scrim); }
.ts-dialog[open] { box-shadow: var(--shadow-3); }   /* the one shadowed surface (v0.7) */
.ts-dialog h2, .ts-dialog h3 { margin-bottom: var(--space-3); }
.ts-dialog .actions { display: flex; gap: var(--space-3); justify-content: flex-end; margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.ts-dialog[open] { animation: ts-rise var(--dur-base) var(--ease-out) both; }

/* ── Table sorting affordance ─────────────────────────────── */
th[aria-sort] { cursor: pointer; }
th[aria-sort]::after { content: " ↕"; color: var(--line-strong); }
th[aria-sort="ascending"]::after { content: " ↑"; color: var(--gold); }
th[aria-sort="descending"]::after { content: " ↓"; color: var(--gold); }

/* ── Component states, explicit so every consumer matches ── */
.ts-button:focus-visible, .ts-input:focus-visible, .ts-select:focus-visible, .ts-tag:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ts-button[aria-pressed="true"] { background: var(--charcoal); color: var(--gold-hi); border-color: var(--charcoal); }
.ts-input:disabled, .ts-select:disabled, .ts-textarea:disabled { opacity: 0.4; cursor: not-allowed; background: var(--surface); }
.ts-input:read-only { background: var(--surface); color: var(--text-muted); }
.ts-card[aria-selected="true"], .ts-card.selected { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
