/* ══════════════════════════════════════════════════════════════════════════
   canon-catalog.css — the price catalog's live markup, on canon v5.

   A PORT OF THE MARKUP WE HAVE. catalog-page.js and its satellites build the
   rows (a virtualised window whose maths reads a MEASURED row height), the card
   grid, the supplier comparison, the category chips and overflow menu, the
   Import menu, the facets, the count line, the bulk selection bar and three
   import dialogs. All of it keeps its markup and is restyled here, in canon
   terms; the page's shell and figure are in catalog.html / catalog-page.js.

   Loaded only while feature_canon_v5 is on (media="not all" until the gate
   flips it). books.css and books-canon.css, which drew the same markup, are
   switched off by the same gate. Every rule is scoped to :root.canon-v5.

   One rule of thumb carried over from the legacy file: a virtualised row must
   never change height between paints, so nothing here gives a row a
   :last-child exception, a hover that changes its box, or wrapping text.
   ══════════════════════════════════════════════════════════════════════════ */

@layer components {

  /* ── Toolbar ──────────────────────────────────────────────────────────── */
  :root.canon-v5 .cat-toolbar .cat-search { width: 280px; max-width: 100%; }
  :root.canon-v5 .cat-toolbar-sp { flex: 1; }
  :root.canon-v5 .cat-sortsel {
    height: 34px; padding: 0 10px; box-sizing: border-box;
    background: var(--c-card); border: 1px solid var(--c-border); border-radius: 6px;
    color: var(--c-text); font-family: inherit; font-size: 12px; cursor: pointer;
  }
  :root.canon-v5 .cat-sortsel:focus { border-color: var(--c-accent-edge); box-shadow: 0 0 0 3px var(--c-accent-soft); outline: none; }

  /* The view toggle is a canon .seg. */
  :root.canon-v5 .cat-viewtoggle {
    display: inline-flex; gap: 2px; padding: 2px;
    background: var(--c-sunken); border: 1px solid var(--c-border); border-radius: 6px;
  }
  :root.canon-v5 .cat-viewtoggle button {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
    border: 0; border-radius: 4px; background: transparent; color: var(--c-cap);
    font-family: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  }
  :root.canon-v5 .cat-viewtoggle button:hover { color: var(--c-text-2); }
  :root.canon-v5 .cat-viewtoggle button.is-active { background: var(--c-card); color: var(--c-text); box-shadow: var(--lift); }
  :root.canon-v5 .cat-viewtoggle button i { font-size: 14px; }

  /* The Import menu (core/ui/docactions.js). Opens downward from a top toolbar. */
  :root.canon-v5 .ui-actmenu { position: relative; display: inline-block; }
  :root.canon-v5 .ui-actmenu__trigger {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
    border: 1px solid var(--c-border); border-radius: 6px; background: var(--c-card); color: var(--c-text);
    font-family: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  }
  :root.canon-v5 .ui-actmenu__trigger:hover { background: var(--c-card-2); border-color: var(--c-border-2); }
  :root.canon-v5 .ui-actmenu__caret { font-size: 14px; opacity: .7; }
  :root.canon-v5 .ui-actmenu__panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 200;
    display: flex; flex-direction: column; width: max-content; min-width: 220px;
    max-width: min(320px, calc(100vw - 24px)); max-height: min(58vh, 480px); overflow-y: auto;
    padding: 4px; box-sizing: border-box;
    background: var(--c-card); border: 1px solid var(--c-border); border-radius: 10px; box-shadow: var(--float);
  }
  :root.canon-v5 .ui-actmenu__panel[hidden] { display: none; }
  :root.canon-v5 .ui-actmenu__item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; box-sizing: border-box;
    border: 0; border-radius: 6px; background: transparent; color: var(--c-text);
    font-family: inherit; font-size: 13px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
  }
  :root.canon-v5 .ui-actmenu__item:hover { background: var(--c-card-2); }
  :root.canon-v5 .ui-actmenu__item i { font-size: 16px; color: var(--c-cap); flex: none; }

  /* ── Category chips, and the overflow menu (core/ui/catmenu.js) ───────── */
  :root.canon-v5 .cat-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
  :root.canon-v5 .cat-chip {
    display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px;
    border: 1px solid var(--c-border); border-radius: 999px; background: var(--c-card); color: var(--c-text-2);
    font-family: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  }
  :root.canon-v5 .cat-chip:hover { border-color: var(--c-border-2); }
  :root.canon-v5 .cat-chip.is-active { background: var(--c-accent-soft); border-color: var(--c-accent-edge); color: var(--c-on-wash-accent); }
  :root.canon-v5 .cat-chip-n { font-family: "Inter", system-ui, sans-serif; font-variant-numeric: tabular-nums; color: var(--c-cap); }
  /* Not opacity: .8 of the on-wash ink is 3.79:1 on the chip wash. The count
     is quieter than the label by weight, which costs no contrast. */
  :root.canon-v5 .cat-chip.is-active .cat-chip-n { color: inherit; font-weight: 500; }

  :root.canon-v5 .catm { position: relative; display: inline-block; }
  :root.canon-v5 .catm-trigger { display: inline-flex; align-items: center; gap: 5px; }
  :root.canon-v5 .catm-caret { font-size: 13px; opacity: .7; }
  :root.canon-v5 .catm-panel {
    position: fixed; z-index: 300; width: 260px; padding: 6px; box-sizing: border-box;
    display: flex; flex-direction: column; gap: 6px;
    background: var(--c-card); border: 1px solid var(--c-border); border-radius: 10px; box-shadow: var(--float);
  }
  :root.canon-v5 .catm-panel[hidden] { display: none; }
  :root.canon-v5 .catm-search {
    width: 100%; height: 32px; padding: 0 10px; box-sizing: border-box; margin: 0;
    background: var(--c-sunken); border: 1px solid var(--c-border); border-radius: 6px; color: var(--c-text); font-family: inherit; font-size: 12px;
  }
  :root.canon-v5 .catm-rows { display: flex; flex-direction: column; overflow-y: auto; min-height: 0; }
  :root.canon-v5 .catm-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
    padding: 7px 9px; border: 0; border-radius: 6px; background: transparent; color: var(--c-text);
    font-family: inherit; font-size: 13px; text-align: left; cursor: pointer;
  }
  :root.canon-v5 .catm-row:hover,
  :root.canon-v5 .catm-row:focus-visible { background: var(--c-card-2); outline: none; }
  :root.canon-v5 .catm-row.is-active { background: var(--c-accent-soft); color: var(--c-on-wash-accent); font-weight: 600; }
  :root.canon-v5 .catm-row-label { min-width: 0; overflow-wrap: anywhere; }
  :root.canon-v5 .catm-row-n { flex: none; font-size: 12px; color: var(--c-cap); font-variant-numeric: tabular-nums; }
  :root.canon-v5 .catm-none { margin: 0; padding: 10px; font-size: 13px; color: var(--c-text-2); }

  /* ── Facets and the count line ────────────────────────────────────────── */
  :root.canon-v5 .cat-facets { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
  :root.canon-v5 .cat-facets:empty { display: none; }
  :root.canon-v5 .cat-facet {
    width: auto; max-width: 100%; height: 30px; padding: 0 10px; box-sizing: border-box;
    border: 1px solid var(--c-border); border-radius: 999px; background: var(--c-card); color: var(--c-text-2);
    font-family: inherit; font-size: 12px; font-weight: 500; cursor: pointer;
  }
  :root.canon-v5 .cat-facet.is-set { border-color: var(--c-accent-edge); color: var(--c-on-wash-accent); background: var(--c-accent-soft); }
  :root.canon-v5 .cat-facet-flag.is-set { border-color: color-mix(in srgb, var(--c-warn) 34%, transparent); color: var(--c-on-wash-warn); background: color-mix(in srgb, var(--c-warn) 10%, transparent); }

  :root.canon-v5 .cat-count { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 12px; font-size: 13px; color: var(--c-text-2); }
  :root.canon-v5 .cat-count:empty { display: none; }
  :root.canon-v5 .cat-count b { color: var(--c-text); font-weight: 600; font-family: "Inter", system-ui, sans-serif; font-variant-numeric: tabular-nums; }
  :root.canon-v5 .cat-count-clear {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px;
    border: 0; border-radius: 4px; background: none; color: var(--c-accent);
    font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  }
  :root.canon-v5 .cat-count-clear:hover { background: var(--c-accent-soft); }
  :root.canon-v5 .cat-count-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
  :root.canon-v5 .cat-window,
  :root.canon-v5 .cat-loading {
    display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 500; border: 1px solid;
  }
  :root.canon-v5 .cat-window { color: var(--c-on-wash-warn); border-color: color-mix(in srgb, var(--c-warn) 34%, transparent); background: color-mix(in srgb, var(--c-warn) 10%, transparent); }
  :root.canon-v5 .cat-loading { color: var(--c-on-wash-accent); border-color: var(--c-accent-edge); background: var(--c-accent-soft); }

  /* ── The row view (catalog-rows.js) — a canon .tbl drawn in grid ──────── */
  :root.canon-v5 .cust-grid.cat-rows-host,
  :root.canon-v5 .cust-grid.cat-cmp-host { display: block; }
  :root.canon-v5 .catv2-list {
    border: 1px solid var(--c-border); border-radius: 10px; background: var(--c-card);
    box-shadow: var(--lift), var(--lift-edge);
  }
  :root.canon-v5 .catv2-head,
  :root.canon-v5 .catv2-row {
    display: grid; grid-template-columns: 34px 34px minmax(220px, 1fr) 120px 104px 88px 88px 104px 150px;
    align-items: center; gap: 10px; padding: 0 14px;
  }
  :root.canon-v5 .catv2-head {
    position: sticky; top: var(--catv2-stick, 0px); z-index: 5; height: 36px;
    background: var(--c-card); border-bottom: 1px solid var(--c-border); border-radius: 9px 9px 0 0;
    font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-cap);
  }
  :root.canon-v5 .catv2-head button {
    display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer;
    color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
  }
  :root.canon-v5 .catv2-head button:hover { color: var(--c-text-2); }
  :root.canon-v5 .catv2-head button[aria-sort="ascending"],
  :root.canon-v5 .catv2-head button[aria-sort="descending"] { color: var(--c-text); }
  :root.canon-v5 .catv2-head .catv2-n button { justify-content: flex-end; width: 100%; }
  :root.canon-v5 .catv2-vport { position: relative; }
  :root.canon-v5 .catv2-vwin { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }
  :root.canon-v5 .catv2-row {
    min-height: 56px; border-bottom: 1px solid var(--c-border); cursor: pointer;
    transition: background var(--dur) var(--ease);
  }
  :root.canon-v5 .catv2-row:hover { background: var(--c-card-2); }
  :root.canon-v5 .catv2-row:focus-visible { outline: 2px solid var(--c-accent); outline-offset: -2px; }
  :root.canon-v5 .catv2-row.is-sel { background: var(--c-accent-soft); }
  :root.canon-v5 .catv2-tickwrap { display: grid; place-items: center; min-width: 34px; min-height: 40px; cursor: pointer; }
  :root.canon-v5 .catv2-tick { width: 16px; height: 16px; accent-color: var(--c-accent); cursor: pointer; }
  :root.canon-v5 .catv2-thumb {
    width: 30px; height: 30px; overflow: hidden; display: grid; place-items: center;
    border: 1px solid var(--c-border); border-radius: 6px; background: var(--c-sunken); color: var(--c-cap); font-size: 15px;
  }
  :root.canon-v5 .catv2-thumb img { width: 100%; height: 100%; object-fit: cover; }
  :root.canon-v5 .catv2-main { display: block; min-width: 0; }
  :root.canon-v5 .catv2-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; color: var(--c-text); }
  :root.canon-v5 .catv2-badge {
    margin-left: 6px; padding: 0 6px; border: 1px solid var(--c-accent-edge); border-radius: 999px;
    font-size: 10px; font-weight: 500; color: var(--c-on-wash-accent); vertical-align: 1px;
  }
  :root.canon-v5 .catv2-spec { display: flex; align-items: center; gap: 5px; margin-top: 2px; overflow: hidden; white-space: nowrap; }
  :root.canon-v5 .catv2-sp {
    flex: none; padding: 0 6px; border: 1px solid var(--c-border); border-radius: 4px; background: var(--c-sunken);
    font-family: "Inter", system-ui, sans-serif; font-size: 11px; font-weight: 500; color: var(--c-text-2); font-variant-numeric: tabular-nums;
  }
  :root.canon-v5 .catv2-sp-cat { display: inline-flex; align-items: center; gap: 4px; padding-left: 0; border-color: transparent; background: none; color: var(--c-cap); font-family: inherit; }
  :root.canon-v5 .catv2-sp-path { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 11px; color: var(--c-cap); }
  :root.canon-v5 .catv2-sp-path::before { content: "·"; margin-right: 5px; }
  :root.canon-v5 .catv2-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--c-text-2); }
  :root.canon-v5 .catv2-n { text-align: right; font-family: "Inter", system-ui, sans-serif; font-size: 13px; font-variant-numeric: tabular-nums; }
  :root.canon-v5 .catv2-c-cost { color: var(--c-cap); }
  :root.canon-v5 .catv2-c-cost.is-missing,
  :root.canon-v5 .catv2-c-rrp.is-missing { color: var(--c-cap); }
  :root.canon-v5 .catv2-c-rrp { color: var(--c-text-2); }
  :root.canon-v5 .catv2-sell { font-size: 14px; font-weight: 600; color: var(--c-text); }
  :root.canon-v5 .catv2-sell small { display: block; font-family: inherit; font-size: 10px; font-weight: 400; color: var(--c-cap); }

  /* Margin, both shapes the row can emit. Under books-v4 a bar with a target
     tick (.mcell); without it a chip (.catv2-m). Never colour alone: the sign,
     the number and the worded flag carry the meaning. */
  :root.canon-v5 .mcell { display: flex; align-items: center; justify-content: flex-end; gap: 10px; max-width: 100%; overflow: hidden; }
  :root.canon-v5 .mbar { position: relative; flex: none; width: 64px; height: 6px; border-radius: 999px; background: var(--c-sunken); }
  :root.canon-v5 .mfill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--c-accent); }
  :root.canon-v5 .mfill.low { background: var(--c-warn); }
  :root.canon-v5 .mtick { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: 1px; background: var(--c-text-2); }
  :root.canon-v5 .mpc { min-width: 42px; text-align: right; font-family: "Inter", system-ui, sans-serif; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--c-text); }
  :root.canon-v5 .mpc.low { color: var(--c-on-wash-warn); }
  :root.canon-v5 .mcell .flag { display: inline-flex; align-items: center; gap: 3px; min-width: 0; overflow: hidden; color: var(--c-on-wash-warn); }
  :root.canon-v5 .mcell .flag-t { display: none; }
  :root.canon-v5 .catv2-m {
    display: inline-block; padding: 1px 8px; border: 1px solid var(--c-border); border-radius: 999px;
    font-family: "Inter", system-ui, sans-serif; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--c-text-2);
  }
  :root.canon-v5 .catv2-m.is-good { color: var(--c-on-wash-ok); border-color: color-mix(in srgb, var(--c-ok) 32%, transparent); }
  :root.canon-v5 .catv2-m.is-thin { color: var(--c-on-wash-warn); border-color: color-mix(in srgb, var(--c-warn) 34%, transparent); }
  :root.canon-v5 .catv2-m.is-loss { color: var(--c-on-wash-danger); border-color: color-mix(in srgb, var(--c-danger) 36%, transparent); }
  :root.canon-v5 .catv2-m.is-none { border-color: transparent; font-weight: 400; color: var(--c-cap); }

  @media (max-width: 1240px) {
    :root.canon-v5 .catv2-head, :root.canon-v5 .catv2-row { grid-template-columns: 34px 34px minmax(200px, 1fr) 120px 88px 88px 104px 130px; }
    :root.canon-v5 .catv2-c-part { display: none; }
  }
  @media (max-width: 1060px) {
    :root.canon-v5 .catv2-head, :root.canon-v5 .catv2-row { grid-template-columns: 34px 34px minmax(180px, 1fr) 88px 88px 104px 120px; }
    :root.canon-v5 .catv2-c-sup { display: none; }
  }
  @media (max-width: 900px) {
    :root.canon-v5 .catv2-head, :root.canon-v5 .catv2-row { grid-template-columns: 34px 34px minmax(160px, 1fr) 88px 104px 110px; }
    :root.canon-v5 .catv2-c-rrp { display: none; }
  }
  @media (max-width: 700px) {
    :root.canon-v5 .catv2-head { display: none; }
    :root.canon-v5 .catv2-row { grid-template-columns: 34px 34px minmax(0, 1fr) auto; gap: 10px; padding: 8px 12px; }
    :root.canon-v5 .catv2-c-cost { display: none; }
    :root.canon-v5 .catv2-row > :last-child { display: none; }
  }

  /* ── The card view: .cust-* markup, a canon card grid ─────────────────── */
  :root.canon-v5 .cust-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
  :root.canon-v5 .cust-card {
    padding: 14px 16px; border: 1px solid var(--c-border); border-radius: 10px;
    background: var(--c-card); box-shadow: var(--lift), var(--lift-edge);
  }
  :root.canon-v5 .cust-card.is-click { cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
  :root.canon-v5 .cust-card.is-click:hover { border-color: var(--c-border-2); background: var(--c-card-2); }
  :root.canon-v5 .cust-card.is-click:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
  :root.canon-v5 .cust-head { display: flex; align-items: flex-start; gap: 10px; }
  :root.canon-v5 .cust-head > div { flex: 1; min-width: 0; }
  :root.canon-v5 .cust-name { font-size: 14px; font-weight: 600; color: var(--c-text); overflow-wrap: anywhere; }
  :root.canon-v5 .cust-meta { margin-top: 3px; font-size: 12px; color: var(--c-cap); overflow-wrap: anywhere; }
  :root.canon-v5 .cust-meta i { margin-right: 3px; font-size: 12px; }
  :root.canon-v5 .cust-notes { font-style: italic; }
  :root.canon-v5 .cust-empty { grid-column: 1 / -1; padding: 40px 16px; text-align: center; font-size: 13px; color: var(--c-text-2); }
  :root.canon-v5 .cat-card .cat-price { white-space: nowrap; text-align: right; font-family: "Inter", system-ui, sans-serif; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--c-text); }
  :root.canon-v5 .cat-card .cat-unit { display: block; font-family: inherit; font-size: 11px; font-weight: 400; color: var(--c-cap); }
  :root.canon-v5 .cat-card .cat-perunit { display: block; font-size: 11px; font-weight: 500; color: var(--c-on-wash-accent); }
  :root.canon-v5 .cat-card-thumb { flex: none; width: 44px; height: 44px; object-fit: cover; border: 1px solid var(--c-border); border-radius: 6px; background: var(--c-sunken); }
  :root.canon-v5 .cat-shared { color: var(--c-on-wash-accent); }
  :root.canon-v5 .cat-sk { pointer-events: none; }
  :root.canon-v5 .cat-sk-line { height: 11px; margin-bottom: 9px; border-radius: 4px; background: var(--c-sunken); }
  :root.canon-v5 .cat-sk-line:last-child { margin-bottom: 0; }
  :root.canon-v5 .cat-sk-sm { height: 8px; }

  /* The margin chip on a card (core/ui/insightstrip.js, which skips its own
     unlayered stylesheet under the canon — it would otherwise win here). */
  :root.canon-v5 .insight-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  :root.canon-v5 .insight-chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
    border: 1px solid var(--c-border); background: var(--c-sunken); color: var(--c-text-2);
    font-size: 11px; font-weight: 500; line-height: 1.5;
  }
  :root.canon-v5 .insight-chip .ti { font-size: 12px; }
  :root.canon-v5 .insight-chip.is-good { color: var(--c-on-wash-ok); border-color: color-mix(in srgb, var(--c-ok) 32%, transparent); background: color-mix(in srgb, var(--c-ok) 10%, transparent); }
  :root.canon-v5 .insight-chip.is-warn { color: var(--c-on-wash-warn); border-color: color-mix(in srgb, var(--c-warn) 34%, transparent); background: color-mix(in srgb, var(--c-warn) 10%, transparent); }
  :root.canon-v5 .insight-chip.is-info { color: var(--c-cap); }

  /* No results, and the dead end's actions. */
  :root.canon-v5 .cat-noresults b { color: var(--c-text); }
  :root.canon-v5 .cat-noresults-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }

  /* ── The supplier comparison (catalog-compare-view.js) ────────────────── */
  :root.canon-v5 .catcmp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
  :root.canon-v5 .catcmp-s { padding: 14px 16px; border: 1px solid var(--c-border); border-radius: 10px; background: var(--c-card); box-shadow: var(--lift); }
  :root.canon-v5 .catcmp-s-v { display: flex; align-items: baseline; gap: 7px; font-family: "Sora", system-ui, sans-serif; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--c-text); }
  :root.canon-v5 .catcmp-s-v i { align-self: center; font-size: 16px; color: var(--c-cap); }
  :root.canon-v5 .catcmp-s-v small { font-family: inherit; font-size: 12px; font-weight: 500; color: var(--c-cap); }
  :root.canon-v5 .catcmp-s-l { display: block; margin-top: 4px; font-size: 12px; color: var(--c-text-2); }
  :root.canon-v5 .catcmp-s.is-bad .catcmp-s-v { color: var(--c-on-wash-warn); }
  :root.canon-v5 .catcmp-s.is-ok .catcmp-s-v { color: var(--c-on-wash-ok); }
  :root.canon-v5 .catcmp-list { display: flex; flex-direction: column; gap: 12px; }
  :root.canon-v5 .catcmp-g {
    overflow: hidden; border: 1px solid var(--c-border); border-left: 3px solid var(--c-border);
    border-radius: 10px; background: var(--c-card); box-shadow: var(--lift);
  }
  :root.canon-v5 .catcmp-g.is-live { border-left-color: var(--c-warn); }
  :root.canon-v5 .catcmp-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 12px 16px 0; }
  :root.canon-v5 .catcmp-name { min-width: 0; font-size: 14px; font-weight: 600; color: var(--c-text); }
  :root.canon-v5 .catcmp-sup { white-space: nowrap; font-size: 12px; color: var(--c-cap); }
  :root.canon-v5 .catcmp-v { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; padding: 5px 16px 12px; font-size: 13px; color: var(--c-text-2); }
  :root.canon-v5 .catcmp-v i { align-self: center; font-size: 14px; color: var(--c-cap); }
  :root.canon-v5 .catcmp-v b { font-weight: 600; color: var(--c-text); font-variant-numeric: tabular-nums; }
  :root.canon-v5 .catcmp-v.is-live b,
  :root.canon-v5 .catcmp-v.is-live i { color: var(--c-on-wash-warn); }
  :root.canon-v5 .catcmp-os { border-top: 1px solid var(--c-border); }
  :root.canon-v5 .catcmp-o {
    width: 100%; min-height: 44px; display: grid; align-items: center; gap: 12px;
    grid-template-columns: minmax(110px, 1.1fr) minmax(0, 1.4fr) 108px 104px; padding: 9px 16px;
    border: 0; border-top: 1px solid var(--c-border); background: none; color: var(--c-text-2);
    font: inherit; text-align: left; cursor: pointer;
  }
  :root.canon-v5 .catcmp-os .catcmp-o:first-child { border-top: 0; }
  :root.canon-v5 .catcmp-o:hover { background: var(--c-card-2); }
  :root.canon-v5 .catcmp-o:focus-visible { outline: 2px solid var(--c-accent); outline-offset: -2px; }
  :root.canon-v5 .catcmp-o-sup { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; font-weight: 500; color: var(--c-text); }
  :root.canon-v5 .catcmp-o-why { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--c-cap); }
  :root.canon-v5 .catcmp-o-n { white-space: nowrap; text-align: right; font-family: "Inter", system-ui, sans-serif; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--c-text); }
  :root.canon-v5 .catcmp-o-n small { font-size: 11px; font-weight: 400; color: var(--c-cap); }
  :root.canon-v5 .catcmp-o-d { white-space: nowrap; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--c-cap); }
  :root.canon-v5 .catcmp-o-d b { font-weight: 600; }
  :root.canon-v5 .catcmp-o-cap { font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
  :root.canon-v5 .catcmp-o.is-best .catcmp-o-n { color: var(--c-on-wash-ok); }
  :root.canon-v5 .catcmp-o.is-over .catcmp-o-d { color: var(--c-on-wash-warn); }
  :root.canon-v5 .catcmp-o.is-out { opacity: .65; }
  :root.canon-v5 .catcmp-tag { display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; border: 1px solid; border-radius: 999px; font-size: 10px; font-weight: 500; }
  :root.canon-v5 .catcmp-tag.is-best { color: var(--c-on-wash-ok); border-color: color-mix(in srgb, var(--c-ok) 32%, transparent); }
  :root.canon-v5 .catcmp-tag.is-cur { color: var(--c-cap); border-color: var(--c-border-2); }
  :root.canon-v5 .catcmp-ai {
    display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 12px 16px;
    border: 1px solid var(--c-accent-edge); border-radius: 6px; background: var(--c-accent-soft);
  }
  :root.canon-v5 .catcmp-ai > i { flex: none; font-size: 18px; color: var(--c-accent); }
  :root.canon-v5 .catcmp-ai > span { flex: 1; min-width: 0; }
  :root.canon-v5 .catcmp-ai b { display: block; font-size: 13px; font-weight: 600; color: var(--c-text); }
  :root.canon-v5 .catcmp-ai small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.45; color: var(--c-text-2); }
  :root.canon-v5 .catcmp-note { display: flex; align-items: flex-start; gap: 6px; margin: -6px 0 16px; font-size: 12px; line-height: 1.45; color: var(--c-text-2); }
  :root.canon-v5 .catcmp-more { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 12px; color: var(--c-cap); }
  :root.canon-v5 .catcmp-empty { text-align: left; }
  @media (max-width: 900px) {
    :root.canon-v5 .catcmp-o { grid-template-columns: minmax(100px, 1fr) 100px 96px; }
    :root.canon-v5 .catcmp-o-why { display: none; }
    :root.canon-v5 .catcmp-o.is-out { grid-template-columns: minmax(0, 1fr) auto; }
    :root.canon-v5 .catcmp-o.is-out .catcmp-o-why { display: block; white-space: normal; }
    :root.canon-v5 .catcmp-o.is-out .catcmp-o-d { display: none; }
  }
  @media (max-width: 640px) {
    :root.canon-v5 .catcmp-stats { grid-template-columns: minmax(0, 1fr); }
    :root.canon-v5 .catcmp-o { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
    :root.canon-v5 .catcmp-o-n { grid-row: 1; grid-column: 2; }
    :root.canon-v5 .catcmp-o-d { grid-column: 2; }
  }

  /* ── The bulk selection bar ───────────────────────────────────────────── */
  :root.canon-v5 .cat-selbar {
    position: fixed; left: 50%; bottom: 18px; z-index: 70;
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px; max-width: calc(100vw - 24px);
    padding: 8px 12px; border: 1px solid var(--c-border); border-radius: 10px;
    background: var(--c-card); box-shadow: var(--float);
    transform: translateX(-50%) translateY(160%); visibility: hidden;
    /* Off-screen is not enough: its buttons would still take Tab. visibility
       waits out the slide before it hides, and shows at once. */
    transition: transform var(--dur) var(--ease), visibility 0s linear var(--dur);
  }
  :root.canon-v5 .cat-selbar.is-on { transform: translateX(-50%) translateY(0); visibility: visible; transition-delay: 0s; }
  :root.canon-v5 .cat-selbar-n { white-space: nowrap; font-size: 13px; font-weight: 500; color: var(--c-text); }
  :root.canon-v5 .cat-selbar-n b { color: var(--c-accent); font-variant-numeric: tabular-nums; }
  :root.canon-v5 .cat-selbar-locked { white-space: nowrap; font-size: 12px; color: var(--c-on-wash-warn); }
  :root.canon-v5 .cat-selbar-sep { width: 1px; height: 22px; background: var(--c-border); }
  :root.canon-v5 .cat-selbar select {
    width: auto; min-width: 150px; height: 26px; padding: 0 8px; box-sizing: border-box;
    border: 1px solid var(--c-border); border-radius: 6px; background: var(--c-sunken); color: var(--c-text); font-family: inherit; font-size: 12px;
  }
  :root.canon-v5 .cat-bulk-markup { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--c-text-2); }
  :root.canon-v5 .cat-bulk-markup input {
    width: 52px; height: 26px; padding: 0 6px; box-sizing: border-box; text-align: right;
    border: 1px solid var(--c-border); border-radius: 6px; background: var(--c-sunken); color: var(--c-text);
    font-family: inherit; font-size: 12px; appearance: textfield;
  }
  @media (max-width: 760px) {
    :root.canon-v5 .cat-selbar { left: 12px; right: 12px; bottom: 12px; max-width: none; transform: translateY(160%); }
    :root.canon-v5 .cat-selbar.is-on { transform: translateY(0); }
  }

  /* ── Inside the item dialog ───────────────────────────────────────────── */
  :root.canon-v5 .cat-pack-hint { margin-top: -4px; font-size: 12px; font-weight: 500; color: var(--c-on-wash-accent); }
  :root.canon-v5 .cat-share { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--c-text-2); cursor: pointer; }
  :root.canon-v5 .cat-share .hint { display: block; color: var(--c-cap); }
  :root.canon-v5 .cat-img-field { display: flex; align-items: center; gap: 10px; }
  :root.canon-v5 .cat-img-field input { flex: 1; min-width: 0; }
  :root.canon-v5 .cat-img-preview { flex: none; width: 54px; height: 54px; object-fit: cover; border: 1px solid var(--c-border); border-radius: 6px; background: var(--c-sunken); }

  /* ── The import dialogs (catalog-import.js, invoice-import.js,
        catalog-csv-import.js). Canon .bk-modal rules live in canon-chrome.css;
        these are what sits inside them. ───────────────────────────────────── */
  :root.canon-v5 .bk-modal.cat-imp-modal { max-width: 880px; }
  :root.canon-v5 .bk-modal.cat-csv-modal { max-width: 620px; }
  :root.canon-v5 .cat-imp-hint { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: var(--c-text-2); }
  :root.canon-v5 .cat-imp-sources { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  :root.canon-v5 .cat-imp-source {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px;
    border: 1px solid var(--c-border); border-radius: 10px; background: var(--c-card);
    font-family: inherit; font-size: 13px; text-align: left; color: var(--c-text);
  }
  :root.canon-v5 button.cat-imp-source { cursor: pointer; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
  :root.canon-v5 button.cat-imp-source:hover { background: var(--c-card-2); border-color: var(--c-border-2); }
  :root.canon-v5 .cat-imp-source > i { font-size: 22px; color: var(--c-accent); }
  :root.canon-v5 .cat-imp-source span { font-size: 12px; color: var(--c-cap); }
  :root.canon-v5 .cat-imp-paste textarea { min-height: 96px; resize: vertical; font-size: 12px; }
  :root.canon-v5 .cat-imp-thumb { display: block; width: 40px; height: 40px; margin-bottom: 4px; object-fit: cover; border: 1px solid var(--c-border); border-radius: 6px; background: var(--c-sunken); }
  :root.canon-v5 .cat-imp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
  :root.canon-v5 .cat-imp-tools .lbl { margin: 0; }
  :root.canon-v5 .cat-imp-supwrap { display: flex; align-items: center; gap: 8px; }
  :root.canon-v5 .cat-imp-supwrap select,
  :root.canon-v5 .cat-imp-supwrap input { max-width: 220px; }
  :root.canon-v5 .cat-imp-fill { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
  :root.canon-v5 .cat-imp-fill select { width: auto; }
  :root.canon-v5 .cat-imp-markup { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--c-text-2); }
  :root.canon-v5 .cat-imp-markup input { width: 58px; appearance: textfield; }
  :root.canon-v5 .cat-imp-scroll { overflow: auto; max-height: 52vh; border: 1px solid var(--c-border); border-radius: 6px; }
  :root.canon-v5 .cat-imp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  :root.canon-v5 .cat-imp-table th {
    position: sticky; top: 0; padding: 8px; white-space: nowrap; text-align: left;
    border-bottom: 1px solid var(--c-border); background: var(--c-card);
    font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-cap);
  }
  :root.canon-v5 .cat-imp-table td { padding: 5px 6px; border-bottom: 1px solid var(--c-border); vertical-align: middle; }
  :root.canon-v5 .cat-imp-table tr.is-off td { opacity: .45; }
  :root.canon-v5 .bk-modal .cat-imp-table input[type="text"],
  :root.canon-v5 .bk-modal .cat-imp-table input[type="number"],
  :root.canon-v5 .bk-modal .cat-imp-table select { height: 30px; padding: 0 8px; font-size: 13px; }
  :root.canon-v5 .bk-modal .cat-imp-table input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; appearance: textfield; }
  :root.canon-v5 .bk-modal .cat-imp-table input[type="checkbox"] { width: 16px; height: 16px; }
  :root.canon-v5 .cat-imp-name { min-width: 220px; }
  :root.canon-v5 .cat-imp-perunit { display: block; margin-top: 3px; font-size: 11px; font-weight: 500; color: var(--c-on-wash-accent); }
  :root.canon-v5 .cat-imp-part { min-width: 90px; }
  :root.canon-v5 .cat-imp-num { width: 84px; }
  :root.canon-v5 .cat-imp-sell { font-weight: 600; }
  :root.canon-v5 .cat-imp-badge {
    display: inline-block; padding: 1px 8px; white-space: nowrap; border: 1px solid var(--c-border); border-radius: 999px;
    background: var(--c-sunken); color: var(--c-cap); font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  }
  :root.canon-v5 .cat-imp-badge.is-new,
  :root.canon-v5 .cat-imp-badge.is-under { color: var(--c-on-wash-accent); border-color: var(--c-accent-edge); background: var(--c-accent-soft); }
  :root.canon-v5 .cat-imp-badge.is-upd,
  :root.canon-v5 .cat-imp-badge.is-cost { color: var(--c-on-wash-warn); border-color: color-mix(in srgb, var(--c-warn) 34%, transparent); background: color-mix(in srgb, var(--c-warn) 10%, transparent); }
  :root.canon-v5 .cat-imp-badge.is-ok { color: var(--c-on-wash-ok); border-color: color-mix(in srgb, var(--c-ok) 32%, transparent); background: color-mix(in srgb, var(--c-ok) 10%, transparent); }
  :root.canon-v5 .cat-imp-badge.is-over { color: var(--c-on-wash-danger); border-color: color-mix(in srgb, var(--c-danger) 36%, transparent); background: var(--c-danger-soft); }
  :root.canon-v5 .siv-header { margin-right: auto; font-weight: 600; color: var(--c-text); }
  :root.canon-v5 .siv-var { white-space: normal; line-height: 1.9; }
  :root.canon-v5 .siv-dim { color: var(--c-cap); }
  :root.canon-v5 .cat-imp-progress {
    display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px;
    border: 1px solid var(--c-border); border-radius: 6px; background: var(--c-sunken); font-size: 13px; color: var(--c-text-2);
  }
  :root.canon-v5 .cat-imp-spinner { flex: none; width: 16px; height: 16px; border: 2px solid var(--c-border-2); border-top-color: var(--c-accent); border-radius: 50%; animation: cat-canon-spin .7s linear infinite; }
  :root.canon-v5 .cat-imp-modal.is-busy #catImpStep1,
  :root.canon-v5 .cat-imp-modal.is-busy #catImpStep2,
  :root.canon-v5 .cat-imp-modal.is-busy #sivStep1,
  :root.canon-v5 .cat-imp-modal.is-busy #sivStep2,
  :root.canon-v5 .cat-csv-body.is-busy { opacity: .55; pointer-events: none; }
  :root.canon-v5 .cat-csv-maps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
  :root.canon-v5 .cat-csv-map { padding: 2px 10px; border: 1px solid var(--c-border); border-radius: 999px; background: var(--c-sunken); font-size: 12px; color: var(--c-text-2); }
  :root.canon-v5 .cat-csv-map b { font-weight: 600; color: var(--c-text); }
  :root.canon-v5 .cat-csv-history { display: flex; align-items: baseline; gap: 6px; margin: 0 0 14px; padding: 8px 10px; border: 1px solid var(--c-accent-edge); border-radius: 6px; background: var(--c-accent-soft); font-size: 13px; color: var(--c-text-2); }
  :root.canon-v5 .cat-csv-history i { color: var(--c-accent); }
  :root.canon-v5 .cat-csv-counts { display: flex; gap: 10px; margin-bottom: 10px; }
  :root.canon-v5 .cat-csv-count { flex: 1 1 0; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: 6px; background: var(--c-sunken); }
  :root.canon-v5 .cat-csv-count b { display: block; font-family: "Sora", system-ui, sans-serif; font-size: 20px; font-weight: 600; line-height: 1.2; color: var(--c-text); }
  :root.canon-v5 .cat-csv-count span { font-size: 12px; color: var(--c-cap); }
  :root.canon-v5 .cat-csv-dupes { margin-bottom: 14px; padding: 12px; border: 1px solid var(--c-border); border-radius: 6px; }
  :root.canon-v5 .cat-csv-dupes select { margin-bottom: 8px; }
  :root.canon-v5 .cat-csv-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--c-text-2); cursor: pointer; }
  :root.canon-v5 .cat-csv-check input { flex: none; }
  :root.canon-v5 .cat-csv-clean { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--c-border); }
  @media (max-width: 640px) {
    :root.canon-v5 .cat-imp-sources { grid-template-columns: 1fr; }
    :root.canon-v5 .cat-imp-tools #catImpSupplier { flex: 1 1 100%; max-width: none; }
    :root.canon-v5 .cat-imp-fill { flex: 1 1 100%; margin-left: 0; }
    :root.canon-v5 .cat-imp-fill select,
    :root.canon-v5 .cat-imp-fill .btn { flex: 1 1 auto; }

    /* Nine columns cannot fit a phone: one stacked card per item, as the
       legacy file does, so Category and the prices stay reachable. */
    :root.canon-v5 .cat-imp-scroll { max-height: 58vh; border: 0; }
    :root.canon-v5 .cat-imp-table,
    :root.canon-v5 .cat-imp-table tbody,
    :root.canon-v5 .cat-imp-table tr,
    :root.canon-v5 .cat-imp-table td { display: block; width: auto; }
    :root.canon-v5 .cat-imp-table thead { display: none; }
    :root.canon-v5 .cat-imp-table tr { position: relative; margin-bottom: 10px; padding: 12px 12px 10px; border: 1px solid var(--c-border); border-radius: 10px; background: var(--c-card); }
    :root.canon-v5 .cat-imp-table tr.is-off { background: transparent; }
    :root.canon-v5 .cat-imp-table td { display: flex; align-items: center; gap: 10px; padding: 5px 0; border: 0; }
    :root.canon-v5 .cat-imp-table td[data-label]::before { content: attr(data-label); flex: 0 0 82px; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-cap); }
    :root.canon-v5 .cat-imp-table td.cat-imp-name { min-width: 0; margin-top: 22px; padding-right: 34px; }
    :root.canon-v5 .bk-modal .cat-imp-table input[type="text"],
    :root.canon-v5 .bk-modal .cat-imp-table input[type="number"],
    :root.canon-v5 .bk-modal .cat-imp-table select { height: 40px; font-size: 16px; }
    :root.canon-v5 .cat-imp-num { width: 100%; }
    :root.canon-v5 .cat-imp-table td.cat-imp-cell-sel { position: absolute; top: 12px; right: 12px; padding: 0; }
    :root.canon-v5 .bk-modal .cat-imp-table td.cat-imp-cell-sel input { width: 22px; height: 22px; }
    :root.canon-v5 .cat-imp-table td.cat-imp-cell-badge { position: absolute; top: 14px; left: 12px; padding: 0; }
  }

  /* Coarse pointers: the same 44px floor the legacy file keeps. */
  @media (hover: none) {
    :root.canon-v5 .cat-chip,
    :root.canon-v5 .catm-row,
    :root.canon-v5 .cat-facet,
    :root.canon-v5 .cat-viewtoggle button,
    :root.canon-v5 .cat-count-clear,
    :root.canon-v5 .catm-trigger { min-height: 44px; }
    :root.canon-v5 .catv2-row { min-height: 60px; }
  }
}

@keyframes cat-canon-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  :root.canon-v5 .cat-imp-spinner { animation: none; }
  :root.canon-v5 .cat-selbar { transition: none; }
  :root.canon-v5.mk-on .cat-sk-line { animation: none; }
}
