/* pages.css: login, overview, staples, deals, search, product, orders, settings, 404.
   Built on the shadcn tokens and ui-* primitives in ui.css; everything here is pg-* (plus the
   class names chart.ts and DueMeter emit, which tests pin). No dark-mode selectors: tokens switch. */

/* ---------- page scaffolding ---------- */

.pg-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-top: 24px;
  min-width: 0;
}
.pg-stack .pg-stack {
  padding-top: 0;
}
.pg-stack--sm {
  gap: 12px;
}
.pg-stack--center {
  min-height: 60vh;
  justify-content: center;
}
.pg-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pg-head .ui-page-header {
  margin: 0;
}
.pg-head .ui-page-header__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.pg-head .ui-page-header__description {
  max-width: 44rem;
}
.pg-back {
  align-self: flex-start;
  margin-left: -10px;
  color: var(--muted-foreground);
}
.pg-muted {
  color: var(--muted-foreground);
}
.pg-small {
  font-size: 0.875rem;
  line-height: 1.4286;
}
.pg-ml {
  margin-left: 6px;
}
.pg-code {
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}
.pg-mono {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}
.pg-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.pg-link,
.pg-row-link {
  text-decoration: none;
  font-weight: 500;
}
.pg-link:hover,
.pg-row-link:hover,
.pg-link-title:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.pg-link-title {
  font-weight: 500;
  line-height: 1.375;
  text-decoration: none;
  color: var(--foreground);
}
.pg-count {
  margin-left: 4px;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}
.pg-count-badge {
  margin-left: 6px;
  vertical-align: 2px;
}
.pg-bullets {
  margin: 0;
  padding-left: 18px;
}
.pg-inline {
  display: inline-flex;
  margin: 0;
}
.pg-inline--block {
  display: flex;
  width: 100%;
}
.pg-btn-block {
  width: 100%;
}
.pg-danger {
  color: var(--destructive);
}
.pg-danger:hover {
  color: var(--destructive);
  background: var(--destructive-hover-bg, color-mix(in oklab, var(--destructive) 10%, transparent));
}
.pg-quiet {
  color: var(--muted-foreground);
}
.pg-notice,
.pg-alert {
  margin: 0;
}

/* ---------- cards ---------- */

.pg-card-actions {
  gap: 8px;
  flex-wrap: wrap;
}
.pg-card-tight {
  gap: 16px;
  padding-block: 20px;
}
.pg-card-tight > .ui-card__header,
.pg-card-tight > .ui-card__content,
.pg-card-tight > .ui-card__footer {
  padding-inline: 20px;
}
/* a card whose content is a table or list running edge to edge */
.pg-card-flush {
  gap: 16px;
  padding-bottom: 8px;
}
.pg-card-flush > .ui-table-wrap {
  padding-inline: 16px;
}

/* ---------- badges: shops, verdicts, statuses ---------- */

.pg-shop__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: currentColor;
  flex-shrink: 0;
}
.pg-shop--barbora .pg-shop__dot {
  background: var(--shop-barbora);
}
.pg-shop--rimi .pg-shop__dot {
  background: var(--shop-rimi);
}
.pg-shop {
  gap: 6px;
}
.pg-shop-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.pg-deal {
  background: var(--secondary);
  color: var(--secondary-foreground);
}
.pg-deal--great {
  background: color-mix(in oklab, var(--success) 14%, transparent);
  color: var(--success);
  border-color: color-mix(in oklab, var(--success) 30%, transparent);
}
.pg-deal--lowest {
  background: var(--success);
  color: var(--success-foreground);
}
.pg-incart {
  gap: 4px;
  text-decoration: none;
}
.pg-incart > svg {
  width: 12px;
  height: 12px;
}
.pg-status {
  background: var(--secondary);
  color: var(--secondary-foreground);
}
.pg-status--basic {
  background: var(--primary);
  color: var(--primary-foreground);
}
.pg-status--soon {
  background: var(--warning);
  color: var(--warning-foreground);
}
.pg-status--paused,
.pg-status--snoozed {
  background: transparent;
  border-color: var(--border);
  color: var(--muted-foreground);
}
.pg-badge-warn {
  gap: 4px;
  margin-left: 6px;
  border-color: color-mix(in oklab, var(--destructive) 40%, var(--border));
  color: var(--destructive);
  text-decoration: none;
}
.pg-badge-warn > svg {
  width: 12px;
  height: 12px;
}

/* ---------- product images ---------- */

/* Shop packshots are drawn for white, so the tile stays light in dark mode too. */
.pg-img {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}
.pg-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pg-img--sm {
  width: 40px;
  height: 40px;
  padding: 2px;
}
.pg-img--md {
  width: 56px;
  height: 56px;
  padding: 3px;
}
.pg-img--lg {
  width: 128px;
  height: 128px;
  padding: 8px;
  border-radius: var(--radius-xl);
}
@media (min-width: 640px) {
  .pg-img--lg {
    width: 176px;
    height: 176px;
  }
}
.pg-img--fill {
  width: 100%;
  height: 100%;
  padding: 12px;
  border: 0;
  border-radius: 0;
}
.pg-img--none {
  background: var(--muted);
  color: var(--muted-foreground);
}
.pg-img--none svg {
  width: 40%;
  max-width: 32px;
  height: auto;
  aspect-ratio: 1;
  opacity: 0.6;
}

/* ---------- per-shop prices ---------- */

.pg-offers {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}
.pg-offers--compact {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.pg-offer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.pg-offer .pg-shop-name {
  min-width: 4.75rem;
  color: var(--muted-foreground);
}
.pg-offers--compact .pg-offer .pg-shop-name {
  min-width: 0;
}
.pg-offer__price {
  font-weight: 600;
}
.pg-offer--off .pg-offer__price {
  font-weight: 400;
  color: var(--muted-foreground);
}
.pg-offer__best {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--success);
}

/* ---------- product tile grid (deals, search, overview) ---------- */

.pg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (max-width: 30rem) {
  .pg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}
.pg-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 12px;
}
.pg-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur, 150ms) var(--ease, ease), box-shadow var(--dur, 150ms) var(--ease, ease);
}
.pg-tile:hover {
  border-color: color-mix(in oklab, var(--foreground) 20%, var(--border));
  box-shadow: var(--shadow-md);
}
.pg-tile__media {
  display: block;
  aspect-ratio: 1;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.pg-tile__media .pg-img {
  transition: transform 200ms var(--ease, ease);
}
.pg-tile:hover .pg-tile__media .pg-img {
  transform: scale(1.03);
}
.pg-tile__pct {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--destructive);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.pg-tile__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 4px;
  min-width: 0;
}
.pg-tile__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.pg-tile__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.375;
  text-decoration: none;
}
.pg-tile__title:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.pg-tile__price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 8px;
  margin-top: auto;
}
.pg-price {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.pg-price--lg {
  font-size: 1.875rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.pg-was {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.pg-tile__meta {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted-foreground);
}
.pg-tile__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 10px 10px 12px 14px;
}
.pg-tile__actions .pg-quiet {
  margin-left: auto;
}
@media (max-width: 30rem) {
  .pg-tile__actions .pg-quiet {
    padding-inline: 8px;
  }
  .pg-tile__actions .pg-quiet {
    font-size: 0;
    gap: 0;
  }
}

/* ---------- search / filter bars ---------- */

.pg-searchbar {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.pg-searchbar .ui-input-group {
  flex: 1 1 auto;
}
.pg-searchbar--lg {
  max-width: 40rem;
}
.pg-scope {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.pg-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.pg-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pg-filter__label {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}
.pg-filters .ui-select {
  min-width: 10rem;
}
.pg-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.pg-pager__info {
  padding-inline: 8px;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* ---------- tables ---------- */

.pg-table td,
.pg-table th[scope="row"] {
  vertical-align: middle;
}
.pg-table th[scope="row"] {
  height: auto;
  padding: 8px;
  font-weight: 400;
  color: var(--muted-foreground);
}
.pg-table--compact td,
.pg-table--compact th[scope="row"] {
  padding-block: 6px;
}
.pg-table tfoot th[scope="row"] {
  font-weight: 500;
  color: var(--foreground);
}
.pg-cell-wrap,
.pg-cell-product {
  white-space: normal;
  min-width: 12rem;
}
.pg-cell-offers {
  white-space: normal;
}
.pg-cell-action {
  width: 1%;
}
.pg-product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pg-product-cell__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.pg-row-unmatched {
  background: color-mix(in oklab, var(--destructive) 5%, transparent);
}
.pg-today {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.pg-delta svg {
  width: 14px;
  height: 14px;
}
.pg-delta--down {
  color: var(--success);
}
.pg-delta--up {
  color: var(--destructive);
}

/* ---------- forms ---------- */

.pg-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.pg-form--tight {
  gap: 10px;
}
.pg-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 16px;
}
.pg-form-grid .ui-field {
  gap: 8px;
}
.pg-span-all {
  grid-column: 1 / -1;
}
.pg-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pg-check {
  gap: 8px;
}
.pg-switch-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.pg-switch-row {
  justify-content: space-between;
  padding: 14px 16px;
}
.pg-switch-row + .pg-switch-row {
  border-top: 1px solid var(--border);
}
.pg-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pg-toggles .ui-toggle {
  width: auto;
}
.pg-subcard {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.pg-subcard--warn {
  border-color: color-mix(in oklab, var(--warning) 55%, var(--border));
}
.pg-subcard__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ---------- collapsibles (details/summary styled as ghost buttons) ---------- */

.pg-collapsible > summary {
  list-style: none;
  width: fit-content;
}
.pg-collapsible > summary::-webkit-details-marker {
  display: none;
}
.pg-collapsible__chev {
  transition: transform var(--dur, 150ms) var(--ease, ease);
}
.pg-collapsible[open] .pg-collapsible__chev {
  transform: rotate(90deg);
}
.pg-collapsible[open] > summary {
  margin-bottom: 8px;
}

/* ---------- login ---------- */

/* The login page has no header: let its muted backdrop fill the viewport. */
main:has(> .pg-login) {
  max-width: none;
  padding: 0;
}

.pg-login {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px 16px;
  background: var(--muted);
}
.pg-login__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
}
.pg-login__logo {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: var(--primary-foreground);
}
.pg-login__logo .pg-icon {
  width: 16px;
  height: 16px;
}
.pg-login__card {
  width: 100%;
  max-width: 24rem;
}
.pg-login__title {
  font-size: 1.25rem;
}

/* ---------- overview ---------- */

.pg-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 64rem) {
  .pg-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}
.pg-stat {
  gap: 12px;
  padding-block: 18px;
}
.pg-stat > .ui-card__header,
.pg-stat > .ui-card__footer {
  padding-inline: 18px;
}
.pg-stat__value {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.025em;
}
@media (min-width: 48rem) {
  .pg-stat__value {
    font-size: 1.875rem;
  }
}
.pg-stat__icon {
  color: var(--muted-foreground);
}
.pg-stat__foot {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.pg-stat__foot a {
  text-decoration: none;
}
.pg-stat__foot a:hover {
  color: var(--foreground);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.pg-dash {
  display: grid;
  gap: 24px;
  align-items: start;
}
.pg-dash__main,
.pg-dash__side {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}
@media (min-width: 60rem) {
  .pg-dash {
    grid-template-columns: minmax(0, 1fr) 22rem;
  }
  .pg-dash__side {
    position: sticky;
    top: 80px;
  }
}
.pg-cartcard__total {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.pg-cartcard__notes {
  margin-top: 12px;
}
.pg-due-done {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--muted-foreground);
  font-size: 0.875rem;
  line-height: 1.7;
}
.pg-fresh {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}
.pg-fresh__item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pg-fresh__dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: var(--border);
  flex-shrink: 0;
}
.pg-fresh__item--ok .pg-fresh__dot {
  background: var(--success);
}
.pg-fresh__item--warn .pg-fresh__dot {
  background: var(--warning);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--warning) 25%, transparent);
}

/* ---------- staples ---------- */

.pg-jump {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.pg-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.pg-staple {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
}
.pg-staple__row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px 16px;
  align-items: start;
}
@media (min-width: 48rem) {
  .pg-staple__row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
}
.pg-staple__img {
  display: block;
  border-radius: var(--radius-lg);
}
/* Photos are how a staple is recognised: a roomy tile, like the cart's. */
.pg-staple__img .pg-img {
  width: 64px;
  height: 64px;
  padding: 4px;
  border-radius: var(--radius-lg);
}
@media (min-width: 48rem) {
  .pg-staple__img .pg-img {
    width: 72px;
    height: 72px;
  }
}
.pg-staple__main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.pg-staple__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.pg-staple__gauge {
  display: flex;
  align-items: center;
}
.pg-staple__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  grid-column: 1 / -1;
}
@media (min-width: 48rem) {
  .pg-staple__actions {
    grid-column: auto;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
  }
}
.pg-switch-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pg-switch-label {
  gap: 8px;
  font-weight: 400;
  color: var(--muted-foreground);
  cursor: pointer;
}
/* With htmx the switch posts on change; the fallback submit button is for no-JS only. */
[hx-trigger] > .pg-nojs {
  display: none;
}
.pg-staple__edit {
  margin-top: 8px;
  padding-left: 72px;
}
@media (max-width: 47.99rem) {
  .pg-staple__edit {
    padding-left: 0;
  }
}
.pg-staple__panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in oklab, var(--muted) 50%, transparent);
}
.pg-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.pg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
  margin: 0;
  font-size: 0.8125rem;
}
.pg-meta > div {
  display: flex;
  gap: 4px;
}
.pg-meta dt {
  color: var(--muted-foreground);
}
.pg-meta dt::after {
  content: ":";
}
.pg-meta dd {
  margin: 0;
}

/* due gauge (DueMeter: class names pinned by tests) */
.due {
  display: block;
  width: 128px;
  height: 8px;
}
.due-track {
  fill: var(--muted);
}
.due-fill {
  fill: var(--muted-foreground);
}
.due-basic .due-fill {
  fill: var(--primary);
}
.due-soon .due-fill {
  fill: var(--warning);
}
.due-mark {
  stroke: var(--card);
  stroke-width: 1.5;
}
.due-none {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

/* ---------- orders ---------- */

.pg-month-total {
  font-weight: 600;
}
.pg-grand {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.pg-facts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 12px 24px;
  margin: 0;
}
.pg-facts-row dt {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.pg-facts-row dd {
  margin: 2px 0 0;
  font-weight: 600;
}
.pg-compare b {
  color: var(--foreground);
  font-weight: 600;
}
.pg-import {
  padding-block: 0;
  gap: 0;
}
.pg-import__summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  list-style: none;
  cursor: pointer;
}
.pg-import__summary::-webkit-details-marker {
  display: none;
}
.pg-import__icon {
  display: inline-flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--muted);
}
.pg-import__text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
}
.pg-import__chev {
  color: var(--muted-foreground);
  transition: transform var(--dur, 150ms) var(--ease, ease);
}
.pg-import[open] .pg-import__chev {
  transform: rotate(180deg);
}
.pg-import[open] > form {
  padding-bottom: 24px;
}
.pg-resolve-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}
.pg-resolve-actions {
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}
.pg-resolve-actions .pg-searchbar {
  flex: 1 1 18rem;
}
.pg-cands {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pg-cand-form {
  height: 100%;
}
.pg-cand {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  text-align: left;
  font-size: 0.875rem;
  transition: background-color var(--dur, 150ms) var(--ease, ease), border-color var(--dur, 150ms) var(--ease, ease);
}
.pg-cand:hover {
  background: var(--accent);
  border-color: color-mix(in oklab, var(--foreground) 20%, var(--border));
}
.pg-cand:focus-visible {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px var(--ring-50, color-mix(in oklab, var(--ring) 50%, transparent));
}
.pg-cand__title {
  flex: 1 1 auto;
  line-height: 1.375;
}
.pg-cand__price {
  font-weight: 600;
}

/* ---------- product ---------- */

.pg-product-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
}
.pg-product-head__text {
  display: flex;
  flex: 1 1 18rem;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.pg-product-head__text p {
  margin: 0;
}
.pg-product-head__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.pg-product-grid {
  display: grid;
  gap: 24px;
  align-items: start;
}
@media (min-width: 60rem) {
  .pg-product-grid {
    grid-template-columns: minmax(0, 1fr) 20rem;
  }
}
.pg-price-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 16px;
}
.pg-price-card {
  gap: 16px;
}
.pg-price-card--best {
  border-color: color-mix(in oklab, var(--success) 55%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--success) 35%, transparent), var(--shadow-sm);
}
.pg-price-card__price {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.pg-verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin: 0;
}
.pg-facts {
  display: flex;
  flex-direction: column;
  margin: 0;
  font-size: 0.875rem;
}
.pg-facts > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-block: 6px;
  border-top: 1px solid var(--border);
}
.pg-facts dt {
  color: var(--muted-foreground);
}
.pg-facts dd {
  margin: 0;
  text-align: right;
}
.pg-cart-add {
  display: flex;
  gap: 8px;
}
.pg-cart-add .ui-btn {
  flex: 1 1 auto;
}
.pg-qty {
  width: 4.5rem;
  flex: none;
}
.pg-watch form,
.pg-watch .btn,
.pg-watch button {
  width: 100%;
}

/* ---------- charts (classes emitted by chart.ts; pinned by tests) ---------- */

.pg-chart {
  min-width: 0;
}
.chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-family: var(--font-sans);
}
.chart .grid {
  stroke: var(--border);
  stroke-width: 1;
}
.chart .tick {
  fill: var(--muted-foreground);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.chart .line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .line.s-barbora,
.chart .dot.s-barbora {
  stroke: var(--shop-barbora);
}
.chart .line.s-rimi,
.chart .dot.s-rimi {
  stroke: var(--shop-rimi);
}
.chart .dot {
  fill: var(--card);
  stroke-width: 2;
}
.chart .end-label {
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  paint-order: stroke;
  stroke: var(--card);
  stroke-width: 3px;
  stroke-linejoin: round;
}
.chart .end-label.s-barbora {
  fill: var(--shop-barbora);
}
.chart .end-label.s-rimi {
  fill: var(--shop-rimi);
}
.chart .ref {
  stroke: var(--muted-foreground);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0.7;
}
.chart .ref-label {
  fill: var(--muted-foreground);
  font-size: 10px;
}
.chart .chart-empty {
  fill: var(--muted-foreground);
  font-size: 13px;
}
.chart .bar {
  stroke: none;
}
.chart .bar.s-barbora {
  fill: var(--shop-barbora);
}
.chart .bar.s-rimi {
  fill: var(--shop-rimi);
}
.chart .bar-total {
  fill: var(--foreground);
  font-weight: 600;
}
.chart .mark {
  stroke: var(--card);
  stroke-width: 1.5;
}
.chart .mark.s-barbora {
  fill: var(--shop-barbora);
}
.chart .mark.s-rimi {
  fill: var(--shop-rimi);
}
.bars-sm {
  display: none;
}
@media (max-width: 34rem) {
  .bars-sm {
    display: block;
  }
  .bars-lg {
    display: none;
  }
}
.pg-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin: 12px 0 0;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.pg-legend__extra {
  margin-left: auto;
}
.pg-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pg-key::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--muted-foreground);
}
.pg-key--barbora::before {
  background: var(--shop-barbora);
}
.pg-key--rimi::before {
  background: var(--shop-rimi);
}
.pg-key--ref::before {
  height: 0;
  border-radius: 0;
  border-top: 1.5px dashed var(--muted-foreground);
  background: none;
}
.pg-key--bought::before {
  width: 8px;
  height: 8px;
  background: var(--foreground);
  transform: rotate(45deg);
}

/* ---------- shared legacy hook still used by chat.tsx (#thinking) ---------- */

/* htmx's own indicator styles are off because of the CSP: hidden until a request is in flight. */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: block;
}
