/*
 * CircuitTwin design system.
 *
 * Tokens first (light by default, dark from prefers-color-scheme or an
 * explicit <html data-theme>), then base elements, layout, components and
 * pages. Class names are prefixed `ct-`. No web fonts: the system UI stack
 * renders immediately and the page needs no third-party origin.
 */

/* ------------------------------------------------------------------ tokens */

:root {
  color-scheme: light;

  --ct-bg: #f7f8f9;
  --ct-surface: #ffffff;
  --ct-surface-2: #f1f3f5;
  --ct-surface-3: #e7eaee;
  --ct-border: #dde1e6;
  --ct-border-strong: #c3c9d1;
  --ct-control-border: #7c8490;
  --ct-text: #0e1116;
  --ct-text-muted: #4b5563;
  --ct-text-faint: #5d6674;
  --ct-accent: #0e7490;
  --ct-accent-hover: #155e75;
  --ct-accent-soft: #e6f7fa;
  --ct-accent-ink: #ffffff;
  --ct-focus: #0891b2;
  --ct-danger: #b42318;
  --ct-danger-soft: #fef3f2;
  --ct-warn: #a15c07;
  --ct-warn-soft: #fffaeb;
  --ct-ok: #067647;
  --ct-ok-soft: #ecfdf3;
  --ct-info: #175cd3;
  --ct-info-soft: #eff8ff;
  --ct-console-bg: #f4f6f8;
  --ct-console-text: #1d2430;
  --ct-grid-line: rgba(14, 116, 144, 0.08);
  --ct-overlay: rgba(14, 17, 22, 0.45);
  --ct-shadow-1: 0 1px 2px rgba(16, 24, 40, 0.06);
  --ct-shadow-2: 0 4px 12px rgba(16, 24, 40, 0.08);
  --ct-shadow-3: 0 16px 40px rgba(16, 24, 40, 0.16);

  --ct-font-sans: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --ct-font-display: "Inter Display", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --ct-font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  --ct-text-xs: 12px;
  --ct-text-sm: 13px;
  --ct-text-base: 14px;
  --ct-text-md: 15px;
  --ct-text-lg: 17px;
  --ct-text-xl: 20px;
  --ct-text-2xl: 24px;
  --ct-text-3xl: 32px;
  --ct-text-hero: clamp(32px, 5.2vw, 52px);
  --ct-leading: 1.5;

  --ct-space-1: 4px;
  --ct-space-2: 8px;
  --ct-space-3: 12px;
  --ct-space-4: 16px;
  --ct-space-5: 20px;
  --ct-space-6: 24px;
  --ct-space-8: 32px;
  --ct-space-10: 40px;
  --ct-space-12: 48px;
  --ct-space-16: 64px;
  --ct-space-20: 80px;

  --ct-radius-1: 4px;
  --ct-radius-2: 6px;
  --ct-radius-3: 8px;
  --ct-radius-4: 12px;

  --ct-sidebar: 232px;
  --ct-topbar: 52px;
  --ct-content-max: 1120px;
  --ct-ease: cubic-bezier(0.2, 0, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --ct-bg: #0a0a0a;
    --ct-surface: #121212;
    --ct-surface-2: #181818;
    --ct-surface-3: #1f1f1f;
    --ct-border: #262626;
    --ct-border-strong: #3a3a3a;
    --ct-control-border: #707070;
    --ct-text: #f5f5f5;
    --ct-text-muted: #a3a3a3;
    --ct-text-faint: #8c8c8c;
    --ct-accent: #22d3ee;
    --ct-accent-hover: #67e8f9;
    --ct-accent-soft: rgba(34, 211, 238, 0.12);
    --ct-accent-ink: #0a0a0a;
    --ct-focus: #22d3ee;
    --ct-danger: #f97066;
    --ct-danger-soft: rgba(249, 112, 102, 0.12);
    --ct-warn: #fdb022;
    --ct-warn-soft: rgba(253, 176, 34, 0.12);
    --ct-ok: #47cd89;
    --ct-ok-soft: rgba(71, 205, 137, 0.12);
    --ct-info: #84adff;
    --ct-info-soft: rgba(132, 173, 255, 0.12);
    --ct-console-bg: #0d0d0d;
    --ct-console-text: #e5e5e5;
    --ct-grid-line: rgba(34, 211, 238, 0.06);
    --ct-overlay: rgba(0, 0, 0, 0.6);
    --ct-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --ct-shadow-2: 0 4px 12px rgba(0, 0, 0, 0.45);
    --ct-shadow-3: 0 16px 40px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --ct-bg: #0a0a0a;
  --ct-surface: #121212;
  --ct-surface-2: #181818;
  --ct-surface-3: #1f1f1f;
  --ct-border: #262626;
  --ct-border-strong: #3a3a3a;
  --ct-control-border: #707070;
  --ct-text: #f5f5f5;
  --ct-text-muted: #a3a3a3;
  --ct-text-faint: #8c8c8c;
  --ct-accent: #22d3ee;
  --ct-accent-hover: #67e8f9;
  --ct-accent-soft: rgba(34, 211, 238, 0.12);
  --ct-accent-ink: #0a0a0a;
  --ct-focus: #22d3ee;
  --ct-danger: #f97066;
  --ct-danger-soft: rgba(249, 112, 102, 0.12);
  --ct-warn: #fdb022;
  --ct-warn-soft: rgba(253, 176, 34, 0.12);
  --ct-ok: #47cd89;
  --ct-ok-soft: rgba(71, 205, 137, 0.12);
  --ct-info: #84adff;
  --ct-info-soft: rgba(132, 173, 255, 0.12);
  --ct-console-bg: #0d0d0d;
  --ct-console-text: #e5e5e5;
  --ct-grid-line: rgba(34, 211, 238, 0.06);
  --ct-overlay: rgba(0, 0, 0, 0.6);
  --ct-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --ct-shadow-2: 0 4px 12px rgba(0, 0, 0, 0.45);
  --ct-shadow-3: 0 16px 40px rgba(0, 0, 0, 0.6);
}

/* -------------------------------------------------------------------- base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ct-bg);
  color: var(--ct-text);
  font-family: var(--ct-font-sans);
  font-size: var(--ct-text-base);
  line-height: var(--ct-leading);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#main {
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--ct-font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ct-text);
}

h1 { font-size: var(--ct-text-2xl); }
h2 { font-size: var(--ct-text-xl); }
h3 { font-size: var(--ct-text-lg); }
h4 { font-size: var(--ct-text-md); }

p {
  margin: 0;
}

a {
  color: var(--ct-accent);
  text-decoration: none;
}

a:hover {
  color: var(--ct-accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

code,
kbd,
pre,
samp {
  font-family: var(--ct-font-mono);
  font-size: 0.92em;
}

:not(pre) > code {
  padding: 1px 5px;
  border-radius: var(--ct-radius-1);
  background: var(--ct-surface-2);
  border: 1px solid var(--ct-border);
}

hr {
  border: 0;
  border-top: 1px solid var(--ct-border);
  margin: var(--ct-space-6) 0;
}

:focus-visible {
  outline: 2px solid var(--ct-focus);
  outline-offset: 2px;
}

::selection {
  background: var(--ct-accent-soft);
}

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

.ct-skip {
  position: absolute;
  left: var(--ct-space-4);
  top: -48px;
  z-index: 100;
  padding: var(--ct-space-2) var(--ct-space-3);
  background: var(--ct-surface);
  border: 1px solid var(--ct-border-strong);
  border-radius: var(--ct-radius-2);
}

.ct-skip:focus {
  top: var(--ct-space-2);
}

.ct-mono {
  font-family: var(--ct-font-mono);
  font-variant-numeric: tabular-nums;
}

.ct-muted { color: var(--ct-text-muted); }
.ct-faint { color: var(--ct-text-faint); }
.ct-num { font-variant-numeric: tabular-nums; }

.ct-icon {
  display: inline-block;
  flex: none;
  vertical-align: -0.15em;
}

/* ------------------------------------------------------------------ layout */

.ct-container {
  width: 100%;
  max-width: var(--ct-content-max);
  margin: 0 auto;
  padding: 0 var(--ct-space-6);
}

.ct-stack { display: flex; flex-direction: column; gap: var(--ct-space-4); }
.ct-row { display: flex; align-items: center; gap: var(--ct-space-3); flex-wrap: wrap; }
.ct-spacer { flex: 1; }

.ct-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ct-space-4); }
.ct-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ct-space-4); }
.ct-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--ct-space-4); }

@media (max-width: 900px) {
  .ct-grid-3, .ct-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .ct-container { padding: 0 var(--ct-space-4); }
  .ct-grid-2, .ct-grid-3, .ct-grid-4 { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------------ buttons */

.ct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ct-space-2);
  height: 34px;
  padding: 0 var(--ct-space-4);
  border: 1px solid transparent;
  border-radius: var(--ct-radius-2);
  font: inherit;
  font-weight: 550;
  font-size: var(--ct-text-sm);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 120ms var(--ct-ease), border-color 120ms var(--ct-ease), color 120ms var(--ct-ease);
}

.ct-btn:hover { text-decoration: none; }

.ct-btn:disabled,
.ct-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.ct-btn--primary {
  background: var(--ct-accent);
  color: var(--ct-accent-ink);
}

.ct-btn--primary:hover:not(:disabled) {
  background: var(--ct-accent-hover);
  color: var(--ct-accent-ink);
}

.ct-btn--secondary {
  background: var(--ct-surface);
  border-color: var(--ct-border-strong);
  color: var(--ct-text);
}

.ct-btn--secondary:hover:not(:disabled) {
  background: var(--ct-surface-2);
  color: var(--ct-text);
}

.ct-btn--ghost {
  background: transparent;
  color: var(--ct-text-muted);
}

.ct-btn--ghost:hover:not(:disabled) {
  background: var(--ct-surface-2);
  color: var(--ct-text);
}

.ct-btn--danger {
  background: var(--ct-danger);
  color: #ffffff;
}

.ct-btn--danger:hover:not(:disabled) {
  filter: brightness(0.92);
  color: #ffffff;
}

.ct-btn--sm { height: 28px; padding: 0 var(--ct-space-3); font-size: var(--ct-text-xs); }
.ct-btn--lg { height: 42px; padding: 0 var(--ct-space-5); font-size: var(--ct-text-md); }
.ct-btn--icon { width: 34px; padding: 0; }
.ct-btn--block { width: 100%; }

.ct-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: ct-spin 700ms linear infinite;
  flex: none;
}

@keyframes ct-spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------- forms */

.ct-field {
  display: flex;
  flex-direction: column;
  gap: var(--ct-space-1);
  min-width: 0;
}

.ct-label {
  font-size: var(--ct-text-sm);
  font-weight: 550;
  color: var(--ct-text);
}

.ct-hint {
  font-size: var(--ct-text-xs);
  color: var(--ct-text-faint);
}

.ct-field-error {
  font-size: var(--ct-text-xs);
  color: var(--ct-danger);
}

.ct-input,
.ct-select,
.ct-textarea {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 var(--ct-space-3);
  border: 1px solid var(--ct-control-border);
  border-radius: var(--ct-radius-2);
  background: var(--ct-surface);
  color: var(--ct-text);
  font: inherit;
  font-size: var(--ct-text-base);
  transition: border-color 120ms var(--ct-ease), box-shadow 120ms var(--ct-ease);
}

.ct-textarea {
  height: auto;
  min-height: 96px;
  padding: var(--ct-space-2) var(--ct-space-3);
  resize: vertical;
  font-family: var(--ct-font-mono);
  font-size: var(--ct-text-sm);
}

.ct-input::placeholder,
.ct-textarea::placeholder {
  color: var(--ct-text-faint);
}

.ct-input:focus,
.ct-select:focus,
.ct-textarea:focus {
  outline: none;
  border-color: var(--ct-focus);
  box-shadow: 0 0 0 3px var(--ct-accent-soft);
}

.ct-input[aria-invalid="true"] {
  border-color: var(--ct-danger);
}

/* --------------------------------------------------------------- drop zone */

.ct-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--ct-space-2);
  padding: var(--ct-space-8) var(--ct-space-6);
  border: 1.5px dashed var(--ct-control-border);
  border-radius: var(--ct-radius-3);
  background: var(--ct-surface);
  color: var(--ct-text-muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms var(--ct-ease), background-color 120ms var(--ct-ease);
}

.ct-drop:hover,
.ct-drop:focus-within {
  border-color: var(--ct-accent);
}

.ct-drop[data-active="true"] {
  border-color: var(--ct-accent);
  background: var(--ct-accent-soft);
  color: var(--ct-text);
}

.ct-drop input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ct-drop__title {
  font-weight: 600;
  color: var(--ct-text);
}

/* ------------------------------------------------------------ cards/panels */

.ct-card {
  background: var(--ct-surface);
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-3);
  box-shadow: var(--ct-shadow-1);
}

.ct-card__header {
  display: flex;
  align-items: center;
  gap: var(--ct-space-3);
  padding: var(--ct-space-3) var(--ct-space-4);
  border-bottom: 1px solid var(--ct-border);
}

.ct-card__body {
  padding: var(--ct-space-4);
}

.ct-kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--ct-space-2) var(--ct-space-6);
  margin: 0;
  font-size: var(--ct-text-sm);
}

.ct-kv dt { color: var(--ct-text-muted); }
.ct-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.ct-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--ct-space-1);
  height: 22px;
  padding: 0 var(--ct-space-2);
  border-radius: 999px;
  border: 1px solid var(--ct-border);
  background: var(--ct-surface-2);
  color: var(--ct-text-muted);
  font-size: var(--ct-text-xs);
  font-weight: 500;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ tables */

.ct-table-wrap {
  overflow: auto;
  max-height: var(--ct-table-max, 70vh);
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-3);
  background: var(--ct-surface);
}

.ct-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--ct-text-sm);
}

.ct-table caption {
  padding: var(--ct-space-3) var(--ct-space-4);
  text-align: left;
  color: var(--ct-text-muted);
  font-size: var(--ct-text-xs);
}

.ct-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--ct-space-2) var(--ct-space-3);
  background: var(--ct-surface-2);
  border-bottom: 1px solid var(--ct-border);
  color: var(--ct-text-muted);
  font-size: var(--ct-text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.ct-table td {
  padding: var(--ct-space-2) var(--ct-space-3);
  border-bottom: 1px solid var(--ct-border);
  vertical-align: top;
}

.ct-table tbody tr:last-child td { border-bottom: 0; }
.ct-table tbody tr:hover td { background: var(--ct-surface-2); }
.ct-table td.ct-num, .ct-table th.ct-num { text-align: right; }

.ct-table--dense th,
.ct-table--dense td {
  padding: 4px var(--ct-space-2);
}

/* -------------------------------------------------------------------- tabs */

.ct-tabs {
  display: flex;
  gap: var(--ct-space-1);
  border-bottom: 1px solid var(--ct-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.ct-tab {
  position: relative;
  padding: var(--ct-space-2) var(--ct-space-3);
  border: 0;
  background: transparent;
  color: var(--ct-text-muted);
  font: inherit;
  font-weight: 550;
  font-size: var(--ct-text-sm);
  white-space: nowrap;
  cursor: pointer;
}

.ct-tab:hover { color: var(--ct-text); }

.ct-tab[aria-selected="true"] {
  color: var(--ct-text);
}

.ct-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: var(--ct-space-2);
  right: var(--ct-space-2);
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--ct-accent);
}

.ct-tabpanel { padding-top: var(--ct-space-4); }

/* ------------------------------------------------------------------ dialog */

.ct-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--ct-space-4);
  background: var(--ct-overlay);
  animation: ct-fade 120ms var(--ct-ease);
}

.ct-dialog {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--ct-surface);
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-4);
  box-shadow: var(--ct-shadow-3);
}

.ct-dialog__header {
  display: flex;
  align-items: center;
  gap: var(--ct-space-3);
  padding: var(--ct-space-4) var(--ct-space-5);
  border-bottom: 1px solid var(--ct-border);
}

.ct-dialog__body { padding: var(--ct-space-5); }

.ct-dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--ct-space-2);
  padding: var(--ct-space-3) var(--ct-space-5);
  border-top: 1px solid var(--ct-border);
  background: var(--ct-surface-2);
  border-radius: 0 0 var(--ct-radius-4) var(--ct-radius-4);
}

@keyframes ct-fade { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------------ toasts */

.ct-toasts {
  position: fixed;
  right: var(--ct-space-4);
  bottom: var(--ct-space-4);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--ct-space-2);
  width: min(380px, calc(100vw - 32px));
}

.ct-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--ct-space-3);
  padding: var(--ct-space-3) var(--ct-space-4);
  background: var(--ct-surface);
  border: 1px solid var(--ct-border);
  border-left: 3px solid var(--ct-info);
  border-radius: var(--ct-radius-3);
  box-shadow: var(--ct-shadow-2);
  font-size: var(--ct-text-sm);
  animation: ct-fade 160ms var(--ct-ease);
}

.ct-toast--success { border-left-color: var(--ct-ok); }
.ct-toast--error { border-left-color: var(--ct-danger); }
.ct-toast--warning { border-left-color: var(--ct-warn); }
.ct-toast__body { flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- callouts */

.ct-callout {
  display: flex;
  gap: var(--ct-space-3);
  padding: var(--ct-space-3) var(--ct-space-4);
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-3);
  background: var(--ct-info-soft);
  font-size: var(--ct-text-sm);
}

.ct-callout--error { background: var(--ct-danger-soft); border-color: color-mix(in srgb, var(--ct-danger) 30%, transparent); }
.ct-callout--warning { background: var(--ct-warn-soft); border-color: color-mix(in srgb, var(--ct-warn) 30%, transparent); }
.ct-callout--success { background: var(--ct-ok-soft); border-color: color-mix(in srgb, var(--ct-ok) 30%, transparent); }
.ct-callout .ct-icon { margin-top: 2px; }
.ct-callout--error .ct-icon { color: var(--ct-danger); }
.ct-callout--warning .ct-icon { color: var(--ct-warn); }
.ct-callout--success .ct-icon { color: var(--ct-ok); }
.ct-callout--info .ct-icon { color: var(--ct-info); }

/* ------------------------------------------------------------ console view */

.ct-console {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-3);
  background: var(--ct-console-bg);
  overflow: hidden;
}

.ct-console__bar {
  display: flex;
  align-items: center;
  gap: var(--ct-space-2);
  padding: var(--ct-space-2) var(--ct-space-3);
  border-bottom: 1px solid var(--ct-border);
  background: var(--ct-surface-2);
  font-size: var(--ct-text-xs);
  color: var(--ct-text-muted);
}

.ct-console__body {
  margin: 0;
  padding: var(--ct-space-3);
  max-height: var(--ct-console-max, 420px);
  overflow: auto;
  color: var(--ct-console-text);
  font-family: var(--ct-font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
}

.ct-console__line { display: flex; gap: var(--ct-space-3); }
.ct-console__port { flex: none; min-width: 64px; color: var(--ct-text-faint); user-select: none; }
.ct-console__text { flex: 1; min-width: 0; }
.ct-console__line--notice .ct-console__text { color: var(--ct-info); }
.ct-console__line--error .ct-console__text { color: var(--ct-danger); }

/* --------------------------------------------------------- register grid */

.ct-regmap {
  overflow-x: auto;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-3);
  background: var(--ct-surface);
}

.ct-regmap table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--ct-text-xs);
}

.ct-regmap th,
.ct-regmap td {
  border: 1px solid var(--ct-border);
  padding: 3px 4px;
  text-align: center;
  vertical-align: middle;
}

.ct-regmap thead th {
  background: var(--ct-surface-2);
  color: var(--ct-text-faint);
  font-family: var(--ct-font-mono);
  font-weight: 500;
}

.ct-regmap__reg {
  width: 168px;
  text-align: left !important;
  background: var(--ct-surface-2);
}

.ct-regmap__name { display: block; font-weight: 600; color: var(--ct-text); font-size: var(--ct-text-sm); }
.ct-regmap__meta { display: block; font-family: var(--ct-font-mono); color: var(--ct-text-faint); }

.ct-regmap__field {
  background: var(--ct-accent-soft);
  color: var(--ct-text);
  font-family: var(--ct-font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ct-regmap__field[data-access="ro"] { background: var(--ct-surface-3); }
.ct-regmap__field[data-access="wo"] { background: var(--ct-warn-soft); }
.ct-regmap__field[data-access="w1c"] { background: var(--ct-danger-soft); }
.ct-regmap__reserved { color: var(--ct-text-faint); background: repeating-linear-gradient(135deg, transparent 0 4px, var(--ct-grid-line) 4px 8px); }

/* ---------------------------------------------------- empty/loading/error */

.ct-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--ct-space-3);
  padding: var(--ct-space-12) var(--ct-space-6);
  text-align: center;
  color: var(--ct-text-muted);
  border: 1px dashed var(--ct-border);
  border-radius: var(--ct-radius-3);
  background: var(--ct-surface);
}

.ct-state__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--ct-radius-3);
  background: var(--ct-surface-2);
  color: var(--ct-text-muted);
}

.ct-state--error .ct-state__icon { background: var(--ct-danger-soft); color: var(--ct-danger); }
.ct-state__title { font-size: var(--ct-text-md); font-weight: 600; color: var(--ct-text); }
.ct-state__body { max-width: 520px; font-size: var(--ct-text-sm); }
.ct-state__detail { font-family: var(--ct-font-mono); font-size: var(--ct-text-xs); color: var(--ct-text-faint); }

.ct-skeleton {
  display: block;
  height: 12px;
  border-radius: var(--ct-radius-1);
  background: linear-gradient(90deg, var(--ct-surface-2), var(--ct-surface-3), var(--ct-surface-2));
  background-size: 200% 100%;
  animation: ct-shimmer 1.4s linear infinite;
}

@keyframes ct-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ------------------------------------------------------------ page header */

.ct-page {
  display: flex;
  flex-direction: column;
  gap: var(--ct-space-6);
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--ct-space-6) var(--ct-space-8) var(--ct-space-12);
}

.ct-page-header {
  display: flex;
  align-items: flex-start;
  gap: var(--ct-space-4);
  flex-wrap: wrap;
}

.ct-page-header__text { flex: 1; min-width: 240px; }
.ct-page-header__text p { margin-top: var(--ct-space-1); color: var(--ct-text-muted); max-width: 720px; }
.ct-page-header__actions { display: flex; gap: var(--ct-space-2); flex-wrap: wrap; }

@media (max-width: 640px) {
  .ct-page { padding: var(--ct-space-4) var(--ct-space-4) var(--ct-space-10); }
}

/* --------------------------------------------------------------- app shell */

.ct-shell {
  display: grid;
  grid-template-columns: var(--ct-sidebar) minmax(0, 1fr);
  grid-template-rows: var(--ct-topbar) minmax(0, 1fr);
  grid-template-areas:
    "brand top"
    "nav main";
  min-height: 100vh;
}

.ct-shell__brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: var(--ct-space-2);
  padding: 0 var(--ct-space-4);
  border-right: 1px solid var(--ct-border);
  border-bottom: 1px solid var(--ct-border);
  background: var(--ct-surface);
}

.ct-shell__top {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: var(--ct-space-3);
  padding: 0 var(--ct-space-4);
  border-bottom: 1px solid var(--ct-border);
  background: var(--ct-surface);
  min-width: 0;
}

.ct-shell__nav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--ct-space-3) var(--ct-space-2);
  border-right: 1px solid var(--ct-border);
  background: var(--ct-surface);
  overflow-y: auto;
}

.ct-shell__main {
  grid-area: main;
  min-width: 0;
  background: var(--ct-bg);
}

.ct-nav-section {
  padding: var(--ct-space-3) var(--ct-space-3) var(--ct-space-1);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ct-text-faint);
}

.ct-nav-link {
  display: flex;
  align-items: center;
  gap: var(--ct-space-3);
  height: 32px;
  padding: 0 var(--ct-space-3);
  border-radius: var(--ct-radius-2);
  color: var(--ct-text-muted);
  font-size: var(--ct-text-sm);
  font-weight: 500;
}

.ct-nav-link:hover {
  background: var(--ct-surface-2);
  color: var(--ct-text);
  text-decoration: none;
}

.ct-nav-link[aria-current="page"],
.ct-nav-link.ct-active {
  background: var(--ct-accent-soft);
  color: var(--ct-text);
}

.ct-nav-link[aria-current="page"] .ct-icon,
.ct-nav-link.ct-active .ct-icon {
  color: var(--ct-accent);
}

.ct-crumb {
  font-size: var(--ct-text-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ct-user {
  display: flex;
  align-items: center;
  gap: var(--ct-space-2);
  min-width: 0;
  font-size: var(--ct-text-sm);
}

.ct-user__email {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ct-text-muted);
}

.ct-segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-2);
  background: var(--ct-surface-2);
}

.ct-segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ct-space-1);
  height: 26px;
  min-width: 30px;
  padding: 0 var(--ct-space-2);
  border: 0;
  border-radius: var(--ct-radius-1);
  background: transparent;
  color: var(--ct-text-muted);
  font: inherit;
  font-size: var(--ct-text-xs);
  cursor: pointer;
}

.ct-segmented button[aria-pressed="true"] {
  background: var(--ct-surface);
  color: var(--ct-text);
  box-shadow: var(--ct-shadow-1);
}

.ct-menu-button { display: none; }

@media (max-width: 860px) {
  .ct-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--ct-topbar) auto minmax(0, 1fr);
    grid-template-areas:
      "top"
      "nav"
      "main";
  }

  .ct-shell__brand { display: none; }
  .ct-menu-button { display: inline-flex; }

  .ct-shell__nav {
    display: none;
    border-right: 0;
    border-bottom: 1px solid var(--ct-border);
  }

  .ct-shell[data-nav-open="true"] .ct-shell__nav { display: flex; }
  .ct-user__email { display: none; }
}

/* ----------------------------------------------------------------- brand */

.ct-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--ct-space-2);
  color: var(--ct-text);
  font-family: var(--ct-font-display);
  font-weight: 650;
  font-size: var(--ct-text-md);
  letter-spacing: -0.01em;
}

.ct-brand:hover { color: var(--ct-text); text-decoration: none; }
.ct-brand__mark { width: 24px; height: 24px; flex: none; }

/* ---------------------------------------------------------------- public */

.ct-public {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.ct-public main { flex: 1; }

.ct-site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--ct-border);
  background: color-mix(in srgb, var(--ct-bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}

.ct-site-header .ct-container {
  display: flex;
  align-items: center;
  gap: var(--ct-space-6);
  height: 60px;
}

.ct-site-nav {
  display: flex;
  align-items: center;
  gap: var(--ct-space-5);
  font-size: var(--ct-text-sm);
}

.ct-site-nav a { color: var(--ct-text-muted); }
.ct-site-nav a:hover { color: var(--ct-text); text-decoration: none; }

@media (max-width: 720px) {
  .ct-site-nav .ct-site-nav__section { display: none; }
}

.ct-hero {
  position: relative;
  padding: var(--ct-space-20) 0 var(--ct-space-16);
  border-bottom: 1px solid var(--ct-border);
  background-image:
    linear-gradient(var(--ct-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--ct-grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
}

.ct-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--ct-space-2);
  margin-bottom: var(--ct-space-5);
  font-family: var(--ct-font-mono);
  font-size: var(--ct-text-xs);
  color: var(--ct-accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ct-hero h1 {
  max-width: 820px;
  font-size: var(--ct-text-hero);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

.ct-hero__lede {
  max-width: 680px;
  margin-top: var(--ct-space-5);
  font-size: var(--ct-text-lg);
  line-height: 1.6;
  color: var(--ct-text-muted);
}

.ct-hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ct-space-3);
  margin-top: var(--ct-space-8);
}

.ct-hero__note { font-size: var(--ct-text-sm); color: var(--ct-text-faint); }

.ct-section {
  padding: var(--ct-space-16) 0;
  border-bottom: 1px solid var(--ct-border);
}

.ct-section__head {
  max-width: 720px;
  margin-bottom: var(--ct-space-8);
}

.ct-section__kicker {
  display: block;
  margin-bottom: var(--ct-space-2);
  font-family: var(--ct-font-mono);
  font-size: var(--ct-text-xs);
  color: var(--ct-accent);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ct-section__head h2 { font-size: var(--ct-text-3xl); letter-spacing: -0.02em; }
.ct-section__head p { margin-top: var(--ct-space-3); color: var(--ct-text-muted); font-size: var(--ct-text-md); }

@media (max-width: 640px) {
  .ct-hero { padding: var(--ct-space-12) 0 var(--ct-space-10); }
  .ct-section { padding: var(--ct-space-10) 0; }
  .ct-section__head h2 { font-size: var(--ct-text-2xl); }
}

.ct-feature {
  display: flex;
  flex-direction: column;
  gap: var(--ct-space-2);
  padding: var(--ct-space-5);
  background: var(--ct-surface);
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-3);
}

.ct-feature__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: var(--ct-space-2);
  border-radius: var(--ct-radius-2);
  background: var(--ct-accent-soft);
  color: var(--ct-accent);
}

.ct-feature h3 { font-size: var(--ct-text-md); }
.ct-feature p { color: var(--ct-text-muted); font-size: var(--ct-text-sm); }

.ct-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-3);
  background: var(--ct-surface);
  counter-reset: ct-step;
}

.ct-step {
  position: relative;
  padding: var(--ct-space-5);
  border-right: 1px solid var(--ct-border);
  counter-increment: ct-step;
}

.ct-step:last-child { border-right: 0; }

.ct-step::before {
  content: counter(ct-step, decimal-leading-zero);
  display: block;
  margin-bottom: var(--ct-space-3);
  font-family: var(--ct-font-mono);
  font-size: var(--ct-text-xs);
  color: var(--ct-accent);
}

.ct-step h3 { font-size: var(--ct-text-md); margin-bottom: var(--ct-space-2); }
.ct-step p { font-size: var(--ct-text-sm); color: var(--ct-text-muted); }
.ct-step code { font-size: 11.5px; }

@media (max-width: 900px) {
  .ct-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-step:nth-child(2) { border-right: 0; }
  .ct-step:nth-child(-n + 2) { border-bottom: 1px solid var(--ct-border); }
}

@media (max-width: 640px) {
  .ct-steps { grid-template-columns: minmax(0, 1fr); }
  .ct-step { border-right: 0; border-bottom: 1px solid var(--ct-border); }
  .ct-step:last-child { border-bottom: 0; }
}

.ct-metric {
  display: flex;
  flex-direction: column;
  gap: var(--ct-space-1);
  padding: var(--ct-space-5);
  background: var(--ct-surface);
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-3);
}

.ct-metric__value {
  font-family: var(--ct-font-display);
  font-size: var(--ct-text-3xl);
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ct-text);
}

.ct-metric__unit { font-size: var(--ct-text-md); font-weight: 500; color: var(--ct-text-muted); margin-left: var(--ct-space-1); }
.ct-metric__label { font-size: var(--ct-text-sm); font-weight: 600; }
.ct-metric__detail { font-size: var(--ct-text-xs); color: var(--ct-text-faint); line-height: 1.5; }

.ct-proof-note {
  margin-top: var(--ct-space-5);
  font-size: var(--ct-text-xs);
  color: var(--ct-text-faint);
}

.ct-terminal {
  margin-top: var(--ct-space-6);
}

.ct-access {
  display: flex;
  align-items: center;
  gap: var(--ct-space-6);
  flex-wrap: wrap;
  padding: var(--ct-space-8);
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-4);
  background: var(--ct-surface);
}

.ct-access__text { flex: 1; min-width: 260px; }
.ct-access__text h2 { font-size: var(--ct-text-2xl); }
.ct-access__text p { margin-top: var(--ct-space-2); color: var(--ct-text-muted); }

.ct-footer {
  padding: var(--ct-space-8) 0;
  font-size: var(--ct-text-sm);
  color: var(--ct-text-faint);
}

.ct-footer .ct-container {
  display: flex;
  align-items: center;
  gap: var(--ct-space-6);
  flex-wrap: wrap;
}

.ct-footer nav { display: flex; gap: var(--ct-space-5); flex-wrap: wrap; }
.ct-footer a { color: var(--ct-text-muted); }

/* ------------------------------------------------------------------ auth */

.ct-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--ct-space-16) var(--ct-space-4);
}

.ct-auth__panel {
  width: 100%;
  max-width: 420px;
  padding: var(--ct-space-8);
  background: var(--ct-surface);
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-4);
  box-shadow: var(--ct-shadow-2);
}

.ct-auth__panel h1 { font-size: var(--ct-text-2xl); }
.ct-auth__panel > p { margin-top: var(--ct-space-2); color: var(--ct-text-muted); }
.ct-auth__form { display: flex; flex-direction: column; gap: var(--ct-space-4); margin-top: var(--ct-space-6); }
.ct-auth__divider {
  display: flex;
  align-items: center;
  gap: var(--ct-space-3);
  margin: var(--ct-space-6) 0 0;
  color: var(--ct-text-faint);
  font-size: var(--ct-text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ct-auth__divider::before,
.ct-auth__divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--ct-border);
}

@media (max-width: 480px) {
  .ct-auth { padding: var(--ct-space-8) var(--ct-space-4); }
  .ct-auth__panel { padding: var(--ct-space-6) var(--ct-space-5); }
}

/* ----------------------------------------------------------------- legal */

.ct-legal {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--ct-space-12) var(--ct-space-6) var(--ct-space-16);
}

.ct-legal h1 { font-size: var(--ct-text-3xl); }
.ct-legal__meta { margin-top: var(--ct-space-2); font-size: var(--ct-text-sm); color: var(--ct-text-faint); }
.ct-legal__intro { margin-top: var(--ct-space-6); font-size: var(--ct-text-md); color: var(--ct-text-muted); }
.ct-legal section { margin-top: var(--ct-space-8); }
.ct-legal section h2 { font-size: var(--ct-text-lg); margin-bottom: var(--ct-space-2); }
.ct-legal section p { color: var(--ct-text-muted); }

@media (max-width: 640px) {
  .ct-legal { padding: var(--ct-space-8) var(--ct-space-4) var(--ct-space-12); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* ------------------------------------------------ product pages (web-product) */

.ct-subhead { font-size: var(--ct-text-md); font-weight: 600; margin: var(--ct-space-2) 0 0; }
.ct-link-strong { font-weight: 600; }
.ct-nowrap { white-space: nowrap; }
.ct-row--wrap { flex-wrap: wrap; }
.ct-grid-2--wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .ct-grid-2--wide { grid-template-columns: minmax(0, 1fr); } }

.ct-cite {
  display: inline-flex;
  align-items: center;
  margin-left: var(--ct-space-2);
  padding: 0 6px;
  border-radius: var(--ct-radius-1);
  border: 1px solid var(--ct-border);
  color: var(--ct-accent);
  font-size: var(--ct-text-xs);
  font-family: var(--ct-font-mono);
  text-decoration: none;
  white-space: nowrap;
}
.ct-cite:hover { background: var(--ct-accent-soft); }
.ct-cite:focus-visible { outline: 2px solid var(--ct-focus); outline-offset: 1px; }

.ct-facts { margin: 0; padding-left: var(--ct-space-5); display: flex; flex-direction: column; gap: var(--ct-space-2); font-size: var(--ct-text-sm); }
.ct-facts li { overflow-wrap: anywhere; }
.ct-problems { margin: 0; padding-left: var(--ct-space-5); display: flex; flex-direction: column; gap: 4px; }
.ct-doc-list { margin: 0; padding-left: var(--ct-space-5); display: flex; flex-direction: column; gap: var(--ct-space-2); font-size: var(--ct-text-sm); overflow-wrap: anywhere; }

.ct-issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--ct-space-2); }
.ct-issue {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--ct-space-2);
  padding: var(--ct-space-2) var(--ct-space-3);
  border-left: 3px solid var(--ct-border-strong);
  background: var(--ct-surface-2);
  border-radius: 0 var(--ct-radius-2) var(--ct-radius-2) 0;
  font-size: var(--ct-text-sm);
}
.ct-issue--warning { border-left-color: var(--ct-warn); }
.ct-issue--error { border-left-color: var(--ct-danger); }
.ct-issue__text { flex: 1 1 240px; overflow-wrap: anywhere; }
.ct-issue__where { color: var(--ct-text-faint); font-size: var(--ct-text-xs); font-family: var(--ct-font-mono); }

/* Datasheet violations: what the firmware did, then what the document says. */
.ct-violations { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--ct-space-3); }
.ct-violation {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--ct-space-3);
  border-left: 3px solid var(--ct-warn);
  background: var(--ct-surface-2);
  border-radius: 0 var(--ct-radius-2) var(--ct-radius-2) 0;
  font-size: var(--ct-text-sm);
  overflow-wrap: anywhere;
}
.ct-violation p { margin: 0; }
.ct-violation__what { font-weight: 600; }
.ct-violation__where { color: var(--ct-text-faint); font-size: var(--ct-text-xs); font-family: var(--ct-font-mono); }
.ct-violation-note { margin: 4px 0 0; font-size: var(--ct-text-xs); color: var(--ct-text-muted); }

.ct-verdict { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.ct-verdict--pass { color: var(--ct-ok); }
.ct-verdict--fail { color: var(--ct-danger); }
.ct-verdict--error { color: var(--ct-warn); }

.ct-stages { list-style: none; margin: 0 0 var(--ct-space-4); padding: 0; display: flex; flex-direction: column; gap: var(--ct-space-2); }
.ct-stages li { display: flex; align-items: center; gap: var(--ct-space-3); color: var(--ct-text-faint); font-size: var(--ct-text-sm); }
.ct-stages__mark { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ct-border-strong); flex: none; }
.ct-stages li[data-state="done"] { color: var(--ct-text); }
.ct-stages li[data-state="done"] .ct-stages__mark { background: var(--ct-ok); border-color: var(--ct-ok); }
.ct-stages li[data-state="active"] { color: var(--ct-text); font-weight: 600; }
.ct-stages li[data-state="active"] .ct-stages__mark { border-color: var(--ct-accent); border-top-color: transparent; animation: ct-spin 0.9s linear infinite; }
.ct-stages li[data-state="failed"] { color: var(--ct-danger); }
.ct-stages li[data-state="failed"] .ct-stages__mark { background: var(--ct-danger); border-color: var(--ct-danger); }
@keyframes ct-spin { to { transform: rotate(360deg); } }

.ct-details summary { cursor: pointer; font-size: var(--ct-text-sm); color: var(--ct-text-muted); padding: var(--ct-space-1) 0; }
.ct-details[open] summary { margin-bottom: var(--ct-space-3); }

.ct-file-line { font-size: var(--ct-text-sm); font-family: var(--ct-font-mono); overflow-wrap: anywhere; }
.ct-file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--ct-text-sm); }
.ct-file-list li { display: flex; align-items: center; gap: var(--ct-space-2); justify-content: space-between; overflow-wrap: anywhere; }

.ct-subrow td { background: var(--ct-surface-2); }
.ct-table tbody tr.ct-subrow:hover td { background: var(--ct-surface-2); }
.ct-regmap { overflow-x: auto; max-width: 100%; }

.ct-check { display: flex; align-items: flex-start; gap: var(--ct-space-2); font-size: var(--ct-text-sm); }
.ct-check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--ct-accent); flex: none; }
.ct-check label { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.ct-fieldset, .ct-device { border: 1px solid var(--ct-border); border-radius: var(--ct-radius-3); padding: var(--ct-space-3) var(--ct-space-4) var(--ct-space-4); margin: 0; min-width: 0; }
.ct-fieldset legend, .ct-device legend { padding: 0 var(--ct-space-1); }
.ct-field--end { justify-content: flex-end; }
.ct-check-row { align-items: end; }

.ct-editor { min-height: 320px; line-height: 1.5; tab-size: 2; white-space: pre; overflow-wrap: normal; overflow-x: auto; }

.ct-progress { height: 8px; border-radius: 999px; background: var(--ct-surface-3); overflow: hidden; }
.ct-progress__bar { height: 100%; background: var(--ct-accent); transition: width 0.3s var(--ct-ease); }

.ct-digest { overflow-wrap: anywhere; font-size: var(--ct-text-xs); }

.ct-chart { margin: 0; display: flex; flex-direction: column; gap: var(--ct-space-1); }
.ct-chart__title { font-size: var(--ct-text-sm); font-weight: 600; }
.ct-chart__svg { width: 100%; height: auto; display: block; }
.ct-chart__grid { stroke: var(--ct-border); stroke-width: 1; }
.ct-chart__axis { stroke: var(--ct-border-strong); stroke-width: 1; }
.ct-chart__tick { fill: var(--ct-text-faint); font-size: 11px; font-family: var(--ct-font-sans); }
.ct-chart__line { stroke: var(--ct-accent); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ct-chart__data summary { font-size: var(--ct-text-xs); color: var(--ct-text-faint); cursor: pointer; }

.ct-code {
  margin: var(--ct-space-2) 0 0;
  padding: var(--ct-space-3);
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-2);
  background: var(--ct-console-bg);
  color: var(--ct-console-text);
  font-family: var(--ct-font-mono);
  font-size: var(--ct-text-xs);
  white-space: pre;
}
.ct-command {
  flex: 1 1 260px;
  min-width: 0;
  padding: var(--ct-space-2) var(--ct-space-3);
  border-radius: var(--ct-radius-2);
  background: var(--ct-surface-2);
  font-family: var(--ct-font-mono);
  font-size: var(--ct-text-sm);
  overflow-wrap: anywhere;
}
.ct-file-card { border: 1px solid var(--ct-border); border-radius: var(--ct-radius-3); padding: var(--ct-space-3); min-width: 0; }
.ct-steps-list { margin: 0; padding-left: var(--ct-space-5); display: flex; flex-direction: column; gap: 4px; font-size: var(--ct-text-sm); }

/* ------------------------------------------------ web-polish (Wave 4) */

/* Messages that quote console output (components/excerpt.rs). */
.ct-message { display: flex; flex-direction: column; gap: var(--ct-space-2); min-width: 0; }
.ct-message__text { margin: 0; overflow-wrap: anywhere; }
.ct-excerpt { margin: 0; min-width: 0; }
.ct-excerpt__body {
  margin: 0;
  padding: var(--ct-space-2) var(--ct-space-3);
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--ct-border);
  border-radius: var(--ct-radius-2);
  background: var(--ct-console-bg);
  color: var(--ct-console-text);
  font-family: var(--ct-font-mono);
  font-size: var(--ct-text-xs);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ct-excerpt__line { display: block; min-height: 1.5em; }
.ct-why { min-width: 180px; max-width: 560px; }

/* Front-page figures (generated from eval-results/ at build time). */
.ct-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--ct-space-4); }

/* Accessibility pass: visible keyboard focus on drop zones (their file
   input is transparent), compact inputs in tables, long paths wrap. */
.ct-drop:focus-within { outline: 2px solid var(--ct-focus); outline-offset: 2px; }
.ct-input--sm { height: 30px; font-size: var(--ct-text-sm); max-width: 220px; }
.ct-break { overflow-wrap: anywhere; word-break: break-word; }
.ct-batch-retry { gap: var(--ct-space-2); flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
.ct-machine { display: flex; flex-direction: column; gap: var(--ct-space-6); min-width: 0; }
