:root {
  --pcsb-navy: #17324d;
  --pcsb-navy-soft: #274965;
  --pcsb-cream: #f6f0e7;
  --pcsb-card: #fffdf8;
  --pcsb-line: #d9d2c8;
  --pcsb-muted: #6f7c87;
  --pcsb-blue: #45A7D8;
  --pcsb-red: #b84a4a;
  --pcsb-grey: #8d969f;
  --pcsb-yellow: #d8a43a;
}

.pcsb-app {
  color: var(--pcsb-navy);
  font: inherit;
}

.pcsb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 12px;
}

.pcsb-results-line {
  margin: 0;
  color: var(--pcsb-muted);
  font-size: 0.88rem;
}

.pcsb-filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  border: 1px solid var(--pcsb-navy);
  border-radius: 9px;
  background: var(--pcsb-navy);
  color: #fff;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.pcsb-filter-toggle:hover,
.pcsb-filter-toggle:focus,
.pcsb-filter-toggle:focus-visible,
.pcsb-filter-toggle:active {
  border-color: var(--pcsb-navy);
  background: var(--pcsb-navy);
  color: #fff;
}

.pcsb-filter-toggle:focus-visible {
  outline: 2px solid var(--pcsb-navy-soft);
  outline-offset: 2px;
}

.pcsb-filter-toggle[aria-expanded="true"],
.pcsb-filter-toggle[aria-expanded="true"]:hover,
.pcsb-filter-toggle[aria-expanded="true"]:focus,
.pcsb-filter-toggle[aria-expanded="true"]:focus-visible,
.pcsb-filter-toggle[aria-expanded="true"]:active {
  border-color: var(--pcsb-red);
  background: var(--pcsb-red);
  color: #fff;
}

.pcsb-filter-toggle[aria-expanded="true"]:focus-visible {
  outline-color: #9f3f3f;
}

.pcsb-filter-chevron {
  display: inline-block;
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 160ms ease;
  transform-origin: center;
}

.pcsb-filter-toggle[aria-expanded="true"] .pcsb-filter-chevron {
  transform: rotate(180deg);
}


.pcsb-disclosure {
  margin: 0 0 14px;
  padding: 0;
  color: var(--pcsb-muted);
  font-size: 0.80rem;
  line-height: 1.45;
}

/* Filters are collapsed by default so comparison cards remain the visual priority. */
.pcsb-filters {
  display: grid;
  gap: 18px;
  margin: 0 0 16px;
  padding: 20px;
  border: 1px solid var(--pcsb-line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.76);
}

.pcsb-filters[hidden] {
  display: none !important;
}

.pcsb-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}

.pcsb-filter-title {
  flex-basis: 100%;
  margin-bottom: 2px;
  color: var(--pcsb-navy);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pcsb-filter-group label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--pcsb-navy-soft);
  font-size: 0.92rem;
  cursor: pointer;
}

.pcsb-filter-group input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--pcsb-navy);
}

.pcsb-margin-filters label {
  display: grid;
  gap: 5px;
  min-width: 155px;
}

.pcsb-margin-filters label > span,
.pcsb-sort-label {
  font-size: 0.8rem;
  font-weight: 700;
}

.pcsb-filter-group select,
.pcsb-filter-actions select {
  min-height: 38px;
  border: 1px solid var(--pcsb-line);
  border-radius: 9px;
  background: #fff;
  color: var(--pcsb-navy);
  padding: 6px 32px 6px 10px;
  font: inherit;
}

.pcsb-filter-actions {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.pcsb-sort-label {
  display: grid;
  gap: 5px;
}

.pcsb-reset {
  min-height: 38px;
  border: 1px solid var(--pcsb-navy);
  border-radius: 9px;
  background: transparent;
  color: var(--pcsb-navy);
  padding: 7px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.pcsb-reset:hover,
.pcsb-reset:focus-visible {
  background: var(--pcsb-navy);
  color: #fff;
}

/* Desktop: three compact comparison cards per row. */
.pcsb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.pcsb-card {
  display: flex;
  min-width: 0;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--pcsb-line);
  border-radius: 15px;
  background: var(--pcsb-card);
  box-shadow: 0 5px 18px rgba(23, 50, 77, 0.055);
}

.pcsb-card[hidden] {
  display: none !important;
}

/* Clean brand headers: main colour -> related mid-tone -> diagonal accent. */
.pcsb-card-head {
  position: relative;
  overflow: hidden;
  padding: 14px 16px 13px;
  border-bottom: 0;
  background:
    linear-gradient(118deg,
      var(--pcsb-book-color) 0%,
      var(--pcsb-book-color) 64%,
      var(--pcsb-book-mid) 64.2%,
      var(--pcsb-book-mid) 82%,
      var(--pcsb-book-accent) 82.2%,
      var(--pcsb-book-accent) 100%);
}

.pcsb-card-head h3 {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--pcsb-book-text, #fff);
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.012em;
  line-height: 1.25;
}

.pcsb-card-body {
  display: flex;
  min-width: 0;
  height: 100%;
  flex-direction: column;
  padding: 0 16px 15px;
}

.pcsb-section {
  padding: 13px 0;
  border-bottom: 1px solid var(--pcsb-line);
}

.pcsb-section h4 {
  margin: 0 0 8px;
  color: var(--pcsb-navy);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.pcsb-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22px;
  align-items: center;
  gap: 9px;
  min-height: 28px;
  color: var(--pcsb-navy-soft);
  font-size: 0.84rem;
  line-height: 1.25;
}

.pcsb-feature-label,
.pcsb-row > span:first-child {
  min-width: 0;
}

.pcsb-feature-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.pcsb-feature-link:hover,
.pcsb-feature-link:focus-visible {
  color: var(--pcsb-red);
  border-bottom-color: currentColor;
}

.pcsb-status {
  position: relative;
  display: inline-flex;
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  align-items: center;
  justify-content: center;
  justify-self: end;
  box-sizing: border-box;
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  vertical-align: middle;
}

.pcsb-status-yes { background: var(--pcsb-blue); }
.pcsb-status-unknown { background: var(--pcsb-grey); }

/* Draw the No icon geometrically instead of relying on a font glyph.
   This keeps the X optically centred in every browser/font combination. */
.pcsb-status-no {
  background: var(--pcsb-red);
  color: transparent;
  font-size: 0;
}

.pcsb-status-no::before,
.pcsb-status-no::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transform-origin: center;
}

.pcsb-status-no::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.pcsb-status-no::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* Fixed four-column margin geometry keeps values, dots and labels perfectly aligned. */
.pcsb-margin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px 12px 54px;
  align-items: center;
  column-gap: 6px;
  min-height: 30px;
  color: var(--pcsb-navy-soft);
  font-size: 0.80rem;
  line-height: 1.2;
}

.pcsb-margin-label {
  min-width: 0;
  white-space: nowrap;
}

.pcsb-margin-value {
  width: 58px;
  color: var(--pcsb-navy);
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.pcsb-margin-rating {
  display: contents;
}

.pcsb-margin-rating .pcsb-margin-dot {
  grid-column: 3;
  justify-self: center;
}

.pcsb-margin-rating .pcsb-margin-rating-text {
  grid-column: 4;
  justify-self: start;
  color: var(--pcsb-muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.pcsb-margin-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.pcsb-margin-low { background: var(--pcsb-blue); }
.pcsb-margin-typical { background: var(--pcsb-yellow); }
.pcsb-margin-high { background: var(--pcsb-red); }
.pcsb-margin-unknown { background: var(--pcsb-grey); }

.pcsb-card-cta {
  margin-top: auto;
  padding-top: 14px;
}

.pcsb-cta {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-sizing: border-box;
  border: 1px solid var(--pcsb-navy);
  border-radius: 9px;
  background: var(--pcsb-navy);
  color: #fff !important;
  text-decoration: none !important;
  font-size: 0.86rem;
  font-weight: 800;
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.pcsb-cta:hover,
.pcsb-cta:focus-visible {
  background: var(--pcsb-red);
  border-color: var(--pcsb-red);
  transform: translateY(-1px);
}

.pcsb-external-arrow {
  display: inline-block;
  font-family: inherit;
  font-size: 0.88em;
  line-height: 1;
}

.pcsb-cta-disabled {
  border-color: #d8dde1;
  background: #eef1f3;
  color: #8c98a2 !important;
  cursor: default;
  opacity: 1;
  pointer-events: none;
}

.pcsb-empty {
  margin: 22px 0 0;
  padding: 24px;
  border: 1px dashed var(--pcsb-line);
  border-radius: 14px;
  color: var(--pcsb-muted);
  text-align: center;
}

/* Two columns on smaller desktop/tablet, one on mobile. */
@media (max-width: 1050px) {
  .pcsb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pcsb-row { font-size: 0.88rem; }
  .pcsb-margin-row { font-size: 0.84rem; }
}

@media (max-width: 700px) {
  .pcsb-grid { grid-template-columns: 1fr; }
  .pcsb-card-body { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 560px) {
  .pcsb-filters { padding: 16px; }
  .pcsb-filter-group { gap: 9px 12px; }
  .pcsb-filter-group label { flex-basis: 100%; }
  .pcsb-margin-filters label { min-width: 0; }

  .pcsb-margin-row {
    grid-template-columns: minmax(0, 1fr) 58px 12px 54px;
  }

  .pcsb-margin-label {
    white-space: normal;
  }
}

@supports not (background: linear-gradient(118deg, #000 0%, #111 64%, #222 82%, #fff 100%)) {
  .pcsb-card-head { background: var(--pcsb-book-color); }
}

/* v1.2.0 availability & regulation */
.pcsb-reg-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 7px;
  min-height: 29px;
  color: var(--pcsb-navy-soft);
  font-size: 0.80rem;
  line-height: 1.22;
}
.pcsb-reg-jurisdiction {
  color: var(--pcsb-navy-soft);
  font-weight: 400;
  white-space: nowrap;
}
.pcsb-reg-framework {
  min-width: 0;
  color: var(--pcsb-muted);
  font-size: 0.74rem;
  text-align: right;
}
.pcsb-reg-row .pcsb-status { justify-self: end; }

.pcsb-comparison-notes {
  margin: 18px 0 0;
  padding-top: 13px;
  border-top: 1px solid var(--pcsb-line);
  color: var(--pcsb-muted);
  font-size: 0.78rem;
  line-height: 1.48;
}
.pcsb-comparison-notes p { margin: 0; }
.pcsb-comparison-notes p + p { margin-top: 5px; }

@media (max-width: 560px) {
  .pcsb-reg-row { grid-template-columns: 88px minmax(0, 1fr) 22px; }
  .pcsb-reg-framework { font-size: 0.76rem; }
}
