.rf-refurb-app {
  --rf-rf-ink: #1a1a18;
  --rf-rf-muted: #5c5a54;
  --rf-rf-line: #d8d4cb;
  --rf-rf-panel: #ffffff;
  --rf-rf-accent: #5b2d8e;
  --rf-rf-accent-dark: #3f1f66;
  --rf-rf-accent-ink: #ffffff;
  --rf-rf-radius: 14px;
  --rf-rf-shadow: 0 18px 40px rgba(26, 26, 24, 0.08);
  color: var(--rf-rf-ink);
  font-family: "DM Sans", system-ui, sans-serif;
}

.rf-refurb-app * {
  box-sizing: border-box;
}

.rf-rf-panel {
  background: var(--rf-rf-panel);
  border: 1px solid var(--rf-rf-line);
  border-radius: var(--rf-rf-radius);
  box-shadow: var(--rf-rf-shadow);
  padding: 1.5rem;
}

.rf-rf-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.rf-rf-toolbar h2 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--rf-rf-accent-dark);
}

.rf-rf-updated {
  margin: 0;
  font-size: 0.84rem;
  color: var(--rf-rf-muted);
}

.rf-rf-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.rf-rf-filter {
  appearance: none;
  border: 1px solid var(--rf-rf-line);
  border-radius: 999px;
  background: #fff;
  color: var(--rf-rf-accent-dark);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}

.rf-rf-filter.is-active,
.rf-rf-filter:hover {
  border-color: var(--rf-rf-accent);
  background: color-mix(in srgb, var(--rf-rf-accent) 8%, #fff);
}

.rf-rf-list {
  display: grid;
  gap: 0.85rem;
}

/* Three panels under the filters. Each has one colour, used only for its
   dot and date pill: green now (Nelson), amber this week (Kootenays),
   blue pre-order (Canada). */
.rf-refurb-app {
  --rf-sec-now: #1f7a4d;
  --rf-sec-soon: #a35c00;
  --rf-sec-preorder: #1f5fa8;
}

.rf-rf-section-now,
.rf-rf-stop-now { --rf-sec: var(--rf-sec-now); }
.rf-rf-section-soon,
.rf-rf-stop-soon { --rf-sec: var(--rf-sec-soon); }
.rf-rf-section-preorder,
.rf-rf-stop-preorder { --rf-sec: var(--rf-sec-preorder); }

.rf-rf-sections {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.rf-rf-section {
  scroll-margin-top: 6rem;
}

.rf-rf-section-head {
  margin: 0 0 1rem;
}

.rf-rf-section-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.75rem;
}

.rf-rf-section-head h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.45rem;
  margin: 0;
  font-size: 1.25rem;
  color: var(--rf-rf-ink);
}

.rf-rf-section-head h2::before {
  content: "";
  align-self: center;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--rf-sec);
}

.rf-rf-where {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--rf-rf-muted);
}

.rf-rf-when {
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--rf-sec);
  background: color-mix(in srgb, var(--rf-sec) 11%, #fff);
  white-space: nowrap;
}

.rf-rf-section-blurb {
  margin: 0.3rem 0 0;
  font-size: 0.88rem;
  color: var(--rf-rf-muted);
}

/* Timeline track under the filters: three stops on one line, today first.
   Each stop links down to its panel. */
.rf-rf-timeline {
  margin-top: 1.25rem;
}

.rf-rf-track {
  position: relative;
  display: grid;
  --rf-track-gap: 0.75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--rf-track-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* The line runs from the first dot to the last. */
.rf-rf-track::before {
  content: "";
  position: absolute;
  top: 0.45rem;
  left: 0.5rem;
  right: calc((100% - 2 * var(--rf-track-gap)) / 3 - 0.5rem);
  height: 2px;
  background: linear-gradient(90deg, var(--rf-sec-now), var(--rf-sec-soon) 50%, var(--rf-sec-preorder));
  opacity: 0.45;
}

.rf-rf-stop {
  position: relative;
  min-width: 0;
}

.rf-rf-stop > a,
.rf-rf-stop > span {
  display: grid;
  gap: 0.1rem;
  color: var(--rf-rf-ink);
  text-decoration: none;
}

.rf-rf-stop-dot {
  width: 0.95rem;
  height: 0.95rem;
  margin-bottom: 0.35rem;
  border-radius: 50%;
  background: var(--rf-sec);
  box-shadow: 0 0 0 3px #fff;
}

.rf-rf-stop-when {
  font-weight: 700;
  color: var(--rf-sec);
}

.rf-rf-stop-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.rf-rf-stop-where {
  font-size: 0.8rem;
  color: var(--rf-rf-muted);
}

.rf-rf-stop > a:hover .rf-rf-stop-title,
.rf-rf-stop > a:focus-visible .rf-rf-stop-title {
  text-decoration: underline;
}

.rf-rf-stop.is-empty {
  opacity: 0.45;
}

@media (max-width: 560px) {
  .rf-rf-track { --rf-track-gap: 0.5rem; }
  .rf-rf-stop-title { font-size: 0.82rem; }
  .rf-rf-stop-when { font-size: 0.9rem; }
  .rf-rf-stop-where { font-size: 0.74rem; }
}

.rf-rf-card {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--rf-rf-line);
  border-radius: 12px;
  background: #fff;
}

/* Title and price share one row: the title is cut short, the price never moves. */
.rf-rf-card-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: baseline;
}

.rf-rf-card-top h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

@media (min-width: 720px) {
  .rf-rf-card-top h3 {
    display: block;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

.rf-rf-card h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--rf-rf-accent-dark);
}

.rf-rf-price {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 750;
  color: var(--rf-rf-accent-dark);
  white-space: nowrap;
}

.rf-rf-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.rf-rf-badge,
.rf-rf-category {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.rf-rf-badge {
  background: color-mix(in srgb, var(--rf-rf-accent) 12%, #fff);
  color: var(--rf-rf-accent-dark);
}

.rf-rf-category {
  background: #f3f0f7;
  color: var(--rf-rf-muted);
}

.rf-rf-specs,
.rf-rf-note {
  margin: 0;
  line-height: 1.5;
}

.rf-rf-specs {
  font-size: 0.92rem;
  color: var(--rf-rf-ink);
}

.rf-rf-note {
  font-size: 0.86rem;
  color: var(--rf-rf-muted);
}

.rf-rf-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.rf-rf-card-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font-size: 0.86rem;
  font-weight: 700;
  text-decoration: none;
}

.rf-rf-card-actions a:first-child {
  background: var(--rf-rf-accent);
  color: var(--rf-rf-accent-ink);
}

.rf-rf-card-actions a:first-child:hover {
  background: var(--rf-rf-accent-dark);
}

.rf-rf-card-actions a.is-outline {
  border: 1px solid var(--rf-rf-line);
  color: var(--rf-rf-accent-dark);
  background: #fff;
}

.rf-rf-card-actions a.is-outline:hover {
  border-color: var(--rf-rf-accent);
}

.rf-rf-empty,
.rf-rf-status {
  margin: 0;
  padding: 1rem 0.25rem;
  color: var(--rf-rf-muted);
  line-height: 1.55;
}

.rf-rf-status[data-tone="error"] {
  color: #9b2c2c;
}

.rf-rf-card {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "body"
    "actions";
}

.rf-rf-card:has(.rf-rf-photo) {
  grid-template-areas:
    "photo"
    "body"
    "actions";
}

.rf-rf-photo {
  grid-area: photo;
}

.rf-rf-card-body {
  grid-area: body;
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.rf-rf-card-actions {
  grid-area: actions;
}

.rf-rf-card h3 {
  overflow-wrap: anywhere;
}

.rf-rf-specs,
.rf-rf-note {
  overflow-wrap: anywhere;
}

.rf-rf-note {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

.rf-rf-note-wrap.is-open .rf-rf-note {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: none;
  overflow: visible;
}

.rf-rf-condition {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--rf-rf-ink);
  overflow-wrap: anywhere;
}

.rf-rf-condition span {
  font-weight: 700;
  color: var(--rf-rf-accent-dark);
}

.rf-rf-more {
  appearance: none;
  border: 0;
  background: none;
  padding: 0.15rem 0;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--rf-rf-accent-dark);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}

.rf-rf-more[hidden] {
  display: none;
}

@media (min-width: 720px) {
  .rf-rf-card {
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-areas: "body actions";
    align-items: start;
    column-gap: 1.25rem;
  }

  .rf-rf-card:has(.rf-rf-photo) {
    grid-template-columns: 7.5rem minmax(0, 1fr) max-content;
    grid-template-areas: "photo body actions";
  }

  .rf-rf-card:has(.rf-rf-photo) .rf-rf-photo {
    margin-bottom: 0;
    max-height: 7.5rem;
  }

  .rf-rf-card-actions {
    justify-content: flex-end;
    padding-top: 0.15rem;
  }
}

/* Reserve */
.rf-rf-card-actions .rf-rf-reserve-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1.15rem;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  background: var(--rf-rf-accent);
  color: var(--rf-rf-accent-ink);
  cursor: pointer;
}

.rf-rf-card-actions .rf-rf-reserve-btn:hover {
  background: var(--rf-rf-accent-dark);
}

.rf-rf-card-actions .rf-rf-reserve-btn + a.is-outline {
  background: #fff;
  color: var(--rf-rf-accent-dark);
}

.rf-rf-held {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  font-size: 0.86rem;
  font-weight: 700;
  background: #f1ecf7;
  color: var(--rf-rf-accent-dark);
}

.rf-rf-card.is-held {
  opacity: 0.72;
}

.rf-rf-photo {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 10px;
  background: #f7f5fa;
  margin-bottom: 0.75rem;
}

.rf-rf-notice {
  margin: 0 0 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: var(--rf-rf-radius);
  border: 1px solid var(--rf-rf-line);
  background: #fff;
  line-height: 1.5;
}

.rf-rf-notice[data-tone="ok"] {
  border-color: #b9dcc4;
  background: #f1f9f3;
}

.rf-rf-notice[data-tone="error"] {
  border-color: #e7b9b2;
  background: #fcf1ef;
}

.rf-rf-dialog {
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 0;
  border-radius: var(--rf-rf-radius);
  padding: 0;
  box-shadow: 0 30px 80px rgba(26, 26, 24, 0.3);
  color: var(--rf-rf-ink);
}

.rf-rf-dialog::backdrop {
  background: rgba(26, 26, 24, 0.45);
}

.rf-rf-reserve {
  position: relative;
  padding: 1.5rem;
  display: grid;
  gap: 0.9rem;
}

.rf-rf-reserve h3 {
  margin: 0;
  font-size: 1.3rem;
}

.rf-rf-close {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  appearance: none;
  border: 0;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--rf-rf-muted);
  cursor: pointer;
}

.rf-rf-dialog-item {
  margin: 0;
  font-weight: 700;
  color: var(--rf-rf-accent-dark);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  padding-right: 1.5rem;
}

.rf-rf-dialog-price {
  margin: -0.5rem 0 0;
  font-weight: 750;
  color: var(--rf-rf-ink);
}

.rf-rf-dialog-how,
.rf-rf-secure {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--rf-rf-muted);
}

.rf-rf-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.rf-rf-field {
  display: grid;
  gap: 0.35rem;
  align-content: start;
}

.rf-rf-field label {
  font-size: 0.88rem;
  font-weight: 650;
}

.rf-rf-field input {
  width: 100%;
  border: 1px solid var(--rf-rf-line);
  border-radius: 10px;
  padding: 0.72rem 0.85rem;
  font: inherit;
  color: inherit;
  background: #fff;
}

.rf-rf-field input:focus {
  outline: 2px solid color-mix(in srgb, var(--rf-rf-accent) 40%, transparent);
  outline-offset: 1px;
  border-color: color-mix(in srgb, var(--rf-rf-accent) 50%, var(--rf-rf-line));
}

.rf-rf-hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.rf-rf-dialog-actions {
  display: grid;
  gap: 0.5rem;
}

.rf-rf-reserve-submit {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.3rem;
  font: inherit;
  font-weight: 700;
  background: var(--rf-rf-accent);
  color: var(--rf-rf-accent-ink);
  cursor: pointer;
}

.rf-rf-reserve-submit:hover {
  background: var(--rf-rf-accent-dark);
}

.rf-rf-reserve-submit:disabled {
  opacity: 0.6;
  cursor: progress;
}

.rf-rf-reserve-status {
  margin: 0;
  font-size: 0.9rem;
}

.rf-rf-reserve-status[data-tone="error"] {
  color: #9b2c1f;
}

.rf-refurb-app .rf-sms-consent {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--rf-rf-muted);
}

.rf-refurb-app .rf-sms-consent a {
  color: var(--rf-rf-accent-dark);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

@media (max-width: 560px) {
  .rf-rf-grid {
    grid-template-columns: 1fr;
  }
}

/* Cosmetic grades: a little face, the letter and a plain word.
   A mint and beaming, B sky blue and smiling, C peach and blushing. */
.rf-rf-grade {
  --g-ink: #1f7a4d;
  --g-bg: #e4f5ec;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem 0.15rem 0.2rem;
  border-radius: 999px;
  background: var(--g-bg);
  color: var(--g-ink);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  cursor: help;
}

.rf-rf-grade-b { --g-ink: #1f5fa8; --g-bg: #e5effa; }
.rf-rf-grade-c { --g-ink: #a3521a; --g-bg: #fdece0; }

.rf-rf-grade svg {
  flex: none;
}

.rf-rf-grade svg circle:first-child {
  fill: #fff;
  stroke: var(--g-ink);
  stroke-width: 1.2;
}

.rf-rf-grade svg .e,
.rf-rf-grade svg .m {
  fill: var(--g-ink);
}

.rf-rf-grade svg .l {
  fill: none;
  stroke: var(--g-ink);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.rf-rf-grade svg .b {
  fill: #f6a5a0;
  opacity: 0.8;
}

.rf-rf-grade b {
  font-weight: 800;
}

.rf-rf-grade .rf-rf-sparkle {
  fill: #e0a400;
  margin-left: -0.1rem;
}

/* Legend under the timeline, shown when the list has graded devices. */
.rf-rf-legend {
  margin-top: 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: #faf8fc;
  border: 1px dashed #ddd3ea;
}

.rf-rf-legend-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--rf-rf-ink);
}

.rf-rf-legend-title span {
  font-weight: 400;
  color: var(--rf-rf-muted);
}

.rf-rf-legend-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rf-rf-legend-list li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.rf-rf-legend-text {
  font-size: 0.82rem;
  color: var(--rf-rf-muted);
}

/* Card titles link to the card itself (?device=<id>) so a device can be shared. */
.rf-rf-card-link {
  color: inherit;
  text-decoration: none;
}

.rf-rf-card-link:hover,
.rf-rf-card-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* The card a link opened. */
.rf-rf-card {
  scroll-margin-top: 7rem;
}

.rf-rf-card.is-target {
  border-color: var(--rf-rf-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rf-rf-accent) 22%, transparent);
}

/* Ask scrolls here; leave room for the sticky header. */
#rf-refurb-inquiry {
  scroll-margin-top: 6rem;
}

/* "New battery" in the Syncro description becomes this badge. */
.rf-rf-badge.rf-rf-battery {
  background: #e6f4ec;
  color: #1f7a4d;
  text-transform: none;
  letter-spacing: 0;
}

/* Supplier units we order in on request. */
.rf-rf-badge.rf-rf-lead,
.rf-rf-badge.rf-rf-order-in {
  background: #fff4e0;
  color: #8a5300;
  text-transform: none;
  letter-spacing: 0;
}
