/* --- Side-panel layout ------------------------------------------------------
   Same rules as user-profile.css and mercantile-book.css: each workspace page
   carries its own copy of the sidebar styles rather than sharing a stylesheet. */
.dashboard-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.dashboard-sidebar {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 4px;
  align-content: start;
}

.dashboard-sidebar a {
  display: block;
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.dashboard-sidebar a:hover { background: var(--soft); }

.dashboard-sidebar a:focus-visible {
  outline: 3px solid rgba(0, 168, 138, .26);
  outline-offset: 2px;
}

.dashboard-sidebar a.is-active {
  background: var(--green);
  color: #fff;
}

.dashboard-content { min-width: 0; }

@media (max-width: 900px) {
  .dashboard-shell { grid-template-columns: 1fr; }
  .dashboard-sidebar {
    position: static;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
  }
  .dashboard-sidebar a { white-space: nowrap; }
}

/* --- Page --------------------------------------------------------------------- */
.products-page { display: grid; gap: 20px; }
.products-page:focus { outline: none; }
.products-page > section { display: grid; gap: 20px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.products-heading h1,
.products-detail-heading h1 {
  margin: 4px 0 8px;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.products-lede { margin: 0; color: var(--muted); max-width: 68ch; }
.products-muted { margin: 0; color: var(--muted); }

.products-message {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
}
.products-message.is-error { border-color: #f1c4c4; background: #fff6f6; color: #a12a2a; }

/* Toolbar */
.products-toolbar { display: grid; gap: 12px; }

.products-search input {
  width: 100%;
  max-width: 420px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.products-search input:focus-visible { outline: 3px solid rgba(0, 168, 138, .26); border-color: var(--green); }

.products-filters { display: flex; flex-wrap: wrap; gap: 8px; }

.products-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.products-filter:hover { background: var(--soft); }
.products-filter:focus-visible { outline: 3px solid rgba(0, 168, 138, .26); outline-offset: 2px; }
.products-filter[aria-pressed="true"] { border-color: var(--green); background: var(--green); color: #fff; }
.products-filter-count { font-size: 12px; opacity: .8; }

.products-count { margin: 0; color: var(--muted); font-size: 14px; }

/* Product list */
.products-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.products-none { color: var(--muted); padding: 12px 0; }

.products-card {
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.products-card:hover { border-color: var(--green); box-shadow: 0 6px 20px rgba(13, 37, 43, .06); }
.products-card:focus-visible { outline: 3px solid rgba(0, 168, 138, .26); outline-offset: 2px; }

.products-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.products-card-name { margin: 0; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.products-card-meta { margin: 0; color: var(--muted); font-size: 14px; }

.products-tool-chips { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.products-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
  background: var(--soft);
  font-size: 13px;
}
.products-tool-chip:not(:has(.products-pill)) { padding-right: 12px; }
.products-tool-name { font-weight: 700; }

/* Pills */
.products-pill,
.products-stage-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid transparent;
}
.products-pill.is-good { background: #e3f7ef; border-color: #b6e8d3; color: #0b6b4f; }
.products-pill.is-caution { background: #fff6e3; border-color: #f0d9a2; color: #7a5800; }
.products-pill.is-info { background: #e8f0fc; border-color: #bcd0f0; color: #1d4f91; }
.products-pill.is-bad { background: #fdecec; border-color: #f2c5c5; color: #9c2424; }
.products-pill.is-neutral { background: #eef3f2; border-color: var(--line); color: var(--ink); }
.products-pill.is-none { background: #fff; border-color: var(--line); color: var(--muted); font-weight: 700; }

.products-stage-pill { background: var(--teal-soft); border-color: #bcebe3; color: var(--green-dark); }
.products-stage-pill.is-archived { background: #f1f3f3; border-color: var(--line); color: var(--muted); }

.products-empty h2 { margin-top: 0; }
.products-empty-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 0; }

/* Detail */
.products-back { justify-self: start; font-weight: 700; text-decoration: none; }
.products-back:hover { text-decoration: underline; }

.products-detail-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.products-detail-heading > div { min-width: 0; flex: 1 1 380px; }
.products-meta { margin: 0; color: var(--muted); }

.products-stage { display: grid; gap: 6px; font-weight: 700; font-size: 14px; }
.products-stage select {
  min-height: 42px;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}
.products-stage-status { min-height: 1.2em; color: var(--muted); font-weight: 600; font-size: 13px; }

.products-section-title { margin: 0 0 12px; font-size: 18px; }

.products-latest { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
@media (min-width: 1500px) { .products-latest { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.products-latest-card {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.products-latest-card.is-empty { background: var(--soft); border-style: dashed; }
.products-latest-card h3 { margin: 0; font-size: 15px; }
.products-latest-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.products-latest-headline { margin: 4px 0 0; font-weight: 800; font-size: 16px; }
.products-latest-date { margin: 0; color: var(--muted); font-size: 13px; }

.products-link { font-weight: 700; }

/* Score chart */
.products-chart { padding: 20px; }
.products-chart-svg { width: 100%; height: auto; display: block; }
.products-chart-grid { stroke: var(--line); stroke-width: 1; }
.products-chart-axis { fill: var(--muted); font-size: 11px; }
.products-chart-line { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.products-chart-dot { fill: #fff; stroke: var(--green-dark); stroke-width: 2.5; }
.products-chart-value { fill: var(--ink); font-size: 11px; font-weight: 800; }

/* History timeline */
.products-history { list-style: none; margin: 0; padding: 0 0 0 22px; display: grid; gap: 14px; position: relative; }
.products-history::before {
  content: "";
  position: absolute;
  inset: 6px auto 6px 6px;
  width: 2px;
  background: var(--line);
}

.products-entry {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}
.products-entry::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--green);
}
.products-entry.is-market_opportunity::before { border-color: #3a7bd5; }
.products-entry.is-trend_explorer::before { border-color: #b26ad8; }
.products-entry.is-similar_pricing::before { border-color: #d89b2b; }

.products-entry-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; }
.products-entry-tool { font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--green-dark); }
.products-entry-date { color: var(--muted); }
.products-entry-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.products-entry-headline { margin: 0; font-weight: 800; font-size: 16px; }

.products-facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.products-facts li {
  border-radius: 8px;
  padding: 3px 9px;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .products-card, .products-entry { padding: 14px; }
  .products-card-top { flex-direction: column; }
  .products-stage select { width: 100%; }
}

/* Selecting products to compare */
.products-compare-hint { margin: -8px 0 0; color: var(--muted); font-size: 14px; }

.products-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: stretch; }
.products-select {
  display: grid;
  place-items: center;
  width: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  cursor: pointer;
}
.products-select:hover { border-color: var(--green); }
.products-select-box { width: 20px; height: 20px; accent-color: var(--green); cursor: pointer; }
.products-select-box:disabled { cursor: not-allowed; }
.products-select:has(.products-select-box:disabled) { opacity: .5; cursor: not-allowed; }
.products-row.is-selected .products-card,
.products-row.is-selected .products-select { border-color: var(--green); background: #f6fdfb; }

.products-compare-bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 -8px 24px rgba(13, 37, 43, .08);
}
.products-compare-count { margin: 0; font-weight: 700; }
.products-compare-actions { display: flex; gap: 8px; }
.products-compare-actions .button:disabled { opacity: .5; cursor: not-allowed; }
body:has(.products-compare-bar:not([hidden])) .footer { padding-bottom: 96px; }

/* Scorecard */
.products-scorecard-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.products-scorecard-wrap:focus-visible { outline: 3px solid rgba(0, 168, 138, .26); outline-offset: 2px; }

.products-scorecard { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.products-scorecard th,
.products-scorecard td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.products-scorecard tbody tr:last-child th,
.products-scorecard tbody tr:last-child td { border-bottom: 0; }
.products-scorecard thead th { background: var(--soft); vertical-align: bottom; min-width: 150px; }
.products-scorecard tbody th[scope="row"],
.products-scorecard-corner {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 120px;
  width: 140px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}
.products-scorecard-corner { background: var(--soft); }
.products-scorecard-group th {
  position: sticky;
  left: 0;
  padding-top: 18px;
  background: #fff;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.products-scorecard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.products-scorecard-name { color: var(--ink); font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; text-decoration: none; }
.products-scorecard-name:hover { color: var(--green-dark); text-decoration: underline; }
.products-scorecard-remove {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.products-scorecard-remove:hover { color: #9c2424; border-color: #f2c5c5; }
.products-scorecard-remove:focus-visible { outline: 3px solid rgba(0, 168, 138, .26); outline-offset: 2px; }

.products-scorecard td.is-best { background: #effaf5; font-weight: 800; }
.products-best {
  display: block;
  margin-top: 2px;
  color: #0b6b4f;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.products-scorecard-note { font-size: 13px; }

/* RTL (Arabic) */
[dir="rtl"] .products-history { padding: 0 22px 0 0; }
[dir="rtl"] .products-history::before { inset: 6px 6px 6px auto; }
[dir="rtl"] .products-entry::before { left: auto; right: -22px; }
[dir="rtl"] .products-tool-chip { padding: 4px 12px 4px 6px; }
[dir="rtl"] .products-scorecard th,
[dir="rtl"] .products-scorecard td { text-align: right; }
[dir="rtl"] .products-scorecard tbody th[scope="row"],
[dir="rtl"] .products-scorecard-corner,
[dir="rtl"] .products-scorecard-group th { left: auto; right: 0; }

/* "Research this product" and "Looks like the same product" (UX audit IMP-3). */
.products-research {
  margin-bottom: 20px;
}

.products-research-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.products-merge {
  margin-bottom: 20px;
  padding: 16px 18px;
}

.products-merge-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.products-merge-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}

/* Product decision panel (UX audit IMP-7). */
.products-decision {
  margin-bottom: 20px;
  padding: 18px 20px;
}

.products-decision-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.products-decision-summary {
  margin: 8px 0 14px;
  font-weight: 700;
  line-height: 1.45;
}

.products-decision-rows {
  display: grid;
  grid-template-columns: minmax(150px, max-content) 1fr;
  gap: 8px 16px;
  margin: 0 0 12px;
}

.products-decision-rows dt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.products-decision-rows dd {
  margin: 0;
  line-height: 1.45;
}

.products-decision-rows dd.is-weakest {
  font-weight: 700;
}

.products-decision-next {
  margin: 0 0 8px;
  font-weight: 700;
}

@media (max-width: 640px) {
  .products-decision-rows {
    grid-template-columns: 1fr;
  }
  .products-decision-rows dd {
    margin-bottom: 6px;
  }
}

.products-decision-merge {
  margin: 0 0 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff6e3;
  color: #7a5800;
}
