/* ==========================================================================
   Motolink Kenya - components

   Phone first. Two constraints drive most decisions:
     - Anything tappable clears --tap (44px). A finger is not a cursor.
     - Fields are 16px. Below that, iOS Safari zooms on focus.

   Three rules keep this from reading as machine-made:

     1. Square corners. A 6px radius on every surface is the most recognisable
        signature of a generated interface.
     2. Depth comes from rules, not shadow. A floating card is a generated
        card. Sections are separated by hairlines, like a printed catalogue.
     3. Lists where a list belongs. A parts marketplace is something you scan
        down, not a grid of identical tiles.

   Colour discipline: --action appears only on controls meant to be pressed and
   on the marker showing where you are. Everything else is a state.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Icons - drawn in js/ui/icons.js
   -------------------------------------------------------------------------- */

.icon {
  width: 1.05em;
  height: 1.05em;
  flex-shrink: 0;
  vertical-align: -0.14em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.icon-sm { width: 0.85em; height: 0.85em; stroke-width: 1.8; }
.icon-lg { width: 1.4em; height: 1.4em; stroke-width: 1.4; }

/* --------------------------------------------------------------------------
   Missing media
   --------------------------------------------------------------------------
   No illustration files. A listing without a photo gets a plain hatched block,
   which reads as deliberately empty rather than as a broken image.
   -------------------------------------------------------------------------- */

.media-empty {
  background-color: var(--surface-sunken);
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0 7px,
    color-mix(in srgb, var(--ink-300) 45%, transparent) 7px 8px
  );
  border: var(--rule);
}

/* --------------------------------------------------------------------------
   Site header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: var(--rule-strong);
  padding-top: var(--safe-top);
}

.site-header .container {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.0625rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-900);
  text-decoration: none;
  flex-shrink: 0;
  min-width: 0;
}

.brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand:hover { color: var(--ink-900); text-decoration: none; }

.brand-mark {
  height: 26px;
  width: auto;
  flex-shrink: 0;
}

.nav-toggle {
  margin-left: auto;
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  border: var(--rule);
  color: var(--ink-700);
}

.nav-toggle:active { background: var(--ink-100); }

.site-nav {
  display: none;
  position: absolute;
  inset: 100% 0 auto 0;
  background: var(--surface);
  border-bottom: var(--rule-strong);
  padding: var(--s-2) var(--gutter) var(--s-4);
  flex-direction: column;
  max-height: calc(100dvh - var(--header-h));
  overflow-y: auto;
}

.site-nav.is-open { display: flex; }

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 var(--s-2);
  border-bottom: var(--rule);
  color: var(--ink-700);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:last-child { border-bottom: none; }

.site-nav a[aria-current="page"] {
  color: var(--action);
  font-weight: 600;
}

.header-actions {
  display: none;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
}

@media (min-width: 940px) {
  .nav-toggle { display: none; }

  .site-nav {
    display: flex;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: var(--s-4);
    border: none;
    padding: 0;
    background: transparent;
    flex: 1;
    max-height: none;
    overflow: visible;
  }

  .site-nav a {
    min-height: 0;
    padding: 0;
    border-bottom: none;
    font-size: 0.9375rem;
    /* A rule that grows from the baseline on the current page, rather than a
       pill or a tinted background. */
    box-shadow: inset 0 -2px 0 transparent;
  }

  .site-nav a:hover { box-shadow: inset 0 -2px 0 var(--ink-300); }

  .site-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--action); }

  .header-actions { display: flex; margin-left: 0; }
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-3) var(--s-1) var(--s-1);
  border: var(--rule);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--ink-700);
  max-width: 100%;
}

.user-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  width: 28px;
  height: 28px;
  background: var(--ink-900);
  color: var(--surface);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  flex-shrink: 0;
}

.avatar-lg { width: 44px; height: 44px; font-size: 0.875rem; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--tap);
  padding: 0.625rem 1.125rem;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--action);
  color: var(--action-ink);
}

.btn-primary:hover:not(:disabled) {
  background: var(--action-hover);
  color: var(--action-ink);
}

.btn-ghost {
  background: transparent;
  border-color: var(--ink-900);
  color: var(--ink-900);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--ink-900);
  color: var(--surface);
}

.btn-quiet {
  background: transparent;
  color: var(--ink-500);
  min-height: var(--tap);
  padding-inline: var(--s-2);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--ink-300);
  text-underline-offset: 3px;
}

.btn-quiet:hover:not(:disabled) {
  color: var(--action);
  text-decoration-color: var(--action);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) { background: #8a2222; }

.btn-sm {
  min-height: 38px;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

.btn-block { width: 100%; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  min-width: 0;
}

.field > label,
.field-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.field-hint {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-500);
}

.field-error {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--danger);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="file"],
select,
textarea {
  width: 100%;
  /* 16px, not 15px. One pixel below this and iOS zooms the page on focus. */
  font-size: 1rem;
  min-height: var(--tap);
  padding: 0.625rem 0.75rem;
  border: var(--rule);
  background: var(--surface);
  color: var(--ink-900);
  font-family: var(--font-body);
  transition: border-color 0.12s ease;
  appearance: none;
}

input::placeholder,
textarea::placeholder { color: var(--ink-400); }

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  outline: 2px solid var(--focus);
  outline-offset: -1px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' fill='none' stroke='%23646c75' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2.1rem;
}

input[type="file"] { padding: 0.5rem; font-size: 0.875rem; }

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
  outline: 2px solid var(--danger);
  outline-offset: -1px;
}

input[name="handle"],
input[name="plate_number"],
input[name="location-pin"],
input[name="reference"] {
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  min-height: var(--tap);
  font-size: 0.9375rem;
  color: var(--ink-700);
  cursor: pointer;
}

.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  accent-color: var(--action);
}

/* --------------------------------------------------------------------------
   Catalogue list
   --------------------------------------------------------------------------
   A parts marketplace is a list you scan down. Each row is separated by a
   hairline instead of being wrapped in its own floating card.
   -------------------------------------------------------------------------- */

.listing {
  border-top: var(--rule-strong);
}

.listing-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  grid-template-areas:
    "thumb body"
    "aside aside";
  column-gap: var(--s-3);
  row-gap: var(--s-3);
  align-items: start;
  padding: var(--s-4) 0;
  border-bottom: var(--rule);
}

.listing-row:last-child { border-bottom: var(--rule-strong); }

.listing-thumb {
  grid-area: thumb;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: var(--rule);
  background: var(--surface-sunken);
}

/* Cover images are landscape, so a square crop cuts them badly. */
.listing-thumb-wide { aspect-ratio: 4 / 3; }

.listing-body {
  grid-area: body;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  min-width: 0;
}

.listing-aside {
  grid-area: aside;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
}

.listing-aside .btn { flex: 1; min-width: 0; }

.listing-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -0.005em;
  color: var(--ink-900);
}

.listing-title a { text-decoration: none; }
.listing-title a:hover { color: var(--action); text-decoration: underline; }

/* Spec line: mono, because these are part numbers and fitments. */
.listing-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: -0.01em;
  color: var(--ink-500);
}

.listing-price {
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink-900);
}

@media (min-width: 760px) {
  .listing-row {
    grid-template-columns: 104px minmax(0, 1fr) 200px;
    grid-template-areas: "thumb body aside";
    column-gap: var(--s-5);
    align-items: center;
    padding: var(--s-4) 0;
  }

  .listing-aside {
    flex-direction: column;
    align-items: stretch;
  }
}

/* --------------------------------------------------------------------------
   Numbered editorial list
   --------------------------------------------------------------------------
   Replaces the three-equal-boxes feature row. Numbers on a rule read as a
   sequence a person wrote; three identical cards read as a template.
   -------------------------------------------------------------------------- */

.numbered {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: var(--rule-strong);
  counter-reset: step;
}

.numbered li {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-4) 0;
  border-bottom: var(--rule);
}

.numbered li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--action);
  padding-top: 0.35em;
}

.numbered h3 { margin-bottom: var(--s-1); }

/* --------------------------------------------------------------------------
   Cards - used on the public provider profile, where a block is warranted
   -------------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card:hover { border-color: var(--ink-400); }

.card-body {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  flex: 1;
}

.card-media {
  aspect-ratio: 4 / 3;
  width: 100%;
  object-fit: cover;
  background: var(--surface-sunken);
  border-bottom: var(--rule);
}

@media (min-width: 620px) {
  .card-media { aspect-ratio: 16 / 10; }
}

.card-title {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.008em;
  color: var(--ink-900);
}

.card-price {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--ink-900);
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-2);
  margin-top: auto;
  padding-top: var(--s-3);
  border-top: var(--rule);
}

@media (min-width: 420px) {
  .card-actions { grid-template-columns: 1fr 1fr; }
}

/* Panels are rule-bounded sections, not floating boxes. */
.panel {
  background: var(--surface);
  border: var(--rule);
  border-radius: var(--r-md);
  padding: var(--s-4);
}

@media (min-width: 700px) {
  .panel { padding: var(--s-5); }
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: var(--rule-strong);
}

/* --------------------------------------------------------------------------
   Badges - technical tags. Mono, squared, tight, uppercase. Not pills.
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.1rem 0.35rem;
  border: 1px solid transparent;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--surface-sunken);
  color: var(--ink-700);
}

.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }

/* Not a state: a label, distinguished by form rather than hue. */
.badge-outline {
  background: transparent;
  border-color: var(--ink-300);
  color: var(--ink-700);
}

/* --------------------------------------------------------------------------
   Notices
   -------------------------------------------------------------------------- */

.notice {
  padding: var(--s-3);
  border: 1px solid;
  border-left-width: 3px;
  font-size: 0.875rem;
  line-height: 1.55;
}

@media (min-width: 700px) {
  .notice { padding: var(--s-3) var(--s-4); }
}

.notice-info   { background: var(--info-soft);   color: var(--info);   border-color: color-mix(in srgb, var(--info) 28%, transparent); border-left-color: var(--info); }
.notice-ok     { background: var(--ok-soft);     color: var(--ok);     border-color: color-mix(in srgb, var(--ok) 28%, transparent); border-left-color: var(--ok); }
.notice-warn   { background: var(--warn-soft);   color: var(--warn);   border-color: color-mix(in srgb, var(--warn) 28%, transparent); border-left-color: var(--warn); }
.notice-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 28%, transparent); border-left-color: var(--danger); }

.notice p + p { margin-top: var(--s-2); }

.setup-banner {
  background: var(--warn-soft);
  color: var(--warn);
  border-bottom: 1px solid var(--warn);
  padding: var(--s-3) var(--gutter);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.setup-banner code { background: color-mix(in srgb, var(--warn) 12%, transparent); }

/* --------------------------------------------------------------------------
   Search
   -------------------------------------------------------------------------- */

.search-panel {
  background: var(--surface);
  border: var(--rule-strong);
  border-radius: var(--r-md);
  padding: var(--s-4);
  display: grid;
  gap: var(--s-3);
  grid-template-columns: 1fr;
}

.search-submit .btn {
  width: 100%;
  min-height: 52px;
  font-size: 1.0625rem;
}

@media (min-width: 620px) {
  .search-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-submit .btn { min-height: var(--tap); font-size: 0.9375rem; }
}

@media (min-width: 1020px) {
  .search-panel {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
    gap: var(--s-4);
  }
  .search-panel .field-span { grid-column: span 2; }
  .search-panel .search-submit { grid-column: span 4; }
}

.location-control {
  display: flex;
  gap: var(--s-2);
}

.location-control input { flex: 1; min-width: 0; }

/* --------------------------------------------------------------------------
   Place autocomplete
   --------------------------------------------------------------------------
   Google Places suggestions, when a Maps key is configured. The wrapper takes
   over the flex behaviour the bare input used to have, so the surrounding
   layout is unchanged whether or not Places is active.
   -------------------------------------------------------------------------- */

.place-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.place-suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 70;
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--ink-900);
  -webkit-overflow-scrolling: touch;
}

.place-suggestion {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: var(--s-2) var(--s-3);
  cursor: pointer;
  border-bottom: var(--rule);
}

.place-suggestion:last-child { border-bottom: none; }

.place-suggestion:hover,
.place-suggestion.is-active {
  background: var(--action-soft);
}

.place-suggestion-main {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-900);
}

.place-suggestion-sub {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: -0.01em;
  color: var(--ink-500);
}

/* Shown under a provider's location field once a place is pinned. */
.place-pinned {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: -0.01em;
  color: var(--ok);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  background: var(--surface);
  border-bottom: var(--rule-strong);
  padding-block: var(--s-5) var(--s-6);
}

@media (min-width: 700px) {
  .hero { padding-block: var(--s-7) var(--s-6); }
}

.hero-inner {
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.hero h1 { max-width: 20ch; }

.service-pills {
  display: flex;
  gap: var(--s-4);
  margin-top: var(--s-2);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-bottom: var(--rule);
}

.service-pills::-webkit-scrollbar { display: none; }

@media (min-width: 700px) {
  .service-pills { flex-wrap: wrap; overflow-x: visible; }
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-500);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  margin-bottom: -1px;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.pill:hover { color: var(--ink-900); }

.pill.is-active {
  color: var(--action);
  border-bottom-color: var(--action);
}

/* --------------------------------------------------------------------------
   Section navigation
   -------------------------------------------------------------------------- */

.section-nav {
  display: flex;
  gap: var(--s-4);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-bottom: var(--rule-strong);
}

.section-nav::-webkit-scrollbar { display: none; }

@media (min-width: 700px) {
  .section-nav { flex-wrap: wrap; overflow-x: visible; }
}

.section-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.section-nav a:hover { color: var(--ink-900); }

.section-nav a[aria-current="page"] {
  color: var(--action);
  border-bottom-color: var(--action);
}

/* --------------------------------------------------------------------------
   Steps
   -------------------------------------------------------------------------- */

.steps {
  display: flex;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: var(--rule);
}

.steps::-webkit-scrollbar { display: none; }

@media (min-width: 700px) {
  .steps { flex-wrap: wrap; overflow-x: visible; }
}

.step-marker {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-400);
  white-space: nowrap;
  flex-shrink: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.step-marker .num { font-size: 0.6875rem; }

.step-marker.is-current {
  color: var(--action);
  border-bottom-color: var(--action);
}

.step-marker.is-done {
  color: var(--ok);
  border-bottom-color: var(--ok);
}

.step-panel { display: flex; flex-direction: column; gap: var(--s-4); }

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  padding-top: var(--s-4);
  border-top: var(--rule-strong);
}

@media (max-width: 619px) {
  .wizard-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: var(--surface);
    margin-inline: calc(var(--gutter) * -1);
    padding: var(--s-3) var(--gutter) calc(var(--s-3) + var(--safe-bottom));
    border-top: var(--rule-strong);
  }

  .wizard-actions .row { flex: 1; gap: var(--s-2); }
  .wizard-actions .row > .btn { flex: 1; }
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap {
  border: var(--rule);
  background: var(--surface);
}

@media (min-width: 720px) {
  .table-wrap { overflow-x: auto; }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  text-align: left;
  padding: var(--s-3);
  border-bottom: var(--rule);
  vertical-align: top;
}

thead th {
  background: var(--surface-sunken);
  border-bottom: var(--rule-strong);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-500);
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: none; }

@media (max-width: 719px) {
  .table-wrap { border: none; background: none; }

  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap th,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap thead { display: none; }

  .table-wrap tbody tr {
    border-top: var(--rule-strong);
    padding: var(--s-3) 0;
  }

  .table-wrap tbody tr:last-child { border-bottom: var(--rule-strong); }

  .table-wrap td {
    border: none;
    padding: var(--s-1) 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-4);
    text-align: right;
  }

  .table-wrap td[data-label]::before {
    content: attr(data-label);
    flex-shrink: 0;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-500);
  }

  .table-wrap td:not([data-label]) {
    display: block;
    text-align: left;
    padding-top: var(--s-3);
  }

  .table-wrap td:not([data-label]) .row { flex-wrap: wrap; }
}

/* --------------------------------------------------------------------------
   Empty and loading states
   -------------------------------------------------------------------------- */

.empty {
  padding: var(--s-5) var(--s-4);
  text-align: center;
  color: var(--ink-500);
  border-top: var(--rule-strong);
  border-bottom: var(--rule);
}

@media (min-width: 700px) {
  .empty { padding: var(--s-7) var(--s-4); }
}

.empty h2, .empty h3 { margin-bottom: var(--s-2); }

.skeleton {
  background: var(--ink-100);
  height: 1rem;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: var(--rule-strong);
  background: var(--surface);
  padding-block: var(--s-5) calc(var(--s-5) + var(--safe-bottom));
  margin-top: var(--s-6);
  font-size: 0.875rem;
  color: var(--ink-500);
}

.footer-grid {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: 1fr;
}

@media (min-width: 700px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}

.footer-grid h4 {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: var(--s-2);
}

.footer-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.footer-links a {
  display: flex;
  align-items: center;
  min-height: 40px;
  color: var(--ink-700);
  text-decoration: none;
}

.footer-links a:hover { color: var(--action); }

.footer-bottom {
  margin-top: var(--s-4);
  padding-top: var(--s-3);
  border-top: var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 23, 26, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

@media (min-width: 620px) {
  .modal { align-items: center; padding: var(--s-4); }
}

.modal-panel {
  background: var(--surface);
  width: 100%;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: var(--rule-strong);
  padding-bottom: var(--safe-bottom);
}

@media (min-width: 620px) {
  .modal-panel {
    width: min(560px, 100%);
    border: var(--rule-strong);
    padding-bottom: 0;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4);
  border-bottom: var(--rule);
}

.modal-body {
  padding: var(--s-4);
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.modal-foot {
  padding: var(--s-4);
  border-top: var(--rule);
}

/* --------------------------------------------------------------------------
   Definition rows
   -------------------------------------------------------------------------- */

.def-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-1) var(--s-4);
  justify-content: space-between;
  align-items: baseline;
  padding-block: var(--s-2);
  border-bottom: var(--rule);
}

.def-row:last-child { border-bottom: none; }

.def-row dt {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.def-row dd {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ink-900);
  text-align: right;
  word-break: break-word;
  min-width: 0;
}

/* --------------------------------------------------------------------------
   Utility
   -------------------------------------------------------------------------- */

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mb-4 { margin-bottom: var(--s-4); }
.text-center { text-align: center; }
.full-width { width: 100%; }
.nowrap { white-space: nowrap; }

.sticky-cta {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: var(--surface);
  border-top: var(--rule-strong);
  padding: var(--s-3) 0 calc(var(--s-3) + var(--safe-bottom));
  margin-top: var(--s-4);
}

/* --------------------------------------------------------------------------
   Chips and the filter bar
   --------------------------------------------------------------------------
   The questions the search form used to ask up front - how far, what condition,
   which make - live here instead. They sit above the results as a scrollable
   strip so they cost one row of height on a phone.
   -------------------------------------------------------------------------- */

.chip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 var(--s-4);
  border: 1px solid var(--ink-900);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-900);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.chip-button:disabled { opacity: 0.5; cursor: progress; }

.chip-button.is-on {
  background: var(--action);
  border-color: var(--action);
  color: var(--action-ink);
}

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding-block: var(--s-3);
  border-bottom: var(--rule);
}

.filter-scroll {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.filter-scroll::-webkit-scrollbar { display: none; }

@media (min-width: 900px) {
  .filter-scroll { flex-wrap: wrap; overflow-x: visible; }
}

.filter-group {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-shrink: 0;
}

.filter-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-500);
  white-space: nowrap;
}

.chips {
  display: flex;
  gap: var(--s-2);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 0.7rem;
  border: 1px solid var(--ink-200);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-700);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.chip:hover { border-color: var(--ink-900); color: var(--ink-900); }

.chip.is-active {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: var(--surface);
  font-weight: 600;
}

.filter-fields {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-fields::-webkit-scrollbar { display: none; }

.filter-fields input {
  min-width: 140px;
  flex: 1;
  min-height: 38px;
  padding: 0.4rem 0.65rem;
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   Listing refinements
   -------------------------------------------------------------------------- */

/* The thumbnail is tappable and opens the listing. */
.listing-thumb-link {
  grid-area: thumb;
  display: block;
}

.listing-thumb-link .listing-thumb { grid-area: auto; }
.listing-thumb-link:hover { opacity: 0.92; }

/* A price the seller chose not to publish reads as an invitation, not a gap. */
.listing-price.is-ask {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--warn);
}

/* --------------------------------------------------------------------------
   Part detail page
   -------------------------------------------------------------------------- */

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-500);
  text-decoration: none;
}

.back-link:hover { color: var(--action); }

.part-layout {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .part-layout {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: var(--s-7);
    align-items: start;
  }

  /* Price, seller and contact stay in view while the photos are read. */
  .part-aside {
    position: sticky;
    top: calc(var(--header-h) + var(--s-4));
  }
}

.part-title {
  font-size: clamp(1.4rem, 4.6vw, 2rem);
  line-height: 1.05;
}

/* --------------------------------------------------------------------------
   Forum
   -------------------------------------------------------------------------- */

.topic-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}

.topic-card { margin-top: var(--s-4); }

.topic-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  line-height: 1.04;
  margin-bottom: var(--s-3);
}

.topic-body {
  font-size: 1rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.topic-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: var(--s-2);
  margin: var(--s-3) 0;
}

.topic-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--ink-200);
}

.forum-composer { margin-top: var(--s-4); }

.replies-title {
  font-size: 1.25rem;
  margin: var(--s-6) 0 var(--s-3);
}

.reply { margin-top: var(--s-3); }

.part-price {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 5.5vw, 2rem);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ink-900);
}

.part-price.is-ask {
  font-family: var(--font-body);
  font-size: clamp(1.1rem, 4vw, 1.35rem);
  font-weight: 600;
  letter-spacing: 0;
  color: var(--warn);
}

/* --------------------------------------------------------------------------
   Gallery
   -------------------------------------------------------------------------- */

.gallery { display: flex; flex-direction: column; gap: var(--s-3); }

.gallery-main {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: var(--rule);
  background: var(--surface-sunken);
}

@media (min-width: 900px) {
  .gallery-main { aspect-ratio: 3 / 2; }
}

.gallery-thumbs {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  scrollbar-width: none;
}

.gallery-thumbs::-webkit-scrollbar { display: none; }

.gallery-thumb {
  width: 64px;
  height: 48px;
  flex-shrink: 0;
  padding: 0;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
}

.gallery-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: var(--rule);
}

.gallery-thumb.is-active { border-color: var(--action); }

/* --------------------------------------------------------------------------
   Specs and seller
   -------------------------------------------------------------------------- */

.spec-list { display: flex; flex-direction: column; }

.seller-logo {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border: var(--rule);
  background: var(--surface-sunken);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Pinned contact bar
   --------------------------------------------------------------------------
   On a phone the two actions that matter are pinned to the bottom of the
   screen. A buyer should never have to scroll to find the phone number.
   -------------------------------------------------------------------------- */

.contact-bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 55;
  background: var(--surface);
  border-top: var(--rule-strong);
  padding-bottom: var(--safe-bottom);
}

.contact-bar-inner {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding: var(--s-3) var(--gutter);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.contact-bar-price {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.contact-bar-price .listing-price,
.contact-bar-price .listing-price.is-ask {
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-bar-actions {
  display: flex;
  gap: var(--s-2);
  flex-shrink: 0;
}

.contact-bar-actions .btn { padding-inline: var(--s-4); }

/* Above this width the sidebar already holds the actions, so the bar would be
   a duplicate. */
@media (min-width: 900px) {
  .contact-bar { display: none; }
}

@media (max-width: 899px) {
  body:has(.contact-bar) { padding-bottom: 76px; }
}

/* --------------------------------------------------------------------------
   Bottom tab bar
   -------------------------------------------------------------------------- */

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 60;
  background: var(--surface);
  border-top: var(--rule-strong);
  padding-bottom: var(--safe-bottom);
}

.tabbar-inner {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  padding: 6px 2px;
  color: var(--ink-500);
  text-decoration: none;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1;
}

.tabbar a:hover { color: var(--ink-900); text-decoration: none; }

.tabbar a.is-current { color: var(--action); font-weight: 600; }

/* The header nav takes over at this width, so the bar would be redundant. */
@media (min-width: 940px) {
  .tabbar { display: none; }
  body.has-tabbar { padding-bottom: 0; }
}

body.has-tabbar { padding-bottom: calc(56px + var(--safe-bottom)); }
