:root {
  --bg: #f4f7f8;
  --panel: #ffffff;
  --text: #1c2b33;
  --muted: #64748b;
  --border: #e2e8ec;
  --field: #f8fafb;
  --accent: #0d9488;        /* Adriatic teal */
  --accent-strong: #0f766e;
  --accent-soft: #e6f6f4;
  --warm: #ff7a59;          /* coral highlight */
  --warm-soft: #fff1ec;
  --drop: #10b981;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(16 42 52 / .06), 0 4px 14px rgb(16 42 52 / .05);
  --shadow-hover: 0 2px 4px rgb(16 42 52 / .08), 0 12px 28px rgb(16 42 52 / .10);
  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
input, select, button { font: inherit; color: inherit; }

/* Top bar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px;
  background: linear-gradient(100deg, #0d9488 0%, #0ea5c6 60%, #38bdf8 100%);
  color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.brand { color: inherit; text-decoration: none; font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.logo {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--warm); color: #fff; font-size: 17px; box-shadow: 0 2px 6px rgb(0 0 0 / .15);
}
.lang { display: flex; gap: 2px; background: rgb(255 255 255 / .18); padding: 3px; border-radius: 9px; }
.lang a { color: #fff; text-decoration: none; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 7px; opacity: .85; }
.lang a.on { background: #fff; color: var(--accent-strong); opacity: 1; }
.lang a:not(.on):hover { opacity: 1; background: rgb(255 255 255 / .15); }

.layout { display: grid; grid-template-columns: 280px 1fr; align-items: start; }

/* Sidebar */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 22px 20px;
  position: sticky; top: 54px; height: calc(100vh - 54px); overflow-y: auto;
}
fieldset { border: 0; margin: 0 0 20px; padding: 0; }
legend { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 7px; padding: 0; }

input[type=search], input[type=number], select {
  width: 100%;
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  transition: border-color .15s, box-shadow .15s;
}
input[type=search]:focus, input[type=number]:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.range { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.range input { min-width: 0; }

/* Segmented control + chips: hidden input, styled span */
.segmented, .chips { display: flex; gap: 4px; }
.segmented { background: var(--field); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.segmented label, .chips label { flex: 1; cursor: pointer; }
.segmented input, .chips input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span, .chips span {
  display: block; text-align: center; padding: 5px 6px; border-radius: 7px; color: var(--muted);
  font-size: 13px; white-space: nowrap; transition: background .15s, color .15s;
}
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--accent); color: #fff; font-weight: 600; box-shadow: 0 1px 3px rgb(13 148 136 / .35); }
.chips span { border: 1px solid var(--border); background: var(--field); }
.chips label:hover span { border-color: var(--accent); }
.chips input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); font-weight: 600; }
.segmented input:focus-visible + span, .chips input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.hoods { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px 0; background: var(--field); }
.hoods label { display: flex; align-items: center; gap: 9px; padding: 4px 12px; cursor: pointer; }
.hoods label:hover { background: var(--accent-soft); }
.hoods .name { flex: 1; }
.hoods .count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.hoods input { accent-color: var(--accent); margin: 0; }
.hoods label:has(input:checked) .name { font-weight: 600; color: var(--accent-strong); }

.reset { display: inline-block; font-size: 13px; color: var(--warm); text-decoration: none; font-weight: 600; }
.reset:hover { text-decoration: underline; }

/* Results */
main { padding: 22px 28px 48px; min-width: 0; }
main.htmx-request { opacity: .55; transition: opacity .15s; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); }
.muted-inline { color: var(--muted); }
.summary > strong { color: var(--text); font-size: 18px; font-weight: 700; }
.pill { background: var(--warm-soft); color: #b4482c; border-radius: 999px; padding: 3px 11px; font-size: 13px; }
.pill strong { font-weight: 700; }
.controls { display: flex; gap: 8px; align-items: center; }
.controls select { width: auto; background: var(--panel); }
.view-toggle { background: var(--panel); }

/* Card (shared by both views) */
.card {
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; color: inherit; text-decoration: none;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: #c9e9e5; }
/* Fixed 4:3 box; the image is absolutely positioned so tall photos can't stretch the card. */
.thumb { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(135deg, #e6f6f4, #e0f2fe); overflow: hidden; flex-shrink: 0; }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.badge {
  position: absolute; top: 10px; left: 10px;
  color: #fff; font-size: 12px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; box-shadow: 0 2px 6px rgb(0 0 0 / .2);
}
.badge.down { background: var(--drop); }
.badge.up { background: var(--warm); }
.body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.price { font-size: 18px; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ppm2 { font-size: 12px; font-weight: 600; color: var(--accent-strong); background: var(--accent-soft); padding: 1px 8px; border-radius: 999px; }
.title { color: var(--muted); font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; font-weight: 500; }
.foot { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.hood-tag { color: var(--accent-strong); font-weight: 600; }

/* Grid view */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; align-items: start; }

/* List view: photo | details | description */
.list { display: flex; flex-direction: column; gap: 14px; }
.list .card { flex-direction: row; }
.list .thumb { width: 260px; }
.list .body { flex: 0 0 280px; border-right: 1px solid var(--border); }
.list .desc {
  flex: 1; margin: 0; padding: 14px 18px; color: var(--muted); font-size: 13px; white-space: pre-line;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical;
}

.more {
  grid-column: 1 / -1; justify-self: center; align-self: center;
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 13px; padding: 18px 0;
}
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty { color: var(--muted); padding: 48px 0; text-align: center; }

/* Listing detail: a <dialog> over the results, or a page of its own when opened directly */
.modal {
  width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 0; border-radius: 18px; background: var(--panel); color: var(--text);
  box-shadow: 0 24px 64px rgb(16 42 52 / .28);
}
.modal::backdrop { background: rgb(16 42 52 / .45); backdrop-filter: blur(3px); }
.detail-page { max-width: 920px; margin: 24px auto; padding: 0 16px; }
.detail-page .detail { background: var(--panel); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.detail-page .close-form { display: none; }
.detail { position: relative; }
.close-form { position: sticky; top: 0; height: 0; z-index: 2; }
.close {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgb(255 255 255 / .92); font-size: 22px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgb(0 0 0 / .18);
}
.close:hover { background: #fff; color: var(--warm); }
.gallery { display: flex; gap: 4px; overflow-x: auto; scroll-snap-type: x mandatory; background: var(--accent-soft); }
.gallery img { height: 340px; width: auto; max-width: 85%; object-fit: cover; flex-shrink: 0; scroll-snap-align: start; }
.detail-body { padding: 22px 26px 28px; display: flex; flex-direction: column; gap: 22px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.detail-head h2 { font-size: 16px; font-weight: 600; margin: 4px 0; }
.detail-price { font-size: 26px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.detail-sub { color: var(--muted); font-size: 13px; }
.cta {
  background: var(--accent); color: #fff; text-decoration: none; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; white-space: nowrap; box-shadow: 0 2px 8px rgb(13 148 136 / .3);
}
.cta:hover { background: var(--accent-strong); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 0; }
.facts div { background: var(--field); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.facts dt { font-size: 11px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.detail h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; }
.history { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.history li { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; }
.history li + li { border-top: 1px solid var(--border); }
.history li:first-child { background: var(--accent-soft); }
.history .when { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.history .amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.delta { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.delta.down { background: #dcfce7; color: #047857; }
.delta.up { background: var(--warm-soft); color: #b4482c; }
.delta.initial { color: var(--muted); }
.muted { color: var(--muted); margin: 0; }
.detail-desc { white-space: pre-line; margin: 0; color: #334155; }

/* Duplicates: badge, sidebar toggle, per-listing price table, /duplicates page */
.topnav { display: flex; align-items: center; gap: 14px; }
.fresh { font-size: 12px; opacity: .85; white-space: nowrap; }
.fresh.stale { opacity: 1; background: var(--warm); padding: 3px 9px; border-radius: 999px; font-weight: 600; }
.fresh.stale::before { content: "⚠ "; }
.tabs { display: flex; gap: 2px; }
.tabs a { color: #fff; text-decoration: none; font-weight: 600; font-size: 13px; padding: 5px 12px; border-radius: 8px; opacity: .88; }
.tabs a:hover { opacity: 1; background: rgb(255 255 255 / .15); }
.tabs a.on { background: rgb(255 255 255 / .22); opacity: 1; }
.badge.dup { left: auto; right: 10px; background: rgb(16 42 52 / .78); font-weight: 600; }
.toggle { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; }
.toggle input { accent-color: var(--accent); margin: 0; }
.small { font-size: 12px; margin-bottom: 8px; }
.copies-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.copies { width: 100%; border-collapse: collapse; font-size: 13px; }
.copies th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); padding: 8px 12px; background: var(--field); white-space: nowrap; }
.copies td { padding: 9px 12px; border-top: 1px solid var(--border); white-space: nowrap; }
.copies .num { text-align: right; font-variant-numeric: tabular-nums; }
.copies .strong { font-weight: 700; }
.copies a { color: var(--accent-strong); font-weight: 600; text-decoration: none; }
.copies a:hover { text-decoration: underline; }
.copies tr.current td { background: var(--accent-soft); }
.copies tr.removed td { color: var(--muted); }
.copies tr.removed .strong { text-decoration: line-through; }
.tag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); }
.tag.good { background: #dcfce7; color: #047857; }
.tag.muted-tag { background: var(--field); color: var(--muted); }
.dups { max-width: 1100px; margin: 0 auto; }
.dups h1 { font-size: 20px; margin: 0 0 4px; }
.dup-group {
  display: grid; grid-template-columns: 200px 1fr; gap: 0; margin-bottom: 16px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.dup-thumb { position: relative; background: linear-gradient(135deg, #e6f6f4, #e0f2fe); min-height: 150px; }
.dup-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dup-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }

/* Statistics page */
.stats { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.stats-head h1 { font-size: 20px; margin: 0 0 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none;
}
.tile.link:hover { border-color: var(--accent); }
.tile-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.tile-value { font-size: 24px; font-weight: 700; }
.tile.hero .tile-value { color: var(--accent-strong); }
.tile-sub { font-size: 12px; color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; min-width: 0; }
.panel h2 { font-size: 15px; margin: 0 0 2px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.table-view { margin-top: 12px; }
.table-view summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent-strong); margin-bottom: 8px; }

/* Horizontal bars: label | bar with value at the tip. The whole row is the hover/focus target. */
.hbars { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.hbar { position: relative; display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 12px; padding: 3px 6px; border-radius: 8px; color: inherit; text-decoration: none; }
.hbar:hover, .hbar:focus-visible { background: var(--field); outline: none; }
.hbar-label { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { display: block; padding-right: 84px; min-width: 0; }
/* Width is a share of the track minus room for the value, so every bar uses the same scale. */
.hbar-fill { position: relative; display: block; height: 16px; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar:hover .hbar-fill { background: var(--accent-strong); }
.hbar-value { position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Columns (histogram) */
.columns { display: flex; align-items: flex-end; gap: 2px; height: 180px; margin-top: 14px; border-bottom: 1px solid var(--border); }
.col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; }
.col-fill { width: 100%; max-width: 24px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 1px; }
.col:hover .col-fill, .col:focus-visible .col-fill { background: var(--accent-strong); }
.col-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Shared hover tooltip for bars and columns */
.tip {
  position: absolute; z-index: 5; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  background: #1c2b33; color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  pointer-events: none; display: none; box-shadow: 0 4px 14px rgb(16 42 52 / .25);
}
.tip strong { display: block; font-size: 13px; }
.hbar .tip { left: auto; right: 0; transform: none; }
.hbar:hover .tip, .hbar:focus-visible .tip, .col:hover .tip, .col:focus .tip { display: block; }
/* Keep tooltips of edge columns inside the chart */
.col.edge-start .tip { left: 0; transform: none; }
.col.edge-end .tip { left: auto; right: 0; transform: none; }

/* Count shown as a small bar inside a table cell */
.copies td.inline-bar { min-width: 90px; width: 35%; padding-right: 52px; }
.ib-fill { position: relative; display: block; height: 10px; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 2px; }
.ib-value { position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); font-variant-numeric: tabular-nums; font-weight: 600; }

@media (max-width: 900px) {
  .list .card { flex-direction: column; }
  .list .thumb { width: 100%; }
  .list .body { flex: none; border-right: 0; }
  .list .desc { border-top: 1px solid var(--border); -webkit-line-clamp: 5; }
}
/* Phone-only pieces, hidden on larger screens */
.filter-btn, .sheet-head, .sheet-foot, .sheet-backdrop { display: none; }

@media (max-width: 760px) {
  main { padding: 14px 16px 40px; }
  /* Inputs at 16px: iOS zooms the page into any smaller input on focus. */
  input[type=search], input[type=number], select { font-size: 16px; }

  /* Top bar: brand + freshness + language on one row, the three tabs full width below. Not sticky: it would eat
     a fifth of the screen. */
  .topbar { position: static; flex-wrap: wrap; gap: 10px 8px; padding: 10px 16px 12px; }
  .brand { font-size: 16px; }
  .logo { width: 28px; height: 28px; font-size: 15px; }
  .topnav { display: contents; }
  .fresh { order: 2; margin-left: auto; font-size: 11px; }
  .lang { order: 3; }
  .tabs { order: 4; flex-basis: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
          background: rgb(255 255 255 / .14); padding: 3px; border-radius: 10px; }
  .tabs a { text-align: center; padding: 7px 4px; }

  /* Filters: a bottom sheet opened from the sticky results bar */
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; top: auto; height: 88dvh; padding: 0;
    display: flex; flex-direction: column; border: 0; border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px rgb(16 42 52 / .25); transform: translateY(105%); transition: transform .25s ease;
  }
  .filters-open .sidebar { transform: none; }
  .filters-open { overflow: hidden; }
  .sidebar form { flex: 1; overflow-y: auto; padding: 16px; overscroll-behavior: contain; }
  .hoods { max-height: none; }
  .sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 12px 16px;
                border-bottom: 1px solid var(--border); font-size: 16px; }
  .sheet-close { width: 40px; height: 40px; border: 0; background: var(--field); border-radius: 50%; font-size: 22px; line-height: 1; }
  .sheet-foot { display: block; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
  .sheet-apply { width: 100%; height: 48px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 700; font-size: 16px; }
  .sheet-backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgb(16 42 52 / .45);
                    opacity: 0; pointer-events: none; transition: opacity .2s; }
  .filters-open .sheet-backdrop { opacity: 1; pointer-events: auto; }

  /* Results bar: filter button, view toggle and sort stay reachable while scrolling */
  #results .results-head { position: sticky; top: 0; z-index: 20; background: var(--bg); margin: -14px -16px 12px;
                           padding: 10px 16px; gap: 6px; box-shadow: 0 1px 0 var(--border); }
  #results .controls { order: -1; width: 100%; gap: 6px; }
  .controls select { flex: 1; min-width: 0; padding: 8px 6px 8px 10px; }
  .filter-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border: 1px solid var(--border);
                border-radius: 10px; background: var(--panel); font-weight: 600; white-space: nowrap; }
  .filter-count { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; min-width: 18px; padding: 1px 6px; }
  .view-toggle span { padding: 6px 8px; }
  .summary { font-size: 13px; }
  .summary > strong { font-size: 15px; }
  .summary .pill { display: none; }

  /* Cards: one column; the list view becomes compact rows (photo left) to scan many flats quickly */
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .grid .thumb { aspect-ratio: 16 / 10; }
  .list { gap: 10px; }
  .list .card { flex-direction: row; }
  .list .thumb { width: 128px; aspect-ratio: auto; }
  .list .body { flex: 1; border-right: 0; padding: 10px 12px; gap: 3px; }
  .list .price { font-size: 16px; flex-wrap: wrap; }
  .list .desc { display: none; }
  .list .badge { top: 6px; left: 6px; font-size: 11px; padding: 2px 6px; }
  .list .badge.dup { left: 6px; right: auto; top: auto; bottom: 6px; }

  /* Listing detail: full screen, close button always reachable */
  .modal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .modal .close { position: fixed; top: max(10px, env(safe-area-inset-top)); right: 10px; width: 42px; height: 42px; }
  .detail-page { margin: 0; padding: 0; }
  .detail-page .detail { border-radius: 0; }
  .gallery img { height: 260px; max-width: 90%; }
  .detail-body { padding: 18px 16px 28px; gap: 20px; }
  .detail-head { flex-direction: column; gap: 12px; }
  .detail-price { font-size: 24px; flex-wrap: wrap; }
  .cta { width: 100%; text-align: center; padding: 12px 18px; }
  .facts { grid-template-columns: 1fr 1fr; gap: 8px; }
  .history li { grid-template-columns: 1fr auto; }
  .history .delta { grid-column: 1 / -1; justify-self: start; }

  /* Who-sells-it-for-how-much table: each listing becomes a two-line row, price always visible */
  .copies.stack thead { display: none; }
  .copies.stack tr { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "seller seller price" "size hood ppm2";
                     gap: 2px 10px; padding: 10px 12px; border-top: 1px solid var(--border); }
  .copies.stack tbody tr:first-child { border-top: 0; }
  .copies.stack td { padding: 0; border: 0; white-space: normal; background: none; }
  .copies.stack tr.current { background: var(--accent-soft); }
  .copies.stack .c-seller { grid-area: seller; }
  .copies.stack .c-price { grid-area: price; text-align: right; }
  .copies.stack .c-size { grid-area: size; text-align: left; color: var(--muted); font-size: 12px; }
  .copies.stack .c-hood { grid-area: hood; color: var(--muted); font-size: 12px; }
  .copies.stack .c-ppm2 { grid-area: ppm2; color: var(--muted); font-size: 12px; }
  .copies.stack .c-link { display: none; }

  /* Other tables: drop secondary columns, let names wrap */
  .copies .hide-sm { display: none; }
  .copies td.wrap { white-space: normal; }
  .copies td, .copies th { padding: 8px 10px; }
  /* No room for count bars next to names: just the number */
  .copies td.inline-bar { min-width: 0; width: auto; padding-right: 10px; }
  .ib-fill { background: none; width: auto !important; min-width: 0; height: auto; }
  .ib-value { position: static; transform: none; margin: 0; }
  .dups .results-head { flex-direction: column; align-items: stretch; }

  /* Duplicates page */
  .dup-group { grid-template-columns: 1fr; }
  .dup-thumb { aspect-ratio: 16 / 9; min-height: 0; }
  .dup-body { padding: 12px 14px; }

  /* Statistics */
  .stats { gap: 14px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile-value { font-size: 21px; }
  .panel { padding: 16px 14px; }
  .stats-grid { grid-template-columns: 1fr; gap: 14px; }
  .hbar { grid-template-columns: 104px 1fr; gap: 8px; padding: 4px 2px; }
  .hbar-track { padding-right: 70px; }
  .columns { height: 150px; gap: 1px; }
}
