/*
 * The stock sheet — DESKTOP layout (>= 900px; index.html loads this file with
 * media="(min-width: 900px)", so nothing here can leak onto a phone).
 * Ported from Main.dc.html. Base tokens and the shared pieces are in sheet.css.
 */

body { line-height: 1.45; }

/* ── layout switch ──────────────────────────────────────────────────────── */

.ph { display: none; }
.desk {
  width: 100%;
  max-width: 1376px;
  margin: 0 auto;
  padding: 22px 32px 28px;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* ── masthead + ticker + notice ─────────────────────────────────────────── */

.masthead__inner { max-width: 1376px; height: 64px; margin: 0 auto; padding: 0 32px; gap: 18px; }
.brand { flex: none; gap: 12px; }
.brand__mark { width: 32px; height: 32px; }
.brand__text { line-height: 1.2; }
.brand__name, .masthead.is-priced .brand__name { font-size: 16px; letter-spacing: 0.05em; }
.brand__sub { font-size: 11px; letter-spacing: 0.16em; }
.masthead__actions { gap: 12px; }
.head-link { white-space: nowrap; }
.fresh--desktop { margin-left: 18px; font-size: 12px; color: rgba(255, 255, 255, 0.86); white-space: nowrap; }

.ticker { height: 36px; }
.ticker__viewport { padding-left: 32px; }
.ticker__toggle { width: 36px; }
.ticker__track { font-size: 12px; letter-spacing: 0.12em; }
.ticker__item { gap: 28px; padding-right: 28px; }
.ticker__gem { font-size: 9px; }

.notice-slot { width: 100%; max-width: 1376px; margin: 0 auto; padding: 14px 32px 0; }
.failure { margin: 48px auto; padding: 28px; }

/* ── sidebar ────────────────────────────────────────────────────────────── */

.side {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.side__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.side__title { font-weight: 900; font-size: 15px; letter-spacing: 0.02em; }
.side__group { border-bottom: 1px solid var(--line-soft); }
.side__group:last-child { border-bottom: 0; }
.side__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: none;
  border: 0;
  color: var(--navy);
  text-align: left;
}
.side__label { flex-grow: 1; font-weight: 800; font-size: 14px; }
.count-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--navy);
  color: var(--white);
  font-family: var(--mono);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chev { flex: none; color: var(--muted); transition: transform 0.15s; }
.chev.is-open { transform: rotate(180deg); }
.side__options { padding: 0 10px 10px; display: flex; flex-direction: column; }
.opt { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.opt:hover { background: var(--head-bg); }
.opt__box { flex: none; width: 16px; height: 16px; margin: 0; accent-color: var(--navy); cursor: pointer; }
.opt__label { flex-grow: 1; min-width: 0; }
.opt__count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.side__more {
  align-self: flex-start;
  margin: 2px 6px 0;
  padding: 4px 0;
  background: none;
  border: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── toolbar ────────────────────────────────────────────────────────────── */

.stock { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.toolbar { display: flex; align-items: center; gap: 10px; }
.search { position: relative; flex-grow: 1; max-width: 420px; display: flex; align-items: center; }
.search svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search__input {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--line-input);
  border-radius: 10px;
  font-size: 14px;
  color: var(--navy);
  background: var(--white);
}
.toolbar__count { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.toolbar__count b { color: var(--navy); font-weight: 600; }
.toolbar__menus { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu { position: relative; }
.menu__btn {
  height: 42px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-input);
  border-radius: 10px;
  background: var(--white);
  color: var(--navy);
  font-size: 14px;
  white-space: nowrap;
}
.menu__key { color: var(--muted); }
.menu__btn b { font-weight: 800; }
.menu__list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  width: 220px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line-input);
  border-radius: 10px;
  box-shadow: 0 14px 36px rgba(22, 35, 62, 0.18);
}
.menu__list--group { width: 180px; }
.menu__item { padding: 9px 10px; border: 0; border-radius: 6px; background: var(--white); color: var(--navy); font-size: 14px; text-align: left; }
.menu__item:hover { background: var(--head-bg); }
.menu__item.is-on { background: var(--group-bg); font-weight: 800; }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ── table ──────────────────────────────────────────────────────────────── */

.table { background: var(--white); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.trow {
  display: grid;
  grid-template-columns: 28px minmax(0, 2.6fr) 60px 108px minmax(0, 1.8fr) 96px 142px;
  align-items: center;
  column-gap: 12px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  background: var(--white);
}
.trow.is-priced { grid-template-columns: 28px minmax(0, 2.4fr) 60px 108px minmax(0, 1.6fr) 90px 84px 142px; }
.trow.is-selected { background: var(--selected-bg); box-shadow: inset 3px 0 0 var(--gold); }
.trow--head {
  padding: 11px 16px;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  background: var(--head-bg);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.trow--group { display: block; padding: 10px 16px; background: var(--group-bg); border-top: 1px solid var(--line); }
.trow--group .cell { display: flex; align-items: baseline; gap: 10px; }
.group__label { font-weight: 900; font-size: 14px; color: var(--navy); }
.group__count { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.trow--empty { display: block; padding: 44px 16px; text-align: center; color: var(--ink-2); }

.cell { min-width: 0; }
.cell--right { text-align: right; }
.th-sort { padding: 0; border: 0; background: none; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; text-align: inherit; }
.th-sort:hover { color: var(--navy); }
.tick { display: block; width: 17px; height: 17px; margin: 0; accent-color: var(--navy); cursor: pointer; }

.phone { display: flex; align-items: center; gap: 12px; }
.thumb {
  flex: none;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--line-soft);
  cursor: zoom-in;
}
.thumb img { display: block; width: 50px; height: 50px; object-fit: cover; }
.thumb--none { display: inline-flex; align-items: center; justify-content: center; color: var(--faint); cursor: default; }
.phone__text { min-width: 0; }
.phone__model { display: block; font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phone__sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.batt { display: flex; align-items: center; gap: 8px; }
.batt__text { width: 38px; text-align: right; font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; }
.batt__bar { display: block; width: 50px; height: 5px; border-radius: 3px; background: #e4e7ee; overflow: hidden; }
.batt__fill { display: block; height: 100%; }
.batt--good { background: var(--green); }
.batt--fair { background: #c49a2c; }
.batt--low { background: #7c8699; }
.batt--none { background: #c5cbd6; }

.faults { display: flex; flex-wrap: wrap; gap: 4px; }
.kit { font-size: 13px; color: var(--ink-2); }
.price { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; color: var(--navy); }
.price--ask { font-size: 12px; font-weight: 400; color: var(--muted); white-space: nowrap; }

.acts { display: flex; justify-content: flex-end; gap: 6px; }
.icon-btn {
  flex: none;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-input);
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
}
.icon-btn--photos { width: auto; min-width: 50px; padding: 0 8px; gap: 5px; font-family: var(--mono); font-size: 12px; }
.icon-btn--none { width: auto; min-width: 50px; border-style: dashed; color: var(--faint); }

.foot { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

/* ── selection bar: sticky to the bottom of the page ────────────────────── */

.selbar--desk { position: sticky; bottom: 0; box-shadow: 0 -10px 28px rgba(22, 35, 62, 0.22); }
.selbar__inner { max-width: 1376px; margin: 0 auto; padding: 12px 32px; display: flex; align-items: center; gap: 16px; }
.selbar__chips { min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.selbar__chip { padding: 4px 9px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.selbar__total { font-family: var(--mono); font-size: 14px; white-space: nowrap; }
.selbar__total b { color: var(--gold); }
.selbar__acts { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.selbar__mail {
  height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 10px;
  color: var(--white);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}
.selbar--desk .selbar__wa { height: 44px; padding: 0 18px; }

/* ── modals: photo viewer + grading & terms ─────────────────────────────── */

.overlay--modal, .overlay--modal-dark { display: flex; align-items: center; justify-content: center; padding: 32px; }
.overlay--modal { background: rgba(12, 19, 36, 0.7); }
.overlay--modal-dark { background: rgba(12, 19, 36, 0.8); }

/* A definite height (the canvas's 560 stage + 92 strip, less on a short window) so the one grid row
   cannot grow past the window: the side panel then scrolls instead of being clipped. */
.pv--desk {
  width: 100%;
  max-width: 1120px;
  height: min(652px, calc(100vh - 64px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  grid-template-rows: minmax(0, 1fr);
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
}
.pv__media { min-height: 0; display: flex; flex-direction: column; background: var(--navy-photo); }
.pv__stage--desk { flex: 1 1 auto; min-height: 0; }
.pv__stage--desk .pv__nav--prev { left: 14px; }
.pv__stage--desk .pv__nav--next { right: 14px; }
.pv__thumbs--desk { gap: 8px; padding: 12px; }
.pv__thumbs--desk .pv__thumb { border-radius: 6px; opacity: 0.7; }
.pv__thumbs--desk .pv__thumb.is-on { opacity: 1; }
.pv__thumbs--desk .pv__thumb img { width: 64px; height: 64px; }
.pv__side { min-height: 0; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.pv__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pv--desk .pv__title { font-size: 22px; line-height: 1.15; }
.pv__facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; font-size: 14px; }
.pv__facts dt { color: var(--muted); }
.pv__facts dd { margin: 0; }
.pv__strong { font-weight: 700; }
.pv__mono { font-family: var(--mono); }
.pv__note { margin: 0; font-size: 12.5px; color: var(--muted); }
.pv__acts { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.pv__wa {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  background: var(--gold);
  color: var(--navy);
  text-decoration: none;
  font-weight: 800;
  font-size: 14px;
}

.terms--desk {
  width: 100%;
  max-width: 780px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: var(--white);
  border-radius: 14px;
}
.terms__head { display: flex; align-items: center; justify-content: space-between; }
.terms__title { margin: 0; font-size: 22px; font-weight: 900; }
.terms__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; font-size: 14px; }

/* ── narrower desktops ──────────────────────────────────────────────────────
 * The canvas columns are drawn for 1440px. Below 1240px the Included and
 * Condition columns fold into the phone cell ("#ref · colour · kit" plus fault
 * chips under the model, as on the phone card), so the Phone column keeps room
 * for a model name; below 1024px the thumb, battery and sidebar tighten too. */

.phone__kit, .phone__faults { display: none; }
.masthead__live { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.fresh--desktop { max-width: 100%; }
.fresh--desktop .fresh__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 1239px) {
  .masthead__inner, .selbar__inner { padding-left: 20px; padding-right: 20px; }
  .ticker__viewport { padding-left: 20px; }
  .notice-slot { padding: 14px 20px 0; }
  .desk { grid-template-columns: 216px minmax(0, 1fr); gap: 20px; padding: 20px 20px 24px; }
  .toolbar { flex-wrap: wrap; }
  .search { min-width: 200px; }
  /* "Sort" / "Group" stay for screen readers; the chosen value carries the button. */
  .menu__key { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .trow { grid-template-columns: 28px minmax(0, 1fr) 52px 92px 130px; }
  .trow.is-priced { grid-template-columns: 28px minmax(0, 1fr) 52px 92px 76px 130px; }
  .cell.kit, .col-kit, .cell.faults, .col-cond { display: none; }
  .phone__kit { display: inline; }
  .phone__faults { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
  .phone__sub { white-space: normal; }
  .batt__bar { width: 36px; }
  .acts { gap: 4px; }
  .icon-btn--photos, .icon-btn--none { min-width: 46px; padding: 0 6px; }
}

@media (max-width: 1023px) {
  .masthead__inner { gap: 12px; }
  .masthead__actions { gap: 8px; }
  .cta { padding: 0 12px; }
  .desk { grid-template-columns: 200px minmax(0, 1fr); gap: 16px; }
  .phone { gap: 10px; }
  .thumb, .thumb img { width: 40px; height: 40px; }
  .trow { grid-template-columns: 28px minmax(0, 1fr) 44px 56px 122px; column-gap: 10px; }
  .trow.is-priced { grid-template-columns: 28px minmax(0, 1fr) 44px 56px 72px 122px; }
  .batt__bar { display: none; }
  .batt__text { width: auto; }
  .icon-btn { width: 32px; height: 32px; }
  .icon-btn--photos, .icon-btn--none { width: auto; min-width: 44px; }
  .selbar__chips { display: none; }
}

/* coloured actions — the desktop half of sheet.css's block: the footer only; rows stay plain */
.selbar__mail { background: var(--mail); border-color: var(--mail); color: var(--white); }
.icon-btn.is-off { opacity: 0.35; filter: grayscale(1); border-style: dashed; }
.pv__wa { background: var(--wa); color: var(--navy); }
