/* ERIX components v8: the subset of the Design System's components/bundle.css that the public
   pages use, values copied as-is. Load after tokens.css (fonts come from its @font-face).
   When a page needs another component, copy its section from bundle.css; don't restyle here.
   Adapters for native controls (bundle.css styles Radix ones) are marked "native". */

.erix, body { font-family: var(--font-sans); color: var(--ink); background: var(--surface); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.erix-num { font-variant-numeric: tabular-nums; }
.erix-unit { font-size: .6em; font-weight: 600; color: var(--ink-subtle); margin-left: .12em; letter-spacing: 0; }
.erix-kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--radius-xs); background: var(--surface-raised); box-shadow: 0 0 0 1px var(--border), 0 1px 0 var(--border); font: 600 11px/1 var(--font-sans); color: var(--ink-subtle); }

/* ---------- Icons (ERIX Glyphs v2 sprite, /erix/icons.svg) ----------
   duo is the default; line in buttons, chips, inputs and badges; solid = #name-solid (status).
   Stroke follows size (opticalStroke in Icon.jsx); dark thins it 8% and lifts the tint to 22%. */
:root { --icon-tint: .16; --icon-grade: 1; }
[data-theme="dark"] { --icon-tint: .22; --icon-grade: .92; }
.erix-icon { flex: none; display: inline-block; vertical-align: middle; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round;
  --icon-sw: 1.9; --icon-duo: var(--icon-tint); stroke-width: calc(var(--icon-sw) * var(--icon-grade)); }
.erix-icon[width="12"] { --icon-sw: 2.25; }
.erix-icon[width="14"] { --icon-sw: 2.1; }
.erix-icon[width="18"] { --icon-sw: 1.8; }
.erix-icon[width="20"] { --icon-sw: 1.7; }
.erix-icon[width="24"] { --icon-sw: 1.6; }
.erix-icon[width="28"] { --icon-sw: 1.5; }
.erix-icon--line, .erix-btn .erix-icon, .erix-iconbtn .erix-icon, .erix-chip .erix-icon, .erix-badge .erix-icon, .erix-inputwrap > .erix-icon { --icon-duo: 0; }

/* ---------- Button ---------- */
.erix-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-md); padding: 0 12px; border: 0; border-radius: var(--radius-md);
  font: 600 13px/1 var(--font-sans); letter-spacing: -0.005em; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color .12s ease-out, box-shadow .12s ease-out, color .12s ease-out, transform .06s ease-out; }
.erix-btn:hover { text-decoration: none; }
.erix-btn > .erix-icon:first-child { margin-left: -2px; }
.erix-btn:active:not(:disabled) { transform: translateY(0.5px); }
.erix-btn:focus-visible, .erix-iconbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.erix-btn:disabled, .erix-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.erix-btn--sm { height: var(--control-sm); padding: 0 10px; font-size: 12.5px; gap: 5px; border-radius: var(--radius-sm); }
.erix-btn--lg { height: var(--control-lg); padding: 0 18px; font-size: 14px; }
.erix-btn--block { width: 100%; }
.erix-btn--primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-btn); }
.erix-btn--primary:hover:not(:disabled) { background: var(--primary-hover); }
.erix-btn--secondary { background: var(--surface-raised); color: var(--ink); box-shadow: 0 0 0 1px var(--border), var(--shadow-xs); }
.erix-btn--secondary:hover:not(:disabled) { background: var(--surface-subtle); box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-xs); }
.erix-btn--secondary > .erix-icon { color: var(--ink-muted); }
.erix-btn--ghost { background: transparent; color: var(--ink-muted); }
.erix-btn--ghost:hover:not(:disabled) { background: var(--surface-subtle); color: var(--ink); }
.erix-btn--inverse { background: var(--logo-plate); color: var(--blue-800); box-shadow: 0 1px 2px rgba(11, 27, 100, 0.3); }
.erix-btn--inverse:hover:not(:disabled) { background: var(--blue-50); }
.erix-btn--onhero { background: rgba(255, 255, 255, 0.10); color: var(--on-hero); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28); }
.erix-btn--onhero:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
.erix-btn--inverse:focus-visible, .erix-btn--onhero:focus-visible { outline-color: var(--on-hero); }

/* ---------- IconButton ---------- */
.erix-iconbtn { position: relative; display: inline-grid; place-items: center; width: var(--control-md); height: var(--control-md); padding: 0; border: 0;
  border-radius: var(--radius-md); background: transparent; color: var(--ink-muted); cursor: pointer; transition: background-color .12s ease-out, color .12s ease-out; }
.erix-iconbtn:hover:not(:disabled) { background: var(--surface-subtle); color: var(--ink); }
.erix-iconbtn--outline { background: var(--surface-raised); box-shadow: 0 0 0 1px var(--border), var(--shadow-xs); }

/* ---------- Field, Input, Select, Textarea ---------- */
.erix-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.erix-field__label { font: 600 13px/16px var(--font-sans); color: var(--ink); }
.erix-field__help { font: 500 12px/16px var(--font-sans); color: var(--ink-subtle); display: flex; gap: 5px; align-items: flex-start; }
.erix-input, .erix-select, .erix-textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface-raised); color: var(--ink); font: 400 14px/20px var(--font-sans); box-shadow: var(--shadow-xs);
  transition: border-color .12s ease-out, box-shadow .12s ease-out; }
.erix-input, .erix-select { height: var(--control-md); padding: 0 10px; font-size: 13.5px; }
.erix-textarea { padding: 9px 12px; min-height: 88px; resize: vertical; }
.erix-input::placeholder, .erix-textarea::placeholder { color: var(--ink-subtle); }
.erix-input:hover, .erix-select:hover, .erix-textarea:hover { border-color: var(--ink-subtle); }
.erix-input:focus, .erix-select:focus, .erix-textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--shadow-focus); }
.erix-input:disabled, .erix-select:disabled, .erix-textarea:disabled { background: var(--surface-subtle); color: var(--ink-muted); box-shadow: none; cursor: not-allowed; }
/* native <select>: chevron drawn in currentColor */
.erix-select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-subtle) 50%), linear-gradient(135deg, var(--ink-subtle) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.erix-inputwrap { position: relative; display: flex; align-items: center; }
.erix-inputwrap > .erix-icon { position: absolute; left: 10px; color: var(--ink-subtle); pointer-events: none; }
.erix-inputwrap > .erix-input { padding-left: 32px; }

/* native checkbox inside .erix-check (bundle.css: Radix .erix-checkbox) */
.erix-check { display: inline-flex; align-items: flex-start; gap: 10px; font: 500 14px/20px var(--font-sans); color: var(--ink); }
.erix-check input { appearance: none; flex: none; display: inline-grid; place-items: center; width: 16px; height: 16px; margin: 2px 0 0; border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs); background: var(--surface-raised); box-shadow: var(--shadow-xs); cursor: pointer; }
.erix-check input::after { content: ""; width: 8px; height: 4px; border: 2px solid var(--on-primary); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); opacity: 0; }
.erix-check input:checked { background: var(--primary); border-color: var(--primary); }
.erix-check input:checked::after { opacity: 1; }
.erix-check input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Tones (shared) ---------- */
.erix-tone--blue { --tone: var(--primary); --tone-subtle: var(--primary-subtle); --tone-solid: var(--solid-blue); }
.erix-tone--purple { --tone: var(--accent); --tone-subtle: var(--accent-subtle); --tone-solid: var(--solid-purple); }
.erix-tone--red { --tone: var(--danger); --tone-subtle: var(--danger-subtle); --tone-solid: var(--solid-red); }
.erix-tone--green { --tone: var(--success); --tone-subtle: var(--success-subtle); --tone-solid: var(--success); }
.erix-tone--orange { --tone: var(--orange); --tone-subtle: var(--orange-subtle); --tone-solid: var(--orange); }
.erix-tone--teal { --tone: var(--teal); --tone-subtle: var(--teal-subtle); --tone-solid: var(--teal); }
.erix-chip { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: var(--radius-md); background: var(--tone-subtle, var(--primary-subtle)); color: var(--tone, var(--primary)); }
.erix-chip--lg { width: 36px; height: 36px; border-radius: 10px; }

/* ---------- Badge ---------- */
.erix-badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--radius-sm);
  font: 600 12px/1 var(--font-sans); background: var(--surface-sunken); color: var(--ink-muted); white-space: nowrap; }
.erix-badge::before { content: ""; width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; flex: none; }
.erix-badge--plain::before, .erix-badge--icon::before { display: none; }
.erix-badge--plain { font-weight: 500; }
.erix-badge--info, .erix-badge--blue { background: var(--primary-subtle); color: var(--primary); }
.erix-badge--success, .erix-badge--green { background: var(--success-subtle); color: var(--success); }
.erix-badge--warning { background: var(--warning-subtle); color: var(--warning); }
.erix-badge--danger, .erix-badge--red { background: var(--danger-subtle); color: var(--danger); }
.erix-badge--ai, .erix-badge--purple { background: var(--accent-subtle); color: var(--accent); }

/* ---------- Alert (tone via erix-tone--*, or the status modifiers below) ---------- */
.erix-alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px 12px 12px; border-radius: var(--radius-lg);
  background: var(--tone-subtle, var(--surface-subtle)); color: var(--ink); font: 400 14px/20px var(--font-sans); }
.erix-alert > .erix-chip { background: var(--surface-raised); box-shadow: var(--shadow-xs); }
.erix-alert__body { flex: 1; min-width: 0; padding-top: 4px; }
.erix-alert__title { font-weight: 650; display: block; margin-bottom: 1px; }
.erix-alert--info { --tone: var(--primary); --tone-subtle: var(--primary-subtle); }
.erix-alert--success { --tone: var(--success); --tone-subtle: var(--success-subtle); }
.erix-alert--warning { --tone: var(--warning); --tone-subtle: var(--warning-subtle); }
.erix-alert--danger { --tone: var(--danger); --tone-subtle: var(--danger-subtle); }

/* ---------- Card ---------- */
.erix-card { background: var(--surface-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); color: var(--ink); min-width: 0; display: flex; flex-direction: column; }
.erix-card--interactive { cursor: pointer; transition: box-shadow .15s ease-out, transform .15s ease-out; }
.erix-card--interactive:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.erix-card__head { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px var(--card-pad); }
.erix-card__titles { flex: 1; min-width: 0; }
.erix-card__title { font: 600 15px/22px var(--font-sans); letter-spacing: -0.005em; margin: 0; color: var(--ink); }
.erix-card__meta { font: 500 12.5px/18px var(--font-sans); color: var(--ink-subtle); margin: 0; }
.erix-card__foot { display: flex; align-items: center; gap: 8px; padding: 12px var(--card-pad); border-top: 1px solid var(--border-soft); }

/* ---------- Table ---------- */
.erix-table-wrap { border-radius: var(--radius-lg); overflow: auto; background: var(--surface-raised); box-shadow: var(--shadow-card); }
.erix-card .erix-table-wrap { border-radius: 0 0 var(--radius-lg) var(--radius-lg); box-shadow: none; }
.erix-table { width: 100%; border-collapse: separate; border-spacing: 0; font: 400 13.5px/20px var(--font-sans); color: var(--ink); }
.erix-table th { position: sticky; top: 0; z-index: var(--z-sticky); height: 36px; padding: 0 16px; background: var(--surface-subtle); color: var(--ink-subtle);
  font: 600 12px/16px var(--font-sans); text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border-soft); }
.erix-table th:first-child, .erix-table td:first-child { padding-left: var(--card-pad); }
.erix-table th:last-child, .erix-table td:last-child { padding-right: var(--card-pad); }
.erix-table td { height: var(--row-h); padding: 0 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; white-space: nowrap; }
.erix-table tbody tr:last-child td { border-bottom: 0; }
.erix-table tbody tr { transition: background-color .1s ease-out; }
.erix-table tbody tr:hover td { background: var(--surface-subtle); }
.erix-table .erix-table__num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Tabs ---------- */
.erix-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border-soft); }
.erix-tab { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 1px;
  background: none; border: 0; color: var(--ink-muted); font: 600 13.5px/1 var(--font-sans); cursor: pointer; }
.erix-tab:hover { color: var(--ink); }
.erix-tab[aria-selected="true"] { color: var(--ink); }
.erix-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--primary); }
.erix-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-xs); }

/* ---------- Kanban ---------- */
.erix-kanban { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 4px; }
.erix-kcol { flex: 0 0 280px; display: flex; flex-direction: column; gap: 8px; padding: 6px 6px 8px; border-radius: var(--radius-lg); background: var(--surface-sunken); }
.erix-card .erix-kanban .erix-kcol { flex: 1 1 0; min-width: 220px; }
.erix-kcol__head { padding: 8px 8px 4px; }
.erix-kcol__row { display: flex; align-items: center; gap: 8px; }
.erix-kcol__dot { width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--tone, var(--ink-subtle)); flex: none; box-shadow: 0 0 0 3px var(--tone-subtle, transparent); }
.erix-kcol__title { font: 650 13.5px/18px var(--font-sans); color: var(--ink); }
.erix-kcol__count { font: 700 11.5px/1 var(--font-sans); color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.erix-kcol__total { margin-left: auto; font: 650 12.5px/16px var(--font-sans); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.erix-deal { display: flex; flex-direction: column; gap: 10px; padding: 12px 12px 10px 14px; border-radius: 9px; background: var(--surface-raised); box-shadow: var(--shadow-sm); }
.erix-deal__name { font: 650 14px/19px var(--font-sans); color: var(--ink); flex: 1; min-width: 0; }
.erix-deal__meta { font: 400 12.5px/16px var(--font-sans); color: var(--ink-subtle); margin-top: 1px; }
.erix-deal__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--border); }
.erix-deal__value { font: 700 13.5px/18px var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink); }

/* ---------- ChatThread ---------- */
.erix-chat { display: flex; flex-direction: column; gap: 6px; }
.erix-bubble { max-width: 70%; padding: 8px 12px 6px; border-radius: 14px; font: 400 14px/20px var(--font-sans); color: var(--ink); }
.erix-bubble--in { align-self: flex-start; background: var(--surface-raised); box-shadow: var(--shadow-card); border-bottom-left-radius: 4px; }
.erix-bubble--bot { align-self: flex-end; background: var(--accent-subtle); border-bottom-right-radius: 4px; }
.erix-bubble__meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 2px; font: 500 11px/14px var(--font-sans); color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.erix-bubble__by { font: 700 11.5px/14px var(--font-sans); color: var(--accent); display: flex; align-items: center; gap: 4px; margin-bottom: 3px; }

/* ---------- Banner ---------- */
.erix-banner { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 22px 28px; min-height: 112px; border-radius: var(--radius-xl); background: var(--solid-blue); color: var(--on-hero); box-shadow: var(--shadow-btn), 0 10px 24px -12px rgba(11, 27, 100, 0.5); }
.erix-banner::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(80% 140% at 100% 0%, rgba(255, 255, 255, 0.14), transparent 60%); }
.erix-banner > * { position: relative; }
.erix-banner > .erix-banner__motif { position: absolute; right: -10px; bottom: -6px; width: 230px; height: 110px; pointer-events: none; }
.erix-banner__swoosh { fill: none; stroke: var(--hero-swoosh); stroke-width: 16; stroke-linecap: round; }
.erix-banner__dot { fill: var(--hero-dot); }
.erix-banner__eyebrow { font: 600 12px/16px var(--font-sans); color: var(--on-hero-muted); margin: 0 0 4px; }
.erix-banner__title { font: 650 22px/28px var(--font-display); letter-spacing: -0.015em; margin: 0; color: var(--on-hero); }
.erix-banner__text { font: 400 14px/20px var(--font-sans); color: var(--on-hero-muted); margin: 4px 0 0; max-width: 520px; }
.erix-banner__actions { display: flex; gap: 8px; margin-right: 180px; }
@media (max-width: 860px) { .erix-banner__motif { display: none; } .erix-banner__actions { margin-right: 0; } }

/* ---------- EmptyState / ErrorState ---------- */
.erix-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: var(--space-4xl) var(--space-2xl); }
.erix-empty__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--surface-raised); color: var(--primary); box-shadow: var(--shadow-sm); margin-bottom: 8px; }
.erix-empty__title { font: 650 17px/24px var(--font-sans); letter-spacing: -0.01em; margin: 0; color: var(--ink); }
.erix-empty__text { font: 400 14px/20px var(--font-sans); color: var(--ink-muted); margin: 0; max-width: 340px; }
.erix-empty__actions { display: flex; gap: 8px; margin-top: 12px; }
.erix-empty__art { margin-bottom: 4px; }
.erix-empty--art { padding-top: var(--space-2xl); }
.erix-empty--error .erix-empty__icon { color: var(--danger); }

/* ---------- Skeleton ---------- */
.erix-skel { display: flex; flex-direction: column; }
.erix-skel__row { display: flex; align-items: center; gap: 16px; height: var(--row-h); padding: 0 var(--card-pad); border-bottom: 1px solid var(--border-soft); }
.erix-skel__row:last-child { border-bottom: 0; }
.erix-skel__bar { height: 10px; border-radius: var(--radius-full); background: linear-gradient(90deg, var(--surface-sunken) 30%, var(--surface-subtle) 50%, var(--surface-sunken) 70%); background-size: 300% 100%; }
@media (prefers-reduced-motion: no-preference) { .erix-skel__bar { animation: erix-shimmer 1.5s ease-in-out infinite; } }
@keyframes erix-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- Spot illustrations (inline SVG from Illustration.jsx) ---------- */
.erix-ill { display: block; flex: none; overflow: visible; }
.erix-ill .i-g { fill: var(--surface-sunken); opacity: .8; }
.erix-ill .i-b { fill: var(--primary-subtle); }
.erix-ill .i-B { fill: var(--primary); }
.erix-ill .i-P { fill: var(--accent); }
.erix-ill .i-R { fill: var(--danger); }
.erix-ill .i-O { fill: var(--orange); }
.erix-ill .i-w { fill: none; stroke: var(--on-primary); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.erix-ill .i-dash { fill: none; stroke: var(--border-strong); stroke-width: 1.5; stroke-dasharray: 5 5; }

/* Touch: every target reaches 44px on coarse pointers without changing desktop density. */
@media (pointer: coarse) {
  .erix-btn, .erix-input, .erix-select { min-height: 44px; }
  .erix-iconbtn { min-width: 44px; min-height: 44px; }
  .erix-check input { width: 20px; height: 20px; }
}
@media (prefers-reduced-motion: reduce) { .erix-btn, .erix-card--interactive { transition: none; } }
