body { margin: 0; font-family: var(--font-sans); font-size: 14px; line-height: 20px; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; transition: background-color .2s ease, color .2s ease; }
.cn-demo { padding: var(--space-4); display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.cn-demo-col { padding: var(--space-4); display: grid; gap: var(--space-4); max-width: 760px; }
.cn-demo-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-soft); }

.cn-icon { width: 16px; height: 16px; flex: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cn-icon-fill { fill: currentColor; stroke: none; }

/* Shared focus: a solid ring plus a soft halo */
.cn-btn:focus-visible, .cn-tab:focus-visible, .cn-file:focus-visible, .cn-theme-opt:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus-halo); }

/* Button */
.cn-btn { font: inherit; font-weight: 500; display: inline-flex; align-items: center; gap: var(--space-2); height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--field); color: var(--ink); cursor: pointer; white-space: nowrap; transition: background-color .16s ease, border-color .16s ease, filter .16s ease; }
.cn-btn:hover { background: var(--surface-sunken); border-color: var(--line-strong); }
.cn-btn-primary { background: var(--primary); border-color: transparent; color: var(--on-primary); box-shadow: var(--shadow-raised); }
.cn-btn-primary:hover { background: var(--primary); border-color: transparent; filter: brightness(1.07); }
.cn-btn-accept { background: var(--indigo); border-color: transparent; color: var(--on-indigo); height: 32px; padding: 0 12px; }
.cn-btn-accept:hover { background: var(--indigo); border-color: transparent; filter: brightness(1.08); }
.cn-btn-quiet { border-color: transparent; background: transparent; color: var(--ink-muted); }
.cn-btn-quiet:hover { color: var(--ink); background: var(--surface-sunken); border-color: transparent; }
.cn-btn-danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.cn-btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.cn-field-actions .cn-btn-quiet { height: 32px; padding: 0 10px; }

/* Provenance chip */
.cn-prov { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; line-height: 16px; color: var(--ink-muted); padding: 3px 10px 3px 8px; border-radius: var(--radius-pill); background: var(--surface-sunken); }
.cn-prov .cn-icon { width: 14px; height: 14px; }
.cn-prov-proposal { color: var(--indigo); background: var(--indigo-soft); font-weight: 600; }
.cn-prov-manual { color: var(--ink); }
.cn-prov-empty { color: var(--ink-subtle); background: transparent; }

/* Status */
.cn-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 500; }
.cn-status .cn-icon { width: 14px; height: 14px; }
.cn-dot { width: 8px; height: 8px; border-radius: var(--radius-round); background: currentColor; }
.cn-status-review { color: var(--review); }
.cn-status-done { color: var(--teal-ink); }
.cn-status-unread { color: var(--ink-subtle); }
.cn-status-unread .cn-dot { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.cn-status-error { color: var(--danger); }
.cn-status-open { color: var(--ink-muted); }

/* Field */
.cn-field { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); transition: background-color .3s ease; }
.cn-field:last-child { border-bottom: 0; }
.cn-field-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-2); }
.cn-field-label { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink); }
.cn-req { color: var(--danger); }
.cn-field-body { display: flex; gap: var(--space-2); align-items: flex-start; }
.cn-input { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 7px 12px; min-height: 36px; box-sizing: border-box; resize: vertical; transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease; }
.cn-input:hover { background: var(--surface); }
.cn-input::placeholder { color: var(--ink-subtle); }
.cn-input:focus { outline: none; background: var(--surface); border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus), 0 0 0 5px var(--focus-halo); }
.cn-mono { font-family: var(--font-mono); font-size: 13px; }
.cn-field-proposed { background: var(--indigo-soft); }
.cn-field-proposed .cn-input { border-style: dashed; border-color: var(--indigo); border-width: 1.5px; background: var(--surface); }
.cn-field-empty .cn-field-label { color: var(--ink-muted); }
.cn-field-actions { display: flex; gap: var(--space-1); }
.cn-field-hint { margin: 6px 0 0 2px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }

/* Step rail */
.cn-rail { list-style: none; margin: 0; padding: 6px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-soft); }
.cn-step { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: var(--radius-sm); min-width: 0; }
.cn-step-mark { flex: none; width: 24px; height: 24px; border-radius: var(--radius-round); display: grid; place-items: center; font-family: var(--font-mono); font-size: 12px; font-weight: 500; background: var(--surface-sunken); color: var(--ink-muted); }
.cn-step-mark .cn-icon { width: 13px; height: 13px; stroke-width: 2.2; }
.cn-step-text { display: grid; min-width: 0; }
.cn-step-label { font-weight: 600; font-size: 13px; line-height: 18px; color: var(--ink); }
.cn-step-opt { font-weight: 400; color: var(--ink-subtle); }
.cn-step-detail { font-size: 12px; line-height: 16px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cn-step-done .cn-step-mark { background: var(--teal); color: var(--on-teal); }
.cn-step-current { background: var(--teal-soft); }
.cn-step-current .cn-step-mark { background: var(--surface); color: var(--teal-ink); box-shadow: inset 0 0 0 1.5px var(--teal-ink); }
.cn-step-current .cn-step-detail { color: var(--teal-ink); }

/* File row */
.cn-file { all: unset; box-sizing: border-box; display: grid; gap: 4px; width: 100%; padding: 10px 12px 12px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-sans); transition: background-color .16s ease; }
.cn-file:hover { background: var(--surface-sunken); }
.cn-file.is-selected { background: var(--surface); box-shadow: var(--shadow-raised), inset 0 0 0 1px var(--line); }
.cn-file-top { display: flex; gap: var(--space-2); justify-content: space-between; align-items: baseline; }
.cn-file-name { font-size: 14px; line-height: 20px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cn-file.is-selected .cn-file-name { font-weight: 600; }
.cn-file-count { flex: none; font-family: var(--font-mono); font-size: 12px; color: var(--ink-subtle); }
.cn-file-meta { display: flex; gap: var(--space-3); align-items: center; }
.cn-file-pending { font-size: 12px; line-height: 16px; color: var(--indigo); }
.cn-meter { display: block; height: 4px; border-radius: var(--radius-pill); background: var(--surface-sunken); margin-top: 4px; overflow: hidden; }
.cn-meter-fill { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--line-strong); opacity: .55; }
.cn-meter-fill.is-full { background: var(--teal); opacity: 1; }

/* Segmented filter */
.cn-tabs { display: flex; gap: 2px; padding: 3px; background: var(--surface-sunken); border-radius: var(--radius-pill); }
.cn-tab { all: unset; flex: 1; text-align: center; justify-content: center; cursor: pointer; font-family: var(--font-sans); font-size: 13px; line-height: 18px; color: var(--ink-muted); padding: 6px 10px; border-radius: var(--radius-pill); display: inline-flex; gap: 6px; align-items: baseline; transition: background-color .16s ease, color .16s ease; }
.cn-tab:hover { color: var(--ink); }
.cn-tab.is-active { color: var(--ink); font-weight: 600; background: var(--surface); box-shadow: var(--shadow-raised); }
.cn-tab-count { font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--ink-subtle); }

/* Theme switch */
.cn-theme { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-sunken); border-radius: var(--radius-pill); }
.cn-theme-opt { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-sans); font-size: 12px; line-height: 16px; color: var(--ink-muted); padding: 6px 12px; border-radius: var(--radius-pill); transition: background-color .16s ease, color .16s ease; }
.cn-theme-opt:hover { color: var(--ink); }
.cn-theme-opt.is-active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-raised); }
.cn-theme-opt .cn-icon { width: 14px; height: 14px; }
.cn-theme.is-compact .cn-theme-opt span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.cn-theme.is-compact .cn-theme-opt { padding: 6px 9px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Spectrum: hue scopes ---------- */
.cn-hue-teal { --h: var(--teal-data); --h-ink: var(--teal-ink); --h-soft: var(--teal-soft); }
.cn-hue-indigo { --h: var(--indigo); --h-ink: var(--indigo); --h-soft: var(--indigo-soft); }
.cn-hue-sky { --h: var(--sky); --h-ink: var(--sky-ink); --h-soft: var(--sky-soft); }
.cn-hue-coral { --h: var(--coral); --h-ink: var(--coral-ink); --h-soft: var(--coral-soft); }
.cn-hue-moss { --h: var(--moss); --h-ink: var(--moss-ink); --h-soft: var(--moss-soft); }
.cn-hue-berry { --h: var(--berry); --h-ink: var(--berry-ink); --h-soft: var(--berry-soft); }
.cn-hue-slate { --h: var(--slate); --h-ink: var(--slate-ink); --h-soft: var(--slate-soft); }

/* Icon tile: soft tint + ink glyph, never a saturated disc */
.cn-tile { flex: none; width: 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--h-soft); color: var(--h-ink); }
.cn-tile .cn-icon { width: 18px; height: 18px; }
.cn-tile.is-sm { width: 28px; height: 28px; border-radius: 8px; }
.cn-tile.is-sm .cn-icon { width: 15px; height: 15px; }

/* File-type chip */
.cn-chip { display: inline-flex; align-items: center; gap: 4px; flex: none; height: 20px; padding: 0 7px 0 5px; border-radius: var(--radius-pill); background: var(--h-soft); color: var(--h-ink); font-family: var(--font-mono); font-size: 11px; line-height: 16px; font-weight: 500; }
.cn-chip .cn-icon { width: 12px; height: 12px; }
.cn-file-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cn-file-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Stat card */
.cn-stat { position: relative; display: grid; gap: 6px; padding: var(--space-4) var(--space-5) var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-soft); overflow: hidden; }
.cn-stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--h); }
.cn-stat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-2); }
.cn-stat-label { font-size: 13px; line-height: 18px; font-weight: 600; color: var(--ink-muted); padding-top: 8px; }
.cn-stat-value { font-size: 28px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); font-variant-numeric: tabular-nums; }
.cn-stat-unit { font-size: 16px; font-weight: 500; color: var(--ink-muted); letter-spacing: 0; }
.cn-stat-delta { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--h-ink); font-variant-numeric: tabular-nums; }
.cn-stat-note { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--ink-muted); }
.cn-stat-action { margin-top: 6px; }

/* Bar list (ranked categories) */
.cn-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cn-bar { display: grid; grid-template-columns: 76px 1fr 64px; gap: var(--space-3); align-items: center; }
.cn-bar-label { font-size: 13px; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cn-bar-track { height: 10px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; }
.cn-bar-fill { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--h); transition: width .3s ease; }
.cn-bar-value { text-align: right; font-size: 13px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* Collection tag */
.cn-ctag { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.cn-ctag-tile { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--h-soft); color: var(--h-ink); box-shadow: inset 0 0 0 1.5px var(--h); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.cn-ctag.is-lg .cn-ctag-tile { width: 40px; height: 40px; border-radius: var(--radius-sm); font-size: 15px; }
.cn-ctag-name { font-size: 14px; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Nav item with module colour */
.cn-nav { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px 6px 6px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-sans); font-size: 14px; line-height: 20px; color: var(--ink-muted); transition: background-color .16s ease, color .16s ease; }
.cn-nav .cn-tile { background: transparent; color: var(--ink-subtle); transition: background-color .16s ease, color .16s ease; }
.cn-nav:hover { background: var(--surface-sunken); color: var(--ink); }
.cn-nav:hover .cn-tile { color: var(--h-ink); }
.cn-nav:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 6px var(--focus-halo); }
.cn-nav.is-active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-raised); }
.cn-nav.is-active .cn-tile { background: var(--h-soft); color: var(--h-ink); }
.cn-nav-label { flex: 1; min-width: 0; }
.cn-nav-kbd { font-family: var(--font-mono); font-size: 11px; color: var(--ink-subtle); }
