/* Thul Codex components. Every value comes from tokens.css; nothing here declares a colour. */
.cx-screen { width: 390px; height: 844px; box-sizing: border-box; background: var(--ground); color: var(--ink); font-family: var(--font-ui); font-size: 14px; line-height: 20px; display: flex; flex-direction: column; overflow: hidden; }
.cx-body { flex: 1; min-height: 0; overflow: hidden; padding: var(--space-8) var(--space-16) var(--space-24); display: flex; flex-direction: column; gap: var(--space-16); }
.cx-stack { display: flex; flex-direction: column; gap: var(--space-12); }
.cx-row-gap { display: flex; gap: var(--space-8); align-items: center; flex-wrap: wrap; }
.cx-spacer { flex: 1; }
.cx-lead { font-size: 16px; line-height: 24px; color: var(--ink-secondary); margin: 0; }
.cx-muted { color: var(--ink-muted); }
.cx-secondary { color: var(--ink-secondary); }
.cx-text-accent { color: var(--accent-text); }
.cx-text-teal { color: var(--teal); }
.cx-text-lavender { color: var(--lavender); }
.cx-text-danger { color: var(--danger); }
.cx-text-muted { color: var(--ink-muted); }
.cx-p { margin: 0; }
.cx-icon { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Buttons */
.cx-btn { font-family: var(--font-ui); font-size: 15px; line-height: 20px; font-weight: 600; min-height: var(--control); padding: 0 var(--space-16); border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8); cursor: pointer; box-sizing: border-box; text-decoration: none; }
.cx-btn:hover { color: var(--ink); border-color: var(--ink-muted); }
.cx-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cx-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.cx-btn-quiet { background: none; border-color: transparent; color: var(--accent-text); padding: 0 var(--space-12); }
.cx-btn-quiet:hover { border-color: transparent; color: var(--accent-hover); }
.cx-btn-danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.cx-btn-danger-outline { background: none; border-color: var(--danger); color: var(--danger); }
.cx-btn:disabled, .cx-btn[aria-disabled="true"] { background: var(--surface); border-color: var(--line); color: var(--ink-muted); cursor: default; }
.cx-btn-lg { min-height: var(--row); font-size: 16px; border-radius: var(--radius-lg); }
.cx-block { display: flex; width: 100%; }
.cx-iconbtn { width: var(--touch); height: var(--touch); border-radius: var(--radius-md); border: 1px solid transparent; background: none; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; box-sizing: border-box; }
.cx-iconbtn:hover { color: var(--ink); background: var(--surface); }
.cx-iconbtn-outline { border-color: var(--line); background: var(--surface); }

/* Hold to stop */
.cx-hold-wrap { display: flex; flex-direction: column; gap: var(--space-6); align-items: stretch; }
.cx-hold { position: relative; overflow: hidden; min-height: var(--row); border-radius: var(--radius-lg); border: 1px solid var(--danger); background: var(--surface); color: var(--danger); font-family: var(--font-ui); font-size: 15px; font-weight: 600; cursor: pointer; padding: 0; }
.cx-hold-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--danger); }
.cx-hold-label { position: relative; display: flex; align-items: center; justify-content: center; gap: var(--space-8); }
.cx-hold-hint { font-size: 12px; line-height: 16px; color: var(--ink-muted); text-align: center; }

/* Cards and notices */
.cx-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-16); display: flex; flex-direction: column; gap: var(--space-12); box-sizing: border-box; color: var(--ink); }
.cx-card-link:hover { color: var(--ink); border-color: var(--line-strong); }
.cx-card-accent { border-color: var(--accent-line); }
.cx-pad-0 { padding: 0; gap: 0; overflow: hidden; }
.cx-notice-head { display: flex; align-items: center; gap: var(--space-8); }
.cx-notice-title { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.cx-notice-body { font-size: 14px; line-height: 20px; color: var(--ink-secondary); display: flex; flex-direction: column; gap: var(--space-4); }
.cx-notice-actions { display: flex; gap: var(--space-8); flex-wrap: wrap; align-items: center; }
.cx-notice-info .cx-notice-icon { color: var(--ink-muted); }
.cx-notice-good .cx-notice-icon, .cx-notice-good .cx-notice-title { color: var(--teal); }
.cx-notice-warning { border-color: var(--accent-line); }
.cx-notice-warning .cx-notice-icon, .cx-notice-warning .cx-notice-title { color: var(--accent-text); }
.cx-notice-danger { border-color: var(--danger); }
.cx-notice-danger .cx-notice-icon, .cx-notice-danger .cx-notice-title { color: var(--danger); }
.cx-notice-paused .cx-notice-icon { color: var(--ink-muted); }
.cx-notice-icon { display: inline-flex; }

/* Chips, dots */
.cx-chip { display: inline-flex; align-items: center; gap: var(--space-6); height: 24px; padding: 0 9px; border-radius: var(--radius-pill); font-size: 12px; line-height: 16px; border: 1px solid var(--line-strong); color: var(--ink-2); white-space: nowrap; box-sizing: border-box; }
.cx-chip-accent { border-color: var(--accent-line); color: var(--accent-text); }
.cx-chip-teal { border-color: var(--teal-line); color: var(--teal); }
.cx-chip-lavender { border-color: var(--lavender-line); color: var(--lavender); }
.cx-chip-danger { border-color: var(--danger); color: var(--danger); }
.cx-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ink-muted); display: inline-block; }
.cx-dot-accent { background: var(--accent); }
.cx-dot-teal { background: var(--teal); }
.cx-dot-lavender { background: var(--lavender); }
.cx-dot-danger { background: var(--danger); }
.cx-dot-muted, .cx-dot-neutral { background: var(--ink-muted); }
.cx-dot-live { box-shadow: var(--halo-live); }
.cx-status { display: inline-flex; align-items: center; gap: var(--space-8); }
.cx-status-label { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }

/* Labels and headers */
.cx-eyebrow { margin: 0; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.cx-section { display: flex; align-items: center; gap: var(--space-8); padding-bottom: var(--space-6); }
.cx-section-action { margin-left: auto; font-size: 13px; line-height: 18px; }
.cx-header { display: flex; align-items: center; gap: var(--space-8); padding: var(--space-16) var(--space-16) var(--space-8); min-height: 64px; box-sizing: border-box; }
.cx-header-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cx-header-title { margin: 0; font-family: var(--font-display); font-size: 28px; line-height: 32px; font-weight: 600; color: var(--ink); }
.cx-accent-title { color: var(--accent); }

/* Rows */
.cx-row { display: flex; align-items: center; gap: var(--space-12); min-height: var(--row); padding: var(--space-8) 0; border-top: 1px solid var(--line-soft); color: var(--ink); box-sizing: border-box; }
a.cx-row:hover { color: var(--ink); }
.cx-row-lead { display: inline-flex; color: var(--ink-muted); }
.cx-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cx-row-title { font-size: 15px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-row-meta { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.cx-row-note { font-size: 12px; line-height: 16px; color: var(--ink-secondary); }
.cx-row-trail { display: inline-flex; align-items: center; gap: var(--space-8); }
.cx-row-chev { color: var(--ink-muted); }
.cx-pad-0 > .cx-row { padding: var(--space-8) var(--space-16); }
.cx-pad-0 > .cx-row:first-child { border-top: 0; }

/* Level meter */
.cx-meter { display: flex; flex-direction: column; gap: var(--space-6); }
.cx-meter-track { position: relative; height: 24px; border-radius: var(--radius-xs); background: var(--surface-tile); overflow: hidden; }
.cx-meter-peak, .cx-meter-rms { position: absolute; left: 0; top: 0; bottom: 0; }
.cx-meter-peak { background: var(--accent); opacity: var(--opacity-peak); }
.cx-meter-rms { background: var(--accent); }
.cx-meter-clip .cx-meter-peak, .cx-meter-clip .cx-meter-rms { background: var(--danger); opacity: 1; }
.cx-meter-label { font-size: 12px; line-height: 16px; color: var(--ink-muted); }

/* Timer */
.cx-timer { display: flex; flex-direction: column; gap: var(--space-4); }
.cx-timer-digits { font-variant-numeric: lining-nums tabular-nums; color: var(--ink); }
.cx-timer-paused .cx-timer-digits { color: var(--ink-muted); }

/* Form controls */
.cx-check { position: relative; display: flex; align-items: flex-start; gap: var(--space-12); min-height: var(--touch); padding: var(--space-12) 0; cursor: pointer; font-size: 16px; line-height: 24px; box-sizing: border-box; }
.cx-check input { position: absolute; opacity: 0; width: 24px; height: 24px; margin: 0; top: var(--space-12); left: 0; }
.cx-check-box { width: 24px; height: 24px; border-radius: var(--radius-check); border: 2px solid var(--line-control); box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; color: transparent; flex: none; }
.cx-check input:checked + .cx-check-box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cx-check input:focus-visible + .cx-check-box { outline: 2px solid var(--focus); outline-offset: 2px; }
.cx-field { display: flex; flex-direction: column; gap: var(--space-6); }
.cx-field-label { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }
.cx-input { min-height: var(--control); border-radius: var(--radius-md); border: 1px solid var(--line-control); background: var(--surface); color: var(--ink); font-family: var(--font-ui); font-size: 15px; padding: 0 var(--space-12); box-sizing: border-box; width: 100%; }
.cx-input::placeholder { color: var(--ink-muted); }
.cx-field-error .cx-input { border-color: var(--danger); }
.cx-field-hint { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.cx-switch { position: relative; display: flex; align-items: center; gap: var(--space-12); min-height: var(--row); cursor: pointer; }
.cx-switch input { position: absolute; opacity: 0; right: 0; width: 44px; height: 28px; margin: 0; }
.cx-switch-text { flex: 1; display: flex; flex-direction: column; }
.cx-switch-label { font-size: 15px; line-height: 20px; }
.cx-switch-desc { font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.cx-switch-track { width: 44px; height: 28px; border-radius: var(--radius-pill); border: 2px solid var(--line-control); box-sizing: border-box; position: relative; flex: none; }
.cx-switch-thumb { position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-muted); }
.cx-switch input:checked + .cx-switch-track { background: var(--accent); border-color: var(--accent); }
.cx-switch input:checked + .cx-switch-track .cx-switch-thumb { left: 20px; background: var(--on-accent); }
.cx-switch input:focus-visible + .cx-switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.cx-seg { display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius-md); overflow: hidden; }
.cx-seg-opt { flex: 1; min-height: var(--touch); background: none; border: 0; border-left: 1px solid var(--line-strong); color: var(--ink-2); font-family: var(--font-ui); font-size: 14px; cursor: pointer; }
.cx-seg-opt:first-child { border-left: 0; }
.cx-seg-on { background: var(--surface-tile); color: var(--ink); font-weight: 600; }

/* Preview cards only */
.cx-preview { padding: var(--space-16); background: var(--ground); color: var(--ink); font-family: var(--font-ui); display: flex; flex-wrap: wrap; gap: var(--space-12); align-items: flex-start; }
.cx-preview-col { flex-direction: column; align-items: stretch; max-width: 360px; }
