/* Marketplace — live listings (assets/js/market.js). Everything is mkt-*. */

/* ── hero ─────────────────────────────────────────────────────────────── */
main > section.mkt-hero { padding: clamp(3rem, 2.2rem + 3vw, 5.2rem) 0 clamp(2rem, 1.6rem + 1.6vw, 3rem); }
.mkt-hero h1 { font-size: clamp(2.4rem, 1.4rem + 4.6vw, 4.6rem); }
.mkt-hero .lede { max-width: 58ch; }
.mkt-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: clamp(1.6rem, 1.2rem + 1.4vw, 2.4rem);
}
.mkt-stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.95rem 1.1rem 1rem;
  min-width: 0;
}
.mkt-stat dt {
  font: 600 0.72rem/1.2 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.mkt-stat dd {
  margin: 0.35rem 0 0;
  font: 600 clamp(1.5rem, 1.2rem + 1vw, 2.1rem)/1.05 var(--font-display);
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.mkt-stat dd small {
  display: block;
  margin-top: 0.3rem;
  font: 500 0.78rem/1.3 var(--font-body);
  letter-spacing: 0;
  color: var(--muted);
}
@media (max-width: 760px) {
  .mkt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .mkt-stat { padding: 0.75rem 0.85rem; }
}

/* ── listings section ─────────────────────────────────────────────────── */
main > section.mkt-section { padding-top: 0; padding-bottom: clamp(3rem, 2rem + 3vw, 5rem); }

/* sticky toolbar */
.mkt-bar {
  position: sticky;
  top: var(--nav-h, 44px);
  z-index: 40;
  margin: 0 -0.75rem;
  padding: 0.85rem 0.75rem 1rem;   /* the chips had 10px under them and sat on the bar's edge */
  background: var(--glass-strong);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.mkt-bar-row { display: flex; align-items: center; gap: 0.6rem; }
.mkt-search { position: relative; flex: 1 1 auto; min-width: 0; }
.mkt-search > svg {
  position: absolute; left: 0.85rem; top: 50%; width: 18px; height: 18px;
  transform: translateY(-50%); color: var(--muted); pointer-events: none;
}
.mkt-search input {
  padding-left: 2.5rem; padding-right: 2.4rem; border-radius: 12px; min-height: 46px; background: var(--surface); border: 1px solid var(--line-strong);
}
.mkt-search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(11, 92, 255, 0.12); }
.mkt-search input::-webkit-search-cancel-button { cursor: pointer; }
.mkt-kbd {
  position: absolute; right: 0.7rem; top: 50%; transform: translateY(-50%);
  font: 600 0.72rem/1 var(--font-mono); color: var(--muted);
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0.25em 0.5em; background: var(--paper);
}
.mkt-search input:focus ~ .mkt-kbd, .mkt-search input:not(:placeholder-shown) ~ .mkt-kbd { display: none; }
.mkt-select { width: auto; min-height: 46px; border-radius: 12px; padding-right: 2rem; font-weight: 600; cursor: pointer; }
.mkt-view { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); padding: 3px; flex: none; }
.mkt-view-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.mkt-view-btn svg { width: 18px; height: 18px; }
.mkt-view-btn[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.mkt-filter-btn {
  display: none; align-items: center; gap: 0.45rem; flex: none; min-height: 46px; padding: 0 0.95rem;
  border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface);
  font: 600 0.92rem/1 var(--font-body); color: var(--ink); cursor: pointer;
}
.mkt-filter-btn svg { width: 18px; height: 18px; }
.mkt-filter-n {
  display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 0.3rem;
  border-radius: 999px; background: var(--accent); color: #fff; font: 600 0.72rem/1 var(--font-mono);
}

/* type tabs */
.mkt-types {
  display: flex; gap: 0.35rem; margin-top: 0.7rem; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.mkt-types::-webkit-scrollbar { display: none; }
.mkt-tab {
  display: inline-flex; align-items: center; gap: 0.45rem; flex: none;
  min-height: 38px; padding: 0 0.95rem; border-radius: 999px; border: 1px solid transparent;
  background: transparent; color: var(--body); font: 600 0.9rem/1 var(--font-body); cursor: pointer; white-space: nowrap;
}
.mkt-tab:hover { background: var(--surface); border-color: var(--line-strong); }
.mkt-tab[aria-selected="true"] { background: var(--ink); color: var(--on-ink); }
.mkt-n {
  font: 600 0.72rem/1 var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums;
}
.mkt-tab[aria-selected="true"] .mkt-n { color: inherit; opacity: 0.75; }

/* filters (inline row on desktop, bottom sheet on phones) */
.mkt-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.4rem; margin-top: 0.65rem; }
.mkt-filters-head, .mkt-filters-foot { display: none; }
.mkt-filter-group { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.mkt-filter-label {
  flex: none; font: 600 0.7rem/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.mkt-caps { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.mkt-chip {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 32px; padding: 0 0.75rem;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--body);
  font: 550 0.83rem/1 var(--font-body); cursor: pointer; white-space: nowrap;
  transition: border-color 0.15s var(--ease-out), background 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.mkt-chip:hover { border-color: var(--blue); color: var(--blue-deep); }
.mkt-chip[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); color: var(--blue-deep); }
.mkt-chip[aria-pressed="true"] .mkt-n { color: var(--blue-deep); }
.mkt-chip[aria-pressed="true"]::before {
  content: ""; width: 0.5rem; height: 0.3rem; margin-right: 0.05rem;
  border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg) translateY(-1px);
}

/* status line */
.mkt-status {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.3rem 1rem;
  margin: 1rem 0 0.9rem; font-size: 0.9rem; color: var(--muted);
}
.mkt-status p { margin: 0; }
.mkt-status strong { color: var(--ink); }
.mkt-linkbtn {
  border: 0; background: none; padding: 0 0 0 0.4rem; color: var(--blue-deep); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.mkt-fresh { display: inline-flex; align-items: center; gap: 0.5rem; font: 500 0.8rem/1.2 var(--font-mono); font-variant-numeric: tabular-nums; }
.mkt-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green-bright); box-shadow: 0 0 0 0 rgba(0, 199, 118, 0.5); animation: mkt-pulse 2s infinite; }
.is-stale .mkt-pulse { background: #e0a43a; animation: none; }
@keyframes mkt-pulse { 0% { box-shadow: 0 0 0 0 rgba(0, 199, 118, 0.45); } 70% { box-shadow: 0 0 0 7px rgba(0, 199, 118, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 199, 118, 0); } }

/* ── cards ────────────────────────────────────────────────────────────── */
.mkt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 1rem; }
.mkt-card {
  position: relative; display: flex; flex-direction: column; gap: 0.8rem; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 1.1rem 1.15rem 1rem; box-shadow: var(--shadow-sm); cursor: pointer;
  transition: border-color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), transform 0.18s var(--ease-out);
}
.mkt-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.mkt-card:focus-within { border-color: #b9ccff; }
.mkt-card.is-changed { animation: mkt-flash 1.6s var(--ease-out); }
@keyframes mkt-flash { 0% { box-shadow: 0 0 0 3px rgba(11, 92, 255, 0.35); } 100% { box-shadow: var(--shadow-sm); } }

.mkt-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.mkt-type {
  display: inline-flex; align-items: center; padding: 0.32em 0.65em; border-radius: 6px;
  font: 600 0.7rem/1 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
}
.mkt-type--llm { background: var(--blue-tint); color: var(--blue-deep); }
.mkt-type--tts { background: var(--green-tint); color: var(--green); }
.mkt-type--stt { background: var(--amber-tint); color: var(--amber); }
.mkt-type--emb { background: #f0eaff; color: #5c3dd6; }
.mkt-type--image { background: #ffeaf4; color: #b03072; }
.mkt-hl {
  display: inline-flex; align-items: center; gap: 0.3em; padding: 0.32em 0.6em; border-radius: 6px;
  font: 600 0.7rem/1 var(--font-mono); letter-spacing: 0.02em; white-space: nowrap;
}
.mkt-hl::before { content: "★"; font-size: 0.85em; }
.mkt-hl--price { background: #e3f7ee; color: #06603f; }
.mkt-hl--speed { background: #fff1d6; color: #8a4b00; }
.mkt-avail {
  display: inline-flex; align-items: center; gap: 0.4rem; margin-left: auto;
  font: 600 0.78rem/1 var(--font-body); white-space: nowrap;
}
.mkt-avail--warm { color: var(--green); }
.mkt-avail--cold { color: var(--muted); }
.mkt-avail--rented { color: var(--amber); }
.mkt-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mkt-dot--warm { background: var(--green-bright); box-shadow: 0 0 0 3px rgba(0, 199, 118, 0.18); }
.mkt-dot--cold { background: #b8c0d2; }
.mkt-dot--rented { background: #e0a43a; }

.mkt-name { margin: 0; font: 600 1.18rem/1.2 var(--font-mono); letter-spacing: -0.02em; min-width: 0; }
.mkt-open {
  display: block; max-width: 100%; padding: 0; border: 0; background: none; color: var(--ink);
  font: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.mkt-open:hover { color: var(--blue-deep); }
.mkt-org { color: var(--muted); font-weight: 400; }

.mkt-caps-row { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: -0.25rem; }
.mkt-caps-row--t { margin-top: 0.35rem; }
.mkt-cap {
  display: inline-flex; align-items: center; padding: 0.28em 0.6em; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--body); font: 550 0.74rem/1.1 var(--font-body); white-space: nowrap;
}
.mkt-cap.is-on { border-color: var(--blue); color: var(--blue-deep); background: var(--blue-tint); }
.mkt-cap--more { color: var(--muted); border-style: dashed; }

/* Admin → Model reference: the card's model facts (only drawn while the feature is on) */
.mkt-ref { display: flex; flex-wrap: wrap; gap: 0.2rem 0.85rem; font-size: 0.8rem; color: var(--muted); }
.mkt-ref b { color: var(--ink); font-family: var(--font-mono); font-weight: 600; }
.mkt-ref-sum { margin: 0 0 0.7rem; font-size: 0.9rem; line-height: 1.55; color: var(--body); }
.mkt-d-ref .mkt-kf { margin-bottom: 0.2rem; }

.mkt-sizes { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.mkt-size {
  position: relative; display: inline-flex; align-items: center; gap: 0.35rem; min-height: 32px; padding: 0 0.7rem;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--paper);
  font: 600 0.8rem/1 var(--font-mono); color: var(--body); cursor: pointer;
}
.mkt-size:hover { border-color: var(--ink-2); color: var(--ink); }
.mkt-size[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.mkt-size.is-dim { opacity: 0.45; }
.mkt-size .mkt-dot { width: 6px; height: 6px; box-shadow: none; }

.mkt-prices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.mkt-price {
  display: flex; flex-direction: column; gap: 0.1rem; min-width: 0;
  background: var(--paper); border-radius: 10px; padding: 0.6rem 0.75rem;
}
.mkt-price:only-child { grid-column: 1 / -1; }
.mkt-price-l { font: 600 0.68rem/1.2 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.mkt-price-v {
  font: 600 1.32rem/1.15 var(--font-display); letter-spacing: -0.03em; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mkt-price-v small { font: 500 0.72rem/1 var(--font-body); letter-spacing: 0; color: var(--muted); vertical-align: 0.2em; }
.mkt-price-u { font-size: 0.76rem; color: var(--muted); line-height: 1.25; }
.mkt-free { color: var(--green); }
.mkt-price--big .mkt-price-v { font-size: 1.6rem; }

.mkt-speed {
  display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 0.6rem; row-gap: 0.35rem; font-size: 0.88rem;
}
.mkt-k { font: 600 0.68rem/1.2 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.mkt-speed-v { color: var(--body); font-variant-numeric: tabular-nums; }
.mkt-speed-v strong { font-family: var(--font-mono); }
.mkt-speed-x { grid-column: 2; font-size: 0.8rem; color: var(--muted); margin-top: -0.25rem; }
.mkt-meter { grid-column: 1 / -1; display: block; height: 6px; border-radius: 999px; background: var(--cloud-2); overflow: hidden; }
.mkt-meter-fill { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width 0.6s var(--ease-out); }
.mkt-meter-fill.is-low { background: #e0a43a; }
.mkt-meter--sm { display: inline-block; width: 56px; height: 5px; vertical-align: middle; margin-right: 0.4rem; }
.mkt-na { color: var(--muted); }

.mkt-facts {
  display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; font-size: 0.82rem; color: var(--muted);
  padding-top: 0.7rem; border-top: 1px dashed var(--line-strong); margin-top: auto;
}
.mkt-facts b { color: var(--ink); font-family: var(--font-mono); font-weight: 600; }
.mkt-avail-sub { flex-basis: 100%; }

.mkt-card-foot { display: flex; align-items: center; gap: 0.5rem; }
.mkt-id {
  display: inline-flex; align-items: center; gap: 0.45rem; min-width: 0; flex: 1 1 auto; min-height: 36px;
  padding: 0 0.7rem; border: 1px solid var(--line); border-radius: 9px; background: var(--paper);
  color: var(--ink-2); cursor: copy; text-align: left;
}
.mkt-id code { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.8rem; background: none; padding: 0; }
.mkt-id svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.mkt-id:hover { border-color: var(--blue); }
.mkt-id:hover svg { color: var(--blue); }
.mkt-id.is-copied { border-color: var(--green); background: var(--green-tint); }
.mkt-id.is-copied svg { color: var(--green); }
.mkt-more {
  flex: none; min-height: 36px; padding: 0 0.85rem; border: 0; border-radius: 9px; background: var(--ink); color: var(--on-ink);
  font: 600 0.84rem/1 var(--font-body); cursor: pointer;
}
.mkt-more:hover { background: var(--accent); }

/* skeletons while loading */
.mkt-skel {
  height: 330px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: linear-gradient(100deg, var(--surface) 30%, var(--cloud) 50%, var(--surface) 70%) 0 0 / 300% 100%;
  animation: mkt-shimmer 1.4s linear infinite;
}
@keyframes mkt-shimmer { to { background-position: -150% 0; } }

.mkt-empty {
  grid-column: 1 / -1; text-align: center; padding: 3.5rem 1rem; background: var(--surface);
  border: 1px dashed var(--line-strong); border-radius: var(--r-md);
}
.mkt-empty p { color: var(--muted); margin: 0.5rem 0 1rem; }

/* ── compare table ───────────────────────────────────────────────────── */
.mkt-tablebox { min-width: 0; }
.mkt-table-wrap {
  overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-sm); -webkit-overflow-scrolling: touch;
}
.mkt-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.88rem; }
.mkt-table th, .mkt-table td { padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
.mkt-table thead th {
  position: sticky; top: 0; background: var(--paper); z-index: 1;
  font: 600 0.7rem/1.2 var(--font-mono); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
}
.mkt-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mkt-table thead th:nth-child(n+3):nth-child(-n+8) { text-align: right; }
.mkt-table td.num small { color: var(--muted); }
.mkt-th {
  border: 0; background: none; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer;
}
.mkt-th:hover { color: var(--ink); }
.mkt-table th[aria-sort] .mkt-th { color: var(--blue-deep); }
.mkt-table th[aria-sort] .mkt-th::after { content: " ↓"; }
.mkt-table th[aria-sort="ascending"] .mkt-th::after { content: " ↑"; }
.mkt-table tbody tr { cursor: pointer; }
.mkt-table tbody tr:hover > * { background: var(--hover); }
.mkt-table tbody tr:last-child > * { border-bottom: 0; }
.mkt-sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.mkt-table thead .mkt-sticky { z-index: 2; background: var(--paper); }
.mkt-table tbody th { font-weight: 400; }
.mkt-t-name { font: 600 0.86rem/1.2 var(--font-mono); color: var(--ink); margin-right: 0.4rem; }
.mkt-table .mkt-hl { margin-right: 0.25rem; }
.mkt-table .mkt-avail { margin-left: 0; }
.mkt-table .mkt-cap { font-size: 0.7rem; }
@media (max-width: 760px) {
  .mkt-table th, .mkt-table td { padding: 0.6rem 0.65rem; }
  .mkt-sticky { max-width: 46vw; white-space: normal; box-shadow: 1px 0 0 var(--line); }
  .mkt-t-name { display: block; overflow-wrap: anywhere; margin-bottom: 0.2rem; }
}

/* ── guide ───────────────────────────────────────────────────────────── */
.mkt-guide { margin-top: 1.6rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.mkt-guide summary {
  list-style: none; cursor: pointer; padding: 1rem 1.2rem; font-weight: 650; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between;
}
.mkt-guide summary::-webkit-details-marker { display: none; }
.mkt-guide summary::after { content: "+"; font: 500 1.4rem/1 var(--font-body); color: var(--muted); }
.mkt-guide[open] summary::after { content: "−"; }
.mkt-guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 1.6rem; padding: 0 1.2rem 1.2rem; }
.mkt-guide h4 { font-size: 0.95rem; margin-bottom: 0.3rem; }
.mkt-guide p { font-size: 0.9rem; line-height: 1.55; margin: 0; }

/* ── drawer ──────────────────────────────────────────────────────────── */
html.mkt-lock, html.mkt-lock body { overflow: hidden; }
/* iOS ignores overflow:hidden on the page: pin the body in place while a sheet
   is open (market.js sets top = -scrollY and restores the scroll on close) */
html.mkt-lock body { position: fixed; left: 0; right: 0; width: 100%; }
.mkt-panel.is-dragging { transition: none; }
.mkt-drawer { position: fixed; inset: 0; z-index: 300; }
.mkt-drawer[hidden] { display: none; }
.mkt-scrim { position: absolute; inset: 0; background: rgba(8, 11, 22, 0.42); opacity: 0; transition: opacity 0.24s var(--ease-out); }
.mkt-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform 0.26s var(--ease-out); outline: none;
}
.mkt-drawer.is-open .mkt-scrim { opacity: 1; }
.mkt-drawer.is-open .mkt-panel { transform: none; }
.mkt-grab { display: none; }
#mk-d-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.mkt-d-head { position: relative; padding: 1.3rem 1.4rem 1rem; border-bottom: 1px solid var(--line); }
.mkt-d-head .mkt-card-top { padding-right: 2.6rem; }
.mkt-d-head .mkt-avail { margin-left: 0.3rem; }
.mkt-d-title { margin: 0.6rem 0 0; font: 600 1.45rem/1.2 var(--font-mono); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.mkt-d-sub { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.9rem; }
.mkt-x {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.mkt-x svg { width: 18px; height: 18px; }
.mkt-x:hover { background: var(--paper); }
.mkt-d-close { position: absolute; top: 1rem; right: 1rem; }
.mkt-d-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 1.1rem 1.4rem 2rem; -webkit-overflow-scrolling: touch; }
.mkt-d-scroll > * + * { margin-top: 1rem; }
.mkt-d-sec { padding-top: 1rem; border-top: 1px solid var(--line); }
.mkt-d-scroll > .mkt-d-sec:first-child { padding-top: 0; border-top: 0; }
.mkt-d-h { font: 600 0.72rem/1.2 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.6rem; }
.mkt-id--big { width: 100%; min-height: 52px; padding: 0.5rem 0.85rem; flex-wrap: wrap; row-gap: 0.15rem; }
.mkt-id--big code { font-size: 0.95rem; color: var(--ink); white-space: normal; overflow-wrap: anywhere; }
.mkt-id-l { flex-basis: 100%; font: 600 0.66rem/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.mkt-id-hint { font: 600 0.8rem/1 var(--font-body); color: var(--blue-deep); }
.mkt-kf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.mkt-kf > div { background: var(--paper); border-radius: 10px; padding: 0.55rem 0.7rem; min-width: 0; }
.mkt-kf dt { font: 600 0.66rem/1.2 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.mkt-kf dd { margin: 0.2rem 0 0; font-size: 0.88rem; color: var(--body); overflow-wrap: anywhere; }
.mkt-kf dd b { font: 600 1.05rem/1.2 var(--font-mono); color: var(--ink); }
.mkt-capdesc { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.45rem; }
.mkt-capdesc li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.6rem; font-size: 0.88rem; line-height: 1.4; }
.mkt-capdesc strong { font-size: 0.86rem; }
.mkt-calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.5rem; align-items: end; }
.mkt-calc label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; color: var(--muted); }
.mkt-calc input { min-height: 42px; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.mkt-calc-out {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; align-items: baseline;
  background: var(--grad-soft); border-radius: 10px; padding: 0.7rem 0.9rem; color: var(--body); font-size: 0.9rem;
}
.mkt-calc-out b { font: 600 1.3rem/1.1 var(--font-display); letter-spacing: -0.03em; color: var(--ink); }
.mkt-fine { font-size: 0.82rem; color: var(--muted); line-height: 1.5; margin: 0.5rem 0 0; }
.mkt-d-sec > .mkt-fine:first-of-type { margin-top: -0.2rem; margin-bottom: 0.7rem; }
.mkt-hosts { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.mkt-host { border: 1px solid var(--line); border-radius: 12px; padding: 0.75rem 0.85rem; }
.mkt-host-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.mkt-host-name { font-weight: 650; color: var(--ink); margin-right: 0.2rem; }
.mkt-host-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 0.4rem 0.8rem; margin: 0.55rem 0 0; }
.mkt-host-facts dt { font: 600 0.62rem/1.2 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.mkt-host-facts dd { margin: 0.1rem 0 0; font: 500 0.84rem/1.3 var(--font-mono); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mkt-host-meta { margin-top: 0.4rem; font-size: 0.76rem; color: var(--muted); }
.mkt-d-scroll .code pre { max-height: 340px; }
.mkt-d-cta { display: flex; gap: 0.6rem; flex-wrap: wrap; padding-top: 1rem; border-top: 1px solid var(--line); }
.mkt-d-cta .btn { flex: 1 1 auto; justify-content: center; }

/* toast */
.mkt-toast {
  position: fixed; left: 50%; bottom: max(1.2rem, env(safe-area-inset-bottom)); z-index: 400;
  transform: translate(-50%, 1.5rem); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--on-ink); padding: 0.6rem 1rem; border-radius: 999px;
  font: 500 0.86rem/1.2 var(--font-body); box-shadow: var(--shadow-lg); max-width: calc(100% - 2rem);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: transform 0.22s var(--ease-out), opacity 0.22s var(--ease-out);
}
.mkt-toast.is-on { transform: translate(-50%, 0); opacity: 1; }

/* ── tablets ─────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .mkt-filters { gap: 0.5rem 1rem; }
  .mkt-filter-group { align-items: flex-start; }
  .mkt-filter-label { padding-top: 0.6rem; }
}

/* ── phones ──────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .mkt-bar { margin: 0 -1.5rem; padding: 0.6rem 1.5rem 0.75rem; top: var(--nav-h, 44px); }
  .mkt-bar-row { gap: 0.45rem; }
  .mkt-kbd { display: none; }
  .mkt-sortwrap { display: none; }
  .mkt-filter-btn { display: inline-flex; padding: 0 0.8rem; }
  .mkt-view-btn { width: 36px; height: 38px; }
  .mkt-types { margin: 0.5rem -1.5rem 0; padding: 0 1.5rem; }

  /* filters become a bottom sheet (sort moves in there too, see below) */
  .mkt-filters {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 320; margin: 0;
    flex-direction: column; flex-wrap: nowrap; gap: 1.1rem;
    max-height: 82vh; max-height: 82dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 0 1.2rem calc(1rem + env(safe-area-inset-bottom));
    background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: 0 -20px 60px -20px rgba(8, 11, 22, 0.35);
    transform: translateY(105%); visibility: hidden;
    transition: transform 0.26s var(--ease-out), visibility 0s linear 0.26s;
  }
  .mkt-filters.is-open { transform: none; visibility: visible; transition: transform 0.26s var(--ease-out); }
  .mkt-filters-head {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1;
    background: var(--surface); padding: 1rem 0 0.6rem; border-bottom: 1px solid var(--line); font-size: 1.05rem;
  }
  .mkt-filters-foot {
    display: flex; gap: 0.6rem; position: sticky; bottom: calc(-1rem - env(safe-area-inset-bottom));
    background: var(--surface); padding: 0.8rem 0 calc(0.2rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
  }
  .mkt-filters-foot .btn { flex: 1; justify-content: center; }
  .mkt-filter-group { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .mkt-filter-label { padding-top: 0; }
  .mkt-chip { min-height: 40px; padding: 0 0.9rem; font-size: 0.9rem; }

  .mkt-status { margin: 0.8rem 0 0.7rem; font-size: 0.85rem; }
  .mkt-grid { gap: 0.75rem; }
  .mkt-card { padding: 1rem; gap: 0.7rem; }
  .mkt-card:hover { transform: none; }
  .mkt-name { font-size: 1.1rem; }
  .mkt-price-v { font-size: 1.2rem; }
  .mkt-skel { height: 300px; }

  /* drawer → bottom sheet */
  .mkt-panel {
    top: auto; left: 0; width: 100%; height: 92vh; height: 92dvh;
    border-radius: 20px 20px 0 0; transform: translateY(100%);
  }
  .mkt-grab { display: block; width: 44px; height: 5px; border-radius: 99px; background: var(--line-strong); margin: 0.55rem auto 0; flex: none; }
  .mkt-d-head { padding: 0.7rem 1.1rem 0.85rem; }
  .mkt-d-close { top: 0.75rem; right: 0.9rem; }
  .mkt-d-title { font-size: 1.25rem; }
  .mkt-d-scroll { padding: 1rem 1.1rem calc(2rem + env(safe-area-inset-bottom)); }
  .mkt-kf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mkt-capdesc li { grid-template-columns: 1fr; gap: 0.1rem; }
}
/* sort lives in the sheet on phones */
.mkt-sheet-sort { display: none; }
@media (max-width: 760px) { .mkt-sheet-sort { display: flex; } }

@media (prefers-reduced-motion: reduce) {
  .mkt-card, .mkt-panel, .mkt-scrim, .mkt-filters, .mkt-meter-fill, .mkt-toast { transition: none; }
  .mkt-card.is-changed, .mkt-pulse, .mkt-skel { animation: none; }
}
.mkt-host.is-pending { opacity: 0.65; border-style: dashed; }
.mkt-filter-n[hidden] { display: none; }
.mkt-sheet-scrim { position: fixed; inset: 0; z-index: 310; background: rgba(8, 11, 22, 0.42); }
.mkt-sheet-scrim[hidden] { display: none; }
@media (max-width: 760px) {
  /* backdrop-filter would make the bar the containing block of the fixed sheet */
  .mkt-bar { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--paper); }
  .mkt-view { display: none; }
  .mkt-filter-btn { gap: 0.35rem; }
}
@media (max-width: 400px) {
  .mkt-filter-btn .mkt-filter-word { display: none; }
}
.mkt-bar.has-sheet { z-index: 330; }
@media (max-width: 760px) {
  .mkt-filters { align-items: stretch; }
  .mkt-sheet-sort .mkt-select { width: 100%; }
}
@media (max-width: 760px) {
  .mkt-table .mkt-sticky { max-width: 44vw; min-width: 9rem; white-space: normal; }
  .mkt-table .mkt-t-name { font-size: 0.8rem; }
  .mkt-caps-row--t { display: none; }
}
.mkt-fo { color: var(--green); font-weight: 600; }

/* ── Rentals: a host you can lease whole (badge, filter, drawer section) ── */
.mkt-rent {
  display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.22rem 0.55rem 0.22rem 0.45rem;
  border-radius: 999px; background: #3b1d8f; color: #fff; font: 700 0.72rem/1 var(--font-body);
  letter-spacing: 0.02em; box-shadow: 0 0 0 3px rgba(91, 52, 214, 0.16); white-space: nowrap;
}
.mkt-rent svg { width: 0.85rem; height: 0.85rem; flex: none; }
.mkt-rent--sm { padding: 0.14rem 0.45rem; font-size: 0.68rem; box-shadow: none; }
.mkt-chip--rent[aria-pressed="true"] { background: #3b1d8f; border-color: #3b1d8f; color: #fff; }
.mkt-d-rent { border: 1px solid #d9cffb; background: #f7f4ff; border-radius: 14px; padding: 1rem 1rem 1.1rem; }
.mkt-rent-how { list-style: none; margin: 0.6rem 0 1rem; padding: 0; display: grid; gap: 0.5rem; font-size: 0.86rem; line-height: 1.45; }
.mkt-rent-how li { padding-left: 1.1rem; position: relative; }
.mkt-rent-how li::before { content: ""; position: absolute; left: 0.1rem; top: 0.5em; width: 0.42rem; height: 0.42rem; border-radius: 50%; background: #5b34d6; }
.mkt-rent-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.mkt-rent-node { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 0.9rem; }
.mkt-rent-price { margin-top: 0.5rem; font-size: 0.9rem; }
.mkt-rent-price b { font-size: 1.05rem; color: var(--ink); }
.mkt-rent-durs { list-style: none; padding: 0; margin: 0.55rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.mkt-rent-durs li { display: grid; gap: 0.1rem; padding: 0.35rem 0.6rem; border: 1px solid var(--line-strong); border-radius: 10px; font-size: 0.76rem; color: var(--muted); }
.mkt-rent-durs li b { font-size: 0.88rem; color: var(--ink); }
.mkt-rent-durs li.is-off { opacity: 0.45; }
.mkt-rent-models { margin-top: 0.6rem; font-size: 0.82rem; }
.mkt-rent-models summary { cursor: pointer; font-weight: 600; color: #3b1d8f; }
.mkt-rent-models ul { list-style: none; padding: 0; margin: 0.45rem 0 0; display: grid; gap: 0.3rem; max-height: 16rem; overflow: auto; }
.mkt-rent-models li { display: flex; justify-content: space-between; gap: 0.6rem; }
.mkt-rent-models li code { font-size: 0.78rem; overflow-wrap: anywhere; }
.mkt-rent-models li.is-cur code { font-weight: 700; color: #3b1d8f; }
.mkt-d-rent .mkt-d-cta { margin-top: 0.9rem; }

/* Price readings + the estimator's working (r20261101g): every sum is shown so it can be checked */
.mkt-price-x { display: block; font-size: 0.72rem; color: var(--muted); line-height: 1.3; margin-top: 0.2rem; cursor: help; }
.mkt-pv { cursor: help; text-decoration: underline dotted rgba(0,0,0,.25); text-underline-offset: 3px; }
.mkt-price-w { display: block; font-size: 0.72rem; color: var(--muted); line-height: 1.3; margin-top: 0.15rem; }
.mkt-calc-out small { font-size: 0.72rem; color: var(--muted); font-weight: 400; }
.mkt-calc-work { flex: 1 1 100%; list-style: none; margin: 0.35rem 0 0; padding: 0.6rem 0.75rem; border-radius: 10px;
  background: var(--surface-2, rgba(127,127,127,.08)); font: 0.8rem/1.55 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--body, inherit); }
.mkt-calc-work li { margin: 0; overflow-wrap: anywhere; }
.mkt-calc-work li:last-child { margin-top: 0.25rem; padding-top: 0.25rem; border-top: 1px dashed var(--line, rgba(127,127,127,.3)); color: var(--ink); }
.mkt-calc-work b { font: inherit; font-weight: 600; color: var(--ink); letter-spacing: 0; }

/* Free-tier badge (only rendered while the free tier's badge switch is on) */
.mkt-free { display: inline-flex; align-items: center; padding: 0.2rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; text-decoration: none; color: var(--green); background: var(--green-tint); border: 1px solid currentColor; }
.mkt-free sup { font-size: 0.7em; margin-left: 1px; top: -0.35em; }
.mkt-free:hover, .mkt-free:focus-visible { text-decoration: underline; }
.mkt-free-note { margin: 0.35rem 0 0; font-size: 0.74rem; line-height: 1.4; color: var(--muted, #666); }
.mkt-free-note a { color: inherit; text-decoration: underline; }
/* model ids in cards, the drawer and rental lists stay plain text, not terminal chips */
:where(main, .mkt-panel) :is(.mkt-id, .mkt-rent-models) code { background: none; box-shadow: none; padding: 0; color: var(--ink); }
.mkt-rent-models li.is-cur code { color: var(--violet); }
