/* Cidev SKU Bot — internal cross-reference console.
 *
 * Design premise: this is an instrument, not a website. Someone reads a verdict
 * here and then solders the result onto a board, so the interface is built like
 * lab equipment — layered surfaces, quiet chrome, one Cidev-blue accent as the
 * only *interactive* tint.
 *
 * The one rule everything else follows: VERDICT COLOUR IS RESERVED FOR MATCH
 * VERDICTS (green = drop-in, amber = check, orange = similar, red = blocked).
 * The chrome uses blue-tinted neutrals and the blue accent for focus/hover, so
 * a blocker can never be lost in decoration.
 *
 * Two themes (D142, 2026-10-21: Cidev blue, light by default; replaced the
 * pastel "mint and peach"): dark tokens live in :root, light ones in
 * :root[data-theme="light"]. /theme.js sets data-theme before first paint. Every colour lives in those two token blocks — rules below use
 * tokens only — and scripts/theme-contrast.test.js holds both blocks to their
 * contrast floors.
 *
 * Fonts are self-hosted in /fonts — CDV-APPS2 is on the LAN and must not depend
 * on a CDN. JetBrains Mono is used for part numbers and values because character
 * disambiguation (0 vs O, 1 vs l) is a correctness requirement when reading an
 * MPN, not a stylistic preference.
 */

/* ---------- self-hosted fonts (variable files, weight range 100–900) ---------- */

@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/heebo-hebrew.woff2') format('woff2');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}

@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/heebo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/fonts/jetbrains-mono-latin.woff2') format('woff2');
}

/* ---------- design tokens ---------- */

:root {
  color-scheme: dark;

  /* Deep navy neutrals carrying the Cidev logo's blue. */
  --bg:        #0c1626;
  --surface:   #13213a;
  --surface-2: #182943;
  --surface-3: #1e3250;
  --border:    #243a5a;
  --border-2:  #33507a;

  --text:    #e7eef8;
  --text-2:  #a8b9d0;
  --text-3:  #889ab4;

  /* Cidev azure: interactive states, the answer's edge and section labels. It
     must never compete with a verdict. --accent-fill is the same blue used as a
     background; text on it is --on-accent. --accent-2 is the warm secondary,
     for the lead form. */
  --accent:      #4fb9f0;
  --accent-fill: #4fb9f0;
  --on-accent:   #051321;
  --accent-2:    #ffa45c;
  --accent-dim:  rgba(79, 185, 240, 0.14);
  --accent-glow: rgba(79, 185, 240, 0.30);

  /* Verdict palette — reserved for match verdicts. */
  --verdict-ok:      #4ade80;
  --verdict-warn:    #facc15;
  --verdict-similar: #fb923c;
  --verdict-block:   #f87171;
  --inferred:        #c4b5fd;

  /* The chat's brand fill (header, launcher, send, submit). */
  --chat-grad: linear-gradient(135deg, #4fb9f0 0%, #3f9fe6 100%);
  --chat-glow: rgba(79, 185, 240, 0.30);
  /* Turns the one-colour Cidev mark into --on-accent ink on --chat-grad. */
  --mark-on-accent: brightness(0) opacity(0.82);

  --shadow:    0 1px 2px rgba(0, 0, 0, 0.4),  0 4px 16px rgba(2, 8, 20, 0.35);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.45), 0 12px 32px rgba(2, 8, 20, 0.45);

  --mono: 'JetBrains Mono', 'Cascadia Mono', Consolas, monospace;
  --ui:   'Heebo', 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;

  --r-sm: 6px;
  --r:    10px;
  --r-lg: 14px;

  --e: cubic-bezier(0.2, 0.7, 0.3, 1);
}

/* Light theme (the default, D142): the same token names, every colour
   redefined. Verdict colours become dark text tones (tags tint their own
   background from them with color-mix), and the blue deepens so white text
   sits on it. */
:root[data-theme="light"] {
  color-scheme: light;

  --bg:        #edf4fb;
  --surface:   #ffffff;
  --surface-2: #f3f8fd;
  --surface-3: #e5eff9;
  --border:    #d9e6f2;
  --border-2:  #bfd3e8;

  --text:    #0f2034;
  --text-2:  #41556d;
  --text-3:  #5a6e86;

  --accent:      #0a6cbd;
  --accent-fill: #0a6cbd;
  --on-accent:   #ffffff;
  --accent-2:    #c2410c;
  --accent-dim:  rgba(10, 108, 189, 0.09);
  --accent-glow: rgba(10, 108, 189, 0.22);

  --verdict-ok:      #15803d;
  --verdict-warn:    #a15c07;
  --verdict-similar: #c2410c;
  --verdict-block:   #c81e2e;
  --inferred:        #6d28d9;

  --chat-grad: linear-gradient(135deg, #0a6cbd 0%, #0a58a0 100%);
  --chat-glow: rgba(10, 108, 189, 0.24);
  --mark-on-accent: brightness(0) invert(1);

  --shadow:    0 1px 2px rgba(15, 50, 90, 0.05), 0 4px 16px rgba(15, 50, 90, 0.07);
  --shadow-lg: 0 2px 4px rgba(15, 50, 90, 0.06), 0 12px 32px rgba(15, 50, 90, 0.12);
}

* { box-sizing: border-box; }

/* Direction comes from <html dir>, which /i18n.js owns — NOT from CSS. A
   `direction: rtl` here would out-rank the attribute and pin the page to RTL in
   both languages, which is exactly what it used to do. Everything below is
   written with logical properties so one rule serves both directions; the two
   variables cover the handful of places CSS has no logical keyword for
   (transform-origin, translateX), and their RTL values are today's behaviour
   unchanged. */
:root {
  --fill-origin: left;         /* the meter bar grows from the inline start */
  --panel-origin: bottom right;/* the chat panel scales out of its anchored corner */
  --nudge-x: 3px;              /* hover nudge, toward the inline end */
}
:root[dir="rtl"] {
  --fill-origin: right;
  --panel-origin: bottom left;
  --nudge-x: -3px;
}

html { scrollbar-color: var(--border-2) var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Atmosphere: one soft accent glow behind the header + a fine graticule
   that fades out. Far enough back to read as texture, never as content. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 42% at 50% -8%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    linear-gradient(color-mix(in srgb, var(--accent) 3%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 3%, transparent) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
  mask-image: linear-gradient(to bottom, black 0%, black 40%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 40%, transparent 100%);
}

::selection { background: var(--accent-dim); }

.ic {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

.brand-logo { height: 26px; width: auto; display: block; }
/* The logo file is a blue mark with WHITE lettering, drawn for a dark bar. On the
   light bar the lettering would vanish: invert turns it dark, and the hue-rotate
   brings the inverted mark back to blue. */
:root[data-theme="light"] .brand-logo { filter: invert(1) hue-rotate(180deg); }

.brand-divider { width: 1px; height: 22px; background: var(--border-2); }

.brand-name {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
  direction: ltr;
  unicode-bidi: isolate;
}

.brand-name b { color: var(--accent); font-weight: 600; }

.brand-sub { font-size: 13px; color: var(--text-3); white-space: nowrap; }

/* Wave 24: link to an internal page in the top bar (chat.js adds it on the internal server only). */
.topbar-link { color: var(--accent); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.topbar-link:hover { text-decoration: underline; }

.topbar-side {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

/* Web-search status pill: chrome, not verdict — stays neutral/accent. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-2);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}

/* Language toggle: the same pill chrome, but interactive. It sits in .topbar-side
   ahead of the status pill and is the only control that changes the whole page's
   direction, so it is small, quiet and always in the same place. i18n.js writes
   its label ("EN" / "עב"). */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.lang-toggle:hover { color: var(--text); border-color: var(--accent); background: var(--surface-2); }
.lang-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Theme toggle: same chrome as the language toggle. It carries both glyphs and
   CSS picks one from data-theme, so the icon is right on first paint, before
   theme.js has wired the button: the sun in dark mode (switch to light), the
   moon in light mode. */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 28px;
  padding: 0;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); background: var(--surface-2); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle .ic { width: 15px; height: 15px; }
.theme-toggle .ic-moon,
:root[data-theme="light"] .theme-toggle .ic-sun { display: none; }
:root[data-theme="light"] .theme-toggle .ic-moon { display: block; }

.pill .ic { width: 13px; height: 13px; }
.pill.is-on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--border-2)); }
.pill.is-off { color: var(--text-3); }

/* Mixed Hebrew + numbers: leave the bidi algorithm alone — forcing LTR here
   visually reorders the Hebrew words around the counts. */
.stats {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}

/* ---------- shell ---------- */

.shell {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 88px;
}

/* ---------- hero / search ----------
 *
 * Empty state: the search field is the page. After the first query the hero
 * compacts to a toolbar and the results take over.
 */

.hero { padding: 32px 0 8px; transition: padding 0.25s var(--e); }

body.is-empty .hero { padding: 96px 0 40px; }

.hero-head { text-align: center; margin-bottom: 28px; display: none; }
body.is-empty .hero-head { display: block; }

.hero-mark {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--accent);
  margin-bottom: 14px;
  filter: drop-shadow(0 0 18px var(--accent-glow));
}

.hero h1 { margin: 0 0 10px; font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }

.hero-sub {
  margin: 0 auto;
  max-width: 560px;
  font-size: 15px;
  color: var(--text-2);
}

.search { display: flex; gap: 10px; max-width: 820px; margin: 0 auto; }

.search-box { position: relative; flex: 1; min-width: 0; }

.search-ic {
  position: absolute;
  inset-inline-start: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-3);
  pointer-events: none;
  transition: color 0.15s;
}

.search-box:focus-within .search-ic { color: var(--accent); }

.search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  padding-block: 15px;
  padding-inline-start: 46px; /* clears .search-ic, which sits at inset-inline-start */
  padding-inline-end: 16px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow);
  /* The box takes both an LTR part number and an RTL Hebrew question. `plaintext`
     lets each line pick its own direction from its first strong character, so
     "נגד 10k 0603" reads correctly and "RC0603FR-0710KL" still reads left to
     right. Forcing `direction: ltr` here visually reorders Hebrew queries. */
  unicode-bidi: plaintext;
  text-align: start;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.search input::placeholder { color: var(--text-3); letter-spacing: 0.01em; }

.search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--accent-dim), var(--shadow);
}

.search button {
  position: relative;
  background: linear-gradient(180deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 600;
  padding: 0 30px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.search button:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-3); }
.search button:active:not(:disabled) { transform: translateY(1px); }
.search button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.search button:disabled { cursor: default; color: transparent; }

.spinner {
  display: none;
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.search button:disabled .spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 22px;
  font-size: 13px;
  color: var(--text-2);
  margin: 18px auto 0;
  max-width: 820px;
}

body:not(.is-empty) .controls { justify-content: flex-start; }

.ctl { display: flex; align-items: center; gap: 7px; cursor: pointer; }

.ctl input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.ctl select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}

.ctl select:focus-visible, .ctl input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Example chips — empty state only. */
.examples {
  display: none;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}

body.is-empty .examples { display: flex; }

.examples-label { font-size: 13px; color: var(--text-3); }

.chip-ex {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
}

.chip-ex:hover { border-color: var(--accent); color: var(--text); background: var(--surface-2); transform: translateY(-1px); }
.chip-ex:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-ex bdi { direction: ltr; unicode-bidi: isolate; }

/* ---------- panels ---------- */

#out { margin-top: 22px; }

.panel {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.32s var(--e) backwards;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-3) 40%, transparent);
}

.panel-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

.panel-body { padding: 18px; }

/* Part numbers must never be reordered by the RTL context around them. */
.mpn {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

.target-mpn { font-size: 21px; font-weight: 600; letter-spacing: 0.03em; }
.target-mfr { color: var(--text-2); font-size: 13px; margin-inline-start: 12px; }

/* ---------- spec chips ---------- */

.specs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }

.spec {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 5px 11px;
  font-size: 12.5px;
}

.spec-name {
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.spec-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  direction: ltr;
  unicode-bidi: isolate;
}

/* An inferred value is marked wherever it is shown. It came from a table derived
   from the catalog, not a datasheet, and the reader has to be able to see that. */
.spec.is-inferred { border-color: color-mix(in srgb, var(--inferred) 40%, var(--border)); }
.spec.is-inferred .spec-value { color: var(--inferred); }
.spec.is-inferred::after { content: "◇"; color: var(--inferred); font-size: 10px; }

/* ---------- results ---------- */

.result-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 10px;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  animation: rise 0.3s var(--e) backwards;
  /* The verdict bar rides the inline-start edge — the right edge in RTL. */
  border-inline-start: 3px solid transparent;
  transition: background 0.15s;
}

.row:last-child { border-bottom: none; }
.row:hover { background: color-mix(in srgb, var(--surface-3) 45%, transparent); }

.row.tier-drop_in { border-inline-start-color: var(--verdict-ok); }
.row.tier-check   { border-inline-start-color: var(--verdict-warn); }
.row.tier-similar { border-inline-start-color: var(--verdict-similar); }
.row.tier-reject  { border-inline-start-color: var(--verdict-block); }

.row-main { min-width: 0; }
.row-mpn { font-size: 15.5px; font-weight: 500; letter-spacing: 0.03em; }
.row-mfr { color: var(--text-2); font-size: 12.5px; margin-inline-start: 10px; }

.verdict { text-align: center; min-width: 104px; }

.verdict-score {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  direction: ltr;
  unicode-bidi: isolate;
}

.verdict-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 3px;
}

.verdict-label .ic { width: 13px; height: 13px; }

.tier-drop_in .verdict-score, .tier-drop_in .verdict-label { color: var(--verdict-ok); }
.tier-check   .verdict-score, .tier-check   .verdict-label { color: var(--verdict-warn); }
.tier-similar .verdict-score, .tier-similar .verdict-label { color: var(--verdict-similar); }
.tier-reject  .verdict-score, .tier-reject  .verdict-label { color: var(--verdict-block); }

/* Signal-strength meter under the score. */
.meter {
  height: 3px;
  background: var(--border-2);
  border-radius: 2px;
  margin-top: 7px;
  overflow: hidden;
}

/* transform-origin has no logical keyword, so it is set on the element from a
   direction-aware variable instead of inside the keyframe. */
.meter span { display: block; height: 100%; border-radius: 2px; transform-origin: var(--fill-origin); animation: fill 0.5s var(--e) backwards; }
@keyframes fill { from { transform: scaleX(0); } }

.tier-drop_in .meter span { background: var(--verdict-ok); }
.tier-check   .meter span { background: var(--verdict-warn); }
.tier-similar .meter span { background: var(--verdict-similar); }
.tier-reject  .meter span { background: var(--verdict-block); }

/* ---------- notes: never collapsed, never truncated ---------- */

.notes { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }

.note {
  font-size: 13px;
  line-height: 1.5;
  padding-inline-start: 20px;
  position: relative;
  color: var(--text-2);
}

.note::before {
  position: absolute;
  inset-inline-start: 0;
  top: 1px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}

.note.safe::before     { content: "↑"; color: var(--verdict-ok); }
.note.warn::before     { content: "!"; color: var(--verdict-warn); }
.note.inferred::before { content: "◇"; color: var(--inferred); }
.note.unknown::before  { content: "?"; color: var(--verdict-similar); }

.note b { color: var(--text); font-weight: 600; }
.note .mpn { color: var(--text); font-size: 12.5px; }

/* A blocker is structurally different from a warning, not just differently
   coloured — it gets its own filled band so it cannot be skimmed past. */
.note.block {
  background: color-mix(in srgb, var(--verdict-block) 13%, transparent);
  border-inline-start: 3px solid var(--verdict-block);
  color: color-mix(in srgb, var(--verdict-block) 35%, var(--text));
  padding: 8px 12px;
  padding-inline-start: 30px;
  border-radius: var(--r-sm);
  font-weight: 500;
}

.note.block::before { content: "✕"; color: var(--verdict-block); inset-inline-start: 11px; top: 8px; }
.note.block b { color: var(--text); }

/* ---------- rejected candidates: compact, dimmed, separate group ---------- */

.reject-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px 9px;
  border-top: 1px solid var(--border-2);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.reject-row {
  display: grid;
  grid-template-columns: minmax(0, 210px) minmax(0, 1fr) minmax(0, 1.3fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 7px 18px;
  font-size: 12.5px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s, color 0.15s;
}

.reject-row:last-child { border-bottom: none; }
.reject-row:hover { color: var(--text-2); background: color-mix(in srgb, var(--surface-3) 40%, transparent); }
.reject-row .mpn { font-size: 12.5px; }

.reject-mfr, .reject-why { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reject-why::before { content: "✕ "; color: color-mix(in srgb, var(--verdict-block) 65%, transparent); font-family: var(--mono); }
.reject-score { font-family: var(--mono); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

/* ---------- web results ----------
 *
 * Structurally distinct from catalog results: hatched header, its own warning
 * band, no score and no verdict colour. These are unverified leads, and giving
 * them the same table and the same green would claim a confidence that does not
 * exist.
 */

.web-panel { border-color: color-mix(in srgb, var(--inferred) 30%, var(--border-2)); }

.web-panel .panel-head {
  background: repeating-linear-gradient(
    135deg,
    color-mix(in srgb, var(--inferred) 8%, transparent) 0 6px,
    transparent 6px 12px
  );
}

.web-cached {
  margin-inline-start: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-3);
}

.web-warning {
  padding: 11px 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  background: color-mix(in srgb, var(--inferred) 8%, transparent);
  border-bottom: 1px solid var(--border);
}

.web-warning b { color: var(--text); font-weight: 600; }

.web-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.web-row:last-of-type { border-bottom: none; }
.web-row:hover { background: color-mix(in srgb, var(--surface-3) 40%, transparent); }

.web-desc { font-size: 12.5px; color: var(--text-2); margin-top: 5px; }

/* ---------- parametric connector matches ----------
 *
 * Structurally distinct from BOTH catalog results (.row/.verdict) AND chart-level
 * cross-references (.web-panel): a parametric match is only "decoded pitch/
 * position count happen to line up with a Cidev part" — no manufacturer has
 * ever claimed these two parts are interchangeable (see
 * renderParametricMatchSection in app.js). Own accent (--verdict-similar, the
 * same colour used for "similar, not exact" catalog tiers) and a different
 * hatch angle from .web-panel's, so this is never skimmed as the same kind of
 * result as either of those.
 */
.param-panel { border-color: color-mix(in srgb, var(--verdict-similar) 30%, var(--border-2)); }

.param-panel .panel-head {
  background: repeating-linear-gradient(
    45deg,
    color-mix(in srgb, var(--verdict-similar) 10%, transparent) 0 5px,
    transparent 5px 10px
  );
}

.param-panel .panel-label { color: var(--verdict-similar); }

.param-warning {
  padding: 11px 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  background: color-mix(in srgb, var(--verdict-similar) 8%, transparent);
  border-bottom: 1px solid var(--border);
}

.param-warning b { color: var(--text); font-weight: 600; }
.param-desc { padding: 15px 18px; font-size: 12.5px; color: var(--text-2); }

.web-source {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: var(--r-sm);
  padding: 5px 12px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.web-source:hover { background: var(--accent-dim); border-color: var(--accent); }
.web-source:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- messages / empty / error ---------- */

.message {
  padding: 24px 18px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.7;
}

.message strong { color: var(--text); font-weight: 600; }
.message .mpn { color: var(--text); }

.retry {
  display: inline-block;
  margin-top: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.retry:hover { border-color: var(--accent); }
.retry:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* A caveat above the results, not a result. Kept monochrome and set apart by
   structure rather than colour — colour in this UI means a match verdict, and
   this band is precisely the statement that no verdict was reached. It must
   stay prominent: it is what keeps a parametric list from being read as one. */
.unparsed-origin {
  display: block;
  padding: 13px 18px;
  padding-inline-start: 16px;
  border-bottom: 1px solid var(--border-2);
  border-inline-start: 3px solid var(--text-2);
  background: color-mix(in srgb, var(--surface-3) 55%, transparent);
  font-size: 13.5px;
  color: var(--text-2);
}

.unparsed-origin b { color: var(--text); }
.unparsed-origin .mpn { color: var(--text); }

/* ---------- refusal (scope gate) ---------- */

.refused-panel { border-color: color-mix(in srgb, var(--verdict-block) 35%, var(--border-2)); }
.refused-panel .panel-label { color: var(--verdict-block); }

/* ---------- free-text query results ---------- */

.matched-band {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.matched-band .specs { margin: 0; display: contents; }
.matched-label { color: var(--text-3); font-size: 12px; }

.param-row { cursor: pointer; border-inline-start-color: var(--border-2); }
.param-row:hover { border-inline-start-color: var(--accent); }
.param-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.param-row .specs { margin-top: 9px; }

.param-go {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  transition: color 0.15s;
}

.param-row:hover .param-go { color: var(--accent); }

/* ---------- skeleton loading ---------- */

.skel-row { padding: 15px 18px; border-bottom: 1px solid var(--border); }
.skel-row:last-child { border-bottom: none; }

.skel {
  position: relative;
  overflow: hidden;
  background: var(--surface-3);
  border-radius: var(--r-sm);
  height: 14px;
}

.skel::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text-3) 14%, transparent), transparent);
  animation: shimmer 1.3s infinite;
}

@keyframes shimmer { to { transform: translateX(100%); } }

.skel.w-40 { width: 40%; }
.skel.w-60 { width: 60%; margin-top: 9px; height: 10px; }
.skel.w-25 { width: 25%; margin-top: 9px; height: 10px; }

/* ---------- export ---------- */

.export {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 13px;
  cursor: pointer;
  margin-inline-start: auto;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.export .ic { width: 13px; height: 13px; }
.export:hover { color: var(--text); border-color: var(--accent); background: var(--accent-dim); }
.export:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- legend ---------- */

.legend {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px 20px;
}

.legend-item { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; }
.legend-item .ic { margin-top: 2px; }
.legend-item b { display: block; color: var(--text-2); font-weight: 600; }
.legend-item span { color: var(--text-3); line-height: 1.5; }

/* Legend icons are keys to the verdict colours — the one legitimate use of the
   verdict palette outside a result. */
.v-ok       { color: var(--verdict-ok); }
.v-warn     { color: var(--verdict-warn); }
.v-similar  { color: var(--verdict-similar); }
.v-block    { color: var(--verdict-block); }
.v-inferred { color: var(--inferred); }

.legend-note { margin: 18px 0 0; font-size: 12.5px; color: var(--text-3); }
.legend-note b { color: var(--text-2); }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .topbar-inner { padding: 10px 16px; }
  .brand-sub, .brand-divider { display: none; }
  .stats { display: none; }
  .shell { padding: 0 16px 64px; }
  body.is-empty .hero { padding: 48px 0 24px; }
  .hero h1 { font-size: 23px; }
  .search { flex-direction: column; }
  .search button { padding: 13px 0; }
  .row { grid-template-columns: 1fr; gap: 10px; }
  .verdict { text-align: start; min-width: 0; display: flex; align-items: center; gap: 12px; }
  .verdict-score { font-size: 18px; }
  .meter { flex: 1; margin-top: 0; }
  .reject-row { grid-template-columns: minmax(0, 1fr) auto; }
  .reject-mfr { display: none; }
  .web-row { grid-template-columns: 1fr; }
  .panel-head { flex-wrap: wrap; }
}

/* ===================================================================
   Conversational widget — deliberately the loudest thing on the page.
   Brief: draw the eye and pull visitors into a query. So unlike the
   console (which keeps verdict colour for verdicts only), the widget
   owns the mint-to-peach brand gradient, a pulsing halo and a soft glow.
   It is the ONE decorative exception, and it lives in its own stacking
   context. --chat-grad / --chat-glow are root tokens (both themes), so
   the feedback panel, which sits outside .chat-widget, can use them too.
   =================================================================== */

.chat-widget {
  position: fixed;
  inset-block-end: 22px;
  inset-inline-start: 22px;   /* RTL page → visually bottom-left, clear of content */
  z-index: 60;
  font-family: var(--ui);
}

/* ---------- launcher ---------- */

.chat-launcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-block: 0;
  padding-inline: 20px 16px; /* was `0 20px 0 16px` — the 20px side is the icon's */
  height: 60px;
  border: 0;
  border-radius: 999px;
  background: var(--chat-grad);
  color: var(--on-accent);
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 8px 26px var(--chat-glow), var(--shadow);
  transition: transform .25s var(--e), box-shadow .25s var(--e);
  animation: chat-float 4.5s var(--e) infinite;
}
.chat-launcher:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 14px 38px var(--chat-glow), var(--shadow-lg); }
.chat-launcher:active { transform: translateY(-1px) scale(0.99); }
.chat-launcher:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }

/* The emblem sits on --chat-grad, so it takes the --on-accent ink: white on the
   deep light-theme blue, dark on the bright dark-theme blue. */
.chat-launcher-ic { width: 28px; height: 28px; object-fit: contain; filter: var(--mark-on-accent); }
.chat-launcher-label { white-space: nowrap; letter-spacing: .2px; }

.chat-launcher-badge {
  position: absolute;
  inset-block-start: -7px;
  inset-inline-end: -7px;
  background: var(--verdict-warn);
  color: var(--surface); /* verdict tones are light in dark mode and dark in light mode */
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .5px;
  padding: 2px 7px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

/* Expanding halo — the eye-catch. Sits behind the pill, pings outward. */
.chat-launcher-pulse {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--chat-grad);
  z-index: -1;
  animation: chat-ping 2.6s var(--e) infinite;
}

@keyframes chat-ping {
  0%   { transform: scale(1); opacity: .55; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { opacity: 0; }
}
@keyframes chat-float {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -4px; }
}
@keyframes chat-spin { to { transform: rotate(360deg); } }

/* Collapse to a round icon button on narrow screens. */
@media (max-width: 560px) {
  .chat-launcher-label { display: none; }
  .chat-launcher { padding: 0; width: 60px; justify-content: center; }
}

/* ---------- attention nudge ---------- */

.chat-nudge {
  position: absolute;
  inset-block-end: 74px;
  inset-inline-start: 0;
  max-width: 230px;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  animation: chat-nudge-in .4s var(--e) both;
}
.chat-nudge::after {
  content: "";
  position: absolute;
  inset-block-end: -7px;
  inset-inline-start: 26px;
  width: 14px; height: 14px;
  background: var(--surface-3);
  border-inline-end: 1px solid var(--border-2);
  border-block-end: 1px solid var(--border-2);
  transform: rotate(45deg);
}
@keyframes chat-nudge-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- panel ---------- */

.chat-panel {
  position: absolute;
  inset-block-end: 74px;
  inset-inline-start: 0;
  width: min(400px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent);
  transform-origin: var(--panel-origin);
  opacity: 0;
  transform: translateY(14px) scale(.96);
  transition: opacity .2s var(--e), transform .2s var(--e);
}
.chat-panel.is-open { opacity: 1; transform: translateY(0) scale(1); }

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 15px;
  background: var(--chat-grad);
  color: var(--on-accent);
}
.chat-head-id { display: flex; align-items: center; gap: 11px; }
/* The Cidev mark in its own colours, on a white tile, in both themes. */
.chat-head-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.chat-head-mark img { width: 26px; height: 26px; object-fit: contain; }
.chat-head-id b { display: block; font-size: 15px; }
.chat-head-sub { display: flex; align-items: center; gap: 6px; font-size: 12px; opacity: .88; }
.chat-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--verdict-ok); box-shadow: 0 0 8px var(--verdict-ok); }

.chat-head-actions { display: flex; gap: 4px; }
.chat-icon-btn {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2);
  font-size: 15px; cursor: pointer;
  transition: background .15s, color .15s;
}
.chat-icon-btn:hover { background: var(--surface-3); color: var(--text); }
.chat-head .chat-icon-btn { color: var(--on-accent); }
.chat-head .chat-icon-btn:hover { background: color-mix(in srgb, var(--on-accent) 16%, transparent); color: var(--on-accent); }
.chat-icon-btn .ic { width: 16px; height: 16px; }

/* ---------- log ---------- */

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
}

.chat-greeting { margin: auto 0; text-align: center; padding: 8px 6px 4px; }
.chat-greeting-mark {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px var(--chat-glow);
}
.chat-greeting-mark img { width: 36px; height: 36px; object-fit: contain; }
.chat-greeting h3 { margin: 0 0 6px; font-size: 18px; }
.chat-greeting p { margin: 0 0 16px; font-size: 14px; color: var(--text-2); line-height: 1.6; }

.chat-quicks { display: flex; flex-direction: column; gap: 8px; }
.chat-quick {
  text-align: start;
  padding: 11px 14px;
  border: 1px solid var(--border-2);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s;
}
.chat-quick:hover {
  border-color: var(--accent);
  background: var(--surface-3);
  transform: translateX(var(--nudge-x)); /* mirrors with the direction */
}

.chat-msg { position: relative; display: flex; flex-direction: column; max-width: 90%; animation: chat-msg-in .25s var(--e) both; }

/* Avatars (D142): the visitor on their own side, the Cidev mark on the
   advisor's, each at the top of its turn on the outer edge. */
.chat-log { --av: 30px; }
.chat-msg.user { padding-inline-start: calc(var(--av) + 10px); }
.chat-msg.assistant { padding-inline-end: calc(var(--av) + 10px); }
.chat-msg.user::before, .chat-msg.assistant::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  width: var(--av); height: var(--av);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(10, 60, 110, 0.18);
}
.chat-msg.user::before { inset-inline-start: 0; background: url('/avatar-user.jpg') center / cover; }
.chat-msg.assistant::before {
  inset-inline-end: 0;
  background: #fff url('/cidev-mark.png') center / 64% no-repeat;
  border: 1px solid var(--border);
}
.chat-msg.user { align-self: flex-start; align-items: flex-start; }
.chat-msg.assistant { align-self: flex-end; align-items: flex-end; }
/* English (LTR): the visitor's own turn sits on the RIGHT, as in every chat
   app. The logical start/end above already does that in Hebrew; in LTR it
   mirrored the visitor to the left, so LTR swaps the sides and the bubble tails. */
.chat-widget[dir="ltr"] .chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-widget[dir="ltr"] .chat-msg.assistant { align-self: flex-start; align-items: flex-start; }
.chat-widget[dir="ltr"] .chat-msg.user .chat-bubble { border-start-start-radius: 16px; border-start-end-radius: 4px; }
.chat-widget[dir="ltr"] .chat-msg.user { padding-inline-start: 0; padding-inline-end: calc(var(--av) + 10px); }
.chat-widget[dir="ltr"] .chat-msg.user::before { inset-inline-start: auto; inset-inline-end: 0; }
.chat-widget[dir="ltr"] .chat-msg.assistant { padding-inline-end: 0; padding-inline-start: calc(var(--av) + 10px); }
.chat-widget[dir="ltr"] .chat-msg.assistant::before { inset-inline-end: auto; inset-inline-start: 0; }
@keyframes chat-msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.chat-bubble {
  padding: 11px 14px;
  border-radius: 15px;
  font-size: 14.5px;
  line-height: 1.6;
  word-break: break-word;
}
.chat-msg.user .chat-bubble {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  border-start-start-radius: 4px;
  font-weight: 500;
}
/* The answer is a framed panel with a blue edge on the reading side; its
   headings read as section labels (.chat-h). */
.chat-msg.assistant .chat-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent);
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
}
/* Blinking caret while the answer types itself out. */
.chat-bubble.is-typing::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-inline-start: 2px;
  vertical-align: text-bottom;
  background: var(--accent);
  animation: chat-caret 1s steps(1) infinite;
}
@keyframes chat-caret { 50% { opacity: 0; } }
.chat-msg.refused .chat-bubble { border-color: var(--verdict-warn); }
.chat-msg.error .chat-bubble { border-color: var(--verdict-block); }

.chat-bubble strong { font-weight: 700; color: var(--text); }
.chat-bubble .chat-h {
  display: block;
  margin: 14px 0 6px;
  padding-block-end: 4px;
  border-block-end: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}
.chat-bubble .chat-h:first-child { margin-block-start: 2px; }
.chat-bubble .chat-li { display: block; padding-inline-start: 14px; position: relative; }
.chat-bubble .chat-li::before { content: "•"; position: absolute; inset-inline-start: 2px; color: var(--accent); }
.chat-bubble .chat-li.sub { padding-inline-start: 30px; }
.chat-bubble .chat-li.sub::before { content: "◦"; inset-inline-start: 17px; }
.chat-inline-link { color: var(--accent); text-decoration: none; border-block-end: 1px solid var(--accent-dim); }
.chat-inline-link:hover { border-block-end-color: var(--accent); }
.chat-bubble .chat-hr { border: 0; border-block-start: 1px solid var(--border-2); margin: 10px 0; }
/* A label already draws its own rule; a "---" right before one would double it. */
.chat-bubble .chat-hr:has(+ .chat-h) { display: none; }
.chat-bubble .chat-code {
  font-family: var(--mono); font-size: .9em;
  background: var(--surface-3); border: 1px solid var(--border); border-radius: 5px;
  padding: 0 5px; direction: ltr; unicode-bidi: isolate;
}

/* source chips */
.chat-sources { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 7px; }
.chat-source {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 12px;
  text-decoration: none;
}
.chat-source .ic { width: 12px; height: 12px; }
a.chat-source:hover { border-color: var(--accent); color: var(--text); }
.chat-source.catalog { color: var(--accent); font-family: var(--mono); }

/* ---------- component cards: bridge from an answer to the technical console ---------- */

.chat-cards { display: flex; flex-direction: column; gap: 8px; margin-block-start: 8px; width: 100%; }

.chat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: start;
}

.chat-card-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.chat-card-head .ic { color: var(--accent); }
.chat-card-mpn { font-family: var(--mono); font-size: 13.5px; font-weight: 600; color: var(--text); }
.chat-card-mfr { font-size: 12px; color: var(--text-2); }

.chat-card-specs { display: flex; flex-wrap: wrap; gap: 5px; margin-block-start: 7px; }

.chat-card-spec {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11.5px;
  color: var(--text-2);
  direction: ltr;
  unicode-bidi: isolate;
}
.chat-card-spec b {
  font-weight: 600;
  color: var(--text-3);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.chat-card-spec.is-inferred { border-color: color-mix(in srgb, var(--inferred) 40%, var(--border)); color: var(--inferred); }

.chat-card-open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-block-start: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: 999px;
  padding: 5px 12px;
  transition: background .15s, border-color .15s, color .15s;
}
.chat-card-open:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--text); }
.chat-card-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chat-card-open .ic { width: 13px; height: 13px; }

/* ---------- lead form: turn interest into a sales lead ---------- */

.chat-lead {
  width: 100%;
  margin-block-start: 8px;
  border-radius: 14px;
  padding: 12px 14px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--chat-glow) 22%, var(--surface-2)), var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--accent-2) 35%, var(--border-2));
}

.chat-lead-form { display: flex; flex-direction: column; gap: 8px; }

.chat-lead-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-block-end: 2px;
}
.chat-lead-head .ic { color: var(--accent-2); }

.chat-lead-field { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--text-2); }
.chat-lead-field input {
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border-2);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
}
.chat-lead-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.chat-lead-err { font-size: 12px; color: var(--verdict-block); }

.chat-lead-submit {
  align-self: stretch;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: var(--chat-grad);
  color: var(--on-accent);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  margin-block-start: 2px;
  box-shadow: 0 4px 14px var(--chat-glow);
  transition: filter .15s, transform .12s;
}
.chat-lead-submit:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.chat-lead-submit:disabled { opacity: .65; cursor: default; }
.chat-lead-submit:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.chat-lead-form.is-busy { opacity: .75; }

.chat-lead-done {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--verdict-ok);
  padding: 4px 2px;
}

/* typing dots */
.chat-typing { display: inline-flex; gap: 4px; padding: 2px 0; }
.chat-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); animation: chat-blink 1.2s infinite; }
.chat-typing i:nth-child(2) { animation-delay: .2s; }
.chat-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes chat-blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ---------- composer ---------- */

.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 14px 6px;
  border-block-start: 1px solid var(--border);
}
.chat-form input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding-inline: 18px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
}
.chat-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.chat-form.is-busy input { opacity: .6; }

.chat-send {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: var(--chat-grad);
  color: var(--on-accent);
  cursor: pointer;
  box-shadow: 0 4px 14px var(--chat-glow);
  transition: transform .12s, filter .15s;
}
.chat-send:hover { filter: brightness(1.08); transform: translateY(-1px); }
.chat-send:active { transform: translateY(0); }
/* The #i-send glyph points right. In RTL "send" is leftwards, so it is mirrored;
   in LTR it already points the right way and must not be. */
.chat-send .ic { width: 18px; height: 18px; }
:root[dir="rtl"] .chat-send .ic { transform: scaleX(-1); }

.chat-disclaimer { margin: 0; padding: 0 16px 12px; font-size: 11px; color: var(--text-3); text-align: center; }

/* ---------- motion guard ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================================================================
   Advisor page (index.html, <body data-chat-mode="page">) — 2026-09-17.
   The advisor is the product, so the panel stops floating and becomes
   the page: centred column, full height under the top bar, no launcher.
   An embedding iframe loads this same page, so it must also hold up in a
   narrow frame (the 560px rule below).
   =================================================================== */

.brand-title { font-size: 15px; font-weight: 700; letter-spacing: .2px; white-space: nowrap; }

.advisor-page { min-height: 100dvh; display: flex; flex-direction: column; }

/* A grid, not a flex row, so the feedback report panel (chat.js, .fb-panel) can
   take a second column beside the chat — see .has-fb-panel below. */
.advisor-shell {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 24px 20px;
  min-height: 0;
}

.advisor-page .chat-widget { position: static; display: flex; flex: 1; min-width: 0; z-index: auto; }

.advisor-page .chat-panel {
  position: static;
  width: 100%;
  height: calc(100dvh - 90px);
  min-height: 420px;
  opacity: 1;
  transform: none;
  transition: none;
}

/* Reading width: the log centres its turns at ~940px on wide screens. */
.advisor-page .chat-log { padding: 22px max(24px, calc((100% - 940px) / 2)); gap: 18px; --av: 40px; }
.advisor-page .chat-msg { max-width: 88%; }
.advisor-page .chat-msg.assistant .chat-bubble { padding: 14px 20px; font-size: 15px; line-height: 1.7; }
.advisor-page .chat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.advisor-page .chat-greeting { max-width: 620px; margin: auto; }
.advisor-page .chat-greeting-mark { width: 72px; height: 72px; border-radius: 20px; }
.advisor-page .chat-greeting-mark img { width: 44px; height: 44px; }
.advisor-page .chat-greeting h3 { font-size: 26px; margin-bottom: 10px; }
.advisor-page .chat-greeting p { font-size: 16px; }
.advisor-page .chat-form input { font-size: 16px; min-width: 0; }
.advisor-page .chat-panel, .advisor-page .chat-log { min-width: 0; }
.advisor-page .topbar-inner { min-width: 0; }

@media (max-width: 560px) {
  .advisor-shell { padding: 0; }
  .advisor-page .chat-panel { height: calc(100dvh - 52px); border-radius: 0; border-inline: 0; }
  .advisor-page .chat-log { padding: 16px; --av: 30px; }
  .advisor-page .chat-msg { max-width: 94%; }
  .advisor-page .brand-divider, .advisor-page .brand-title { display: none; }
}

/* ===================================================================
   Engineer feedback (spec 2026-10-20): "✓ accurate" / "✗ report a
   mistake" pills under each answer, and the one report panel. Tokens
   only — the palette/theme task redefines them, so nothing here may
   carry its own colour literal.
   =================================================================== */

.fb-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-block-start: 6px;
}

/* "Accurate" is a soft green, "report an error" a soft red (Erez, 2026-10-21:
   the neutral pills were hard to see). Both tint from the verdict tokens, so each
   theme's own green/red carries them and the contrast gate covers the text. */
.fb-pill {
  --fb: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border: 1px solid color-mix(in srgb, var(--fb) 38%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--fb) 9%, transparent);
  color: var(--fb);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
}
.fb-pill.fb-good { --fb: var(--verdict-ok); }
.fb-pill.fb-bad  { --fb: var(--verdict-block); }
.fb-pill:hover:not(:disabled) { background: color-mix(in srgb, var(--fb) 17%, transparent); border-color: color-mix(in srgb, var(--fb) 60%, transparent); }
.fb-pill:active:not(:disabled) { transform: translateY(1px); }
.fb-pill:focus-visible { outline: 2px solid var(--fb); outline-offset: 2px; }
.fb-pill:disabled { cursor: default; opacity: .6; }
.fb-pill.is-saved, .fb-pill.is-saved:disabled { border-color: var(--fb); opacity: 1; }

.fb-note { font-size: 12px; color: var(--text-2); }
.fb-note.is-ok { color: var(--verdict-ok); }
.fb-note.is-err { color: var(--verdict-block); }

/* Page mode, wide viewport: the panel is the shell's second column, and the
   shell widens so the chat column keeps its width. In RTL the grid puts the
   panel on the left, in LTR on the right — the inline end either way. */
.advisor-shell.has-fb-panel {
  max-width: 1300px;
  grid-template-columns: minmax(0, 1fr) 360px;
}

.fb-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100dvh - 90px);
  min-height: 420px;
  min-width: 0;
  padding: 16px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: 18px;
  color: var(--text);
  font-family: var(--ui);
  text-align: start;
}
.fb-panel[hidden] { display: none; }

/* Widget mode, or page mode under 900px: a sheet over the chat log, inside
   #chat-panel. The page-mode panel is position:static, so it is made the
   containing block here; `inset: auto` cancels the floating panel's offsets. */
.advisor-page .chat-panel { position: relative; inset: auto; }
.fb-panel.is-sheet {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: 5;
  height: auto;
  min-height: 0;
  max-height: calc(100% - 64px);
  border-inline: 0;
  border-block-end: 0;
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow-lg);
}

.fb-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fb-panel-head b { font-size: 15px; }

.fb-ref {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--r);
  background: var(--surface-2);
  font-size: 13px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.fb-ref bdi { color: var(--text); }

.fb-form { display: flex; flex-direction: column; gap: 12px; }

.fb-cats { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; border: 0; }
.fb-cats legend { padding: 0; margin-block-end: 6px; font-size: 13px; font-weight: 600; }
.fb-cat { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; cursor: pointer; }
.fb-cat input { margin: 3px 0 0; accent-color: var(--accent); }

.fb-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); }
.fb-field textarea,
.fb-field input {
  padding: 8px 10px;
  border: 1px solid var(--border-2);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
}
.fb-field textarea { resize: vertical; min-height: 96px; }
.fb-field textarea:focus,
.fb-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.fb-err { font-size: 12px; color: var(--verdict-block); }

.fb-buttons { display: flex; gap: 8px; }
.fb-submit,
.fb-cancel {
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
/* Same gradient button as the lead form's submit (.chat-lead-submit). */
.fb-submit {
  border: 0;
  background: var(--chat-grad);
  color: var(--on-accent);
  box-shadow: 0 4px 14px var(--chat-glow);
  transition: filter .15s, transform .12s;
}
.fb-submit:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.fb-submit:disabled { opacity: .65; cursor: default; }
.fb-cancel { border: 1px solid var(--border-2); background: transparent; color: var(--text-2); }
.fb-cancel:hover { color: var(--text); border-color: var(--text-3); }
.fb-submit:focus-visible,
.fb-cancel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Embed mode (?embed=1): the advisor inside the floating-bubble iframe (public/embed.js,
   public/embed-mode.js). Hides the page header and fits the panel to the iframe. */
html[data-embed] .topbar { display: none; }
html[data-embed] .advisor-shell { padding: 0; max-width: none; }
html[data-embed] .advisor-page .chat-panel { height: 100dvh; min-height: 0; border-radius: 0; border-inline: 0; }
html[data-embed] .advisor-page .chat-log { padding: 16px; --av: 30px; }
html[data-embed] .advisor-page .chat-msg { max-width: 94%; }
html[data-embed] .advisor-page .chat-greeting h3 { font-size: 20px; }
html[data-embed] .advisor-page .chat-greeting p { font-size: 14px; }
