/* ═══════════════════════════════════════════════════════════════════════════
   ph-components.css — Globe — Product Visibility Hub component styles
   ---------------------------------------------------------------------------
   Drop this into wwwroot/css/ and link it in App.razor AFTER the MudBlazor
   stylesheet so these rules win:

     <link rel="stylesheet" href="css/ph-components.css" />

   These classes are the source of truth for layout and visual detail.
   Use them on plain elements or on MudBlazor components via the Class="…"
   parameter. DO NOT rebuild these in MudGrid/MudItem — the grid classes here
   exist specifically because MudGrid's flex items do not stretch children,
   which is what causes uneven card widths.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  --ph-primary: #00B2E2;
  --ph-primary-dark: #0090B5;
  --ph-primary-light: #33C5EA;
  --ph-accent: #EE9E22;

  --ph-red: #b41e15;
  --ph-red-bg: rgba(180, 30, 21, 0.08);
  --ph-red-border: rgba(180, 30, 21, 0.28);
  --ph-green: #00873a;
  --ph-green-bg: rgba(0, 135, 58, 0.08);
  --ph-amber: #b46500;
  --ph-amber-bg: rgba(180, 101, 0, 0.09);
  --ph-slate: #55606e;
  --ph-slate-bg: rgba(85, 96, 110, 0.10);
  --ph-gold: #b8860b;

  --ph-bg: #F4F5F7;
  --ph-surface: #FFFFFF;
  --ph-surface-2: #FAFBFC;

  --ph-text: rgba(0, 0, 0, 0.87);
  --ph-text-2: rgba(0, 0, 0, 0.60);
  --ph-text-3: rgba(0, 0, 0, 0.38);

  --ph-divider: rgba(0, 0, 0, 0.08);
  --ph-divider-light: rgba(0, 0, 0, 0.04);
  --ph-hover: rgba(0, 0, 0, 0.035);

  --ph-internal-bg: rgba(0, 178, 226, 0.06);
  --ph-internal-border: rgba(0, 178, 226, 0.30);

  --ph-appbar-h: 64px;
  --ph-drawer-w: 240px;
  --ph-content-max: 1560px;

  --ph-font: "Golos Text", "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ph-mono: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Adapted from [data-ph-theme="dark"] in the source handoff — this app's
   MudThemeProvider toggles dark mode via [data-mud-theme="dark"] instead. */
[data-mud-theme="dark"] {
  --ph-primary: #33C5EA;
  --ph-primary-dark: #00B2E2;
  --ph-primary-light: #66D6F0;

  --ph-red: #ff6b60;
  --ph-red-bg: rgba(255, 107, 96, 0.12);
  --ph-red-border: rgba(255, 107, 96, 0.35);
  --ph-green: #34d17a;
  --ph-green-bg: rgba(52, 209, 122, 0.12);
  --ph-amber: #e6a44d;
  --ph-amber-bg: rgba(230, 164, 77, 0.14);
  --ph-slate: #9aa4b0;
  --ph-slate-bg: rgba(154, 164, 176, 0.14);
  --ph-gold: #d4a72c;

  --ph-bg: #1A1A1A;
  --ph-surface: #272727;
  --ph-surface-2: #2F2F2F;

  --ph-text: #FFFFFF;
  --ph-text-2: rgba(255, 255, 255, 0.70);
  --ph-text-3: rgba(255, 255, 255, 0.45);

  --ph-divider: rgba(255, 255, 255, 0.09);
  --ph-divider-light: rgba(255, 255, 255, 0.05);
  --ph-hover: rgba(255, 255, 255, 0.05);

  --ph-internal-bg: rgba(53, 197, 234, 0.10);
  --ph-internal-border: rgba(53, 197, 234, 0.40);
}

/* ═══ KPI STRIP ═══════════════════════════════════════════════════════════
   THE FIX for uneven cards: this is CSS Grid, not MudGrid. Every card is a
   direct grid child, so every card is exactly one column wide and all cards
   in a row are the same height. Do not wrap cards in MudItem.

   Correct markup:
     <div class="ph-kpi-grid">
       <button class="ph-kpi-card ph-kpi-card--clickable" …>…</button>
       … 6 total …
     </div>
   ═══════════════════════════════════════════════════════════════════════ */

.ph-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
  align-items: stretch;      /* equal heights across the row */
  width: 100%;
}

.ph-kpi-card {
  /* fill the grid cell — this is what the screenshot is missing */
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
  min-width: 0;              /* allows shrink below content width */
  height: 100%;
  box-sizing: border-box;

  padding: 15px 16px;
  background: var(--ph-surface);
  border: 1px solid var(--ph-divider);
  border-radius: 8px;

  /* reset when rendered as <button> */
  font: inherit;
  text-align: left;
  appearance: none;
  color: inherit;
  transition: border-color 0.15s ease;
}

.ph-kpi-card--clickable { cursor: pointer; }
.ph-kpi-card--clickable:hover { border-color: var(--ph-primary-light); }
.ph-kpi-card--clickable:focus-visible {
  outline: 2px solid var(--ph-primary);
  outline-offset: 2px;
}

.ph-kpi-card__head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

/* Icon inherits the card's accent colour — set --ph-kpi-color per card */
.ph-kpi-card__icon {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  font-size: 17px;
  line-height: 1;
  color: var(--ph-kpi-color, var(--ph-text-2));
}
.ph-kpi-card__icon svg { width: 17px; height: 17px; display: block; }

.ph-kpi-card__label {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ph-text-2);
  min-width: 0;
  overflow-wrap: anywhere;   /* "OFFLINE / UNAVAILABLE" must not clip */
}

.ph-kpi-card__value {
  font-size: 27px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ph-kpi-color, var(--ph-text));
}

.ph-kpi-card__sub {
  font-size: 11px;
  line-height: 1.35;
  color: var(--ph-text-3);
}

/* Per-card accent. Apply ONE of these alongside .ph-kpi-card. */
.ph-kpi--red     { --ph-kpi-color: var(--ph-red); }
.ph-kpi--cyan    { --ph-kpi-color: var(--ph-primary-dark); }
.ph-kpi--amber   { --ph-kpi-color: var(--ph-amber); }
.ph-kpi--accent  { --ph-kpi-color: var(--ph-accent); }
.ph-kpi--green   { --ph-kpi-color: var(--ph-green); }
.ph-kpi--neutral { --ph-kpi-color: var(--ph-text); }

@media (max-width: 1179px) {
  .ph-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .ph-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .ph-kpi-card__value { font-size: 24px; }
}

/* Admin KPI strip — same card, 4-up */
.ph-kpi-grid--admin { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 767px) {
  .ph-kpi-grid--admin { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Sources KPI strip — 3-up */
.ph-kpi-grid--sources { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 767px) {
  .ph-kpi-grid--sources { grid-template-columns: 1fr; }
}

/* ═══ SURFACES ════════════════════════════════════════════════════════════ */

.ph-card {
  background: var(--ph-surface);
  border: 1px solid var(--ph-divider);
  border-radius: 8px;
  overflow: hidden;
}
.ph-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--ph-divider);
}
.ph-card__title { font-size: 15px; font-weight: 600; }
.ph-card__sub   { font-size: 12.5px; color: var(--ph-text-2); margin-top: 2px; }
.ph-card__body  { padding: 18px 20px; }
.ph-card__foot {
  padding: 10px 18px;
  font-size: 11px;
  color: var(--ph-text-3);
  background: var(--ph-surface-2);
}

/* ═══ PILLS & CHIPS ═══════════════════════════════════════════════════════ */

.ph-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.ph-pill svg { width: 15px; height: 15px; }

.ph-pill--red    { color: var(--ph-red);          background: var(--ph-red-bg); }
.ph-pill--amber  { color: var(--ph-amber);        background: var(--ph-amber-bg); }
.ph-pill--slate  { color: var(--ph-slate);        background: var(--ph-slate-bg); }
.ph-pill--green  { color: var(--ph-green);        background: var(--ph-green-bg); }
.ph-pill--cyan   { color: var(--ph-primary-dark); background: var(--ph-internal-bg); }
.ph-pill--accent { color: var(--ph-accent);       background: var(--ph-amber-bg); }

/* Stratification tiers */
.ph-tier {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ph-tier--top     { color: var(--ph-red);    background: var(--ph-red-bg); }
.ph-tier--middle  { color: var(--ph-amber);  background: var(--ph-amber-bg); }
.ph-tier--bottom  { color: var(--ph-slate);  background: var(--ph-slate-bg); }
.ph-tier--nosales { color: var(--ph-text-3); background: var(--ph-divider); }

/* INTERNAL provenance chip */
.ph-internal-chip {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ph-primary-dark);
  background: var(--ph-internal-bg);
  border: 1px solid var(--ph-internal-border);
}

/* PROMO ACTIVE chip */
.ph-promo-chip {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ph-accent);
  background: var(--ph-amber-bg);
}

/* ═══ STOPLIGHT — binary red/green, ALWAYS with a glyph ═══════════════════ */

.ph-stoplight {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  flex-shrink: 0;
}
.ph-stoplight svg { width: 15px; height: 15px; }
.ph-stoplight--exception { background: var(--ph-red); }
.ph-stoplight--clean     { background: var(--ph-green); }
.ph-stoplight--lg        { width: 24px; height: 24px; }
.ph-stoplight--lg svg    { width: 16px; height: 16px; }
.ph-stoplight--xl        { width: 34px; height: 34px; }
.ph-stoplight--xl svg    { width: 20px; height: 20px; }

/* ═══ STOCK PILL ══════════════════════════════════════════════════════════ */

.ph-stock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.ph-stock::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.ph-stock--in       { color: var(--ph-green); }
.ph-stock--low      { color: var(--ph-amber); }
.ph-stock--out,
.ph-stock--unlisted { color: var(--ph-red); }

/* ═══ RETAILER ACCENT ═════════════════════════════════════════════════════ */

.ph-retailer {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.ph-retailer__swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
  background: var(--ph-retailer-color, var(--ph-text-3));
}
.ph-retailer__name {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ═══ DATA GRID ═══════════════════════════════════════════════════════════
   CSS Grid, not <table>, so column templates stay declarative and rows can
   be anchors/buttons. Set the template on the wrapper via a modifier class.
   ═══════════════════════════════════════════════════════════════════════ */

.ph-grid__head,
.ph-grid__row {
  display: grid;
  gap: 12px;
  align-items: center;
  grid-template-columns: var(--ph-grid-cols);
}
.ph-grid__head {
  padding: 11px 18px;
  background: var(--ph-surface-2);
  border-bottom: 1px solid var(--ph-divider);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ph-text-3);
}
.ph-grid__row {
  padding: 13px 18px;
  border-bottom: 1px solid var(--ph-divider-light);
  cursor: pointer;
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
}
.ph-grid__row:hover { background: var(--ph-hover); }
.ph-grid__row--suppressed { opacity: 0.62; }

/* Column templates — one per screen */
.ph-grid--exceptions { --ph-grid-cols: 44px 1.7fr 0.9fr 0.7fr 0.6fr 1.1fr 1.3fr 1.4fr 0.6fr 40px; }
.ph-grid--products   { --ph-grid-cols: 48px 1.8fr 0.8fr 0.7fr 0.6fr 1fr 1.1fr 1fr 0.8fr 1fr 40px; }
.ph-grid--listings   { --ph-grid-cols: 44px 1.6fr 0.8fr 0.7fr 0.6fr 1.1fr 0.9fr 1fr 0.9fr 1.2fr; }

/* Sortable header cell */
.ph-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}
.ph-sort:hover { color: var(--ph-text-2); }
.ph-sort__icon { width: 14px; height: 14px; opacity: 0.35; }
.ph-sort--active { color: var(--ph-primary-dark); }
.ph-sort--active .ph-sort__icon { opacity: 1; }

/* Primary cell: name over mono meta line */
.ph-cell__name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ph-cell__meta {
  margin-top: 2px;
  font-family: var(--ph-mono);
  font-size: 11px;
  color: var(--ph-text-3);
}
/* Product Code specifically (2026-08-05) — client direction: their team identifies products by
   code, never by name, so wherever a code sits next to a name it needs to actually stand out,
   not read as secondary/faint metadata like .ph-cell__meta. Bigger, bolder, higher-contrast. */
.ph-cell__code {
  margin-top: 2px;
  font-family: var(--ph-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ph-text-2);
}
.ph-cell__expact { font-size: 12px; line-height: 1.45; }
.ph-cell__key    { color: var(--ph-text-3); }
.ph-num          { font-variant-numeric: tabular-nums; }
.ph-mono         { font-family: var(--ph-mono); }

/* Price colouring against goal bounds */
.ph-price--high { color: var(--ph-amber); font-weight: 600; }
.ph-price--low  { color: var(--ph-slate); font-weight: 600; }

/* ═══ MOBILE CARD LIST (replaces grids below 768px) ═══════════════════════ */

.ph-cardlist { display: none; }
@media (max-width: 767px) {
  .ph-grid__head,
  .ph-grid__row { display: none; }
  .ph-cardlist  { display: block; }
}
.ph-cardlist__item {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--ph-divider-light);
  border-left: 3px solid var(--ph-retailer-color, transparent);
  cursor: pointer;
}
.ph-cardlist__top { display: flex; align-items: center; gap: 9px; }
.ph-cardlist__inset {
  padding: 9px 11px;
  border-radius: 6px;
  background: var(--ph-surface-2);
  font-size: 12px;
  line-height: 1.5;
}

/* ═══ FILTER BAR ══════════════════════════════════════════════════════════ */

.ph-filterbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--ph-surface);
  border: 1px solid var(--ph-divider);
  border-radius: 8px;
}
.ph-filterbar__divider { width: 1px; height: 24px; background: var(--ph-divider); }
.ph-filterbar__count {
  margin-left: auto;
  font-family: var(--ph-mono);
  font-size: 12px;
  color: var(--ph-text-3);
}

/* Renamed from .ph-search (2026-08-01) — that class was also used by the AppBar's
   PhSearchAutocomplete (wwwroot/app.css), which forces white input text for its dark cyan
   background via `!important`. Reusing the name here made that rule leak onto this light
   --ph-surface-2 box (later stylesheet, same selector) — white-on-near-white text. Renamed
   so the two never collide again; see app.css's own "Top-nav search" section for the AppBar one. */
.ph-table-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 230px;
  height: 34px;
  padding: 0 12px;
  background: var(--ph-surface-2);
  border: 1px solid var(--ph-divider);
  border-radius: 6px;
}
.ph-table-search:focus-within { border-color: var(--ph-primary); }
.ph-table-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
  color: var(--ph-text);
}

.ph-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  background: var(--ph-surface-2);
  border: 1px solid var(--ph-divider);
  border-radius: 6px;
  cursor: pointer;
}
.ph-select__label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ph-text-3);
}
.ph-select select {
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ph-text);
  cursor: pointer;
  appearance: none;
}

/* Scope toggle (My scope / All owners) */
.ph-scope {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--ph-surface-2);
  border: 1px solid var(--ph-divider);
  color: var(--ph-text);
}
.ph-scope--mine {
  background: var(--ph-internal-bg);
  border-color: var(--ph-primary);
  color: var(--ph-primary-dark);
}

/* ═══ SEGMENTED CONTROL ═══════════════════════════════════════════════════ */

.ph-segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--ph-surface);
  border: 1px solid var(--ph-divider);
  border-radius: 8px;
}
.ph-segmented__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ph-text-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.ph-segmented__btn--active { background: var(--ph-primary); color: #fff; }

/* ═══ PAGER ═══════════════════════════════════════════════════════════════ */

.ph-pager {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-top: 16px;
  background: var(--ph-surface);
  border: 1px solid var(--ph-divider);
  border-radius: 8px;
}
.ph-pager__range { font-family: var(--ph-mono); font-size: 12px; color: var(--ph-text-2); }
.ph-pager__nav   { display: flex; align-items: center; gap: 4px; margin: 0 auto; }
.ph-pager__btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--ph-divider);
  border-radius: 6px;
  background: var(--ph-surface);
  color: var(--ph-text);
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.ph-pager__btn:hover:not(:disabled) { border-color: var(--ph-primary-light); }
.ph-pager__btn--active {
  background: var(--ph-primary);
  border-color: var(--ph-primary);
  color: #fff;
}
.ph-pager__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ph-pager__ellipsis { padding: 0 4px; color: var(--ph-text-3); }

/* ═══ NOTES ═══════════════════════════════════════════════════════════════ */

.ph-note {
  display: flex;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 7px;
  background: var(--ph-surface-2);
  border: 1px solid var(--ph-divider-light);
}
.ph-note__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex-shrink: 0;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  background: var(--ph-avatar-color, var(--ph-slate));
}
.ph-note__head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ph-note__author { font-size: 12.5px; font-weight: 600; }
.ph-note__you {
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ph-primary-dark);
  background: var(--ph-internal-bg);
}
.ph-note__stamp {
  margin-top: 2px;
  font-family: var(--ph-mono);
  font-size: 10.5px;
  color: var(--ph-text-3);
}
.ph-note__body {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* ═══ AUDIT TIMELINE ══════════════════════════════════════════════════════ */

.ph-timeline__item { display: flex; gap: 13px; }
.ph-timeline__rail { display: flex; flex-direction: column; align-items: center; }
.ph-timeline__node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ph-surface-2);
  color: var(--ph-node-color, var(--ph-text-2));
}
.ph-timeline__line { flex: 1 1 auto; width: 2px; margin: 3px 0; background: var(--ph-divider); }
.ph-timeline__item:last-child .ph-timeline__line { display: none; }
.ph-timeline__content { flex: 1 1 auto; padding-bottom: 18px; }
.ph-timeline__action { font-size: 13px; font-weight: 600; }
.ph-timeline__meta { margin-top: 2px; font-size: 11.5px; color: var(--ph-text-2); }
.ph-timeline__values {
  margin-top: 6px;
  padding: 6px 9px;
  border-radius: 5px;
  background: var(--ph-surface-2);
  font-family: var(--ph-mono);
  font-size: 11.5px;
  color: var(--ph-text-2);
}

/* ═══ ATTRIBUTE MATRIX ════════════════════════════════════════════════════ */

.ph-matrix__scroll { overflow-x: auto; }
.ph-matrix {
  border-collapse: collapse;
  width: 100%;
  min-width: 900px;
  font-size: 12.5px;
}
.ph-matrix th,
.ph-matrix td {
  padding: 11px 14px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--ph-divider-light);
}
.ph-matrix thead th {
  background: var(--ph-surface-2);
  border-bottom: 1px solid var(--ph-divider);
}
.ph-matrix thead th:first-child,
.ph-matrix tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
}
.ph-matrix thead th:first-child {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ph-text-3);
}
.ph-matrix tbody th {
  font-weight: 600;
  color: var(--ph-text-2);
  background: var(--ph-surface);
}
.ph-matrix__section > th,
.ph-matrix__section > td { border-top: 1px solid var(--ph-divider); }
.ph-matrix__empty { color: var(--ph-text-3); }

/* ── Retailer columns with an open exception on this product (2026-07-29) ──── */
.ph-matrix th.ph-matrix__col--exception {
  background: var(--ph-red-bg);
  border-bottom: 2px solid var(--ph-red);
}
.ph-matrix td.ph-matrix__col--exception {
  background: color-mix(in srgb, var(--ph-red-bg) 55%, transparent);
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .ph-matrix td.ph-matrix__col--exception { background: var(--ph-red-bg); }
}
.ph-matrix__col-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--ph-red);
  color: #fff;
  flex-shrink: 0;
}
.ph-matrix__col-badge svg { width: 11px; height: 11px; }

/* ── Retailer column picker chrome ──────────────────────────────────────── */
.ph-picker__row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.ph-picker__row:hover { background: var(--ph-hover); }
.ph-picker__shortcut {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--ph-divider);
  border-radius: 6px;
  background: var(--ph-surface-2);
  color: var(--ph-text-2);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.ph-picker__shortcut:hover { border-color: var(--ph-primary-light); color: var(--ph-text); }
.ph-picker__shortcut--accent {
  color: var(--ph-red);
  border-color: var(--ph-red-border);
  background: var(--ph-red-bg);
}

/* ── Column width cap + title wrapping ──────────────────────────────────────
   `display: -webkit-box` (a former "3-line clamp" attempt here) breaks a
   <td>/<th>'s table-cell layout — it takes the cell out of the browser's
   table column-width algorithm entirely, which auto-table-layout uses across
   EVERY row in that column, not just this one. That's what was collapsing
   every column in the whole matrix down to near-zero width (found 2026-08-03,
   reported as "attribute matrix page is screwed up"). white-space: normal +
   overflow-wrap: anywhere already lets a long Title wrap across lines within
   the 190px cap without leaving table-cell layout — no clamp needed. */
.ph-matrix th,
.ph-matrix td { max-width: 190px; }
.ph-matrix tbody tr.ph-matrix__row--wrap td,
.ph-matrix tbody tr.ph-matrix__row--wrap th {
  white-space: normal;
  overflow-wrap: anywhere;
}
.ph-matrix thead th:first-child,
.ph-matrix tbody th {
  max-width: none;
  white-space: nowrap;
}

/* ═══ INTERNAL ROW (listings comparison) ══════════════════════════════════ */

.ph-internal-row {
  background: var(--ph-internal-bg);
  border-left: 3px solid var(--ph-primary);
}

/* ═══ GOAL BOUNDS BAR ═════════════════════════════════════════════════════ */

.ph-goalbar__labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-family: var(--ph-mono);
  font-size: 11px;
  color: var(--ph-text-3);
}
.ph-goalbar__track {
  position: relative;
  height: 10px;
  border-radius: 5px;
  opacity: 0.55;
  background: linear-gradient(90deg,
    var(--ph-slate) 0%, var(--ph-slate) 18%,
    var(--ph-green) 30%, var(--ph-green) 70%,
    var(--ph-amber) 82%, var(--ph-amber) 100%);
}
.ph-goalbar__marker {
  position: absolute;
  top: -20px;
  left: var(--ph-marker-pos, 50%);
  transform: translateX(-50%);
  font-family: var(--ph-mono);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--ph-marker-color, var(--ph-text));
}

/* ═══ EMPTY STATES ════════════════════════════════════════════════════════ */

.ph-empty {
  padding: 56px 20px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ph-text-2);
}
.ph-empty--ok {
  padding: 28px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ph-green);
}

/* ═══ PAGE CHROME ═════════════════════════════════════════════════════════ */

.ph-page {
  max-width: var(--ph-content-max);
  margin: 0 auto;
  padding: 30px 40px 64px;
}
@media (max-width: 1179px) { .ph-page { padding: 24px 24px 60px; } }
@media (max-width: 767px)  { .ph-page { padding: 18px 14px 56px; } }

.ph-page__title {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
@media (max-width: 767px) { .ph-page__title { font-size: 22px; } }

.ph-page__sub {
  margin-bottom: 20px;
  font-size: 13.5px;
  color: var(--ph-text-2);
}
