/*
 * PlusMMR components: reference implementation.
 * Load order: tokens/tokens.css, css/base.css, css/components.css.
 * Rules: tokens only (no literal colours), BEM with the pm- prefix,
 * state through ARIA attributes or is-* classes, mobile first (375 px).
 * Unprefixed custom properties (--dim, --value, --from, --to) are per-instance
 * inputs set inline by the template; they are not design tokens.
 * Contents:
 *   1 Layout primitives  2 Basics  3 Forms  4 Feedback  5 App shell
 *   6 Product  7 Charts  8 Public pages
 */

/* =========================================================================
   1. Layout primitives
   ========================================================================= */

.pm-container {
  width: 100%;
  max-width: var(--pm-app-max);
  margin-inline: auto;
  padding-inline: var(--pm-gutter);
}

.pm-container--site { max-width: calc(var(--pm-site-max) + 2 * var(--pm-gutter)); }
.pm-container--reading { max-width: calc(var(--pm-reading-max) + 2 * var(--pm-gutter)); }

.pm-stack {
  display: flex;
  flex-direction: column;
  gap: var(--pm-space-4);
}

.pm-stack--tight { gap: var(--pm-space-2); }
.pm-stack--loose { gap: var(--pm-space-8); }

.pm-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--pm-space-2);
}

.pm-cluster--between { justify-content: space-between; }

.pm-grid {
  display: grid;
  grid-template-columns: repeat(var(--pm-grid-columns), minmax(0, 1fr));
  gap: var(--pm-grid-gap);
}

.pm-grid > * { grid-column: 1 / -1; }

@media (min-width: 1024px) {
  .pm-grid > .pm-col-4 { grid-column: span 4; }
  .pm-grid > .pm-col-5 { grid-column: span 5; }
  .pm-grid > .pm-col-6 { grid-column: span 6; }
  .pm-grid > .pm-col-7 { grid-column: span 7; }
  .pm-grid > .pm-col-8 { grid-column: span 8; }
}

/* Dimension identity: sets --dim for any descendant mark. */
.pm-dim--laning { --dim: var(--pm-dim-laning); }
.pm-dim--farming { --dim: var(--pm-dim-farming); }
.pm-dim--survival { --dim: var(--pm-dim-survival); }
.pm-dim--fighting { --dim: var(--pm-dim-fighting); }
.pm-dim--vision { --dim: var(--pm-dim-vision); }
.pm-dim--itemization { --dim: var(--pm-dim-itemization); }

.pm-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: var(--pm-radius-xs);
  background: var(--dim, var(--pm-text-tertiary));
  flex-shrink: 0;
}

/* =========================================================================
   2. Basics
   ========================================================================= */

/* ---------- Button ---------- */
.pm-button {
  --_bg: var(--pm-surface-2);
  --_fg: var(--pm-text-primary);
  --_border: var(--pm-border-default);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--pm-space-2);
  height: var(--pm-control-height-md);
  padding: 0 var(--pm-space-4);
  border: var(--pm-border-width) solid var(--_border);
  border-radius: var(--pm-radius-md);
  background: var(--_bg);
  color: var(--_fg);
  font-size: var(--pm-font-size-body);
  font-weight: var(--pm-weight-medium);
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--pm-duration-fast) var(--pm-ease-standard),
              border-color var(--pm-duration-fast) var(--pm-ease-standard),
              color var(--pm-duration-fast) var(--pm-ease-standard);
}

.pm-button:hover { --_bg: var(--pm-surface-3); --_border: var(--pm-border-strong); }
.pm-button:active { --_bg: var(--pm-surface-4); }

.pm-button--primary { --_bg: var(--pm-accent); --_fg: var(--pm-text-on-accent); --_border: var(--pm-accent); font-weight: var(--pm-weight-semibold); }
.pm-button--primary:hover { --_bg: var(--pm-accent-hover); --_border: var(--pm-accent-hover); }
.pm-button--primary:active { --_bg: var(--pm-accent-active); --_border: var(--pm-accent-active); }

.pm-button--ghost { --_bg: transparent; --_fg: var(--pm-text-secondary); --_border: transparent; }
.pm-button--ghost:hover { --_bg: var(--pm-surface-2); --_fg: var(--pm-text-primary); --_border: transparent; }
.pm-button--ghost:active { --_bg: var(--pm-surface-3); }

.pm-button--danger { --_bg: var(--pm-danger-solid); --_fg: var(--pm-text-on-danger); --_border: var(--pm-danger-solid); }
.pm-button--danger:hover { --_bg: var(--pm-danger-solid-hover); --_border: var(--pm-danger-solid-hover); }
.pm-button--danger:active { --_bg: var(--pm-danger-solid-hover); }

.pm-button--sm { height: var(--pm-control-height-sm); padding: 0 var(--pm-space-3); font-size: var(--pm-font-size-small); gap: var(--pm-space-1); }
.pm-button--lg { height: var(--pm-control-height-lg); padding: 0 var(--pm-space-5); }
.pm-button--block { display: flex; width: 100%; }
.pm-button--icon { width: var(--pm-control-height-md); padding: 0; }
.pm-button--icon.pm-button--sm { width: var(--pm-control-height-sm); }

.pm-button:disabled,
.pm-button[aria-disabled="true"] {
  --_bg: var(--pm-surface-2);
  --_fg: var(--pm-text-disabled);
  --_border: var(--pm-surface-2);
  cursor: not-allowed;
}

.pm-button[aria-busy="true"] {
  color: transparent;
  pointer-events: none;
}

.pm-button[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid var(--_fg);
  border-right-color: transparent;
  border-radius: var(--pm-radius-full);
  animation: pm-spin 0.7s linear infinite;
}

/* ---------- Link ---------- */
.pm-link {
  color: var(--pm-text-primary);
  text-decoration: underline;
  text-decoration-color: var(--pm-border-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color var(--pm-duration-fast) var(--pm-ease-standard);
}

.pm-link:hover { text-decoration-color: var(--pm-text-primary); }

.pm-link--quiet {
  color: var(--pm-text-secondary);
  text-decoration-color: transparent;
}

.pm-link--quiet:hover { color: var(--pm-text-primary); text-decoration-color: var(--pm-border-strong); }

.pm-link--external::after {
  content: "\2197";
  margin-left: 2px;
  font-size: 0.85em;
  color: var(--pm-text-tertiary);
}

/* ---------- Badge (status, count) ---------- */
.pm-badge {
  --_bg: var(--pm-surface-2);
  --_fg: var(--pm-text-secondary);
  --_border: var(--pm-border-default);
  display: inline-flex;
  align-items: center;
  gap: var(--pm-space-1);
  height: 22px;
  padding: 0 var(--pm-space-2);
  border: var(--pm-border-width) solid var(--_border);
  border-radius: var(--pm-radius-sm);
  background: var(--_bg);
  color: var(--_fg);
  font-size: var(--pm-font-size-caption);
  line-height: var(--pm-line-height-caption);
  font-weight: var(--pm-weight-medium);
  white-space: nowrap;
}

.pm-badge .pm-icon { width: 14px; height: 14px; stroke-width: 2.4; }

.pm-badge--success { --_bg: var(--pm-success-bg); --_fg: var(--pm-success-fg); --_border: var(--pm-success-border); }
.pm-badge--attention { --_bg: var(--pm-attention-bg); --_fg: var(--pm-attention-fg); --_border: var(--pm-attention-border); }
.pm-badge--danger { --_bg: var(--pm-danger-bg); --_fg: var(--pm-danger-fg); --_border: var(--pm-danger-border); }
.pm-badge--info { --_bg: var(--pm-info-bg); --_fg: var(--pm-info-fg); --_border: var(--pm-info-border); }
.pm-badge--provisional { --_bg: transparent; --_fg: var(--pm-text-secondary); --_border: var(--pm-border-strong); border-style: dashed; }
.pm-badge--pill { border-radius: var(--pm-radius-full); }
.pm-badge--count { min-width: 22px; justify-content: center; padding: 0 6px; border-radius: var(--pm-radius-full); }

/* ---------- Tag (roles, filters, metadata) ---------- */
.pm-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--pm-space-1);
  height: 28px;
  padding: 0 var(--pm-space-2);
  border-radius: var(--pm-radius-sm);
  background: var(--pm-surface-2);
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-size-small);
  white-space: nowrap;
}

.pm-tag__remove {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: calc(-1 * var(--pm-space-1));
  border-radius: var(--pm-radius-xs);
  color: var(--pm-text-tertiary);
}

.pm-tag__remove:hover { background: var(--pm-surface-3); color: var(--pm-text-primary); }
.pm-tag--goal { background: transparent; border: var(--pm-border-width) solid var(--pm-accent-border); color: var(--pm-accent-text); height: 22px; font-size: var(--pm-font-size-caption); }

/* ---------- Tooltip ---------- */
.pm-tooltip {
  position: relative;
  display: inline-flex;
}

.pm-tooltip__bubble {
  position: absolute;
  bottom: calc(100% + var(--pm-space-2));
  left: 50%;
  z-index: var(--pm-z-tooltip);
  width: max-content;
  max-width: 260px;
  padding: var(--pm-space-2) var(--pm-space-3);
  border-radius: var(--pm-radius-md);
  background: var(--pm-tooltip-bg);
  color: var(--pm-tooltip-fg);
  font-size: var(--pm-font-size-small);
  line-height: var(--pm-line-height-small);
  font-weight: var(--pm-weight-regular);
  text-align: left;
  white-space: normal;
  box-shadow: var(--pm-shadow-2);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 4px);
  transition: opacity var(--pm-duration-fast) var(--pm-ease-enter),
              transform var(--pm-duration-fast) var(--pm-ease-enter),
              visibility 0s linear var(--pm-duration-fast);
  pointer-events: none;
}

.pm-tooltip:hover .pm-tooltip__bubble,
.pm-tooltip:focus-within .pm-tooltip__bubble,
.pm-tooltip.is-open .pm-tooltip__bubble {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}

.pm-tooltip__trigger {
  display: inline-grid;
  place-items: center;
  color: var(--pm-text-tertiary);
  border-radius: var(--pm-radius-full);
}

.pm-tooltip__trigger:hover { color: var(--pm-text-primary); }

/* ---------- Tabs ---------- */
.pm-tabs { display: block; min-width: 0; }

.pm-tabs__list {
  display: flex;
  gap: var(--pm-space-1);
  border-bottom: var(--pm-border-width) solid var(--pm-border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
}

.pm-tabs__tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--pm-space-2);
  height: 40px;
  padding: 0 var(--pm-space-3);
  color: var(--pm-text-secondary);
  font-weight: var(--pm-weight-medium);
  white-space: nowrap;
  text-decoration: none;
}

.pm-tabs__tab:hover { color: var(--pm-text-primary); }

.pm-tabs__tab[aria-selected="true"],
.pm-tabs__tab[aria-current="page"] {
  color: var(--pm-text-primary);
}

.pm-tabs__tab[aria-selected="true"]::after,
.pm-tabs__tab[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--pm-space-3);
  right: var(--pm-space-3);
  bottom: -1px;
  height: 2px;
  border-radius: var(--pm-radius-xs);
  background: var(--pm-text-primary);
}

.pm-tabs__tab:disabled { color: var(--pm-text-disabled); }
.pm-tabs__panel { padding-top: var(--pm-space-4); }

/* ---------- Segmented control ---------- */
.pm-segmented {
  display: inline-flex;
  padding: var(--pm-space-half);
  gap: var(--pm-space-half);
  border-radius: var(--pm-radius-md);
  background: var(--pm-surface-2);
  border: var(--pm-border-width) solid var(--pm-border-subtle);
  max-width: 100%;
  overflow-x: auto;
  align-self: flex-start;
}

.pm-segmented__option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 30px;
  padding: 0 var(--pm-space-3);
  border-radius: var(--pm-radius-sm);
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-size-small);
  font-weight: var(--pm-weight-medium);
  white-space: nowrap;
  cursor: pointer;
}

.pm-segmented__option:hover { color: var(--pm-text-primary); }

.pm-segmented__option[aria-checked="true"],
.pm-segmented__option[aria-pressed="true"],
.pm-segmented input:checked + .pm-segmented__option {
  background: var(--pm-control-selected);
  color: var(--pm-text-primary);
  box-shadow: var(--pm-shadow-1);
}

.pm-segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pm-segmented input:focus-visible + .pm-segmented__option {
  outline: var(--pm-focus-width) solid var(--pm-focus-ring);
  outline-offset: 0;
}

.pm-segmented--block { display: flex; align-self: stretch; }
.pm-segmented--block .pm-segmented__option { flex: 1; }

/* ---------- Card ---------- */
.pm-card {
  background: var(--pm-surface-1);
  border: var(--pm-border-width) solid var(--pm-border-default);
  border-radius: var(--pm-radius-lg);
  box-shadow: var(--pm-shadow-1);
  min-width: 0;
}

.pm-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pm-space-3);
  flex-wrap: wrap;
  padding: var(--pm-space-4) var(--pm-space-4) 0;
}

.pm-card__title {
  font-size: var(--pm-font-size-h3);
  line-height: var(--pm-line-height-h3);
  font-weight: var(--pm-weight-semibold);
  letter-spacing: var(--pm-tracking-h3);
}

.pm-card__body { padding: var(--pm-space-4); }

.pm-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pm-space-3);
  flex-wrap: wrap;
  padding: var(--pm-space-3) var(--pm-space-4);
  border-top: var(--pm-border-width) solid var(--pm-border-subtle);
}

@media (min-width: 768px) {
  .pm-card__header { padding: var(--pm-space-5) var(--pm-space-5) 0; }
  .pm-card__body { padding: var(--pm-space-5); }
  .pm-card__footer { padding: var(--pm-space-3) var(--pm-space-5); }
}

.pm-card--flush > .pm-card__body { padding: 0; }
.pm-card--quiet { background: transparent; border-color: transparent; box-shadow: none; }
.pm-card--quiet > .pm-card__header,
.pm-card--quiet > .pm-card__body { padding-inline: 0; }

/* ---------- Divider ---------- */
.pm-divider {
  height: 0;
  margin: var(--pm-space-4) 0;
  border: 0;
  border-top: var(--pm-border-width) solid var(--pm-border-subtle);
}

.pm-divider--vertical {
  align-self: stretch;
  width: 0;
  height: auto;
  margin: 0;
  border-top: 0;
  border-left: var(--pm-border-width) solid var(--pm-border-subtle);
}

.pm-divider--label {
  display: flex;
  align-items: center;
  gap: var(--pm-space-3);
  height: auto;
  border-top: 0;
  color: var(--pm-text-tertiary);
  font-size: var(--pm-font-size-caption);
}

.pm-divider--label::before,
.pm-divider--label::after {
  content: "";
  flex: 1;
  border-top: var(--pm-border-width) solid var(--pm-border-subtle);
}

/* ---------- Avatar ---------- */
.pm-avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--pm-radius-full);
  background: var(--pm-fill-muted);
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-size-caption);
  font-weight: var(--pm-weight-semibold);
  overflow: hidden;
  flex-shrink: 0;
  text-transform: uppercase;
}

.pm-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pm-avatar--sm { width: 24px; height: 24px; font-size: var(--pm-font-size-overline); }
.pm-avatar--lg { width: 48px; height: 48px; font-size: var(--pm-font-size-body); }

/* ---------- Table ---------- */
/* .table-scroll is required by stage 3.4 (tables.spec.ts); keep the exact name. */
.table-scroll,
.pm-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.pm-table {
  width: 100%;
  font-size: var(--pm-font-size-small);
  line-height: var(--pm-line-height-small);
}

.pm-table th {
  padding: var(--pm-space-2) var(--pm-space-3);
  border-bottom: var(--pm-border-width) solid var(--pm-border-default);
  color: var(--pm-text-tertiary);
  font-size: var(--pm-font-size-caption);
  font-weight: var(--pm-weight-medium);
  letter-spacing: var(--pm-tracking-caption);
  text-align: left;
  white-space: nowrap;
}

.pm-table td {
  padding: var(--pm-space-3);
  border-bottom: var(--pm-border-width) solid var(--pm-border-subtle);
  color: var(--pm-text-primary);
  vertical-align: middle;
  white-space: nowrap;
}

.pm-table tbody tr:last-child td { border-bottom: 0; }
.pm-table tbody tr:hover td { background: var(--pm-surface-2); }
.pm-table .pm-table__num { text-align: right; font-variant-numeric: tabular-nums; }
.pm-table .pm-table__muted { color: var(--pm-text-secondary); }
.pm-table .pm-table__wrap { white-space: normal; min-width: 180px; }
.pm-table th:first-child, .pm-table td:first-child { padding-left: var(--pm-space-4); }
.pm-table th:last-child, .pm-table td:last-child { padding-right: var(--pm-space-4); }
.pm-table--dense td { padding-block: var(--pm-space-2); }
.pm-table tr.is-current td { background: var(--pm-surface-2); }
.pm-table td.pm-table__gain { color: var(--pm-accent-text); font-weight: var(--pm-weight-medium); }
.pm-table__result { display: inline-flex; align-items: center; gap: 6px; }
.pm-table caption { caption-side: bottom; padding: var(--pm-space-3) var(--pm-space-4); color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); text-align: left; }

/* ---------- Pagination ---------- */
.pm-pagination {
  display: flex;
  align-items: center;
  gap: var(--pm-space-1);
  flex-wrap: wrap;
}

.pm-pagination__item {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--pm-space-2);
  border-radius: var(--pm-radius-md);
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-size-small);
  text-decoration: none;
  border: var(--pm-border-width) solid transparent;
}

.pm-pagination__item:hover { background: var(--pm-surface-2); color: var(--pm-text-primary); }
.pm-pagination__item[aria-current="page"] { background: var(--pm-surface-2); border-color: var(--pm-border-default); color: var(--pm-text-primary); font-weight: var(--pm-weight-semibold); }
.pm-pagination__item[aria-disabled="true"] { color: var(--pm-text-disabled); pointer-events: none; }
.pm-pagination__gap { min-width: 24px; text-align: center; color: var(--pm-text-tertiary); }
.pm-pagination__summary { margin-left: auto; color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); }

/* =========================================================================
   3. Forms
   ========================================================================= */

.pm-input,
.pm-textarea,
.pm-select select {
  width: 100%;
  min-height: var(--pm-control-height-md);
  padding: 0 var(--pm-space-3);
  border: var(--pm-border-width) solid var(--pm-border-strong);
  border-radius: var(--pm-radius-md);
  background: var(--pm-surface-0);
  color: var(--pm-text-primary);
  font-size: var(--pm-font-size-body);
  line-height: var(--pm-line-height-body);
  transition: border-color var(--pm-duration-fast) var(--pm-ease-standard);
}

.pm-input::placeholder,
.pm-textarea::placeholder { color: var(--pm-text-tertiary); opacity: 1; }

.pm-input:hover,
.pm-textarea:hover,
.pm-select select:hover { border-color: var(--pm-text-tertiary); }

.pm-input:focus-visible,
.pm-textarea:focus-visible,
.pm-select select:focus-visible {
  border-color: var(--pm-focus-ring);
  outline: var(--pm-border-width) solid var(--pm-focus-ring);
  outline-offset: 0;
}

.pm-input[aria-invalid="true"],
.pm-textarea[aria-invalid="true"],
.pm-select select[aria-invalid="true"] { border-color: var(--pm-danger-fg); }

.pm-input:disabled,
.pm-textarea:disabled,
.pm-select select:disabled {
  background: var(--pm-surface-2);
  border-color: var(--pm-border-default);
  color: var(--pm-text-disabled);
  cursor: not-allowed;
}

.pm-textarea {
  min-height: 96px;
  padding: var(--pm-space-2) var(--pm-space-3);
  resize: vertical;
}

.pm-select { position: relative; display: block; }

.pm-select select {
  appearance: none;
  padding-right: var(--pm-space-10);
  cursor: pointer;
}

.pm-select::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -6px;
  border-right: 1.5px solid var(--pm-text-secondary);
  border-bottom: 1.5px solid var(--pm-text-secondary);
  transform: rotate(45deg);
  pointer-events: none;
}

/* Checkbox and radio: checked state uses the primary text colour, not green. */
.pm-checkbox,
.pm-radio {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--pm-space-3);
  cursor: pointer;
  color: var(--pm-text-primary);
}

.pm-checkbox__input,
.pm-radio__input {
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  border: 1.5px solid var(--pm-border-strong);
  background: var(--pm-surface-0);
  cursor: pointer;
  transition: background-color var(--pm-duration-fast) var(--pm-ease-standard), border-color var(--pm-duration-fast) var(--pm-ease-standard);
}

.pm-checkbox__input { border-radius: var(--pm-radius-sm); }
.pm-radio__input { border-radius: var(--pm-radius-full); }

.pm-checkbox__input:hover,
.pm-radio__input:hover { border-color: var(--pm-text-secondary); }

.pm-checkbox__input:checked {
  background: var(--pm-text-primary);
  border-color: var(--pm-text-primary);
}

.pm-checkbox__input:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border-right: 2px solid var(--pm-text-inverse);
  border-bottom: 2px solid var(--pm-text-inverse);
  transform: rotate(45deg);
}

.pm-radio__input:checked { border-color: var(--pm-text-primary); border-width: 5px; background: var(--pm-surface-0); }

.pm-checkbox__input[aria-invalid="true"] { border-color: var(--pm-danger-fg); }

.pm-checkbox__input:disabled,
.pm-radio__input:disabled { border-color: var(--pm-border-default); background: var(--pm-surface-2); cursor: not-allowed; }

.pm-checkbox__input:disabled + .pm-checkbox__label,
.pm-radio__input:disabled + .pm-radio__label { color: var(--pm-text-disabled); }

.pm-checkbox__label,
.pm-radio__label { font-size: var(--pm-font-size-body); line-height: var(--pm-line-height-body); }

.pm-checkbox__hint { display: block; color: var(--pm-text-tertiary); font-size: var(--pm-font-size-small); line-height: var(--pm-line-height-small); }

/* Switch: on = primary text colour track, so ten switches do not paint the screen green. */
.pm-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--pm-space-3);
  cursor: pointer;
}

.pm-switch__input {
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  margin: 0;
  border-radius: var(--pm-radius-full);
  border: 1.5px solid var(--pm-border-strong);
  background: var(--pm-surface-2);
  cursor: pointer;
  transition: background-color var(--pm-duration-base) var(--pm-ease-standard), border-color var(--pm-duration-base) var(--pm-ease-standard);
}

.pm-switch__input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: var(--pm-radius-full);
  background: var(--pm-text-secondary);
  transition: transform var(--pm-duration-base) var(--pm-ease-standard), background-color var(--pm-duration-base) var(--pm-ease-standard);
}

.pm-switch__input:checked { background: var(--pm-text-primary); border-color: var(--pm-text-primary); }
.pm-switch__input:checked::after { transform: translateX(16px); background: var(--pm-surface-0); }
.pm-switch__input:disabled { opacity: 0.45; cursor: not-allowed; }
.pm-switch__label { color: var(--pm-text-primary); }

/* Settings list of switches */
.pm-switch-list > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--pm-space-4);
  padding: var(--pm-space-3) 0;
  border-bottom: var(--pm-border-width) solid var(--pm-border-subtle);
}

.pm-switch-list > li:last-child { border-bottom: 0; }

/* ---------- Form field ---------- */
.pm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  border: 0;
  padding: 0;
  margin: 0;
}

.pm-field__label {
  display: flex;
  align-items: baseline;
  gap: var(--pm-space-2);
  color: var(--pm-text-primary);
  font-size: var(--pm-font-size-small);
  line-height: var(--pm-line-height-small);
  font-weight: var(--pm-weight-medium);
  padding: 0;
}

.pm-field__optional { color: var(--pm-text-tertiary); font-weight: var(--pm-weight-regular); }

.pm-field__hint,
.pm-field__error {
  font-size: var(--pm-font-size-small);
  line-height: var(--pm-line-height-small);
}

.pm-field__hint { color: var(--pm-text-tertiary); }

.pm-field__error {
  display: flex;
  gap: 6px;
  color: var(--pm-danger-fg);
}

.pm-field__error .pm-icon { width: 16px; height: 16px; margin-top: 1px; stroke-width: 2.25; }

legend.pm-field__label { margin-bottom: 6px; }
.pm-field__options { display: flex; flex-direction: column; gap: var(--pm-space-2); }

/* =========================================================================
   4. Feedback
   ========================================================================= */

/* ---------- Modal ---------- */
.pm-modal {
  position: fixed;
  inset: 0;
  z-index: var(--pm-z-modal);
  display: grid;
  place-items: end center;
  padding: var(--pm-space-4);
}

@media (min-width: 768px) {
  .pm-modal { place-items: center; }
}

.pm-modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--pm-backdrop);
}

.pm-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100% - var(--pm-space-8));
  overflow: auto;
  border: var(--pm-border-width) solid var(--pm-border-default);
  border-radius: var(--pm-radius-xl);
  background: var(--pm-surface-3);
  box-shadow: var(--pm-shadow-3);
  animation: pm-rise var(--pm-duration-base) var(--pm-ease-enter);
}

.pm-modal__header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--pm-space-3); padding: var(--pm-space-5) var(--pm-space-5) 0; }
.pm-modal__title { font-size: var(--pm-font-size-h3); line-height: var(--pm-line-height-h3); font-weight: var(--pm-weight-semibold); }
.pm-modal__body { padding: var(--pm-space-3) var(--pm-space-5) var(--pm-space-5); color: var(--pm-text-secondary); }
.pm-modal__footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--pm-space-2); padding: var(--pm-space-4) var(--pm-space-5); border-top: var(--pm-border-width) solid var(--pm-border-subtle); }

/* In-page rendering for documentation */
.pm-modal--static { position: relative; inset: auto; z-index: auto; min-height: 280px; padding: var(--pm-space-8) var(--pm-space-4); border-radius: var(--pm-radius-lg); overflow: hidden; }
.pm-modal--static .pm-modal__dialog { max-height: none; }

/* ---------- Toast ---------- */
.pm-toast-region {
  position: fixed;
  right: var(--pm-space-4);
  bottom: calc(var(--pm-bottomnav-height) + var(--pm-space-4));
  left: var(--pm-space-4);
  z-index: var(--pm-z-toast);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--pm-space-2);
  pointer-events: none;
}

@media (min-width: 1024px) {
  .pm-toast-region { left: auto; bottom: var(--pm-space-6); right: var(--pm-space-6); }
}

.pm-toast {
  --_icon: var(--pm-text-secondary);
  display: flex;
  align-items: flex-start;
  gap: var(--pm-space-3);
  width: 100%;
  max-width: 400px;
  padding: var(--pm-space-3) var(--pm-space-3) var(--pm-space-3) var(--pm-space-4);
  border: var(--pm-border-width) solid var(--pm-border-default);
  border-radius: var(--pm-radius-lg);
  background: var(--pm-surface-4);
  box-shadow: var(--pm-shadow-2);
  pointer-events: auto;
  animation: pm-rise var(--pm-duration-base) var(--pm-ease-enter);
}

.pm-toast > .pm-icon { color: var(--_icon); margin-top: 1px; }
.pm-toast--success { --_icon: var(--pm-success-fg); }
.pm-toast--attention { --_icon: var(--pm-attention-fg); }
.pm-toast--danger { --_icon: var(--pm-danger-fg); }
.pm-toast--info { --_icon: var(--pm-info-fg); }
.pm-toast__content { flex: 1; min-width: 0; }
.pm-toast__title { font-weight: var(--pm-weight-medium); }
.pm-toast__body { color: var(--pm-text-secondary); font-size: var(--pm-font-size-small); line-height: var(--pm-line-height-small); }
.pm-toast__close { color: var(--pm-text-secondary); border-radius: var(--pm-radius-sm); padding: 2px; }
.pm-toast__close:hover { color: var(--pm-text-primary); background: var(--pm-surface-3); }

/* ---------- Banner ---------- */
.pm-banner {
  --_bg: var(--pm-surface-2);
  --_border: var(--pm-border-default);
  --_icon: var(--pm-text-secondary);
  display: flex;
  align-items: flex-start;
  gap: var(--pm-space-3);
  padding: var(--pm-space-3) var(--pm-space-4);
  border: var(--pm-border-width) solid var(--_border);
  border-radius: var(--pm-radius-md);
  background: var(--_bg);
  color: var(--pm-text-primary);
}

.pm-banner > .pm-icon { color: var(--_icon); margin-top: 1px; }
.pm-banner__content { flex: 1; min-width: 0; }
.pm-banner__title { font-weight: var(--pm-weight-semibold); }
.pm-banner__text { color: var(--pm-text-primary); }
.pm-banner__actions { display: flex; gap: var(--pm-space-2); flex-wrap: wrap; margin-top: var(--pm-space-2); }
.pm-banner--info { --_bg: var(--pm-info-bg); --_border: var(--pm-info-border); --_icon: var(--pm-info-fg); }
.pm-banner--attention { --_bg: var(--pm-attention-bg); --_border: var(--pm-attention-border); --_icon: var(--pm-attention-fg); }
.pm-banner--danger { --_bg: var(--pm-danger-bg); --_border: var(--pm-danger-border); --_icon: var(--pm-danger-fg); }
.pm-banner--success { --_bg: var(--pm-success-bg); --_border: var(--pm-success-border); --_icon: var(--pm-success-fg); }

/* ---------- Skeleton ---------- */
.pm-skeleton {
  display: block;
  height: 12px;
  border-radius: var(--pm-radius-sm);
  background: var(--pm-fill-muted);
  animation: pm-pulse 1.6s var(--pm-ease-standard) infinite;
}

.pm-skeleton--title { height: 20px; width: 40%; }
.pm-skeleton--num { height: 28px; width: 56px; }
.pm-skeleton--block { height: 64px; border-radius: var(--pm-radius-md); }
.pm-skeleton--circle { width: 32px; height: 32px; border-radius: var(--pm-radius-full); }

/* ---------- Spinner ---------- */
.pm-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--pm-border-default);
  border-top-color: var(--pm-text-secondary);
  border-radius: var(--pm-radius-full);
  animation: pm-spin 0.8s linear infinite;
  flex-shrink: 0;
}

.pm-spinner--lg { width: 24px; height: 24px; }

/* ---------- Progress bar ---------- */
.pm-progress {
  position: relative;
  height: 6px;
  border-radius: var(--pm-radius-full);
  background: var(--pm-fill-muted);
  overflow: hidden;
}

.pm-progress__bar {
  height: 100%;
  width: calc(var(--value, 0) * 1%);
  border-radius: inherit;
  background: var(--pm-text-secondary);
  transition: width var(--pm-duration-slow) var(--pm-ease-standard);
}

.pm-progress--accent .pm-progress__bar { background: var(--pm-accent-fill); }
.pm-progress--lg { height: 8px; }

.pm-progress--indeterminate .pm-progress__bar {
  width: 35%;
  animation: pm-indeterminate 1.4s var(--pm-ease-standard) infinite;
}

.pm-progress-label {
  display: flex;
  justify-content: space-between;
  gap: var(--pm-space-3);
  flex-wrap: wrap;
  margin-bottom: var(--pm-space-2);
  font-size: var(--pm-font-size-small);
  color: var(--pm-text-secondary);
}

.pm-progress-label > * { white-space: nowrap; }

/* ---------- Empty state (also the StateBlock container) ---------- */
.pm-empty {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--pm-space-2) var(--pm-space-4);
  align-items: start;
  padding: var(--pm-space-6) var(--pm-space-4);
}

@media (min-width: 768px) {
  .pm-empty { padding: var(--pm-space-8) var(--pm-space-6); }
}

.pm-empty__icon {
  grid-row: span 3;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--pm-radius-md);
  background: var(--pm-surface-2);
  color: var(--pm-text-secondary);
}

.pm-empty__title { font-size: var(--pm-font-size-h3); line-height: var(--pm-line-height-h3); font-weight: var(--pm-weight-semibold); }
.pm-empty__text { color: var(--pm-text-secondary); max-width: 52ch; }
.pm-empty__actions { display: flex; gap: var(--pm-space-2); flex-wrap: wrap; margin-top: var(--pm-space-2); }
.pm-empty--error .pm-empty__icon { background: var(--pm-danger-bg); color: var(--pm-danger-fg); }
.pm-empty--pending .pm-empty__icon { background: var(--pm-info-bg); color: var(--pm-info-fg); }

/* =========================================================================
   5. App shell
   ========================================================================= */

.pm-logo {
  display: inline-flex;
  align-items: center;
  color: var(--pm-logo-text);
  text-decoration: none;
}

.pm-logo svg { height: 22px; width: auto; }
.pm-logo__plus { fill: var(--logo-accent, var(--pm-logo-accent)); }
.pm-logo__mmr { fill: var(--logo-text, var(--pm-logo-text)); }
.pm-logo--mark svg { height: 24px; }

.pm-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-height: 100%;
  background: var(--pm-surface-0);
}

.pm-shell__main {
  min-width: 0;
  padding: var(--pm-space-5) var(--pm-gutter) calc(var(--pm-bottomnav-height) + var(--pm-space-8));
}

.pm-shell__content { max-width: var(--pm-app-max); margin-inline: auto; }

@media (min-width: 1024px) {
  .pm-shell { grid-template-columns: var(--pm-sidenav-width) minmax(0, 1fr); grid-template-rows: 1fr; }
  .pm-shell > .pm-topbar,
  .pm-shell > .pm-bottomnav { display: none; }
  .pm-shell__main { padding: var(--pm-space-8) var(--pm-gutter) var(--pm-space-16); }
}

/* ---------- Top bar (mobile and tablet) ---------- */
.pm-topbar {
  position: sticky;
  top: 0;
  z-index: var(--pm-z-sticky);
  display: flex;
  align-items: center;
  gap: var(--pm-space-3);
  height: var(--pm-topbar-height);
  padding: 0 var(--pm-gutter);
  border-bottom: var(--pm-border-width) solid var(--pm-border-subtle);
  background: var(--pm-surface-0);
}

.pm-topbar__actions { margin-left: auto; display: flex; align-items: center; gap: var(--pm-space-3); }

/* ---------- Side navigation (desktop >= 1024) ---------- */
.pm-sidenav {
  display: none;
}

@media (min-width: 1024px) {
  .pm-sidenav {
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: var(--pm-space-6);
    min-height: 100vh;
    padding: var(--pm-space-5) var(--pm-space-3);
    border-right: var(--pm-border-width) solid var(--pm-border-subtle);
    background: var(--pm-surface-0);
  }
}

.pm-sidenav__brand { padding: var(--pm-space-1) var(--pm-space-3); }

.pm-sidenav__account {
  display: flex;
  align-items: center;
  gap: var(--pm-space-3);
  padding: var(--pm-space-2) var(--pm-space-3);
  border-radius: var(--pm-radius-md);
  background: var(--pm-surface-1);
  border: var(--pm-border-width) solid var(--pm-border-subtle);
}

.pm-sidenav__account-name { font-weight: var(--pm-weight-medium); font-size: var(--pm-font-size-small); line-height: var(--pm-line-height-small); }
.pm-sidenav__account-meta { color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); line-height: var(--pm-line-height-caption); }
.pm-sidenav__list { display: flex; flex-direction: column; gap: var(--pm-space-half); }
.pm-sidenav__section { padding: 0 var(--pm-space-3) var(--pm-space-1); }

.pm-sidenav__item {
  display: flex;
  align-items: center;
  gap: var(--pm-space-3);
  height: 36px;
  padding: 0 var(--pm-space-3);
  border-radius: var(--pm-radius-md);
  color: var(--pm-text-secondary);
  font-weight: var(--pm-weight-medium);
  text-decoration: none;
}

.pm-sidenav__item .pm-icon { color: var(--pm-text-tertiary); }
.pm-sidenav__item:hover { background: var(--pm-surface-1); color: var(--pm-text-primary); }
.pm-sidenav__item[aria-current="page"] { background: var(--pm-surface-2); color: var(--pm-text-primary); }
.pm-sidenav__item[aria-current="page"] .pm-icon { color: var(--pm-text-primary); }
.pm-sidenav__item .pm-badge { margin-left: auto; }
.pm-sidenav__footer { padding: 0 var(--pm-space-3); }

/* ---------- Bottom navigation (mobile < 1024) ---------- */
.pm-bottomnav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--pm-z-nav);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(var(--pm-bottomnav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: var(--pm-border-width) solid var(--pm-border-default);
  background: var(--pm-surface-1);
}

.pm-bottomnav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--pm-space-1);
  color: var(--pm-text-tertiary);
  font-size: var(--pm-font-size-overline);
  line-height: var(--pm-line-height-overline);
  font-weight: var(--pm-weight-medium);
  text-decoration: none;
}

.pm-bottomnav__item[aria-current="page"] { color: var(--pm-text-primary); }
.pm-bottomnav--static { position: relative; }

/* ---------- Page header ---------- */
.pm-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--pm-space-4);
  margin-bottom: var(--pm-space-6);
}

.pm-page-header__text { display: flex; flex-direction: column; gap: var(--pm-space-1); min-width: 0; }
.pm-page-header__title { font-size: var(--pm-font-size-h1); line-height: var(--pm-line-height-h1); letter-spacing: var(--pm-tracking-h1); font-weight: var(--pm-weight-semibold); }

.pm-page-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--pm-space-1) var(--pm-space-3);
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-size-small);
  line-height: var(--pm-line-height-small);
}

.pm-page-header__meta > :not(:last-child)::after {
  content: "\00B7";
  margin-left: var(--pm-space-3);
  color: var(--pm-text-tertiary);
}

.pm-page-header__actions { display: flex; gap: var(--pm-space-2); flex-wrap: wrap; }

/* ---------- Sync status ---------- */
.pm-sync {
  --_dot: var(--pm-success-fg);
  display: inline-flex;
  align-items: center;
  gap: var(--pm-space-2);
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-size-small);
  line-height: var(--pm-line-height-small);
}

.pm-sync__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--pm-radius-full);
  background: var(--_dot);
  flex-shrink: 0;
}

.pm-sync--syncing .pm-sync__dot { background: transparent; border: 2px solid var(--pm-info-fg); border-right-color: transparent; width: 12px; height: 12px; animation: pm-spin 0.9s linear infinite; }
.pm-sync--stale { --_dot: var(--pm-attention-fg); }
.pm-sync--error { --_dot: var(--pm-danger-fg); }
.pm-sync__action { color: var(--pm-text-primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--pm-border-strong); }

/* =========================================================================
   6. Product components
   ========================================================================= */

/* ---------- Skill list and skill row ----------
   Rows respond to the list's own width (container query), so the same
   component works in a full-width panel, a side column and on a phone. */
.pm-skill-list { container-type: inline-size; }

.pm-skill-list__head {
  display: none;
  color: var(--pm-text-tertiary);
  font-size: var(--pm-font-size-caption);
  line-height: var(--pm-line-height-caption);
}

.pm-skill {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name score"
    "track track"
    "meta meta";
  gap: var(--pm-space-2) var(--pm-space-4);
  align-items: center;
  padding: var(--pm-space-4);
  border-top: var(--pm-border-width) solid var(--pm-border-subtle);
}

.pm-skill:first-child { border-top: 0; }

@container (min-width: 520px) {
  .pm-skill-list__head,
  .pm-skill {
    display: grid;
    grid-template-columns: minmax(120px, 1.1fr) 92px minmax(140px, 2fr) minmax(150px, 1fr);
    grid-template-areas: "name score track meta";
    gap: var(--pm-space-4);
    padding: var(--pm-space-3) var(--pm-space-5);
  }
  .pm-skill { min-height: 68px; }
  .pm-skill-list__head { padding-top: var(--pm-space-3); padding-bottom: var(--pm-space-2); border-bottom: var(--pm-border-width) solid var(--pm-border-subtle); }
  .pm-skill-list__head + .pm-skill { border-top: 0; }
  .pm-skill-list__head > :nth-child(4) { display: none; }
}

@container (min-width: 760px) {
  .pm-skill-list__head,
  .pm-skill {
    grid-template-columns: minmax(140px, 1.1fr) 96px minmax(180px, 2fr) 112px minmax(170px, 1fr);
    grid-template-areas: "name score track spark meta";
    gap: var(--pm-space-5);
  }
  .pm-skill-list__head > :nth-child(4) { display: block; }
}

.pm-skill-list__head > :nth-child(2) { text-align: left; }
.pm-skill-list__scale { display: flex; justify-content: space-between; }

.pm-skill__name { grid-area: name; display: flex; align-items: center; gap: var(--pm-space-3); min-width: 0; }
.pm-skill__label { font-weight: var(--pm-weight-semibold); }
.pm-skill__sub { display: block; color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); line-height: var(--pm-line-height-caption); }

.pm-skill__score {
  grid-area: score;
  display: flex;
  align-items: baseline;
  gap: var(--pm-space-1);
  justify-self: end;
  white-space: nowrap;
}

@container (min-width: 520px) {
  .pm-skill__score { justify-self: start; }
}

.pm-skill__value {
  font-size: var(--pm-font-size-num-lg);
  line-height: var(--pm-line-height-num-lg);
  letter-spacing: var(--pm-tracking-num);
  font-weight: var(--pm-weight-semibold);
}

.pm-skill__unc { color: var(--pm-text-secondary); font-size: var(--pm-font-size-body); }

/* Interval track: 0..100, median of the rank at 50, band = S +- U */
.pm-skill__track {
  grid-area: track;
  position: relative;
  height: 20px;
}

.pm-skill__track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: var(--pm-radius-xs);
  background: var(--pm-fill-muted);
}

.pm-skill__median {
  position: absolute;
  left: 50%;
  top: 3px;
  bottom: 3px;
  width: 1px;
  background: var(--pm-text-tertiary);
}

.pm-skill__band {
  position: absolute;
  top: 50%;
  height: 8px;
  margin-top: -4px;
  left: calc(var(--from) * 1%);
  width: calc((var(--to) - var(--from)) * 1%);
  border-radius: var(--pm-radius-full);
  background: var(--dim);
  opacity: var(--pm-dim-band-opacity);
}

.pm-skill__point {
  position: absolute;
  top: 50%;
  left: calc(var(--value) * 1%);
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: var(--pm-radius-full);
  background: var(--dim);
  box-shadow: 0 0 0 2px var(--pm-surface-1);
}

.pm-skill__spark { grid-area: spark; display: none; }

@container (min-width: 760px) {
  .pm-skill__spark { display: block; }
}

.pm-skill__meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--pm-space-1) var(--pm-space-2);
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-size-caption);
  line-height: var(--pm-line-height-caption);
}

@container (min-width: 520px) {
  .pm-skill__meta { flex-direction: column; align-items: flex-start; gap: var(--pm-space-1); }
}

.pm-skill__delta { color: var(--pm-text-secondary); white-space: nowrap; }
.pm-skill__delta strong { color: var(--pm-text-primary); font-weight: var(--pm-weight-semibold); }

.pm-skill--preliminary .pm-skill__value { color: var(--pm-text-secondary); }
.pm-skill--preliminary .pm-skill__band { opacity: calc(var(--pm-dim-band-opacity) * 0.7); }
.pm-skill--preliminary .pm-skill__point { background: var(--pm-surface-1); box-shadow: inset 0 0 0 2px var(--dim), 0 0 0 2px var(--pm-surface-1); }

.pm-skill--hidden .pm-skill__value,
.pm-skill--na .pm-skill__value { color: var(--pm-text-tertiary); }
.pm-skill--hidden .pm-skill__track::before { background: transparent; border-top: 2px dotted var(--pm-fill-muted); height: 0; }
.pm-skill--hidden .pm-skill__median { opacity: 0.5; }
.pm-skill--na .pm-skill__label { color: var(--pm-text-secondary); }
.pm-skill--na .pm-swatch { background: transparent; box-shadow: inset 0 0 0 1.5px var(--pm-border-strong); }
.pm-skill--na .pm-skill__track { display: none; }

.pm-skill__state {
  display: inline-flex;
  align-items: center;
  gap: var(--pm-space-1);
  color: var(--pm-text-tertiary);
  font-size: var(--pm-font-size-small);
}

.pm-skill__state .pm-icon { width: 16px; height: 16px; stroke-width: 2.25; }

/* ---------- Metric comparison row (inside .pm-metric-list) ---------- */
.pm-metric-list { container-type: inline-size; }

.pm-metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "name value"
    "track track"
    "note note";
  gap: var(--pm-space-2) var(--pm-space-4);
  padding: var(--pm-space-3) 0;
  border-top: var(--pm-border-width) solid var(--pm-border-subtle);
}

.pm-metric:first-child { border-top: 0; }

@container (min-width: 520px) {
  .pm-metric {
    grid-template-columns: minmax(120px, 1.2fr) 112px minmax(130px, 2fr) minmax(96px, 0.9fr);
    grid-template-areas: "name value track note";
    align-items: center;
    gap: var(--pm-space-4);
  }
}

.pm-metric__name { grid-area: name; min-width: 0; }
.pm-metric__unit { display: block; color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); line-height: var(--pm-line-height-caption); }
.pm-metric__value { grid-area: value; text-align: right; font-size: var(--pm-font-size-h3); font-weight: var(--pm-weight-semibold); white-space: nowrap; }

@container (min-width: 520px) {
  .pm-metric__value { text-align: left; }
}

.pm-metric__cohort { display: block; color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); line-height: var(--pm-line-height-caption); font-weight: var(--pm-weight-regular); }
.pm-metric__track { grid-area: track; position: relative; height: 24px; }

.pm-metric__rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  height: 8px;
  border-radius: var(--pm-radius-full);
  background: var(--pm-div-mid);
}

.pm-metric__fill {
  position: absolute;
  top: 8px;
  height: 8px;
  background: var(--pm-div-below-2);
}

.pm-metric--below .pm-metric__fill { left: calc(var(--value) * 1%); right: 50%; border-radius: var(--pm-radius-full) 0 0 var(--pm-radius-full); }
.pm-metric--above .pm-metric__fill { left: 50%; right: calc(100% - var(--value) * 1%); background: var(--pm-div-above-2); border-radius: 0 var(--pm-radius-full) var(--pm-radius-full) 0; }

.pm-metric__median {
  position: absolute;
  left: 50%;
  top: 4px;
  width: 2px;
  height: 16px;
  margin-left: -1px;
  border-radius: var(--pm-radius-xs);
  background: var(--pm-text-secondary);
}

.pm-metric__marker {
  position: absolute;
  top: 6px;
  left: calc(var(--value) * 1%);
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: var(--pm-radius-full);
  background: var(--pm-text-primary);
  box-shadow: 0 0 0 2px var(--pm-surface-1);
}

.pm-metric__note { grid-area: note; color: var(--pm-text-secondary); font-size: var(--pm-font-size-small); line-height: var(--pm-line-height-small); }

/* ---------- Mastery dots: "3 из 5" ---------- */
.pm-mastery {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--pm-space-2) var(--pm-space-3);
}

.pm-mastery__dots { display: inline-flex; gap: 6px; }

.pm-mastery__dot {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: var(--pm-radius-full);
  border: 2px dashed var(--pm-check-pending);
}

.pm-mastery__dot--pass { border: 0; background: var(--pm-check-pass); }
.pm-mastery__dot--miss { border: 2px solid var(--pm-check-miss); }

.pm-mastery__dot--miss::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 2px;
  margin: -1px 0 0 -3px;
  border-radius: var(--pm-radius-xs);
  background: var(--pm-check-miss);
}

.pm-mastery__dot--inline { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; }
.pm-mastery__dot--inline.pm-mastery__dot--miss::after { width: 5px; margin-left: -2.5px; }
.pm-mastery--lg .pm-mastery__dots { gap: var(--pm-space-2); }
.pm-mastery--lg .pm-mastery__dot { width: 22px; height: 22px; }
.pm-mastery--lg .pm-mastery__dot--miss::after { width: 10px; margin-left: -5px; }
.pm-mastery__label { font-weight: var(--pm-weight-semibold); white-space: nowrap; }
.pm-mastery__hint { color: var(--pm-text-secondary); font-size: var(--pm-font-size-small); }

/* ---------- Goal card ---------- */
.pm-goal {
  display: flex;
  flex-direction: column;
  gap: var(--pm-space-5);
  padding: var(--pm-space-5) var(--pm-space-4);
  border: var(--pm-border-width) solid var(--pm-border-default);
  border-radius: var(--pm-radius-lg);
  background: var(--pm-surface-1);
  box-shadow: var(--pm-shadow-1);
}

@media (min-width: 768px) {
  .pm-goal { padding: var(--pm-space-6); }
}

.pm-goal__top { display: flex; align-items: center; justify-content: space-between; gap: var(--pm-space-3); flex-wrap: wrap; }
.pm-goal__skill { display: inline-flex; align-items: center; gap: var(--pm-space-2); color: var(--pm-text-secondary); font-size: var(--pm-font-size-small); }

.pm-goal__title {
  font-size: var(--pm-font-size-h2);
  line-height: var(--pm-line-height-h2);
  letter-spacing: var(--pm-tracking-h2);
  font-weight: var(--pm-weight-semibold);
  text-wrap: balance;
}

.pm-goal__figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: var(--pm-border-width) solid var(--pm-border-subtle);
  border-bottom: var(--pm-border-width) solid var(--pm-border-subtle);
}

.pm-goal__figure { padding: var(--pm-space-3) var(--pm-space-3) var(--pm-space-3) 0; }
.pm-goal__figure + .pm-goal__figure { padding-left: var(--pm-space-3); border-left: var(--pm-border-width) solid var(--pm-border-subtle); }
.pm-goal__figure-label { display: block; color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); line-height: var(--pm-line-height-caption); }

.pm-goal__figure-value {
  display: block;
  font-size: var(--pm-font-size-num-lg);
  line-height: var(--pm-line-height-num-lg);
  letter-spacing: var(--pm-tracking-num);
  font-weight: var(--pm-weight-semibold);
  white-space: nowrap;
}

.pm-goal__figure-value small { display: block; font-size: var(--pm-font-size-caption); line-height: var(--pm-line-height-caption); color: var(--pm-text-tertiary); font-weight: var(--pm-weight-regular); letter-spacing: 0; white-space: normal; }
.pm-goal__progress { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--pm-space-3); }
.pm-goal__meta { color: var(--pm-text-secondary); font-size: var(--pm-font-size-small); }
.pm-goal__actions { display: flex; align-items: center; gap: var(--pm-space-2) var(--pm-space-3); flex-wrap: wrap; }

.pm-goal--proposed { border-style: dashed; border-color: var(--pm-border-strong); }
.pm-goal--mastered { border-color: var(--pm-accent-border); }
.pm-goal--expired .pm-goal__title,
.pm-goal--expired .pm-goal__figure-value { color: var(--pm-text-secondary); }

.pm-goal--compact { gap: var(--pm-space-4); padding: var(--pm-space-4); }
.pm-goal--compact .pm-goal__title { font-size: var(--pm-font-size-h3); line-height: var(--pm-line-height-h3); }

/* ---------- Goal evaluation row (inside .pm-eval-list) ---------- */
.pm-eval-list { container-type: inline-size; }

.pm-eval {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  grid-template-areas:
    "icon match xp"
    "icon value xp";
  gap: 0 var(--pm-space-3);
  align-items: center;
  padding: var(--pm-space-3) 0;
  border-top: var(--pm-border-width) solid var(--pm-border-subtle);
}

.pm-eval:first-child { border-top: 0; }

@container (min-width: 560px) {
  .pm-eval {
    grid-template-columns: 24px minmax(140px, 1.4fr) minmax(120px, 1fr) minmax(130px, 1fr) 72px;
    grid-template-areas: "icon match value result xp";
  }
}

.pm-eval__icon {
  grid-area: icon;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: var(--pm-radius-full);
}

.pm-eval__icon .pm-icon { width: 14px; height: 14px; stroke-width: 2.6; }
.pm-eval--pass .pm-eval__icon { background: var(--pm-check-pass); color: var(--pm-text-on-accent); }
.pm-eval--miss .pm-eval__icon { box-shadow: inset 0 0 0 2px var(--pm-check-miss); color: var(--pm-check-miss); }
.pm-eval--pending .pm-eval__icon { box-shadow: inset 0 0 0 2px var(--pm-check-pending); color: var(--pm-text-tertiary); }
.pm-eval__match { grid-area: match; min-width: 0; font-size: var(--pm-font-size-small); }
.pm-eval__hero { font-weight: var(--pm-weight-medium); font-size: var(--pm-font-size-body); }
.pm-eval__date { color: var(--pm-text-tertiary); margin-left: var(--pm-space-2); }
.pm-eval__value { grid-area: value; font-size: var(--pm-font-size-small); color: var(--pm-text-secondary); white-space: nowrap; }
.pm-eval__value strong { color: var(--pm-text-primary); font-size: var(--pm-font-size-body); }
.pm-eval__result { grid-area: result; display: none; font-size: var(--pm-font-size-small); white-space: nowrap; }

@container (min-width: 560px) {
  .pm-eval__result { display: block; }
}

.pm-eval--pass .pm-eval__result { color: var(--pm-text-primary); }
.pm-eval--miss .pm-eval__result { color: var(--pm-text-secondary); }
.pm-eval__attain { color: var(--pm-text-tertiary); margin-left: var(--pm-space-1); }
.pm-eval__xp { grid-area: xp; text-align: right; font-weight: var(--pm-weight-semibold); white-space: nowrap; }
.pm-eval__xp--gain { color: var(--pm-accent-text); }
.pm-eval__xp--none { color: var(--pm-text-tertiary); font-weight: var(--pm-weight-regular); }

/* ---------- Level badge and XP bar ---------- */
.pm-level {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: var(--pm-border-width-strong) solid var(--pm-accent-border);
  border-radius: var(--pm-radius-md);
  background: var(--pm-accent-subtle);
  flex-shrink: 0;
}

.pm-level__label { color: var(--pm-accent-text); font-size: 10px; line-height: 12px; font-weight: var(--pm-weight-semibold); letter-spacing: var(--pm-tracking-overline); text-transform: uppercase; }
.pm-level__value { font-size: 20px; line-height: 22px; font-weight: var(--pm-weight-bold); letter-spacing: var(--pm-tracking-num); }

.pm-xp {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--pm-space-2) var(--pm-space-4);
  align-items: center;
}

.pm-xp__body { display: flex; flex-direction: column; gap: var(--pm-space-2); min-width: 0; }
.pm-xp__row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 var(--pm-space-3); font-size: var(--pm-font-size-small); }
.pm-xp__row > * { white-space: nowrap; }
.pm-xp__total { font-weight: var(--pm-weight-semibold); font-size: var(--pm-font-size-body); }
.pm-xp__next { color: var(--pm-text-tertiary); }
.pm-xp__gain { color: var(--pm-accent-text); font-weight: var(--pm-weight-medium); }

.pm-xp__bar {
  height: 8px;
  border-radius: var(--pm-radius-full);
  background: var(--pm-fill-muted);
  overflow: hidden;
}

.pm-xp__fill {
  height: 100%;
  width: calc(var(--value) * 1%);
  border-radius: inherit;
  background: var(--pm-accent-fill);
}

/* ---------- Match list row ---------- */
.pm-match-list { container-type: inline-size; }

.pm-match {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "hero"
    "meta"
    "status";
  gap: var(--pm-space-1) var(--pm-space-4);
  align-items: center;
  padding: var(--pm-space-3) var(--pm-space-4);
  border-bottom: var(--pm-border-width) solid var(--pm-border-subtle);
  color: inherit;
  text-decoration: none;
}

.pm-match:hover { background: var(--pm-surface-2); }
.pm-match:last-child { border-bottom: 0; }

@container (min-width: 680px) {
  .pm-match {
    grid-template-columns: minmax(170px, 1.4fr) 96px 112px 64px minmax(200px, 1.6fr);
    grid-template-areas: "hero result time duration status";
    padding: var(--pm-space-3) var(--pm-space-5);
  }
}

.pm-match__hero { grid-area: hero; display: flex; align-items: baseline; gap: var(--pm-space-2); min-width: 0; }
.pm-match__hero-name { font-weight: var(--pm-weight-semibold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-match__role { color: var(--pm-text-tertiary); font-size: var(--pm-font-size-small); white-space: nowrap; }

.pm-match__meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--pm-space-2);
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-size-small);
}

.pm-match__result,
.pm-match__time,
.pm-match__duration { display: none; font-size: var(--pm-font-size-small); white-space: nowrap; }

@container (min-width: 680px) {
  .pm-match__meta { display: none; }
  .pm-match__result { grid-area: result; display: block; }
  .pm-match__time { grid-area: time; display: block; color: var(--pm-text-secondary); }
  .pm-match__duration { grid-area: duration; display: block; color: var(--pm-text-secondary); text-align: right; }
}

.pm-match__result--win { color: var(--pm-text-primary); }
.pm-match__result--loss { color: var(--pm-text-secondary); }
.pm-match__status { grid-area: status; display: flex; flex-wrap: wrap; gap: var(--pm-space-1); margin-top: var(--pm-space-1); }

@container (min-width: 680px) {
  .pm-match__status { margin-top: 0; }
}

/* ---------- Coaching report ---------- */
.pm-report { display: flex; flex-direction: column; gap: var(--pm-space-5); }
.pm-report__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--pm-space-3); flex-wrap: wrap; }
.pm-report__source { color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); }
.pm-report__findings { display: flex; flex-direction: column; counter-reset: pm-finding; }

.pm-report__finding {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: var(--pm-space-2) var(--pm-space-3);
  padding: var(--pm-space-4) 0;
  border-top: var(--pm-border-width) solid var(--pm-border-subtle);
  counter-increment: pm-finding;
}

.pm-report__finding:first-child { border-top: 0; padding-top: 0; }

.pm-report__finding::before {
  content: counter(pm-finding);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: var(--pm-border-width) solid var(--pm-border-strong);
  border-radius: var(--pm-radius-full);
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-size-caption);
  font-weight: var(--pm-weight-semibold);
}

.pm-report__finding-body { display: flex; flex-direction: column; gap: var(--pm-space-2); min-width: 0; }
.pm-report__finding-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pm-space-2); color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); }
.pm-report__text { max-width: 68ch; }
.pm-report__evidence { display: flex; flex-wrap: wrap; gap: var(--pm-space-1); }

.pm-report__plan {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pm-space-3);
}

@media (min-width: 768px) {
  .pm-report__plan { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.pm-report__plan-item {
  padding: var(--pm-space-4);
  border-radius: var(--pm-radius-md);
  background: var(--pm-surface-2);
}

.pm-report__plan-item .pm-overline { display: block; margin-bottom: var(--pm-space-1); }

/* Evidence timestamp chip */
.pm-timechip {
  display: inline-flex;
  align-items: center;
  gap: var(--pm-space-1);
  height: 24px;
  padding: 0 var(--pm-space-2);
  border: var(--pm-border-width) solid var(--pm-border-default);
  border-radius: var(--pm-radius-sm);
  background: var(--pm-surface-2);
  color: var(--pm-text-primary);
  font-family: var(--pm-font-mono);
  font-size: var(--pm-font-size-caption);
  white-space: nowrap;
  text-decoration: none;
}

.pm-timechip:hover { border-color: var(--pm-border-strong); }
.pm-timechip__kind { font-family: var(--pm-font-sans); color: var(--pm-text-tertiary); }

/* Feedback: полезно / не полезно */
.pm-feedback { display: flex; flex-direction: column; gap: var(--pm-space-3); padding-top: var(--pm-space-4); border-top: var(--pm-border-width) solid var(--pm-border-subtle); }
.pm-feedback__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pm-space-2) var(--pm-space-3); }
.pm-feedback__question { color: var(--pm-text-secondary); font-size: var(--pm-font-size-small); margin-right: var(--pm-space-1); }
.pm-feedback .pm-button[aria-pressed="true"] { --_bg: var(--pm-control-selected); --_border: var(--pm-text-secondary); --_fg: var(--pm-text-primary); }
.pm-feedback__thanks { display: flex; align-items: center; gap: var(--pm-space-2); color: var(--pm-text-secondary); font-size: var(--pm-font-size-small); }

/* ---------- Weekly review ---------- */
.pm-review { display: flex; flex-direction: column; gap: var(--pm-space-5); }
.pm-review__head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: var(--pm-space-2); }
.pm-review__period { color: var(--pm-text-tertiary); font-size: var(--pm-font-size-small); }

.pm-review__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: var(--pm-border-width) solid var(--pm-border-subtle);
  border-radius: var(--pm-radius-md);
  background: var(--pm-border-subtle);
  overflow: hidden;
}

@media (min-width: 768px) {
  .pm-review__stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.pm-review__stat { padding: var(--pm-space-3) var(--pm-space-4); background: var(--pm-surface-1); }
.pm-review__stat-value { display: block; font-size: var(--pm-font-size-num-lg); line-height: var(--pm-line-height-num-lg); letter-spacing: var(--pm-tracking-num); font-weight: var(--pm-weight-semibold); }
.pm-review__stat-value--gain { color: var(--pm-accent-text); }
.pm-review__stat-label { display: block; color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); line-height: var(--pm-line-height-caption); }
.pm-review__changes > li { display: flex; align-items: center; gap: var(--pm-space-3); padding: var(--pm-space-2) 0; border-bottom: var(--pm-border-width) solid var(--pm-border-subtle); font-size: var(--pm-font-size-small); }
.pm-review__changes > li:last-child { border-bottom: 0; }
.pm-review__change-name { flex: 1; }
.pm-review__change-delta { color: var(--pm-text-secondary); white-space: nowrap; }

.pm-review__next {
  display: flex;
  gap: var(--pm-space-3);
  align-items: flex-start;
  padding: var(--pm-space-4);
  border-radius: var(--pm-radius-md);
  background: var(--pm-surface-2);
}

/* ---------- Stepper (onboarding, import) ---------- */
.pm-stepper { display: flex; flex-direction: column; }

.pm-stepper__step {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--pm-space-4);
  padding-bottom: var(--pm-space-6);
}

.pm-stepper__step:last-child { padding-bottom: 0; }

.pm-stepper__step::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 28px;
  bottom: 4px;
  width: 2px;
  border-radius: var(--pm-radius-xs);
  background: var(--pm-border-default);
}

.pm-stepper__step:last-child::before { display: none; }
.pm-stepper__step--done::before { background: var(--pm-accent-border); }

.pm-stepper__marker {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: var(--pm-radius-full);
  border: 2px solid var(--pm-border-default);
  color: var(--pm-text-tertiary);
  font-size: var(--pm-font-size-caption);
  font-weight: var(--pm-weight-semibold);
  background: var(--pm-surface-1);
}

.pm-stepper__marker .pm-icon { width: 14px; height: 14px; stroke-width: 2.6; }
.pm-stepper__step--done .pm-stepper__marker { border-color: var(--pm-accent); background: var(--pm-accent); color: var(--pm-text-on-accent); }
.pm-stepper__step--current .pm-stepper__marker { border-color: var(--pm-text-primary); color: var(--pm-text-primary); }
.pm-stepper__body { display: flex; flex-direction: column; gap: var(--pm-space-1); min-width: 0; padding-top: 2px; }
.pm-stepper__title { font-weight: var(--pm-weight-semibold); }
.pm-stepper__step--pending .pm-stepper__title { color: var(--pm-text-secondary); font-weight: var(--pm-weight-medium); }
.pm-stepper__step--done .pm-stepper__title { color: var(--pm-text-secondary); font-weight: var(--pm-weight-medium); }
.pm-stepper__text { color: var(--pm-text-secondary); font-size: var(--pm-font-size-small); line-height: var(--pm-line-height-small); }
.pm-stepper__extra { margin-top: var(--pm-space-3); }

/* ---------- Private profile notice ---------- */
.pm-notice {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pm-space-4);
  padding: var(--pm-space-5) var(--pm-space-4);
  border: var(--pm-border-width) solid var(--pm-border-default);
  border-radius: var(--pm-radius-lg);
  background: var(--pm-surface-1);
}

@media (min-width: 768px) {
  .pm-notice { grid-template-columns: 40px minmax(0, 1fr); padding: var(--pm-space-6); gap: var(--pm-space-5); }
}

.pm-notice__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--pm-radius-md); background: var(--pm-attention-bg); color: var(--pm-attention-fg); }
.pm-notice__body { display: flex; flex-direction: column; gap: var(--pm-space-3); }
.pm-notice__title { font-size: var(--pm-font-size-h3); line-height: var(--pm-line-height-h3); font-weight: var(--pm-weight-semibold); }
.pm-notice__text { color: var(--pm-text-secondary); max-width: 60ch; }
.pm-notice__steps { counter-reset: pm-notice; display: flex; flex-direction: column; gap: var(--pm-space-2); }

.pm-notice__steps > li {
  counter-increment: pm-notice;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--pm-space-2);
  font-size: var(--pm-font-size-small);
}

.pm-notice__steps > li::before {
  content: counter(pm-notice) ".";
  color: var(--pm-text-tertiary);
  font-variant-numeric: tabular-nums;
}

.pm-notice__path { font-weight: var(--pm-weight-medium); }

/* ---------- Pro hint (quiet paywall) ---------- */
.pm-paywall {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pm-space-4);
  padding: var(--pm-space-4);
  border: var(--pm-border-width) dashed var(--pm-border-strong);
  border-radius: var(--pm-radius-lg);
}

@media (min-width: 768px) {
  .pm-paywall { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: var(--pm-space-5); }
}

.pm-paywall__label { display: inline-flex; align-items: center; gap: var(--pm-space-2); }
.pm-paywall__title { font-weight: var(--pm-weight-semibold); margin-top: var(--pm-space-1); }
.pm-paywall__text { color: var(--pm-text-secondary); font-size: var(--pm-font-size-small); line-height: var(--pm-line-height-small); max-width: 64ch; margin-top: var(--pm-space-1); }
.pm-paywall__aside { display: flex; flex-direction: column; align-items: flex-start; gap: var(--pm-space-2); }

@media (min-width: 768px) {
  .pm-paywall__aside { align-items: flex-end; text-align: right; }
}

.pm-paywall__price { color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); }

/* ---------- Leaderboard row (inside .pm-leader-list) ---------- */
.pm-leader-list { container-type: inline-size; }

.pm-leader {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  grid-template-areas:
    "place who ip"
    "place meta ip";
  gap: 0 var(--pm-space-3);
  align-items: center;
  padding: var(--pm-space-3) var(--pm-space-4);
  border-bottom: var(--pm-border-width) solid var(--pm-border-subtle);
}

@container (min-width: 600px) {
  .pm-leader {
    grid-template-columns: 40px minmax(180px, 2fr) minmax(90px, 1fr) minmax(90px, 1fr) 96px;
    grid-template-areas: "place who meta goals ip";
    padding: var(--pm-space-3) var(--pm-space-5);
  }
}

.pm-leader__place { grid-area: place; color: var(--pm-text-tertiary); font-weight: var(--pm-weight-semibold); }
.pm-leader__who { grid-area: who; display: flex; align-items: center; gap: var(--pm-space-3); min-width: 0; }
.pm-leader__name { font-weight: var(--pm-weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-leader__meta { grid-area: meta; color: var(--pm-text-secondary); font-size: var(--pm-font-size-small); white-space: nowrap; }
.pm-leader__goals { grid-area: goals; display: none; color: var(--pm-text-secondary); font-size: var(--pm-font-size-small); }

@container (min-width: 600px) {
  .pm-leader__goals { display: block; }
}

.pm-leader__ip { grid-area: ip; text-align: right; font-weight: var(--pm-weight-semibold); }
.pm-leader__ip small { display: block; color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); font-weight: var(--pm-weight-regular); }
.pm-leader.is-me { background: var(--pm-surface-2); }
.pm-leader--head { color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); padding-block: var(--pm-space-2); }
.pm-leader__gap { padding: var(--pm-space-1) var(--pm-space-4); color: var(--pm-text-tertiary); border-bottom: var(--pm-border-width) solid var(--pm-border-subtle); }
.pm-leader--head .pm-leader__place,
.pm-leader--head .pm-leader__ip { font-weight: var(--pm-weight-medium); }

/* ---------- Share card: 1200x630, fixed brand colours (the PNG has no theme) ---------- */
.pm-sharecard {
  container-type: inline-size;
  position: relative;
  width: 100%;
  aspect-ratio: 1200 / 630;
  overflow: hidden;
  border-radius: var(--pm-radius-md);
  background: var(--pm-brand-ink);
  color: var(--pm-brand-paper);
  font-family: var(--pm-font-sans);
}

.pm-sharecard__inner {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  padding: 5.33cqw;
  gap: 2cqw 4cqw;
}

.pm-sharecard__logo { grid-column: 1; height: 3cqw; --logo-accent: var(--pm-brand-green); --logo-text: var(--pm-brand-paper); }
.pm-sharecard__logo svg { height: 100%; width: auto; }
.pm-sharecard__date { grid-column: 2; justify-self: end; color: var(--pm-brand-muted); font-size: 1.67cqw; }
.pm-sharecard__main { grid-column: 1 / -1; align-self: center; display: flex; flex-direction: column; gap: 1.5cqw; }
.pm-sharecard__kicker { color: var(--pm-brand-green); font-size: 1.67cqw; font-weight: var(--pm-weight-semibold); letter-spacing: 0.06em; text-transform: uppercase; }
.pm-sharecard__title { font-size: 4.67cqw; line-height: 1.12; font-weight: var(--pm-weight-bold); letter-spacing: -0.02em; max-width: 80%; }
.pm-sharecard__skill { color: var(--pm-brand-muted); font-size: 2cqw; }
.pm-sharecard__facts { display: flex; gap: 4cqw; margin-top: 1.5cqw; }
.pm-sharecard__fact-value { display: block; font-size: 3.33cqw; font-weight: var(--pm-weight-semibold); letter-spacing: -0.02em; line-height: 1.1; }
.pm-sharecard__fact-label { display: block; color: var(--pm-brand-muted); font-size: 1.5cqw; margin-top: 0.5cqw; }
.pm-sharecard__dots { display: flex; gap: 0.9cqw; align-items: center; height: 3.67cqw; }
.pm-sharecard__dot { width: 2.33cqw; height: 2.33cqw; border-radius: var(--pm-radius-full); border: 0.25cqw solid var(--pm-brand-muted); }
.pm-sharecard__dot--pass { background: var(--pm-brand-green); border-color: var(--pm-brand-green); }
.pm-sharecard__foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; border-top: 0.1cqw solid var(--pm-brand-muted); padding-top: 2cqw; font-size: 1.83cqw; }
.pm-sharecard__name { font-weight: var(--pm-weight-semibold); }
.pm-sharecard__domain { color: var(--pm-brand-muted); }

/* =========================================================================
   7. Charts
   ========================================================================= */

.pm-chart { display: flex; flex-direction: column; gap: var(--pm-space-3); min-width: 0; }
.pm-chart__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--pm-space-3); flex-wrap: wrap; }
.pm-chart__title { font-weight: var(--pm-weight-semibold); }
.pm-chart__legend { display: flex; flex-wrap: wrap; gap: var(--pm-space-1) var(--pm-space-4); color: var(--pm-text-secondary); font-size: var(--pm-font-size-caption); }
.pm-chart__key { display: inline-flex; align-items: center; gap: 6px; }
.pm-chart__key-line { width: 16px; height: 2px; background: var(--dim, var(--pm-chart-bar)); border-radius: var(--pm-radius-xs); }
.pm-chart__key-dash { width: 16px; height: 0; border-top: 2px dashed var(--pm-chart-baseline); }
.pm-chart__key-band { width: 16px; height: 8px; border-radius: var(--pm-radius-xs); background: var(--dim); opacity: var(--pm-dim-band-opacity); }
.pm-chart svg { width: 100%; height: auto; overflow: visible; }
.pm-chart__grid { stroke: var(--pm-chart-grid); stroke-width: 1; }
.pm-chart__axis { stroke: var(--pm-chart-axis); stroke-width: 1; }
.pm-chart__label { fill: var(--pm-chart-label); font-size: 12px; font-family: var(--pm-font-sans); }
.pm-chart__label--end { text-anchor: end; }
.pm-chart__label--mid { text-anchor: middle; }
.pm-chart__label--strong { fill: var(--pm-text-primary); font-weight: var(--pm-weight-semibold); }
.pm-chart__line { fill: none; stroke: var(--dim, var(--pm-chart-bar)); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pm-chart__band { fill: var(--dim, var(--pm-chart-bar)); opacity: var(--pm-dim-band-opacity); }
.pm-chart__baseline { stroke: var(--pm-chart-baseline); stroke-width: 1.5; stroke-dasharray: 4 4; fill: none; vector-effect: non-scaling-stroke; }
.pm-chart__dot { fill: var(--dim, var(--pm-chart-bar)); stroke: var(--pm-surface-1); stroke-width: 2; }
.pm-chart__dot--hollow { fill: var(--pm-surface-1); stroke: var(--dim, var(--pm-chart-bar)); }
.pm-chart__table { margin-top: var(--pm-space-2); }
.pm-chart__note { color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); line-height: var(--pm-line-height-caption); }

.pm-chart__tooltip {
  position: absolute;
  z-index: var(--pm-z-tooltip);
  padding: var(--pm-space-2) var(--pm-space-3);
  border: var(--pm-border-width) solid var(--pm-border-default);
  border-radius: var(--pm-radius-md);
  background: var(--pm-surface-4);
  box-shadow: var(--pm-shadow-2);
  font-size: var(--pm-font-size-small);
  line-height: var(--pm-line-height-small);
  pointer-events: none;
}

/* Sparkline inside a skill row */
.pm-spark { width: 100%; max-width: 132px; height: 32px; overflow: visible; }
.pm-spark__line { fill: none; stroke: var(--dim); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.pm-spark__base { stroke: var(--pm-chart-baseline); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.pm-spark__end { fill: var(--dim); }

/* Rank distribution bar chart (HTML bars, table fallback for screen readers) */
.pm-distribution { display: flex; flex-direction: column; gap: var(--pm-space-3); }

.pm-distribution__plot {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--bars, 8), minmax(0, 1fr));
  gap: var(--pm-space-1);
  align-items: end;
  height: 200px;
  padding-top: var(--pm-space-5);
  border-bottom: var(--pm-border-width) solid var(--pm-chart-axis);
  background-image: linear-gradient(to top, var(--pm-chart-grid) 1px, transparent 1px);
  background-size: 100% 25%;
}

.pm-distribution__bar {
  position: relative;
  height: calc(var(--value) * 1%);
  min-height: 2px;
  border-radius: var(--pm-radius-sm) var(--pm-radius-sm) 0 0;
  background: var(--pm-chart-bar);
}

.pm-distribution__bar:hover { background: var(--pm-chart-highlight); }

.pm-distribution__value {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  text-align: center;
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-size-caption);
  line-height: var(--pm-line-height-caption);
  white-space: nowrap;
}

.pm-distribution__labels {
  display: grid;
  grid-template-columns: repeat(var(--bars, 8), minmax(0, 1fr));
  gap: var(--pm-space-1);
  color: var(--pm-chart-label);
  font-size: var(--pm-font-size-caption);
  line-height: var(--pm-line-height-caption);
  text-align: center;
}

.pm-distribution__labels > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =========================================================================
   8. Public pages (Twig)
   ========================================================================= */

.pm-site-header {
  position: sticky;
  top: 0;
  z-index: var(--pm-z-sticky);
  border-bottom: var(--pm-border-width) solid var(--pm-border-subtle);
  background: var(--pm-surface-0);
}

.pm-site-header__inner { display: flex; align-items: center; gap: var(--pm-space-6); height: 64px; }
.pm-site-header__nav { display: none; gap: var(--pm-space-5); }

@media (min-width: 1024px) {
  .pm-site-header__nav { display: flex; }
  .pm-site-header__menu { display: none; }
}

.pm-site-header__nav a { color: var(--pm-text-secondary); text-decoration: none; font-size: var(--pm-font-size-small); font-weight: var(--pm-weight-medium); }
.pm-site-header__nav a:hover,
.pm-site-header__nav a[aria-current="page"] { color: var(--pm-text-primary); }
.pm-site-header__actions { margin-left: auto; display: flex; align-items: center; gap: var(--pm-space-2); }

.pm-site-footer {
  border-top: var(--pm-border-width) solid var(--pm-border-subtle);
  padding: var(--pm-space-10) 0 var(--pm-space-8);
  color: var(--pm-text-secondary);
  font-size: var(--pm-font-size-small);
  line-height: var(--pm-line-height-small);
}

.pm-site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pm-space-8);
}

@media (min-width: 768px) {
  .pm-site-footer__grid { grid-template-columns: 2fr 1fr 1fr; }
}

.pm-site-footer__title { color: var(--pm-text-primary); font-weight: var(--pm-weight-semibold); margin-bottom: var(--pm-space-3); }
.pm-site-footer__links { display: flex; flex-direction: column; gap: var(--pm-space-2); }
.pm-site-footer__links a { color: var(--pm-text-secondary); text-decoration: none; }
.pm-site-footer__links a:hover { color: var(--pm-text-primary); }
.pm-site-footer__legal { margin-top: var(--pm-space-8); padding-top: var(--pm-space-5); border-top: var(--pm-border-width) solid var(--pm-border-subtle); color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); line-height: var(--pm-line-height-caption); }

/* ---------- Landing hero ---------- */
.pm-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pm-space-10);
  padding: var(--pm-space-10) 0 var(--pm-space-12);
}

@media (min-width: 1024px) {
  .pm-hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--pm-space-12); align-items: center; padding: var(--pm-space-20) 0; }
}

.pm-hero__text { display: flex; flex-direction: column; gap: var(--pm-space-5); align-items: flex-start; }
.pm-hero__title { text-wrap: balance; max-width: 16em; }
.pm-hero__lead { color: var(--pm-text-secondary); font-size: var(--pm-font-size-reading); line-height: var(--pm-line-height-reading); max-width: 34em; }
.pm-hero__actions { display: flex; flex-wrap: wrap; gap: var(--pm-space-3); margin-top: var(--pm-space-2); }
.pm-hero__note { color: var(--pm-text-tertiary); font-size: var(--pm-font-size-small); }
.pm-hero__artifact { display: flex; flex-direction: column; gap: var(--pm-space-3); min-width: 0; }
.pm-hero__caption { color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); }

/* ---------- How it works: 3 steps ---------- */
.pm-steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pm-space-6);
  counter-reset: pm-step;
}

@media (min-width: 768px) {
  .pm-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--pm-space-8); }
}

.pm-steps__item {
  counter-increment: pm-step;
  display: flex;
  flex-direction: column;
  gap: var(--pm-space-2);
  padding-top: var(--pm-space-4);
  border-top: var(--pm-border-width-strong) solid var(--pm-border-default);
}

.pm-steps__item::before {
  content: counter(pm-step, decimal-leading-zero);
  color: var(--pm-text-tertiary);
  font-family: var(--pm-font-mono);
  font-size: var(--pm-font-size-small);
}

.pm-steps__title { font-size: var(--pm-font-size-h3); line-height: var(--pm-line-height-h3); font-weight: var(--pm-weight-semibold); }
.pm-steps__text { color: var(--pm-text-secondary); }

/* ---------- Waitlist form ---------- */
.pm-waitlist {
  display: flex;
  flex-direction: column;
  gap: var(--pm-space-5);
  padding: var(--pm-space-5) var(--pm-space-4);
  border: var(--pm-border-width) solid var(--pm-border-default);
  border-radius: var(--pm-radius-lg);
  background: var(--pm-surface-1);
}

@media (min-width: 768px) {
  .pm-waitlist { padding: var(--pm-space-8); }
}

.pm-waitlist__row { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--pm-space-4); }

@media (min-width: 768px) {
  .pm-waitlist__row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.pm-waitlist__honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.pm-waitlist__submit { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pm-space-3) var(--pm-space-4); }
.pm-waitlist__legal { color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); line-height: var(--pm-line-height-caption); }
.pm-waitlist__price { display: flex; flex-direction: column; gap: var(--pm-space-3); padding-top: var(--pm-space-5); border-top: var(--pm-border-width) solid var(--pm-border-subtle); }

/* ---------- Cookie consent ---------- */
.pm-cookie {
  position: fixed;
  left: var(--pm-space-4);
  right: var(--pm-space-4);
  bottom: var(--pm-space-4);
  z-index: var(--pm-z-overlay);
  display: flex;
  flex-direction: column;
  gap: var(--pm-space-3);
  max-width: 560px;
  padding: var(--pm-space-4);
  border: var(--pm-border-width) solid var(--pm-border-default);
  border-radius: var(--pm-radius-lg);
  background: var(--pm-surface-3);
  box-shadow: var(--pm-shadow-3);
  font-size: var(--pm-font-size-small);
  line-height: var(--pm-line-height-small);
}

.pm-cookie__text { color: var(--pm-text-secondary); }
.pm-cookie__title { color: var(--pm-text-primary); font-weight: var(--pm-weight-semibold); font-size: var(--pm-font-size-body); margin-bottom: var(--pm-space-1); }
.pm-cookie__actions { display: flex; flex-wrap: wrap; gap: var(--pm-space-2); }
.pm-cookie__actions .pm-button { flex: 1 1 auto; }
.pm-cookie--static { position: relative; left: auto; right: auto; bottom: auto; }

/* ---------- SEO article ---------- */
.pm-article {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pm-space-8);
  padding: var(--pm-space-8) 0 var(--pm-space-12);
}

@media (min-width: 1024px) {
  .pm-article { grid-template-columns: minmax(0, var(--pm-reading-max)) 220px; justify-content: space-between; gap: var(--pm-space-12); }
}

.pm-article__header { display: flex; flex-direction: column; gap: var(--pm-space-3); margin-bottom: var(--pm-space-6); }
.pm-article__crumbs { display: flex; flex-wrap: wrap; gap: var(--pm-space-2); color: var(--pm-text-tertiary); font-size: var(--pm-font-size-small); }
.pm-article__crumbs a { color: var(--pm-text-secondary); text-decoration: none; }
.pm-article__crumbs a:hover { color: var(--pm-text-primary); }
.pm-article__meta { color: var(--pm-text-tertiary); font-size: var(--pm-font-size-small); }
.pm-article__aside { display: none; }

@media (min-width: 1024px) {
  .pm-article__aside { display: block; position: sticky; top: calc(64px + var(--pm-space-6)); align-self: start; }
}

.pm-article__toc { display: flex; flex-direction: column; gap: var(--pm-space-2); padding-left: var(--pm-space-3); border-left: var(--pm-border-width) solid var(--pm-border-subtle); font-size: var(--pm-font-size-small); }
.pm-article__toc a { color: var(--pm-text-secondary); text-decoration: none; }
.pm-article__toc a:hover,
.pm-article__toc a[aria-current="true"] { color: var(--pm-text-primary); }

/* Long-form text */
.pm-prose {
  max-width: var(--pm-reading-max);
  font-size: var(--pm-font-size-reading);
  line-height: var(--pm-line-height-reading);
  color: var(--pm-text-primary);
}

.pm-prose > * + * { margin-top: var(--pm-space-5); }
.pm-prose h2 { margin-top: var(--pm-space-12); font-size: var(--pm-font-size-h2); line-height: var(--pm-line-height-h2); }
.pm-prose h3 { margin-top: var(--pm-space-8); }
.pm-prose h2 + *,
.pm-prose h3 + * { margin-top: var(--pm-space-3); }
.pm-prose p,
.pm-prose li { color: var(--pm-text-primary); }
.pm-prose ul { padding-left: var(--pm-space-5); list-style: disc; }
.pm-prose ol { padding-left: var(--pm-space-5); list-style: decimal; }
.pm-prose li + li { margin-top: var(--pm-space-2); }
.pm-prose li::marker { color: var(--pm-text-tertiary); }
.pm-prose a { color: var(--pm-text-primary); text-decoration-color: var(--pm-border-strong); text-underline-offset: 3px; }
.pm-prose figure { margin-top: var(--pm-space-8); }
.pm-prose figcaption { margin-top: var(--pm-space-2); color: var(--pm-text-tertiary); font-size: var(--pm-font-size-small); line-height: var(--pm-line-height-small); }
.pm-prose .table-scroll { margin-top: var(--pm-space-6); border: var(--pm-border-width) solid var(--pm-border-default); border-radius: var(--pm-radius-md); }

/* ---------- Ranks / MMR table ---------- */
.pm-ranks td:first-child { font-weight: var(--pm-weight-semibold); }
.pm-ranks__en { display: block; color: var(--pm-text-tertiary); font-size: var(--pm-font-size-caption); font-weight: var(--pm-weight-regular); }
.pm-ranks__share { display: flex; align-items: center; gap: var(--pm-space-2); justify-content: flex-end; }
.pm-ranks__share-bar { width: 64px; height: 6px; border-radius: var(--pm-radius-full); background: var(--pm-fill-muted); overflow: hidden; }
.pm-ranks__share-bar > span { display: block; height: 100%; width: calc(var(--value) * 1%); background: var(--pm-chart-bar); }

/* ---------- CTA block ---------- */
.pm-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--pm-space-5);
  align-items: center;
  padding: var(--pm-space-6) var(--pm-space-5);
  border: var(--pm-border-width) solid var(--pm-border-default);
  border-radius: var(--pm-radius-lg);
  background: var(--pm-surface-1);
}

@media (min-width: 768px) {
  .pm-cta { grid-template-columns: minmax(0, 1fr) auto; padding: var(--pm-space-8); }
}

.pm-cta__title { font-size: var(--pm-font-size-h2); line-height: var(--pm-line-height-h2); font-weight: var(--pm-weight-semibold); letter-spacing: var(--pm-tracking-h2); }
.pm-cta__text { margin-top: var(--pm-space-2); color: var(--pm-text-secondary); max-width: 56ch; }

/* =========================================================================
   Keyframes
   ========================================================================= */

@keyframes pm-spin { to { transform: rotate(360deg); } }
@keyframes pm-pulse { 50% { opacity: 0.5; } }
@keyframes pm-rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pm-indeterminate { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
