/* Craft Convert Application: component styles. Reads tokens.css; both themes follow data-theme on <html>.
   Type sizes mirror the type styles in tokens.json (ui 14/20/500, small 13/18, caption 12/16, label 12/16/500).
   Control looks follow the brand's product components (.btn, .input, .pill, .switch): 7px corners,
   a hairline edge with shadow-sm and inset-hi, a half-pixel lift on hover, and focus as an accent
   edge with a 3px accent-ring halo. */
:root {
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 80ms;
  --duration-base: 120ms;
}
html { color-scheme: light; }
[data-theme="dark"] { color-scheme: dark; }
body { margin: 0; font-family: var(--font-sans); font-size: 14px; line-height: 20px; font-weight: 500; color: var(--text-primary); background: var(--surface-canvas); -webkit-font-smoothing: antialiased; }
.cca-icon { flex: none; display: block; }
.cca-logo { display: inline-flex; align-items: center; flex: none; line-height: 1; }
.cca-logo__mark { display: block; flex: none; }
.cca-logo__word { font-family: var(--font-sans); font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; color: var(--text-primary); }

.cca-label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text-tertiary); padding: var(--space-2) var(--space-2) var(--space-1); }
.tnum { font-variant-numeric: tabular-nums; }

/* Buttons: 7px corners, sentence case. Hover gains border-strong, lifts half a pixel and steps to shadow-md. */
.cca-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1\.5); font: inherit; font-weight: 500; line-height: 1; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); cursor: pointer; white-space: nowrap; user-select: none; box-sizing: border-box; transition: background-color var(--duration-base) var(--ease-standard), border-color var(--duration-base) var(--ease-standard), transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard); }
.cca-btn:active:not(:disabled) { transform: translateY(0); }
.cca-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.cca-btn--md { height: 32px; padding: 0 var(--space-3); font-size: 14px; }
.cca-btn--sm { height: 28px; padding: 0 11px; font-size: 13px; }
.cca-btn .cca-icon { opacity: 0.8; }
.cca-btn--secondary { background: var(--surface-raised); color: var(--text-primary); box-shadow: var(--inset-hi), var(--shadow-sm); }
.cca-btn--secondary:hover:not(:disabled) { border-color: var(--border-strong); transform: translateY(-0.5px); box-shadow: var(--inset-hi), var(--shadow-md); }
.cca-btn--primary, .cca-iconbtn.cca-iconbtn--primary {
  background: linear-gradient(180deg, color-mix(in oklch, var(--accent) 92%, white) 0%, var(--accent) 50%, var(--accent-hover) 100%);
  border-color: color-mix(in oklch, var(--accent) 60%, transparent);
  color: var(--text-on-accent);
  box-shadow: var(--inset-hi), 0 1px 1px rgba(0, 0, 0, 0.10), 0 4px 10px -2px color-mix(in oklch, var(--accent) 35%, transparent);
}
.cca-btn--primary:hover:not(:disabled), .cca-iconbtn.cca-iconbtn--primary:hover:not(:disabled) { background: linear-gradient(180deg, color-mix(in oklch, var(--accent) 96%, white) 0%, var(--accent-hover) 50%, oklch(from var(--accent) calc(l - 0.08) c h) 100%); transform: translateY(-0.5px); color: var(--text-on-accent); }
.cca-btn--primary .cca-icon { opacity: 0.9; }
.cca-btn--ghost { background: transparent; border-color: transparent; color: var(--text-primary); }
.cca-btn--ghost:hover:not(:disabled) { background: var(--surface-hover); }
.cca-btn--danger {
  background: linear-gradient(180deg, color-mix(in oklch, var(--status-danger-fill) 92%, white) 0%, var(--status-danger-fill) 50%, oklch(from var(--status-danger-fill) calc(l - 0.06) c h) 100%);
  border-color: color-mix(in oklch, var(--status-danger-fill) 60%, transparent);
  color: var(--text-on-accent);
  box-shadow: var(--inset-hi), 0 1px 1px rgba(0, 0, 0, 0.10), 0 4px 10px -2px color-mix(in oklch, var(--status-danger-fill) 35%, transparent);
}
.cca-btn--danger:hover:not(:disabled) { background: linear-gradient(180deg, color-mix(in oklch, var(--status-danger-fill) 96%, white) 0%, oklch(from var(--status-danger-fill) calc(l - 0.04) c h) 50%, oklch(from var(--status-danger-fill) calc(l - 0.1) c h) 100%); transform: translateY(-0.5px); }
.cca-btn--danger .cca-icon { opacity: 0.9; }

.cca-iconbtn { display: inline-grid; place-items: center; flex: none; box-sizing: border-box; border-radius: var(--radius-md); border: 1px solid transparent; background: transparent; color: var(--text-secondary); cursor: pointer; padding: 0; transition: background-color var(--duration-base) var(--ease-standard), color var(--duration-base) var(--ease-standard), border-color var(--duration-base) var(--ease-standard), transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard); }
.cca-iconbtn--sm { width: 28px; height: 28px; }
.cca-iconbtn--md { width: 32px; height: 32px; }
.cca-iconbtn--lg { width: 36px; height: 36px; }
.cca-iconbtn--ghost:hover:not(:disabled), .cca-iconbtn.is-active { background: var(--surface-hover); color: var(--text-primary); }
.cca-iconbtn.is-active { color: var(--text-accent); }
.cca-iconbtn--secondary { border-color: var(--border-subtle); background: var(--surface-raised); color: var(--text-primary); box-shadow: var(--inset-hi), var(--shadow-sm); }
.cca-iconbtn--secondary:hover:not(:disabled) { border-color: var(--border-strong); transform: translateY(-0.5px); box-shadow: var(--inset-hi), var(--shadow-md); }
.cca-iconbtn:active:not(:disabled) { transform: translateY(0); }
.cca-iconbtn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Badge: 5px corners, sentence case, as the brand pill but square-ish. */
.cca-badge { display: inline-flex; align-items: center; gap: var(--space-1); height: 20px; padding: 0 7px; box-sizing: border-box; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 11.5px; font-weight: 500; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cca-badge--neutral { background: var(--surface-hover); color: var(--text-primary); }
.cca-badge--paper { background: var(--surface-sidebar); color: var(--text-secondary); border-color: var(--border-strong); }
.cca-badge--violet { background: var(--accent-soft); color: var(--accent-soft-fg); border-color: color-mix(in oklch, var(--accent) 22%, transparent); }
.cca-badge--accent { background: var(--accent); color: var(--text-on-accent); }
.cca-badge--success { background: color-mix(in oklch, var(--status-success) 8%, transparent); color: var(--status-success); border-color: color-mix(in oklch, var(--status-success) 35%, transparent); }
.cca-badge--warning { background: color-mix(in oklch, var(--status-warning) 8%, transparent); color: var(--status-warning); border-color: color-mix(in oklch, var(--status-warning) 35%, transparent); }
.cca-badge--danger { background: color-mix(in oklch, var(--status-danger) 8%, transparent); color: var(--status-danger); border-color: color-mix(in oklch, var(--status-danger) 35%, transparent); }

.cca-kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-canvas); font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--text-tertiary); line-height: 1; }

.cca-tip { position: relative; display: inline-flex; }
.cca-tip__bubble { position: absolute; z-index: var(--z-menu); left: 50%; transform: translateX(-50%); bottom: calc(100% + 8px); display: inline-flex; gap: var(--space-2); align-items: center; white-space: nowrap; padding: var(--space-1) var(--space-2); border-radius: var(--radius-md); background: var(--text-primary); color: var(--surface-canvas); font-size: 12px; line-height: 16px; box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: opacity var(--duration-base) var(--ease-standard); }
.cca-tip--bottom .cca-tip__bubble { bottom: auto; top: calc(100% + 8px); }
.cca-tip:hover .cca-tip__bubble, .cca-tip:focus-within .cca-tip__bubble, .cca-tip.is-open .cca-tip__bubble { opacity: 1; }
.cca-tip__kbd { opacity: 0.75; font-family: var(--font-mono); font-size: 11px; }

.cca-avatar { display: inline-grid; place-items: center; flex: none; border-radius: var(--radius-pill); overflow: hidden; font-weight: 600; line-height: 1; letter-spacing: 0.01em; box-sizing: border-box; }
.cca-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cca-avatar--violet { background: var(--accent-soft); color: var(--accent-soft-fg); }
.cca-avatar--accent { background: var(--accent); color: var(--text-on-accent); }
.cca-avatar--neutral { background: var(--surface-hover); color: var(--text-primary); }
.cca-avatar--paper { background: var(--surface-sidebar); color: var(--text-secondary); box-shadow: inset 0 0 0 1px var(--border-strong); }

.cca-spinner { display: inline-block; flex: none; border-radius: var(--radius-pill); border: 2px solid var(--border-strong); border-top-color: var(--text-accent); animation: cca-spin 800ms linear infinite; box-sizing: border-box; }
@keyframes cca-spin { to { transform: rotate(360deg); } }

/* Fields: the brand .input, with a border-control edge so a field can be found without focus. */
.cca-field { display: flex; flex-direction: column; gap: var(--space-1\.5); }
.cca-field__label { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--text-secondary); }
.cca-field__control { position: relative; display: flex; align-items: center; gap: var(--space-2); height: 32px; padding: 0 10px; box-sizing: border-box; border-radius: var(--radius-md); border: 1px solid var(--border-control); background: var(--surface-raised); color: var(--text-secondary); transition: border-color var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard); }
.cca-field__control:focus-within { border-color: var(--focus-ring); box-shadow: 0 0 0 3px var(--accent-ring); }
.cca-field__control input, .cca-field__control textarea, .cca-field__control select { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 400; color: var(--text-primary); }
.cca-field__control ::placeholder { color: var(--text-tertiary); }
.cca-field__control--area { height: auto; padding: var(--space-2) 10px; }
.cca-field__control--area textarea { resize: vertical; line-height: 21px; }
.cca-field__control--select select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: var(--space-5); }
.cca-field__control--select select option { background: var(--surface-raised); color: var(--text-primary); }
.cca-field__control--select .cca-icon { position: absolute; right: 10px; pointer-events: none; }
.cca-field__helper { display: flex; align-items: center; gap: var(--space-1); font-size: 12px; line-height: 16px; font-weight: 400; color: var(--text-secondary); }
.cca-field.is-error .cca-field__control { border-color: var(--status-danger); }
.cca-field.is-error .cca-field__control:focus-within { box-shadow: 0 0 0 3px color-mix(in oklch, var(--status-danger) 25%, transparent); }
.cca-field.is-error .cca-field__helper { color: var(--status-danger); }

.cca-check { display: inline-flex; align-items: flex-start; gap: var(--space-2); cursor: pointer; position: relative; }
.cca-check input, .cca-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.cca-check__box { width: 16px; height: 16px; flex: none; margin-top: 2px; border-radius: var(--radius-sm); border: 1.5px solid var(--border-control); background: var(--surface-raised); display: grid; place-items: center; color: transparent; box-sizing: border-box; transition: background-color var(--duration-base) var(--ease-standard), border-color var(--duration-base) var(--ease-standard); }
.cca-check input:checked + .cca-check__box { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }
.cca-check__text { display: flex; flex-direction: column; font-size: 14px; line-height: 20px; }
.cca-check__text small { font-size: 13px; line-height: 18px; font-weight: 400; color: var(--text-secondary); }
.cca-check.is-disabled, .cca-switch.is-disabled { opacity: 0.5; cursor: not-allowed; }

/* Switch: the brand's 30 x 17 track with a white knob. */
.cca-switch { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; position: relative; font-size: 14px; }
.cca-switch__track { width: 30px; height: 17px; flex: none; border-radius: var(--radius-pill); background: var(--border-control); position: relative; transition: background-color var(--duration-base) var(--ease-standard); }
.cca-switch__thumb { position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: var(--radius-pill); background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform var(--duration-base) var(--ease-standard); }
.cca-switch input:checked + .cca-switch__track { background: var(--accent); }
.cca-switch input:checked + .cca-switch__track .cca-switch__thumb { transform: translateX(13px); }

.cca-seg { display: inline-flex; padding: var(--space-0\.5); gap: 2px; border-radius: var(--radius-lg); background: var(--surface-hover); }
.cca-seg__opt { display: inline-flex; align-items: center; gap: var(--space-1); height: 26px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-secondary); font: inherit; font-size: 13px; cursor: pointer; transition: background-color var(--duration-base) var(--ease-standard), color var(--duration-base) var(--ease-standard); }
.cca-seg__opt:hover { color: var(--text-primary); }
.cca-seg__opt.is-on { background: var(--surface-raised); color: var(--text-primary); box-shadow: var(--inset-hi), var(--shadow-sm); }

.cca-search { display: flex; align-items: center; gap: var(--space-2); height: 32px; padding: 0 var(--space-1\.5) 0 10px; box-sizing: border-box; border-radius: var(--radius-md); background: var(--surface-hover); color: var(--text-secondary); transition: box-shadow var(--duration-base) var(--ease-standard); }
.cca-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 400; color: var(--text-primary); }
.cca-search input::placeholder { color: var(--text-tertiary); }
.cca-search input::-webkit-search-cancel-button { display: none; }
.cca-search:focus-within { box-shadow: 0 0 0 1px var(--focus-ring), 0 0 0 4px var(--accent-ring); }

/* Title bar and sidebar */
.cca-titlebar { display: flex; align-items: center; gap: var(--space-2); height: var(--titlebar-height); padding: 0 var(--space-3); background: var(--surface-sidebar); border-bottom: 1px solid var(--border-subtle); box-sizing: border-box; }
.cca-titlebar__controls { display: inline-flex; gap: 8px; margin-right: var(--space-3); }
.cca-titlebar__controls i { width: 12px; height: 12px; border-radius: 50%; background: var(--border-strong); }
.cca-titlebar__left, .cca-titlebar__right { display: flex; align-items: center; gap: var(--space-1); flex: 1; }
.cca-titlebar__right { justify-content: flex-end; }
.cca-titlebar__title { font-size: 13px; font-weight: 600; letter-spacing: -0.005em; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%; }

.cca-sidebar { display: flex; flex-direction: column; width: var(--sidebar-width); height: 100%; background: var(--surface-sidebar); border-right: 1px solid var(--border-subtle); box-sizing: border-box; flex: none; }
.cca-sidebar.is-collapsed { width: 56px; }
.cca-sidebar.is-collapsed .cca-navitem__label, .cca-sidebar.is-collapsed .cca-label, .cca-sidebar.is-collapsed .cca-navitem__trail { display: none; }
.cca-sidebar__header { display: flex; align-items: center; gap: var(--space-2); min-height: 32px; padding: var(--space-3) var(--space-3) var(--space-2); }
.cca-sidebar__body { flex: 1; overflow: auto; padding: 0 var(--space-2); display: flex; flex-direction: column; gap: var(--space-3); }
.cca-sidebar__section { display: flex; flex-direction: column; gap: 1px; }
.cca-sidebar__footer { padding: var(--space-2); border-top: 1px solid var(--border-subtle); }
.cca-navitem { display: flex; align-items: center; gap: var(--space-2); width: 100%; height: 32px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-primary); font: inherit; font-size: 14px; text-align: left; cursor: pointer; transition: background-color var(--duration-base) var(--ease-standard); }
.cca-navitem .cca-icon { color: var(--text-secondary); }
.cca-navitem:hover { background: var(--surface-hover); }
.cca-navitem.is-active { background: var(--surface-selected); color: var(--text-primary); font-weight: 600; }
.cca-navitem.is-active .cca-icon { color: var(--text-accent); }
.cca-navitem.is-muted { color: var(--text-secondary); font-size: 13px; }
.cca-navitem.is-muted.is-active { color: var(--text-primary); }
.cca-navitem__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cca-navitem__trail { display: inline-flex; align-items: center; color: var(--text-tertiary); font-family: var(--font-mono); font-size: 11.5px; font-weight: 400; }

/* Tabs: the 2px accent underline is the one 2px line in the system. */
.cca-tabs { display: flex; gap: var(--space-5); border-bottom: 1px solid var(--border-subtle); }
.cca-tab { position: relative; display: inline-flex; align-items: center; gap: var(--space-1\.5); height: 38px; padding: 0; border: 0; background: transparent; color: var(--text-secondary); font: inherit; font-size: 14px; cursor: pointer; transition: color var(--duration-base) var(--ease-standard); }
.cca-tab:hover { color: var(--text-primary); }
.cca-tab.is-on { color: var(--text-primary); font-weight: 600; }
.cca-tab.is-on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.cca-tab__count { font-family: var(--font-mono); font-size: 11.5px; font-weight: 400; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

/* Menu and command palette */
.cca-menu { display: flex; flex-direction: column; min-width: 220px; padding: var(--space-1); box-sizing: border-box; border-radius: var(--radius-lg); background: var(--surface-raised); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-md); }
.cca-menu__item { display: flex; align-items: center; gap: var(--space-2); min-height: 32px; padding: var(--space-1\.5) var(--space-2); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-primary); font: inherit; font-size: 14px; text-align: left; cursor: pointer; transition: background-color var(--duration-base) var(--ease-standard); }
.cca-menu__item .cca-icon { color: var(--text-secondary); }
.cca-menu__item:hover, .cca-menu__item.is-active { background: var(--surface-hover); }
.cca-menu__item.is-danger, .cca-menu__item.is-danger .cca-icon { color: var(--status-danger); }
.cca-menu__label { flex: 1; display: flex; flex-direction: column; }
.cca-menu__label small { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--text-secondary); }
.cca-menu__tick { width: 16px; display: inline-flex; color: var(--text-accent); }
.cca-menu__kbd { font-family: var(--font-mono); font-size: 11.5px; font-weight: 400; color: var(--text-tertiary); }
.cca-menu__sep { height: 1px; margin: var(--space-1) var(--space-2); background: var(--border-subtle); }
.cca-menu__heading { padding-top: var(--space-1); }

.cca-palette { width: 560px; max-width: 100%; border-radius: var(--radius-xl); background: var(--surface-raised); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-lg); overflow: hidden; }
.cca-palette__input { display: flex; align-items: center; gap: var(--space-2); height: 48px; padding: 0 var(--space-4); border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); }
.cca-palette__input input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px; font-weight: 400; color: var(--text-primary); }
.cca-palette__input input::placeholder { color: var(--text-tertiary); }
.cca-palette__list { padding: var(--space-1) var(--space-2) var(--space-2); max-height: 320px; overflow: auto; }
.cca-palette__item { display: flex; align-items: center; gap: var(--space-2); height: 36px; padding: 0 var(--space-2); border-radius: var(--radius-md); font-size: 14px; color: var(--text-primary); }
.cca-palette__item .cca-icon { color: var(--text-secondary); }
.cca-palette__item span:first-of-type { flex: 1; }
.cca-palette__item.is-active { background: var(--surface-accent-subtle); }
.cca-palette__item.is-active .cca-icon { color: var(--text-accent); }

/* Chat */
.cca-composer { display: flex; flex-direction: column; gap: var(--space-2); width: 100%; max-width: var(--content-max); box-sizing: border-box; padding: var(--space-3) var(--space-2) var(--space-2) var(--space-4); border-radius: var(--radius-xl); background: var(--surface-raised); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-sm); transition: border-color var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard); }
.cca-composer:focus-within { border-color: var(--focus-ring); box-shadow: 0 0 0 3px var(--accent-ring); }
.cca-composer__input { border: 0; outline: 0; resize: none; background: transparent; font: inherit; font-size: 15px; line-height: 24px; font-weight: 400; color: var(--text-primary); min-height: 48px; padding: 0 var(--space-2) 0 0; }
.cca-composer__input::placeholder { color: var(--text-tertiary); }
.cca-composer__bar { display: flex; align-items: center; gap: var(--space-1\.5); margin-left: -2px; }
.cca-composer__spacer { flex: 1; }
.cca-composer__files { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.cca-modelpick { display: inline-flex; align-items: center; gap: var(--space-1); height: 28px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-md); background: transparent; color: var(--text-secondary); font: inherit; font-size: 13px; cursor: pointer; margin-right: var(--space-0\.5); transition: background-color var(--duration-base) var(--ease-standard); }
.cca-modelpick:hover { background: var(--surface-hover); color: var(--text-primary); }

.cca-msg { display: flex; flex-direction: column; max-width: var(--content-max); width: 100%; }
.cca-msg--user { align-items: flex-end; }
.cca-msg__bubble { max-width: 80%; padding: var(--space-2) var(--space-4); box-sizing: border-box; border-radius: var(--radius-xl); background: var(--surface-bubble); color: var(--text-primary); font-size: 15px; line-height: 24px; font-weight: 400; white-space: pre-wrap; }
.cca-msg--assistant { gap: var(--space-2); }
.cca-msg__actions { display: flex; gap: 2px; margin-left: -6px; }
.cca-prose { font-size: 15px; line-height: 24px; font-weight: 400; color: var(--text-primary); }
.cca-prose > :first-child { margin-top: 0; }
.cca-prose > :last-child { margin-bottom: 0; }
.cca-prose p, .cca-prose ul, .cca-prose ol { margin: 0 0 var(--space-3); }
.cca-prose ul, .cca-prose ol { padding-left: 20px; }
.cca-prose h3 { font-size: 15.5px; line-height: 22px; font-weight: 600; letter-spacing: -0.01em; margin: var(--space-4) 0 var(--space-1\.5); }
.cca-prose strong { font-weight: 600; }
.cca-prose a { color: var(--text-accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.cca-prose a:hover { text-decoration-thickness: 2px; }
.cca-prose code { font-family: var(--font-mono); font-size: 13px; padding: 1px 4px; border-radius: var(--radius-sm); background: var(--surface-code); border: 1px solid var(--border-subtle); }
.cca-prose li { margin-bottom: var(--space-1); }
.cca-prose li::marker { color: var(--text-tertiary); }

.cca-status { display: inline-flex; align-items: center; gap: var(--space-2); font-size: 13px; color: var(--text-secondary); }
.cca-status__dot { width: 7px; height: 7px; border-radius: var(--radius-pill); background: var(--accent); animation: cca-pulse 1.25s var(--ease-standard) infinite; }
[data-theme="dark"] .cca-status__dot { background: var(--text-accent); }
@keyframes cca-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

.cca-tool { border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); background: var(--surface-canvas); max-width: var(--content-max); overflow: hidden; }
.cca-tool__head { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: 36px; padding: var(--space-1\.5) var(--space-3); border: 0; background: transparent; border-radius: inherit; color: var(--text-primary); font: inherit; font-size: 13px; text-align: left; cursor: pointer; transition: background-color var(--duration-base) var(--ease-standard); }
.cca-tool__head:hover { background: var(--surface-hover); }
.cca-tool__head > .cca-icon:first-child { color: var(--text-secondary); }
.cca-tool__title { font-weight: 600; white-space: nowrap; }
.cca-tool__detail { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); font-family: var(--font-mono); font-size: 12px; font-weight: 400; }
.cca-tool__state { display: inline-flex; margin-left: auto; color: var(--status-success); }
.cca-tool--error .cca-tool__state { color: var(--status-danger); }
.cca-tool__chev { color: var(--text-tertiary); transition: transform var(--duration-base) var(--ease-standard); }
.cca-tool.is-open .cca-tool__chev { transform: rotate(180deg); }
.cca-tool__body { padding: var(--space-2) var(--space-3) var(--space-3); border-top: 1px solid var(--border-subtle); font-family: var(--font-mono); font-size: 12px; line-height: 18px; font-weight: 400; color: var(--text-secondary); white-space: pre-wrap; background: var(--surface-code); }

.cca-filecard { display: flex; align-items: center; gap: var(--space-3); width: 100%; max-width: 360px; padding: var(--space-3); box-sizing: border-box; border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); background: var(--surface-raised); color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color var(--duration-base) var(--ease-standard), transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard); }
.cca-filecard:hover { border-color: var(--border-strong); transform: translateY(-0.5px); box-shadow: var(--shadow-md); }
.cca-filecard__icon { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--radius-md); background: var(--accent-soft); color: var(--accent-soft-fg); }
.cca-filecard__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cca-filecard__name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cca-filecard__meta { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--text-secondary); }
.cca-filecard__open { color: var(--text-tertiary); }
.cca-filecard.is-compact { width: auto; max-width: 220px; padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1); gap: var(--space-2); border-radius: var(--radius-md); box-shadow: none; }
.cca-filecard.is-compact .cca-filecard__icon { width: 28px; height: 28px; border-radius: var(--radius-sm); }
.cca-filecard.is-compact .cca-filecard__name { font-size: 13px; }

.cca-code { border-radius: var(--radius-lg); background: var(--surface-code); border: 1px solid var(--border-subtle); overflow: hidden; max-width: var(--content-max); }
.cca-code__head { display: flex; align-items: center; justify-content: space-between; height: 32px; padding: 0 var(--space-1) 0 var(--space-3); font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--text-secondary); border-bottom: 1px solid var(--border-subtle); }
.cca-code__copy { display: inline-flex; align-items: center; gap: var(--space-1); height: 24px; padding: 0 var(--space-2); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); font-family: var(--font-sans); font-size: 12px; font-weight: 500; cursor: pointer; }
.cca-code__copy:hover { background: var(--surface-hover); color: var(--text-primary); }
.cca-code pre { margin: 0; padding: var(--space-3); overflow: auto; font-family: var(--font-mono); font-size: 13px; line-height: 20px; font-weight: 400; color: var(--text-primary); }

/* Feedback */
.cca-toast { display: flex; align-items: flex-start; gap: var(--space-3); width: 360px; max-width: 100%; box-sizing: border-box; padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--surface-raised); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-md); }
.cca-toast__icon { margin-top: 2px; }
.cca-toast__text { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.cca-toast__text strong { font-weight: 600; }
.cca-toast__text span { font-size: 13px; line-height: 18px; font-weight: 400; color: var(--text-secondary); }
.cca-toast > .cca-iconbtn { margin-top: -4px; }
.cca-toast__action { display: flex; gap: var(--space-2); margin-top: var(--space-2); }
.cca-tone--info .cca-toast__icon, .cca-banner.cca-tone--info > .cca-icon { color: var(--text-accent); }
.cca-tone--success .cca-toast__icon, .cca-banner.cca-tone--success > .cca-icon { color: var(--status-success); }
.cca-tone--warning .cca-toast__icon, .cca-banner.cca-tone--warning > .cca-icon { color: var(--status-warning); }
.cca-tone--danger .cca-toast__icon, .cca-banner.cca-tone--danger > .cca-icon { color: var(--status-danger); }

.cca-banner { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; box-sizing: border-box; padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4); border-radius: var(--radius-lg); border: 1px solid var(--border-subtle); background: var(--surface-raised); font-size: 14px; line-height: 20px; font-weight: 400; }
.cca-banner.cca-tone--info { background: var(--surface-accent-subtle); border-color: color-mix(in oklch, var(--accent) 18%, transparent); }
.cca-banner.cca-tone--success { border-color: color-mix(in oklch, var(--status-success) 45%, transparent); }
.cca-banner.cca-tone--warning { border-color: color-mix(in oklch, var(--status-warning) 55%, transparent); }
.cca-banner.cca-tone--danger { border-color: color-mix(in oklch, var(--status-danger) 55%, transparent); }
.cca-banner__text { flex: 1; }

.cca-dialog { max-width: 100%; box-sizing: border-box; border-radius: var(--radius-xl); background: var(--surface-raised); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-lg); }
.cca-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-4) var(--space-2) var(--space-5); }
.cca-dialog__head h2 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: -0.015em; }
.cca-dialog__body { padding: 0 var(--space-5); font-size: 14px; line-height: 21px; font-weight: 400; color: var(--text-secondary); }
.cca-dialog__body p { margin: 0 0 var(--space-3); }
.cca-dialog__body > :last-child { margin-bottom: 0; }
.cca-dialog__actions { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-5); }
.cca-scrim { position: relative; display: grid; place-items: center; padding: var(--space-6); background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

.cca-empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); text-align: center; padding: var(--space-8) var(--space-5); }
.cca-empty__mark { color: var(--text-primary); }
.cca-empty__title { margin: 0; font-size: 28px; line-height: 34px; font-weight: 650; letter-spacing: -0.025em; color: var(--text-primary); }

.cca-progress { display: flex; flex-direction: column; gap: var(--space-1\.5); width: 100%; }
.cca-progress__row { display: flex; justify-content: space-between; gap: var(--space-3); font-size: 13px; color: var(--text-secondary); }
.cca-progress__value { font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.cca-progress__track { height: 6px; border-radius: var(--radius-pill); background: var(--surface-hover); overflow: hidden; box-shadow: inset 0 0 0 1px var(--border-subtle); }
.cca-progress__track span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--duration-base) var(--ease-standard); }

/* Layout */
.cca-panel { display: flex; flex-direction: column; width: var(--panel-width); max-width: 100%; height: 100%; background: var(--surface-canvas); border-left: 1px solid var(--border-subtle); box-sizing: border-box; flex: none; }
.cca-panel__head { display: flex; align-items: center; gap: var(--space-3); height: 52px; flex: none; padding: 0 var(--space-2) 0 var(--space-5); border-bottom: 1px solid var(--border-subtle); }
.cca-panel__titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cca-panel__titles strong { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cca-panel__titles span { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--text-secondary); }
.cca-panel__actions { display: flex; align-items: center; gap: 2px; }
.cca-panel__tabs { padding: 0 var(--space-5); flex: none; }
.cca-panel__body { flex: 1; overflow: auto; padding: var(--space-5); }

.cca-setting { display: flex; align-items: center; gap: var(--space-5); padding: var(--space-4) 0; border-bottom: 1px solid var(--border-subtle); }
.cca-setting__text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.cca-setting__text strong { font-size: 14px; font-weight: 600; }
.cca-setting__text span { font-size: 13px; line-height: 18px; font-weight: 400; color: var(--text-secondary); }
.cca-setting__control { flex: none; }

/* Focus: never a browser outline. The edge turns accent with a 3px accent-ring halo outside it.
   Declared last so it wins over each variant's resting shadow. */
.cca-btn:focus-visible, .cca-iconbtn:focus-visible, .cca-navitem:focus-visible, .cca-menu__item:focus-visible, .cca-seg__opt:focus-visible, .cca-tab:focus-visible, .cca-modelpick:focus-visible, .cca-tool__head:focus-visible, .cca-code__copy:focus-visible,
.cca-check input:focus-visible + .cca-check__box, .cca-switch input:focus-visible + .cca-switch__track { outline: none; box-shadow: 0 0 0 1px var(--focus-ring), 0 0 0 4px var(--accent-ring); }
.cca-btn--secondary:focus-visible, .cca-iconbtn--secondary:focus-visible, .cca-filecard:focus-visible { outline: none; border-color: var(--focus-ring); box-shadow: 0 0 0 3px var(--accent-ring); }

/* Only the spinner and the status pulse loop, and both stop under reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .cca-spinner, .cca-status__dot { animation: none; }
  .cca-btn, .cca-iconbtn, .cca-filecard { transition: none; }
}

/* Preview helpers */
.cca-demo { padding: var(--space-5); display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.cca-demo--col { flex-direction: column; align-items: stretch; max-width: 420px; }
.cca-demo--chat { flex-direction: column; align-items: stretch; gap: var(--space-5); max-width: 680px; }
